From 535e08f7a336e023be8299dafce00ae71d08252b Mon Sep 17 00:00:00 2001 From: Boris Drazhzhov Date: Wed, 3 Jun 2015 23:00:25 +0300 Subject: [PATCH 1/3] Now this gem tries to find installed typescript module and use it for .ts files compilation --- lib/typescript-src.rb | 10 +++++++++- lib/typescript-src/version.rb | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/typescript-src.rb b/lib/typescript-src.rb index 6ed09c2..d6a3c3a 100644 --- a/lib/typescript-src.rb +++ b/lib/typescript-src.rb @@ -7,7 +7,15 @@ module Src class << self # @return [Pathname] def typescript_path - @typescript_path ||= ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript') + unless @typescript_path + begin + @typescript_path = ::Pathname.new(`npm root -g`.strip! + '/typescript') + rescue + @typescript_path = ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript') + end + end + + @typescript_path end # @return [Pathname] diff --git a/lib/typescript-src/version.rb b/lib/typescript-src/version.rb index a09eb7b..53b3cb5 100644 --- a/lib/typescript-src/version.rb +++ b/lib/typescript-src/version.rb @@ -1,5 +1,5 @@ module TypeScript module Src - VERSION = '1.0.1.2' # TypeScript compiler version + gem's revision + VERSION = '1.0.1.3' # TypeScript compiler version + gem's revision end end \ No newline at end of file From 48d7e3028c8ffd906da36980c3bb88b6ff8adba8 Mon Sep 17 00:00:00 2001 From: Boris Drazhzhov Date: Wed, 3 Jun 2015 23:09:28 +0300 Subject: [PATCH 2/3] temporary fixed issue with TS sources --- lib/typescript-src.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/typescript-src.rb b/lib/typescript-src.rb index d6a3c3a..11934ad 100644 --- a/lib/typescript-src.rb +++ b/lib/typescript-src.rb @@ -25,7 +25,7 @@ def tsc_path # @return [Pathname] def js_path - typescript_path.join('bin/typescript.js') + typescript_path.join('bin/tsc.js') end # @return [Pathname] From 8d142417775f424d7452f67f38b7fa031b5470d5 Mon Sep 17 00:00:00 2001 From: Boris Drazhzhov Date: Mon, 6 Jul 2015 22:41:44 +0300 Subject: [PATCH 3/3] Updated built-in Typescript version Added ability to use external Typescript compiler --- CHANGES.md | 3 + README.md | 5 +- lib/typescript-src.rb | 8 +- .../support/typescript/.npmignore | 9 +- .../support/typescript/CONTRIBUTING.md | 74 + .../support/typescript/README.md | 78 + .../support/typescript/README.txt | 27 - .../typescript/ThirdPartyNoticeText.txt | 70 +- .../support/typescript/bin/lib.core.d.ts | 1164 + .../support/typescript/bin/lib.core.es6.d.ts | 4801 + .../support/typescript/bin/lib.d.ts | 24933 +++-- .../support/typescript/bin/lib.dom.d.ts | 13043 +++ .../support/typescript/bin/lib.es6.d.ts | 17195 ++++ .../typescript/bin/lib.scriptHost.d.ts | 38 + .../support/typescript/bin/lib.webworker.d.ts | 1652 + .../cs/cz/diagnosticMessages.generated.json | 374 - .../cs/diagnosticMessages.generated.json | 374 - .../cz/diagnosticMessages.generated.json | 374 - .../de/diagnosticMessages.generated.json | 374 - .../diagnosticMessages.generated.json | 374 - .../en/diagnosticMessages.generated.json | 374 - .../en/us/diagnosticMessages.generated.json | 374 - .../es/diagnosticMessages.generated.json | 374 - .../fr/diagnosticMessages.generated.json | 374 - .../it/diagnosticMessages.generated.json | 374 - .../ja/diagnosticMessages.generated.json | 374 - .../ja/jp/diagnosticMessages.generated.json | 374 - .../ko/diagnosticMessages.generated.json | 374 - .../ko/kr/diagnosticMessages.generated.json | 374 - .../pl/diagnosticMessages.generated.json | 374 - .../pt/br/diagnosticMessages.generated.json | 374 - .../pt/diagnosticMessages.generated.json | 374 - .../ru/diagnosticMessages.generated.json | 374 - .../tr/diagnosticMessages.generated.json | 374 - .../zh/cn/diagnosticMessages.generated.json | 373 - .../zh/tw/diagnosticMessages.generated.json | 373 - .../support/typescript/bin/tsc.js | 79192 ++++------------ .../support/typescript/bin/typescript.d.ts | 1849 + .../support/typescript/bin/typescript.js | 61516 ------------ .../typescript/bin/typescriptServices.d.ts | 1849 + .../typescript/bin/typescriptServices.js | 26273 +++++ .../bin/typescriptServices_internal.d.ts | 258 + .../typescript/bin/typescript_internal.d.ts | 258 + .../support/typescript/package.json | 38 +- lib/typescript-src/version.rb | 2 +- 45 files changed, 97954 insertions(+), 144233 deletions(-) create mode 100644 lib/typescript-src/support/typescript/CONTRIBUTING.md create mode 100644 lib/typescript-src/support/typescript/README.md delete mode 100644 lib/typescript-src/support/typescript/README.txt create mode 100644 lib/typescript-src/support/typescript/bin/lib.core.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/lib.core.es6.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/lib.dom.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/lib.es6.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/lib.scriptHost.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/lib.webworker.d.ts delete mode 100644 lib/typescript-src/support/typescript/bin/resources/cs/cz/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/cs/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/cz/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/de/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/en/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/en/us/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/es/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/fr/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/it/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/ja/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/ja/jp/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/ko/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/ko/kr/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/pl/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/pt/br/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/pt/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/ru/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/tr/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/zh/cn/diagnosticMessages.generated.json delete mode 100644 lib/typescript-src/support/typescript/bin/resources/zh/tw/diagnosticMessages.generated.json create mode 100644 lib/typescript-src/support/typescript/bin/typescript.d.ts delete mode 100644 lib/typescript-src/support/typescript/bin/typescript.js create mode 100644 lib/typescript-src/support/typescript/bin/typescriptServices.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/typescriptServices.js create mode 100644 lib/typescript-src/support/typescript/bin/typescriptServices_internal.d.ts create mode 100644 lib/typescript-src/support/typescript/bin/typescript_internal.d.ts diff --git a/CHANGES.md b/CHANGES.md index 0ce3c74..8fde183 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +## v1.4.1.3 2015-06-29 21:37:00+0300 +* Updated Typescript to v1.4.1 +* Added option `use_external_tsc` (boolean). It could be helpful if you have locally installed Typescript node.js module and want to use it. ## v1.0.1.2 2014-08-09 08:37:08+0900 diff --git a/README.md b/README.md index f5bbc49..dc350fb 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,12 @@ Or install it yourself as: ```ruby require 'typescript-src' +TypeScript::Src.use_external_tsc = true # if you want to use tsc from installed node.js module. + # false by default (it uses built-in tsc) + p TypeScript::Src.tsc_path # => # p TypeScript::Src.js_path # => # -p TypeScript::Src.version # => "1.0.1" +p TypeScript::Src.version # => "1.4.1.3" ``` ## Contributing diff --git a/lib/typescript-src.rb b/lib/typescript-src.rb index 11934ad..bff3bc6 100644 --- a/lib/typescript-src.rb +++ b/lib/typescript-src.rb @@ -5,12 +5,14 @@ module TypeScript module Src class << self + attr_accessor :use_external_tsc + # @return [Pathname] def typescript_path unless @typescript_path - begin + if self.use_external_tsc @typescript_path = ::Pathname.new(`npm root -g`.strip! + '/typescript') - rescue + else @typescript_path = ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript') end end @@ -55,6 +57,8 @@ def version package_info['version'] end end + + self.use_external_tsc = false end end diff --git a/lib/typescript-src/support/typescript/.npmignore b/lib/typescript-src/support/typescript/.npmignore index fd2663a..3a42c8f 100644 --- a/lib/typescript-src/support/typescript/.npmignore +++ b/lib/typescript-src/support/typescript/.npmignore @@ -1,12 +1,7 @@ built doc -samples src tests -typings -bin/winjs.d.ts -bin/winrt.d.ts -bin/*.bat -bin/jquery.d.ts -bin/typescriptServices.js Jakefile +.travis.yml +scripts/ diff --git a/lib/typescript-src/support/typescript/CONTRIBUTING.md b/lib/typescript-src/support/typescript/CONTRIBUTING.md new file mode 100644 index 0000000..932bca9 --- /dev/null +++ b/lib/typescript-src/support/typescript/CONTRIBUTING.md @@ -0,0 +1,74 @@ +## Contributing bug fixes +TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort. + +## Contributing features +Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted. + +Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue. + +## Legal +You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright. + +Please submit a Contributor License Agreement (CLA) before submitting a pull request. Download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to . Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features. + +## Housekeeping +Your pull request should: + +* Include a description of what your change intends to do +* Be a child commit of a reasonably recent commit in the **master** branch + * Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR) +* It is desirable, but not necessary, for the tests to pass at each commit +* Have clear commit messages + * e.g. "Refactor feature", "Fix issue", "Add tests for issue" +* Include adequate tests + * At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why + * Tests should include reasonable permutations of the target fix/change + * Include baseline changes with your change + * All changed code must have 100% code coverage +* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines) +* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration + +## Running the Tests +To run all tests, invoke the runtests target using jake: + +`jake runtests` + +This run will all tests; to run only a specific subset of tests, use: + +`jake runtests tests=` + +e.g. to run all compiler baseline tests: + +`jake runtests tests=compiler` + +or to run specifc test:tests\cases\compiler\2dArrays.ts + +`jake runtests tests=2dArrays` + +## Adding a Test +To add a new testcase, simply place a .ts file in tests\cases\compiler containing code that exemplifies the bugfix or change you are making. + +These files support metadata tags in the format // @name: value . The supported names and values are: + +* comments, sourcemap, noimplicitany, declaration: true or false (corresponds to the compiler command-line options of the same name) +* target: ES3 or ES5 (same as compiler) +* out, outDir: path (same as compiler) +* module: local, commonjs, or amd (local corresponds to not passing any compiler --module flag) + +**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in tests\cases\conformance in an appropriately-named subfolder. +**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common. + +## Managing the Baselines +Compiler testcases generate baselines that track the emitted .js, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output. + +When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use + +`jake diff` + +After verifying that the changes in the baselines are correct, run + +`jake baseline-accept` + +to establish the new baselines as the desired behavior. This will change the files in tests\baselines\reference, which should be included as part of your commit. It's important to carefully validate changes in the baselines. + +**Note** that baseline-accept should only be run after a full test run! Accepting baselines after running a subset of tests will delete baseline files for the tests that didn't run. diff --git a/lib/typescript-src/support/typescript/README.md b/lib/typescript-src/support/typescript/README.md new file mode 100644 index 0000000..46581b6 --- /dev/null +++ b/lib/typescript-src/support/typescript/README.md @@ -0,0 +1,78 @@ +[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript) +[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript) +[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript) + +# TypeScript + +[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang). + + +## Contribute + +There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. +* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). +* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)). + + +## Documentation + +* [Quick tutorial](http://www.typescriptlang.org/Tutorial) +* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) +* [Homepage](http://www.typescriptlang.org/) + +## Building + +In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. + +Clone a copy of the repo: + +``` +git clone https://github.com/Microsoft/TypeScript.git +``` + +Change to the TypeScript directory: + +``` +cd TypeScript +``` + +Install Jake tools and dev dependencies: + +``` +npm install -g jake +npm install +``` + +Use one of the following to build and test: + +``` +jake local # Build the compiler into built/local +jake clean # Delete the built compiler +jake LKG # Replace the last known good with the built one. + # Bootstrapping step to be executed when the built compiler reaches a stable state. +jake tests # Build the test infrastructure using the built compiler. +jake runtests # Run tests using the built compiler and test infrastructure. + # You can override the host or specify a test for this command. + # Use host= or tests=. +jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional + parameters 'host=', 'tests=[regex], reporter=[list|spec|json|]'. +jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests. +jake -T # List the above commands. +``` + + +## Usage + +```shell +node built/local/tsc.js hello.ts +``` + + +## Roadmap + +For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap). diff --git a/lib/typescript-src/support/typescript/README.txt b/lib/typescript-src/support/typescript/README.txt deleted file mode 100644 index 7e571e5..0000000 --- a/lib/typescript-src/support/typescript/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -# TypeScript - -Scalable JavaScript development with types, classes and modules. - -## Install - - npm install -g typescript - -## Usage - - tsc hello.ts - - -## Build - -1. Install Node if you haven't already (http://nodejs.org/) -2. Install Jake, the tool we use to build our compiler (https://github.com/mde/jake). To do this, run "npm install -g jake". -3. To use jake, run one of the following commands: - - jake local - This builds the compiler. The output is in built/local in the public directory - - jake clean - deletes the build compiler - - jake LKG - This replaces the LKG (last known good) version of the compiler with the built one. - - This is a bootstrapping step to be executed whenever the built compiler reaches a stable state. - - jake tests - This builds the test infrastructure, using the built compiler. - - jake runtests - This runs the tests, using the built compiler and built test infrastructure. - - You can also override the host or specify a test for this command. Use host= or tests=. - - jake baseline-accept - This replaces the baseline test results with the results obtained from jake runtests. - - jake -T lists the above commands. diff --git a/lib/typescript-src/support/typescript/ThirdPartyNoticeText.txt b/lib/typescript-src/support/typescript/ThirdPartyNoticeText.txt index ef7619a..6fbb7e4 100644 --- a/lib/typescript-src/support/typescript/ThirdPartyNoticeText.txt +++ b/lib/typescript-src/support/typescript/ThirdPartyNoticeText.txt @@ -19,67 +19,17 @@ limitations under the License. --------------------------------------------- Third Party Code Components -------------------------------------------- ----- Mozilla Developer Code--------- -The following Mozilla Developer Code is under Public Domain as updated after Aug. 20, 2012, see, https://developer.mozilla.org/en-US/docs/Project:Copyrights -1. Array filter Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter -Any copyright is dedicated to the Public Domain. -2. Array forEach Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach -Any copyright is dedicated to the Public Domain. - -3. Array indexOf Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf -Any copyright is dedicated to the Public Domain. - -4. Array map Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map -Any copyright is dedicated to the Public Domain. - -5. Array Reduce Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce -Any copyright is dedicated to the Public Domain. - -6. String Trim Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim -Any copyright is dedicated to the Public Domain. - -7. Date now Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now -Any copyright is dedicated to the Public Domain. - -------------JSON2 Script------------------------ -json2.js 2012-10-08 -Public Domain. -NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -See, http://www.JSON.org/js.html - ---------------r.js---------------------- -Copyright (c) 2010-2011 Dojo Foundation. All Rights Reserved. -Originally License under MIT License -------------------------------------------------------------------------- +------------------- DefinitelyTyped -------------------- +This file is based on or incorporates material from the projects listed below (collectively ?Third Party Code?). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. +DefinitelyTyped +This project is licensed under the MIT license. +Copyrights are respective of each contributor listed at the beginning of each definition file. Provided for Informational Purposes Only -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +MIT License +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------- - ------------- End of ThirdPartyNotices --------------------------------------------------- */ diff --git a/lib/typescript-src/support/typescript/bin/lib.core.d.ts b/lib/typescript-src/support/typescript/bin/lib.core.d.ts new file mode 100644 index 0000000..989bd9b --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/lib.core.d.ts @@ -0,0 +1,1164 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare var NaN: number; +declare var Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties?: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: any): any; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: any): any; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: any): any; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare var Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(thisArg: any, ...argArray: any[]): any; + + prototype: any; + length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + prototype: Function; +} + +declare var Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A function that returns the replacement text. + */ + replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replaceValue A function that returns the replacement text. + */ + replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + +interface Boolean { +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + prototype: Boolean; +} + +declare var Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends Array { + raw: string[]; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + E: number; + /** The natural logarithm of 10. */ + LN10: number; + /** The natural logarithm of 2. */ + LN2: number; + /** The base-2 logarithm of e. */ + LOG2E: number; + /** The base-10 logarithm of e. */ + LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + SQRT1_2: number; + /** The square root of 2. */ + SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point (y,x). + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare var Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */ + source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): RegExp; +} + +interface RegExpConstructor { + new (pattern: string, flags?: string): RegExp; + (pattern: string, flags?: string): RegExp; + prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare var RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + prototype: Error; +} + +declare var Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + prototype: EvalError; +} + +declare var EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + prototype: RangeError; +} + +declare var RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + prototype: ReferenceError; +} + +declare var ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + prototype: SyntaxError; +} + +declare var SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + prototype: TypeError; +} + +declare var TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + prototype: URIError; +} + +declare var URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + */ + stringify(value: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + */ + stringify(value: any, replacer: (key: string, value: any) => any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + */ + stringify(value: any, replacer: any[]): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: any[], space: any): string; +} +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): boolean; + prototype: Array; +} + +declare var Array: ArrayConstructor; diff --git a/lib/typescript-src/support/typescript/bin/lib.core.es6.d.ts b/lib/typescript-src/support/typescript/bin/lib.core.es6.d.ts new file mode 100644 index 0000000..6efadf0 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/lib.core.es6.d.ts @@ -0,0 +1,4801 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare var NaN: number; +declare var Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties?: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: any): any; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: any): any; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: any): any; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare var Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(thisArg: any, ...argArray: any[]): any; + + prototype: any; + length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + prototype: Function; +} + +declare var Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A function that returns the replacement text. + */ + replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replaceValue A function that returns the replacement text. + */ + replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + +interface Boolean { +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + prototype: Boolean; +} + +declare var Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends Array { + raw: string[]; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + E: number; + /** The natural logarithm of 10. */ + LN10: number; + /** The natural logarithm of 2. */ + LN2: number; + /** The base-2 logarithm of e. */ + LOG2E: number; + /** The base-10 logarithm of e. */ + LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + SQRT1_2: number; + /** The square root of 2. */ + SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point (y,x). + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare var Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */ + source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): RegExp; +} + +interface RegExpConstructor { + new (pattern: string, flags?: string): RegExp; + (pattern: string, flags?: string): RegExp; + prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare var RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + prototype: Error; +} + +declare var Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + prototype: EvalError; +} + +declare var EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + prototype: RangeError; +} + +declare var RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + prototype: ReferenceError; +} + +declare var ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + prototype: SyntaxError; +} + +declare var SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + prototype: TypeError; +} + +declare var TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + prototype: URIError; +} + +declare var URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + */ + stringify(value: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + */ + stringify(value: any, replacer: (key: string, value: any) => any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + */ + stringify(value: any, replacer: any[]): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: any[], space: any): string; +} +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): boolean; + prototype: Array; +} + +declare var Array: ArrayConstructor; +declare type PropertyKey = string | number | Symbol; + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + // [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): Symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): Symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: Symbol): string; + + // Well-known Symbols + + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + hasInstance: Symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + isConcatSpreadable: Symbol; + + /** + * A Boolean value that if true indicates that an object may be used as a regular expression. + */ + isRegExp: Symbol; + + /** + * A method that returns the default iterator for an object.Called by the semantics of the + * for-of statement. + */ + iterator: Symbol; + + /** + * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive + * abstract operation. + */ + toPrimitive: Symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built- in method Object.prototype.toString. + */ + toStringTag: Symbol; + + /** + * An Object whose own property names are property names that are excluded from the with + * environment bindings of the associated objects. + */ + unscopables: Symbol; +} +declare var Symbol: SymbolConstructor; + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): Symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface Function { + /** + * Returns a new function object that is identical to the argument object in all ways except + * for its identity and the value of its HomeObject internal slot. + */ + toMethod(newHome: Object): Function; + + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + name: string; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + +interface Array { + /** Iterator */ + // [Symbol.iterator] (): Iterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface String { + /** Iterator */ + // [Symbol.iterator] (): Iterator; + + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + contains(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + //[Symbol.iterator](): Iterator; + next(): IteratorResult; +} + +interface Iterable { + //[Symbol.iterator](): Iterator; +} + +interface GeneratorFunction extends Function { + +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + +interface Generator extends Iterator { + next(value?: any): IteratorResult; + throw (exception: any): IteratorResult; + return (value: T): IteratorResult; + // [Symbol.toStringTag]: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; + + // [Symbol.toStringTag]: string; +} + +interface RegExp { + // [Symbol.isRegExp]: boolean; + + /** + * Matches a string with a regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + match(string: string): string[]; + + /** + * Replaces text in a string, using a regular expression. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of rgExp in stringObj. + */ + replace(string: string, replaceValue: string): string; + + search(string: string): number; + + /** + * Returns an Array object into which substrings of the result of converting string to a String + * have been stored. The substrings are determined by searching from left to right for matches + * of the this value regular expression; these occurrences are not part of any substring in the + * returned array, but serve to divide up the String value. + * + * If the regular expression that contains capturing parentheses, then each time separator is + * matched the results (including any undefined results) of the capturing parentheses are spliced. + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than limit elements. + */ + split(string: string, limit?: number): string[]; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + unicode: boolean; +} + +interface Map { + clear(): void; + delete(key: K): boolean; + entries(): Iterator<[K, V]>; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + keys(): Iterator; + set(key: K, value?: V): Map; + size: number; + values(): Iterator; + // [Symbol.iterator]():Iterator<[K,V]>; + // [Symbol.toStringTag]: string; +} + +interface MapConstructor { + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + // [Symbol.toStringTag]: string; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): Iterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): Iterator; + size: number; + values(): Iterator; + // [Symbol.iterator]():Iterator; + // [Symbol.toStringTag]: string; +} + +interface SetConstructor { + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + // [Symbol.toStringTag]: string; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + +interface JSON { + // [Symbol.toStringTag]: string; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; + + // [Symbol.toStringTag]: string; +} + +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian: boolean): void; + + // [Symbol.toStringTag]: string; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int8Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int8Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int8Array; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: Int8Array): Int8Array; + new (array: number[]): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} +declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: Uint8Array): Uint8Array; + new (array: number[]): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} +declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: Uint8ClampedArray): Uint8ClampedArray; + new (array: number[]): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int16Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int16Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int16Array; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: Int16Array): Int16Array; + new (array: number[]): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} +declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint16Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint16Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint16Array; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: Uint16Array): Uint16Array; + new (array: number[]): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} +declare var Uint16Array: Uint16ArrayConstructor; + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int32Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int32Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int32Array; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: Int32Array): Int32Array; + new (array: number[]): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint32Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint32Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint32Array; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: Uint32Array): Uint32Array; + new (array: number[]): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float32Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float32Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float32Array; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: Float32Array): Float32Array; + new (array: number[]): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} +declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float64Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float64Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float64Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float64Array; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: Float64Array): Float64Array; + new (array: number[]): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare var Float64Array: Float64ArrayConstructor; + +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handeler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; + +declare var Reflect: { + apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + construct(target: Function, argumentsList: ArrayLike): any; + defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + deleteProperty(target: any, propertyKey: PropertyKey): boolean; + enumerate(target: any): Iterator; + get(target: any, propertyKey: PropertyKey, receiver?: any): any; + getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + getPrototypeOf(target: any): any; + has(target: any, propertyKey: string): boolean; + has(target: any, propertyKey: Symbol): boolean; + isExtensible(target: any): boolean; + ownKeys(target: any): Array; + preventExtensions(target: any): boolean; + set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; + setPrototypeOf(target: any, proto: any): boolean; +}; + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | Promise, onrejected?: (reason: any) => TResult | Promise): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | Promise): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param init A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + + (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | Promise)[]): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of values. + * @returns A new Promise. + */ + all(values: Promise[]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: (T | Promise)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | Promise): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/lib.d.ts b/lib/typescript-src/support/typescript/bin/lib.d.ts index d3e57e7..bd8e2cc 100644 --- a/lib/typescript-src/support/typescript/bin/lib.d.ts +++ b/lib/typescript-src/support/typescript/bin/lib.d.ts @@ -1,4 +1,4 @@ -/* ***************************************************************************** +/*! ***************************************************************************** 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 @@ -124,10 +124,7 @@ interface Object { propertyIsEnumerable(v: string): boolean; } -/** - * Provides functionality common to all JavaScript objects. - */ -declare var Object: { +interface ObjectConstructor { new (value?: any): Object; (): any; (value: any): any; @@ -221,6 +218,11 @@ declare var Object: { keys(o: any): string[]; } +/** + * Provides functionality common to all JavaScript objects. + */ +declare var Object: ObjectConstructor; + /** * Creates a new function. */ @@ -255,8 +257,8 @@ interface Function { caller: Function; } -declare var Function: { - /** +interface FunctionConstructor { + /** * Creates a new function. * @param args A list of arguments the function accepts. */ @@ -265,6 +267,8 @@ declare var Function: { prototype: Function; } +declare var Function: FunctionConstructor; + interface IArguments { [index: number]: any; length: number; @@ -317,13 +321,13 @@ interface String { * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): string[]; + match(regexp: string): RegExpMatchArray; /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): string[]; + match(regexp: RegExp): RegExpMatchArray; /** * Replaces text in a string, using a regular expression or search string. @@ -424,24 +428,29 @@ interface String { [index: number]: string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare var String: { +interface StringConstructor { new (value?: any): String; (value?: any): string; prototype: String; fromCharCode(...codes: number[]): string; } +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + interface Boolean { } -declare var Boolean: { + +interface BooleanConstructor { new (value?: any): Boolean; (value?: any): boolean; prototype: Boolean; } +declare var Boolean: BooleanConstructor; + interface Number { /** * Returns a string representation of an object. @@ -468,8 +477,7 @@ interface Number { toPrecision(precision?: number): string; } -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: { +interface NumberConstructor { new (value?: any): Number; (value?: any): number; prototype: Number; @@ -499,6 +507,13 @@ declare var Number: { POSITIVE_INFINITY: number; } +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends Array { + raw: string[]; +} + interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ E: number; @@ -764,7 +779,7 @@ interface Date { toJSON(key?: any): string; } -declare var Date: { +interface DateConstructor { new (): Date; new (value: number): Date; new (value: string): Date; @@ -790,39 +805,18 @@ declare var Date: { now(): number; } -interface RegExpExecArray { - [index: number]: string; - length: number; +declare var Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} +interface RegExpExecArray extends Array { index: number; input: string; - - toString(): string; - toLocaleString(): string; - concat(...items: string[][]): string[]; - join(separator?: string): string; - pop(): string; - push(...items: string[]): number; - reverse(): string[]; - shift(): string; - slice(start?: number, end?: number): string[]; - sort(compareFn?: (a: string, b: string) => number): string[]; - splice(start: number): string[]; - splice(start: number, deleteCount: number, ...items: string[]): string[]; - unshift(...items: string[]): number; - - indexOf(searchElement: string, fromIndex?: number): number; - lastIndexOf(searchElement: string, fromIndex?: number): number; - every(callbackfn: (value: string, index: number, array: string[]) => boolean, thisArg?: any): boolean; - some(callbackfn: (value: string, index: number, array: string[]) => boolean, thisArg?: any): boolean; - forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void; - map(callbackfn: (value: string, index: number, array: string[]) => any, thisArg?: any): any[]; - filter(callbackfn: (value: string, index: number, array: string[]) => boolean, thisArg?: any): string[]; - reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: string[]) => any, initialValue?: any): any; - reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: string[]) => any, initialValue?: any): any; } - interface RegExp { /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. @@ -853,9 +847,11 @@ interface RegExp { // Non-standard extensions compile(): RegExp; } -declare var RegExp: { + +interface RegExpConstructor { new (pattern: string, flags?: string): RegExp; (pattern: string, flags?: string): RegExp; + prototype: RegExp; // Non-standard extensions $1: string; @@ -870,64 +866,87 @@ declare var RegExp: { lastMatch: string; } +declare var RegExp: RegExpConstructor; + interface Error { name: string; message: string; } -declare var Error: { + +interface ErrorConstructor { new (message?: string): Error; (message?: string): Error; prototype: Error; } +declare var Error: ErrorConstructor; + interface EvalError extends Error { } -declare var EvalError: { + +interface EvalErrorConstructor { new (message?: string): EvalError; (message?: string): EvalError; prototype: EvalError; } +declare var EvalError: EvalErrorConstructor; + interface RangeError extends Error { } -declare var RangeError: { + +interface RangeErrorConstructor { new (message?: string): RangeError; (message?: string): RangeError; prototype: RangeError; } +declare var RangeError: RangeErrorConstructor; + interface ReferenceError extends Error { } -declare var ReferenceError: { + +interface ReferenceErrorConstructor { new (message?: string): ReferenceError; (message?: string): ReferenceError; prototype: ReferenceError; } +declare var ReferenceError: ReferenceErrorConstructor; + interface SyntaxError extends Error { } -declare var SyntaxError: { + +interface SyntaxErrorConstructor { new (message?: string): SyntaxError; (message?: string): SyntaxError; prototype: SyntaxError; } +declare var SyntaxError: SyntaxErrorConstructor; + interface TypeError extends Error { } -declare var TypeError: { + +interface TypeErrorConstructor { new (message?: string): TypeError; (message?: string): TypeError; prototype: TypeError; } +declare var TypeError: TypeErrorConstructor; + interface URIError extends Error { } -declare var URIError: { + +interface URIErrorConstructor { new (message?: string): URIError; (message?: string): URIError; prototype: URIError; } +declare var URIError: URIErrorConstructor; + interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. @@ -979,11 +998,24 @@ declare var JSON: JSON; ///////////////////////////// interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; /** * Returns a string representation of an array. */ toString(): string; toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. @@ -999,15 +1031,6 @@ interface Array { * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; - /** - * Removes the last element from an array and returns it. - */ - pop(): T; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; /** * Reverses the elements in an Array. */ @@ -1124,14 +1147,10 @@ interface Array { */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - [n: number]: T; } -declare var Array: { + +interface ArrayConstructor { new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; @@ -1142,6 +1161,7 @@ declare var Array: { prototype: Array; } +declare var Array: ArrayConstructor; ///////////////////////////// /// IE10 ECMAScript Extensions @@ -1158,6 +1178,11 @@ interface ArrayBuffer { * Read-only. The length of the ArrayBuffer (in bytes). */ byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; } declare var ArrayBuffer: { @@ -1202,14 +1227,14 @@ interface Int8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1260,14 +1285,14 @@ interface Uint8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1318,14 +1343,14 @@ interface Int16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1376,14 +1401,14 @@ interface Uint16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1434,14 +1459,14 @@ interface Int32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1492,14 +1517,14 @@ interface Uint32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1550,14 +1575,14 @@ interface Float32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1608,14 +1633,14 @@ interface Float64Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float64Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1770,6 +1795,7 @@ interface Map { } declare var Map: { new (): Map; + prototype: Map; } interface WeakMap { @@ -1781,6 +1807,7 @@ interface WeakMap { } declare var WeakMap: { new (): WeakMap; + prototype: WeakMap; } interface Set { @@ -1793,10 +1820,13 @@ interface Set { } declare var Set: { new (): Set; + prototype: Set; } +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// declare module Intl { - interface CollatorOptions { usage?: string; localeMatcher?: string; @@ -1911,12246 +1941,10510 @@ declare module Intl { } interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; } interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; } interface Date { + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } - ///////////////////////////// -/// IE9 DOM APIs +/// IE DOM APIs ///////////////////////////// + interface PositionOptions { enableHighAccuracy?: boolean; timeout?: number; maximumAge?: number; } -interface NavigatorID { - appVersion: string; - appName: string; - userAgent: string; - platform: string; +interface ObjectURLOptions { + oneTimeOnly?: boolean; } -interface HTMLTableElement extends HTMLElement, MSDataBindingTableExtensions, MSDataBindingExtensions, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. - */ - borderColorLight: any; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollection; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollection; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Retrieves a collection of all cells in the table row or in the entire table. - */ - cells: HTMLCollection; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. - */ - borderColorDark: any; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLElement; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLElement; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLElement; - /** - * Moves a table row to a new position. - * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. - * @param indexTo Number that specifies where the row is moved within the rows collection. - */ - moveRow(indexFrom?: number, indexTo?: number): Object; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLElement; -} -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new (): HTMLTableElement; +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; } -interface TreeWalker { - whatToShow: number; - filter: NodeFilter; - root: Node; - currentNode: Node; - expandEntityReferences: boolean; - previousSibling(): Node; - lastChild(): Node; - nextSibling(): Node; - nextNode(): Node; - parentNode(): Node; - firstChild(): Node; - previousNode(): Node; +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; } -declare var TreeWalker: { - prototype: TreeWalker; - new (): TreeWalker; + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; } -interface GetSVGDocument { - getSVGDocument(): Document; +interface AlgorithmParameters { } -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - y: number; - y1: number; - x: number; - x1: number; -} -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new (): SVGPathSegCurvetoQuadraticRel; +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; } -interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; - getEntriesByType(entryType: string): any; - toJSON(): any; - getMeasures(measureName?: string): any; - clearMarks(markName?: string): void; - getMarks(markName?: string): any; - clearResourceTimings(): void; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - getEntriesByName(name: string, entryType?: string): any; - getEntries(): any; - clearMeasures(measureName?: string): void; - setResourceTimingBufferSize(maxSize: number): void; +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; } -declare var Performance: { - prototype: Performance; - new (): Performance; + +interface ExceptionInformation { + domain?: string; } -interface MSDataBindingTableExtensions { - dataPageSize: number; - nextPage(): void; - firstPage(): void; - refresh(): void; - previousPage(): void; - lastPage(): void; +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; } -interface CompositionEvent extends UIEvent { - data: string; - locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; } -declare var CompositionEvent: { - prototype: CompositionEvent; - new (): CompositionEvent; + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; } -interface WindowTimers { - clearTimeout(handle: number): void; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; - clearInterval(handle: number): void; - setInterval(handler: any, timeout?: any, ...args: any[]): number; +interface Algorithm { + name?: string; + params?: AlgorithmParameters; } -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { - orientType: SVGAnimatedEnumeration; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - markerHeight: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - refY: SVGAnimatedLength; - refX: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - SVG_MARKER_ORIENT_UNKNOWN: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; +interface MouseEventInit { + bubbles?: boolean; + cancelable?: boolean; + view?: Window; + detail?: number; + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; } -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new (): SVGMarkerElement; - SVG_MARKER_ORIENT_UNKNOWN: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; + +interface WebGLContextAttributes { + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; } -interface CSSStyleDeclaration { - backgroundAttachment: string; - visibility: string; - textAlignLast: string; - borderRightStyle: string; - counterIncrement: string; - orphans: string; - cssText: string; - borderStyle: string; - pointerEvents: string; - borderTopColor: string; - markerEnd: string; - textIndent: string; - listStyleImage: string; - cursor: string; - listStylePosition: string; - wordWrap: string; - borderTopStyle: string; - alignmentBaseline: string; - opacity: string; - direction: string; - strokeMiterlimit: string; - maxWidth: string; - color: string; - clip: string; - borderRightWidth: string; - verticalAlign: string; - overflow: string; - mask: string; - borderLeftStyle: string; - emptyCells: string; - stopOpacity: string; - paddingRight: string; - parentRule: CSSRule; - background: string; - boxSizing: string; - textJustify: string; - height: string; - paddingTop: string; +interface NodeListOf extends NodeList { length: number; - right: string; - baselineShift: string; - borderLeft: string; - widows: string; - lineHeight: string; - left: string; - textUnderlinePosition: string; - glyphOrientationHorizontal: string; - display: string; - textAnchor: string; - cssFloat: string; - strokeDasharray: string; - rubyAlign: string; - fontSizeAdjust: string; - borderLeftColor: string; - backgroundImage: string; - listStyleType: string; - strokeWidth: string; - textOverflow: string; - fillRule: string; - borderBottomColor: string; - zIndex: string; - position: string; - listStyle: string; - msTransformOrigin: string; - dominantBaseline: string; - overflowY: string; - fill: string; - captionSide: string; - borderCollapse: string; - boxShadow: string; - quotes: string; - tableLayout: string; - unicodeBidi: string; - borderBottomWidth: string; - backgroundSize: string; - textDecoration: string; - strokeDashoffset: string; - fontSize: string; - border: string; - pageBreakBefore: string; - borderTopRightRadius: string; - msTransform: string; - borderBottomLeftRadius: string; - textTransform: string; - rubyPosition: string; - strokeLinejoin: string; - clipPath: string; - borderRightColor: string; - fontFamily: string; - clear: string; - content: string; - backgroundClip: string; - marginBottom: string; - counterReset: string; - outlineWidth: string; - marginRight: string; - paddingLeft: string; - borderBottom: string; - wordBreak: string; - marginTop: string; - top: string; - fontWeight: string; - borderRight: string; - width: string; - kerning: string; - pageBreakAfter: string; - borderBottomStyle: string; - fontStretch: string; - padding: string; - strokeOpacity: string; - markerStart: string; - bottom: string; - borderLeftWidth: string; - clipRule: string; - backgroundPosition: string; - backgroundColor: string; - pageBreakInside: string; - backgroundOrigin: string; - strokeLinecap: string; - borderTopWidth: string; - outlineStyle: string; - borderTop: string; - outlineColor: string; - paddingBottom: string; - marginLeft: string; - font: string; - outline: string; - wordSpacing: string; - maxHeight: string; - fillOpacity: string; - letterSpacing: string; - borderSpacing: string; - backgroundRepeat: string; - borderRadius: string; - borderWidth: string; - borderBottomRightRadius: string; - whiteSpace: string; - fontStyle: string; - minWidth: string; - stopColor: string; - borderTopLeftRadius: string; - borderColor: string; - marker: string; - glyphOrientationVertical: string; - markerMid: string; - fontVariant: string; - minHeight: string; - stroke: string; - rubyOverhang: string; - overflowX: string; - textAlign: string; - margin: string; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - removeProperty(propertyName: string): string; - item(index: number): string; - [index: number]: string; - setProperty(propertyName: string, value: string, priority?: string): void; -} -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new (): CSSStyleDeclaration; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { -} -declare var SVGGElement: { - prototype: SVGGElement; - new (): SVGGElement; -} - -interface MSStyleCSSProperties extends MSCSSProperties { - pixelWidth: number; - posHeight: number; - posLeft: number; - pixelTop: number; - pixelBottom: number; - textDecorationNone: boolean; - pixelLeft: number; - posTop: number; - posBottom: number; - textDecorationOverline: boolean; - posWidth: number; - textDecorationLineThrough: boolean; - pixelHeight: number; - textDecorationBlink: boolean; - posRight: number; - pixelRight: number; - textDecorationUnderline: boolean; -} -declare var MSStyleCSSProperties: { - prototype: MSStyleCSSProperties; - new (): MSStyleCSSProperties; -} - -interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, MSNavigatorExtensions, NavigatorGeolocation, MSNavigatorDoNotTrack, NavigatorStorageUtils { -} -declare var Navigator: { - prototype: Navigator; - new (): Navigator; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - y: number; - x2: number; - x: number; - y2: number; -} -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new (): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGZoomEvent extends UIEvent { - zoomRectScreen: SVGRect; - previousScale: number; - newScale: number; - previousTranslate: SVGPoint; - newTranslate: SVGPoint; -} -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new (): SVGZoomEvent; -} - -interface NodeSelector { - querySelectorAll(selectors: string): NodeList; - querySelector(selectors: string): Element; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new (): HTMLTableDataCellElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; -} -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new (): HTMLBaseElement; -} - -interface ClientRect { - left: number; - width: number; - right: number; - top: number; - bottom: number; - height: number; -} -declare var ClientRect: { - prototype: ClientRect; - new (): ClientRect; -} - -interface PositionErrorCallback { - (error: PositionError): void; -} - -interface DOMImplementation { - createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; - createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; - hasFeature(feature: string, version?: string): boolean; - createHTMLDocument(title: string): Document; -} -declare var DOMImplementation: { - prototype: DOMImplementation; - new (): DOMImplementation; -} - -interface SVGUnitTypes { - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: { - prototype: SVGUnitTypes; - new (): SVGUnitTypes; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; -} - -interface Element extends Node, NodeSelector, ElementTraversal { - scrollTop: number; - clientLeft: number; - scrollLeft: number; - tagName: string; - clientWidth: number; - scrollWidth: number; - clientHeight: number; - clientTop: number; - scrollHeight: number; - getAttribute(name?: string): string; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - getBoundingClientRect(): ClientRect; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - msMatchesSelector(selectors: string): boolean; - hasAttribute(name: string): boolean; - removeAttribute(name?: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - getAttributeNode(name: string): Attr; - fireEvent(eventName: string, eventObj?: any): boolean; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "bdi"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "main"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "rp"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "summary"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: string): NodeList; - getClientRects(): ClientRectList; - setAttributeNode(newAttr: Attr): Attr; - removeAttributeNode(oldAttr: Attr): Attr; - setAttribute(name?: string, value?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; -} -declare var Element: { - prototype: Element; - new (): Element; -} - -interface HTMLNextIdElement extends HTMLElement { - n: string; -} -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new (): HTMLNextIdElement; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - y: number; - x: number; -} -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new (): SVGPathSegMovetoRel; + item(index: number): TNode; + [index: number]: TNode; } -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - y1: SVGAnimatedLength; - x2: SVGAnimatedLength; - x1: SVGAnimatedLength; - y2: SVGAnimatedLength; -} -declare var SVGLineElement: { - prototype: SVGLineElement; - new (): SVGLineElement; -} - -interface HTMLParagraphElement extends HTMLElement, DOML2DeprecatedTextFlowControl { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; -} -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new (): HTMLParagraphElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Removes an element from the collection. - */ - remove(index?: number): void; - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: any): void; -} -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new (): HTMLAreasCollection; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { -} -declare var SVGDescElement: { - prototype: SVGDescElement; - new (): SVGDescElement; -} - -interface Node extends EventTarget { - nodeType: number; - previousSibling: Node; - localName: string; - namespaceURI: string; - textContent: string; - parentNode: Node; - nextSibling: Node; - nodeValue: string; - lastChild: Node; - childNodes: NodeList; - nodeName: string; - ownerDocument: Document; - attributes: NamedNodeMap; - firstChild: Node; - prefix: string; - removeChild(oldChild: Node): Node; - appendChild(newChild: Node): Node; - isSupported(feature: string, version: string): boolean; - isEqualNode(arg: Node): boolean; - lookupPrefix(namespaceURI: string): string; - isDefaultNamespace(namespaceURI: string): boolean; - compareDocumentPosition(other: Node): number; - normalize(): void; - isSameNode(other: Node): boolean; - hasAttributes(): boolean; - lookupNamespaceURI(prefix: string): string; - cloneNode(deep?: boolean): Node; - hasChildNodes(): boolean; - replaceChild(newChild: Node, oldChild: Node): Node; - insertBefore(newChild: Node, refChild?: Node): Node; - ENTITY_REFERENCE_NODE: number; - ATTRIBUTE_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - TEXT_NODE: number; - ELEMENT_NODE: number; - COMMENT_NODE: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_TYPE_NODE: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_NODE: number; - ENTITY_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - CDATA_SECTION_NODE: number; - NOTATION_NODE: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_PRECEDING: number; -} -declare var Node: { - prototype: Node; - new (): Node; - ENTITY_REFERENCE_NODE: number; - ATTRIBUTE_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - TEXT_NODE: number; - ELEMENT_NODE: number; - COMMENT_NODE: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_TYPE_NODE: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_NODE: number; - ENTITY_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - CDATA_SECTION_NODE: number; - NOTATION_NODE: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_PRECEDING: number; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - y: number; - x: number; -} -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new (): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface DOML2DeprecatedListSpaceReduction { - compact: boolean; -} - -interface MSScriptHost { -} -declare var MSScriptHost: { - prototype: MSScriptHost; - new (): MSScriptHost; -} - -interface SVGClipPathElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - clipPathUnits: SVGAnimatedEnumeration; -} -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new (): SVGClipPathElement; -} - -interface MouseEvent extends UIEvent { - toElement: Element; - layerY: number; - fromElement: Element; - which: number; - pageX: number; - offsetY: number; - x: number; - y: number; - metaKey: boolean; - altKey: boolean; - ctrlKey: boolean; - offsetX: number; - screenX: number; - clientY: number; - shiftKey: boolean; - layerX: number; - screenY: number; - relatedTarget: EventTarget; - button: number; - pageY: number; - buttons: number; - clientX: number; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; - getModifierState(keyArg: string): boolean; -} -declare var MouseEvent: { - prototype: MouseEvent; - new (): MouseEvent; -} - -interface RangeException { - code: number; - message: string; - toString(): string; - INVALID_NODE_TYPE_ERR: number; - BAD_BOUNDARYPOINTS_ERR: number; -} -declare var RangeException: { - prototype: RangeException; - new (): RangeException; - INVALID_NODE_TYPE_ERR: number; - BAD_BOUNDARYPOINTS_ERR: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - y: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - dy: SVGAnimatedLengthList; - x: SVGAnimatedLengthList; - dx: SVGAnimatedLengthList; -} -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new (): SVGTextPositioningElement; -} - -interface HTMLAppletElement extends HTMLElement, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { - width: number; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - object: string; - form: HTMLFormElement; - code: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the class identifier for the object. - */ - classid: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - contentDocument: Document; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - BaseHref: string; -} -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new (): HTMLAppletElement; -} - -interface TextMetrics { - width: number; -} -declare var TextMetrics: { - prototype: TextMetrics; - new (): TextMetrics; -} - -interface DocumentEvent { - createEvent(eventInterface: string): Event; -} - -interface HTMLOListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { - /** - * The starting number. - */ - start: number; -} -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new (): HTMLOListElement; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new (): SVGPathSegLinetoVerticalRel; -} - -interface SVGAnimatedString { - animVal: string; - baseVal: string; -} -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new (): SVGAnimatedString; -} - -interface CDATASection extends Text { -} -declare var CDATASection: { - prototype: CDATASection; - new (): CDATASection; -} - -interface StyleMedia { - type: string; - matchMedium(mediaquery: string): boolean; -} -declare var StyleMedia: { - prototype: StyleMedia; - new (): StyleMedia; -} - -interface HTMLSelectElement extends HTMLElement, MSHTMLCollectionExtensions, MSDataBindingExtensions { - options: HTMLSelectElement; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - type: string; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: any): void; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - [name: string]: any; -} -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new (): HTMLSelectElement; -} - -interface TextRange { - boundingLeft: number; - htmlText: string; - offsetLeft: number; - boundingWidth: number; - boundingHeight: number; - boundingTop: number; - text: string; - offsetTop: number; - moveToPoint(x: number, y: number): void; - queryCommandValue(cmdID: string): any; - getBookmark(): string; - move(unit: string, count?: number): number; - queryCommandIndeterm(cmdID: string): boolean; - scrollIntoView(fStart?: boolean): void; - findText(string: string, count?: number, flags?: number): boolean; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - getBoundingClientRect(): ClientRect; - moveToBookmark(bookmark: string): boolean; - isEqual(range: TextRange): boolean; - duplicate(): TextRange; - collapse(start?: boolean): void; - queryCommandText(cmdID: string): string; - select(): void; - pasteHTML(html: string): void; - inRange(range: TextRange): boolean; - moveEnd(unit: string, count?: number): number; - getClientRects(): ClientRectList; - moveStart(unit: string, count?: number): number; - parentElement(): Element; - queryCommandState(cmdID: string): boolean; - compareEndPoints(how: string, sourceRange: TextRange): number; - execCommandShowHelp(cmdID: string): boolean; - moveToElementText(element: Element): void; - expand(Unit: string): boolean; - queryCommandSupported(cmdID: string): boolean; - setEndPoint(how: string, SourceRange: TextRange): void; - queryCommandEnabled(cmdID: string): boolean; -} -declare var TextRange: { - prototype: TextRange; - new (): TextRange; -} - -interface SVGTests { - requiredFeatures: SVGStringList; - requiredExtensions: SVGStringList; - systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface HTMLBlockElement extends HTMLElement, DOML2DeprecatedTextFlowControl { - /** - * Sets or retrieves the width of the object. - */ - width: number; - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new (): HTMLBlockElement; -} - -interface CSSStyleSheet extends StyleSheet { - owningElement: Element; - imports: StyleSheetList; - isAlternate: boolean; - rules: MSCSSRuleList; - isPrefAlternate: boolean; - readOnly: boolean; - cssText: string; - ownerRule: CSSRule; - href: string; - cssRules: CSSRuleList; - id: string; - pages: StyleSheetPageList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - insertRule(rule: string, index?: number): number; - removeRule(lIndex: number): void; - deleteRule(index?: number): void; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - removeImport(lIndex: number): void; -} -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new (): CSSStyleSheet; -} - -interface MSSelection { - type: string; - typeDetail: string; - createRange(): TextRange; - clear(): void; - createRangeCollection(): TextRangeCollection; - empty(): void; -} -declare var MSSelection: { - prototype: MSSelection; - new (): MSSelection; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; -} -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new (): HTMLMetaElement; -} - -interface SVGPatternElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired, SVGURIReference { - patternUnits: SVGAnimatedEnumeration; - y: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - height: SVGAnimatedLength; -} -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new (): SVGPatternElement; -} - -interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; -} -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new (): SVGAnimatedAngle; -} - -interface Selection { - isCollapsed: boolean; - anchorNode: Node; - focusNode: Node; - anchorOffset: number; - focusOffset: number; - rangeCount: number; - addRange(range: Range): void; - collapseToEnd(): void; - toString(): string; - selectAllChildren(parentNode: Node): void; - getRangeAt(index: number): Range; - collapse(parentNode: Node, offset: number): void; - removeAllRanges(): void; - collapseToStart(): void; - deleteFromDocument(): void; - removeRange(range: Range): void; -} -declare var Selection: { - prototype: Selection; - new (): Selection; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; -} -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new (): SVGScriptElement; -} - -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new (): HTMLDDElement; -} - -interface MSDataBindingRecordSetReadonlyExtensions { - recordset: Object; - namedRecordset(dataMember: string, hierarchy?: any): Object; -} - -interface CSSStyleRule extends CSSRule { - selectorText: string; - style: MSStyleCSSProperties; - readOnly: boolean; -} -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new (): CSSStyleRule; -} - -interface NodeIterator { - whatToShow: number; - filter: NodeFilter; - root: Node; - expandEntityReferences: boolean; - nextNode(): Node; - detach(): void; - previousNode(): Node; -} -declare var NodeIterator: { - prototype: NodeIterator; - new (): NodeIterator; -} - -interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox, SVGExternalResourcesRequired { - viewTarget: SVGStringList; -} -declare var SVGViewElement: { - prototype: SVGViewElement; - new (): SVGViewElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; -} -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new (): HTMLLinkElement; -} - -interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getTransformToElement(element: SVGElement): SVGMatrix; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; -} -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new (): HTMLFontElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { -} -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new (): SVGTitleElement; -} - -interface ControlRangeCollection { - length: number; - queryCommandValue(cmdID: string): any; - remove(index: number): void; - add(item: Element): void; - queryCommandIndeterm(cmdID: string): boolean; - scrollIntoView(varargStart?: any): void; - item(index: number): Element; - [index: number]: Element; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - addElement(item: Element): void; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandEnabled(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - select(): void; -} -declare var ControlRangeCollection: { - prototype: ControlRangeCollection; - new (): ControlRangeCollection; -} - -interface MSNamespaceInfo extends MSEventAttachmentTarget { - urn: string; - onreadystatechange: (ev: Event) => any; - name: string; - readyState: string; - doImport(implementationUrl: string): void; -} -declare var MSNamespaceInfo: { - prototype: MSNamespaceInfo; - new (): MSNamespaceInfo; -} - -interface WindowSessionStorage { - sessionStorage: Storage; -} - -interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; -} -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new (): SVGAnimatedTransformList; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; -} -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new (): HTMLTableCaptionElement; -} - -interface HTMLOptionElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - index: number; - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - create(): HTMLOptionElement; -} -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new (): HTMLOptionElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - areas: HTMLAreasCollection; -} -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new (): HTMLMapElement; -} - -interface HTMLMenuElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { - type: string; -} -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new (): HTMLMenuElement; -} - -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new (): MouseWheelEvent; -} - -interface SVGFitToViewBox { - viewBox: SVGAnimatedRect; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; -} - -interface SVGPointList { - numberOfItems: number; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; - getItem(index: number): SVGPoint; - clear(): void; - appendItem(newItem: SVGPoint): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - removeItem(index: number): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; -} -declare var SVGPointList: { - prototype: SVGPointList; - new (): SVGPointList; -} - -interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; -} -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new (): SVGAnimatedLengthList; -} - -interface Window extends EventTarget, MSEventAttachmentTarget, WindowLocalStorage, MSWindowExtensions, WindowSessionStorage, WindowTimers { - ondragend: (ev: DragEvent) => any; - onkeydown: (ev: KeyboardEvent) => any; - ondragover: (ev: DragEvent) => any; - onkeyup: (ev: KeyboardEvent) => any; - onreset: (ev: Event) => any; - onmouseup: (ev: MouseEvent) => any; - ondragstart: (ev: DragEvent) => any; - ondrag: (ev: DragEvent) => any; - screenX: number; - onmouseover: (ev: MouseEvent) => any; - ondragleave: (ev: DragEvent) => any; - history: History; - pageXOffset: number; - name: string; - onafterprint: (ev: Event) => any; - onpause: (ev: Event) => any; - onbeforeprint: (ev: Event) => any; - top: Window; - onmousedown: (ev: MouseEvent) => any; - onseeked: (ev: Event) => any; - opener: Window; - onclick: (ev: MouseEvent) => any; - innerHeight: number; - onwaiting: (ev: Event) => any; - ononline: (ev: Event) => any; - ondurationchange: (ev: Event) => any; - frames: Window; - onblur: (ev: FocusEvent) => any; - onemptied: (ev: Event) => any; - onseeking: (ev: Event) => any; - oncanplay: (ev: Event) => any; - outerWidth: number; - onstalled: (ev: Event) => any; - onmousemove: (ev: MouseEvent) => any; - innerWidth: number; - onoffline: (ev: Event) => any; - length: number; - screen: Screen; - onbeforeunload: (ev: BeforeUnloadEvent) => any; - onratechange: (ev: Event) => any; - onstorage: (ev: StorageEvent) => any; - onloadstart: (ev: Event) => any; - ondragenter: (ev: DragEvent) => any; - onsubmit: (ev: Event) => any; - self: Window; - document: Document; - onprogress: (ev: any) => any; - ondblclick: (ev: MouseEvent) => any; - pageYOffset: number; - oncontextmenu: (ev: MouseEvent) => any; - onchange: (ev: Event) => any; - onloadedmetadata: (ev: Event) => any; - onplay: (ev: Event) => any; - onerror: ErrorEventHandler; - onplaying: (ev: Event) => any; - parent: Window; - location: Location; - oncanplaythrough: (ev: Event) => any; - onabort: (ev: UIEvent) => any; - onreadystatechange: (ev: Event) => any; - outerHeight: number; - onkeypress: (ev: KeyboardEvent) => any; - frameElement: Element; - onloadeddata: (ev: Event) => any; - onsuspend: (ev: Event) => any; - window: Window; - onfocus: (ev: FocusEvent) => any; - onmessage: (ev: MessageEvent) => any; - ontimeupdate: (ev: Event) => any; - onresize: (ev: UIEvent) => any; - onselect: (ev: UIEvent) => any; - navigator: Navigator; - styleMedia: StyleMedia; - ondrop: (ev: DragEvent) => any; - onmouseout: (ev: MouseEvent) => any; - onended: (ev: Event) => any; - onhashchange: (ev: Event) => any; - onunload: (ev: Event) => any; - onscroll: (ev: UIEvent) => any; - screenY: number; - onmousewheel: (ev: MouseWheelEvent) => any; - onload: (ev: Event) => any; - onvolumechange: (ev: Event) => any; - oninput: (ev: Event) => any; - performance: Performance; - alert(message?: any): void; - scroll(x?: number, y?: number): void; - focus(): void; - scrollTo(x?: number, y?: number): void; - print(): void; - prompt(message?: string, defaul?: string): string; - toString(): string; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - scrollBy(x?: number, y?: number): void; - confirm(message?: string): boolean; - close(): void; - postMessage(message: any, targetOrigin: string, ports?: any): void; - showModalDialog(url?: string, argument?: any, options?: any): any; - blur(): void; - getSelection(): Selection; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -} -declare var Window: { - prototype: Window; - new (): Window; -} - -interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; -} -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new (): SVGAnimatedPreserveAspectRatio; -} - -interface MSSiteModeEvent extends Event { - buttonID: number; - actionURL: string; -} -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new (): MSSiteModeEvent; -} - -interface DOML2DeprecatedTextFlowControl { - clear: string; -} - -interface StyleSheetPageList { - length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new (): StyleSheetPageList; -} - -interface MSCSSProperties extends CSSStyleDeclaration { - scrollbarShadowColor: string; - scrollbarHighlightColor: string; - layoutGridChar: string; - layoutGridType: string; - textAutospace: string; - textKashidaSpace: string; - writingMode: string; - scrollbarFaceColor: string; - backgroundPositionY: string; - lineBreak: string; - imeMode: string; - msBlockProgression: string; - layoutGridLine: string; - scrollbarBaseColor: string; - layoutGrid: string; - layoutFlow: string; - textKashida: string; - filter: string; - zoom: string; - scrollbarArrowColor: string; - behavior: string; - backgroundPositionX: string; - accelerator: string; - layoutGridMode: string; - textJustifyTrim: string; - scrollbar3dLightColor: string; - msInterpolationMode: string; - scrollbarTrackColor: string; - scrollbarDarkShadowColor: string; - styleFloat: string; - getAttribute(attributeName: string, flags?: number): any; - setAttribute(attributeName: string, AttributeValue: any, flags?: number): void; - removeAttribute(attributeName: string, flags?: number): boolean; -} -declare var MSCSSProperties: { - prototype: MSCSSProperties; - new (): MSCSSProperties; -} - -interface HTMLCollection extends MSHTMLCollectionExtensions { - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Retrieves an object from various collections. - */ - item(nameOrIndex?: any, optionalIndex?: any): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [name: number]: Element; -} -declare var HTMLCollection: { - prototype: HTMLCollection; - new (): HTMLCollection; -} - -interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; -} - -interface HTMLImageElement extends HTMLElement, MSImageResourceExtensions, MSDataBindingExtensions, MSResourceMetadata { - /** - * Sets or retrieves the width of the object. - */ - width: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * The original height of the image resource before sizing. - */ - naturalHeight: number; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * The original width of the image resource before sizing. - */ - naturalWidth: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - /** - * Contains the hypertext reference (HREF) of the URL. - */ - href: string; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - complete: boolean; - create(): HTMLImageElement; -} -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new (): HTMLImageElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new (): HTMLAreaElement; -} - -interface EventTarget { - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; - removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; -} - -interface SVGAngle { - valueAsString: string; - valueInSpecifiedUnits: number; - value: number; - unitType: number; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - convertToSpecifiedUnits(unitType: number): void; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; -} -declare var SVGAngle: { - prototype: SVGAngle; - new (): SVGAngle; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; -} - -interface HTMLButtonElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - status: any; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; -} -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new (): HTMLButtonElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; -} -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new (): HTMLSourceElement; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} -declare var CanvasGradient: { - prototype: CanvasGradient; - new (): CanvasGradient; -} - -interface KeyboardEvent extends UIEvent { - location: number; - keyCode: number; - shiftKey: boolean; - which: number; - locale: string; - key: string; - altKey: boolean; - metaKey: boolean; - char: string; - ctrlKey: boolean; - repeat: boolean; - charCode: number; - getModifierState(keyArg: string): boolean; - initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_MOBILE: number; -} -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new (): KeyboardEvent; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_MOBILE: number; -} - -interface Document extends Node, NodeSelector, MSEventAttachmentTarget, DocumentEvent, MSResourceMetadata, MSNodeExtensions { - /** - * Retrieves the collection of user agents and versions declared in the X-UA-Compatible - */ - compatible: MSCompatibleInfoCollection; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (ev: KeyboardEvent) => any; - - /** - * Gets the implementation object of the current document. - */ - implementation: DOMImplementation; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (ev: Event) => any; - - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollection; - - /** - * Fires when the user presses the F1 key while the browser is the active window. - * @param ev The event. - */ - onhelp: (ev: Event) => any; - - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (ev: DragEvent) => any; - - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - - /** - * Fires for an element just prior to setting focus on that element. - * @param ev The focus event - */ - onfocusin: (ev: FocusEvent) => any; - - - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (ev: Event) => any; - - security: string; - - /** - * Contains the title of the document. - */ - title: string; - - /** - * Retrieves a collection of namespace objects. - */ - namespaces: MSNamespaceInfoCollection; - - /** - * Gets the default character set from the current regional language settings. - */ - defaultCharset: string; - - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollection; - - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - styleSheets: StyleSheetList; - - /** - * Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window. - */ - frames: Window; - - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (ev: Event) => any; - - - /** - * Returns a reference to the collection of elements contained by the object. - */ - all: HTMLCollection; - - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollection; - - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (ev: FocusEvent) => any; - - - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (ev: Event) => any; - - - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (ev: Event) => any; - - - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (ev: UIEvent) => any; - - - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (ev: Event) => any; - - - /** - * Fires when the data set exposed by a data source object changes. - * @param ev The event. - */ - ondatasetchanged: (ev: MSEventObj) => any; - - - /** - * Fires when rows are about to be deleted from the recordset. - * @param ev The event - */ - onrowsdelete: (ev: MSEventObj) => any; - - Script: MSScriptHost; - - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (ev: Event) => any; - - - /** - * Gets the URL for the document, stripped of any character encoding. - */ - URLUnencoded: string; - - defaultView: Window; - - /** - * Fires when the user is about to make a control selection of the object. - * @param ev The event. - */ - oncontrolselect: (ev: MSEventObj) => any; - - - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (ev: DragEvent) => any; - - onsubmit: (ev: Event) => any; - - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - inputEncoding: string; - - /** - * Gets the object that has the focus when the parent document has focus. - */ - activeElement: Element; - - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (ev: Event) => any; - - - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollection; - - /** - * Retrieves an autogenerated, unique identifier for the object. - */ - uniqueID: string; - - /** - * Sets or gets the URL for the current document. - */ - URL: string; - - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (ev: UIEvent) => any; - - head: HTMLHeadElement; - cookie: string; - xmlEncoding: string; - oncanplaythrough: (ev: Event) => any; - - /** - * Retrieves the document compatibility mode of the document. - */ - documentMode: number; - - characterSet: string; - - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollection; - - onbeforeupdate: (ev: MSEventObj) => any; - - /** - * Fires to indicate that all data is available from the data source object. - * @param ev The event. - */ - ondatasetcomplete: (ev: MSEventObj) => any; - - plugins: HTMLCollection; - - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (ev: Event) => any; - - - /** - * Gets the root svg element in the document hierarchy. - */ - rootElement: SVGSVGElement; - - /** - * Retrieves a value that indicates the current state of the object. - */ - readyState: string; - - /** - * Gets the URL of the location that referred the user to the current page. - */ - referrer: string; - - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - - /** - * Fires on a databound object when an error occurs while updating the associated data in the data source object. - * @param ev The event. - */ - onerrorupdate: (ev: MSEventObj) => any; - - - /** - * Gets a reference to the container object of the window. - */ - parentWindow: Window; - - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (ev: MouseEvent) => any; - - - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (ev: MSSiteModeEvent) => any; - - - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (ev: MouseWheelEvent) => any; - - - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (ev: Event) => any; - - - /** - * Fires when data changes in the data provider. - * @param ev The event. - */ - oncellchange: (ev: MSEventObj) => any; - - - /** - * Fires just before the data source control changes the current row in the object. - * @param ev The event. - */ - onrowexit: (ev: MSEventObj) => any; - - - /** - * Fires just after new rows are inserted in the current recordset. - * @param ev The event. - */ - onrowsinserted: (ev: MSEventObj) => any; - - - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string; - - msCapsLockWarningOff: boolean; - - /** - * Fires when a property changes on the object. - * @param ev The event. - */ - onpropertychange: (ev: MSEventObj) => any; - - - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (ev: DragEvent) => any; - - - /** - * Gets an object representing the document type declaration associated with the current document. - */ - doctype: DocumentType; - - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (ev: DragEvent) => any; - - - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (ev: DragEvent) => any; - - - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (ev: MouseEvent) => any; - - - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (ev: DragEvent) => any; - - - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (ev: MouseEvent) => any; - - - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (ev: Event) => any; - - - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (ev: MouseEvent) => any; - - - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (ev: MouseEvent) => any; - - - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (ev: Event) => any; - - - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (ev: Event) => any; - - /** - * false (false)[rolls - */ - - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; - - - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollection; - - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - - /** - * Sets or gets the security domain of the document. - */ - domain: string; - - xmlStandalone: boolean; - - /** - * Represents the active selection, which is a highlighted block of text or other elements in the document that a user or a script can carry out some action on. - */ - selection: MSSelection; - - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (ev: Event) => any; - - - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (ev: MouseEvent) => any; - - - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - - /** - * Fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected. - * @param ev The event. - */ - onbeforeeditfocus: (ev: MSEventObj) => any; - - - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (ev: Event) => any; - - - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (ev: any) => any; - - - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (ev: MouseEvent) => any; - - - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (ev: MouseEvent) => any; - - - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (ev: Event) => any; - - media: string; - - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (ev: Event) => any; - - - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (ev: Event) => any; - - onafterupdate: (ev: MSEventObj) => any; - - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (ev: Event) => any; - - - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollection; - - /** - * Contains information about the current URL. - */ - location: Location; - - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (ev: UIEvent) => any; - - - /** - * Fires for the current element with focus immediately after moving focus to another element. - * @param ev The event. - */ - onfocusout: (ev: FocusEvent) => any; - - - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (ev: Event) => any; - - - /** - * Fires when a local DOM Storage area is written to disk. - * @param ev The event. - */ - onstoragecommit: (ev: StorageEvent) => any; - - - /** - * Fires periodically as data arrives from data source objects that asynchronously transmit their data. - * @param ev The event. - */ - ondataavailable: (ev: MSEventObj) => any; - - - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (ev: Event) => any; - - - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - lastModified: string; - - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (ev: KeyboardEvent) => any; - - - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (ev: Event) => any; - - - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (ev: UIEvent) => any; - - - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (ev: UIEvent) => any; - - - onselectstart: (ev: Event) => any; - - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (ev: FocusEvent) => any; - - - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (ev: Event) => any; - - - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (ev: UIEvent) => any; - - ondrop: (ev: DragEvent) => any; - - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (ev: Event) => any; - - - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - compatMode: string; - - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (ev: UIEvent) => any; - - - /** - * Fires to indicate that the current row has changed in the data source and new data values are available on the object. - * @param ev The event. - */ - onrowenter: (ev: MSEventObj) => any; - - - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (ev: Event) => any; - - oninput: (ev: Event) => any; - - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - - adoptNode(source: Node): Node; - - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - createCDATASection(data: string): CDATASection; - - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "a"): HTMLAnchorElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "abbr"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "address"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "area"): HTMLAreaElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "article"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "aside"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "audio"): HTMLAudioElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "b"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "base"): HTMLBaseElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "bdi"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "bdo"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "blockquote"): HTMLQuoteElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "body"): HTMLBodyElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "br"): HTMLBRElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "button"): HTMLButtonElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "canvas"): HTMLCanvasElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "caption"): HTMLTableCaptionElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "cite"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "code"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "col"): HTMLTableColElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "colgroup"): HTMLTableColElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "datalist"): HTMLDataListElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "dd"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "del"): HTMLModElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "dfn"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "div"): HTMLDivElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "dl"): HTMLDListElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "dt"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "em"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "embed"): HTMLEmbedElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "fieldset"): HTMLFieldSetElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "figcaption"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "figure"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "footer"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "form"): HTMLFormElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "h1"): HTMLHeadingElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "h2"): HTMLHeadingElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "h3"): HTMLHeadingElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "h4"): HTMLHeadingElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "h5"): HTMLHeadingElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "h6"): HTMLHeadingElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "head"): HTMLHeadElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "header"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "hgroup"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "hr"): HTMLHRElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "html"): HTMLHtmlElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "i"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "iframe"): HTMLIFrameElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "img"): HTMLImageElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "input"): HTMLInputElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "ins"): HTMLModElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "kbd"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "label"): HTMLLabelElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "legend"): HTMLLegendElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "li"): HTMLLIElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "link"): HTMLLinkElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "main"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "map"): HTMLMapElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "mark"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "menu"): HTMLMenuElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "meta"): HTMLMetaElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "nav"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "noscript"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "object"): HTMLObjectElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "ol"): HTMLOListElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "optgroup"): HTMLOptGroupElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "option"): HTMLOptionElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "p"): HTMLParagraphElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "param"): HTMLParamElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "pre"): HTMLPreElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "progress"): HTMLProgressElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "q"): HTMLQuoteElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "rp"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "rt"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "ruby"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "s"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "samp"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "script"): HTMLScriptElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "section"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "select"): HTMLSelectElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "small"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "source"): HTMLSourceElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "span"): HTMLSpanElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "strong"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "style"): HTMLStyleElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "sub"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "summary"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "sup"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "table"): HTMLTableElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "tbody"): HTMLTableSectionElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "td"): HTMLTableDataCellElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "textarea"): HTMLTextAreaElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "tfoot"): HTMLTableSectionElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "th"): HTMLTableHeaderCellElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "thead"): HTMLTableSectionElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "title"): HTMLTitleElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "tr"): HTMLTableRowElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "track"): HTMLTrackElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "u"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "ul"): HTMLUListElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "var"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "video"): HTMLVideoElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "wbr"): HTMLElement; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: string): HTMLElement; - - /** - * Removes mouse capture from the object in the current document. - */ - releaseCapture(): void; - - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): void; - createElementNS(namespaceURI: string, qualifiedName: string): Element; - - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): any; - - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): TreeWalker; - createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; - - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - - getElementsByClassName(classNames: string): NodeList; - importNode(importedNode: Node, deep: boolean): Node; - - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - - /** - * Fires a specified event on the object. - * @param eventName Specifies the name of the event to fire. - * @param eventObj Object that specifies the event object from which to obtain event object properties. - */ - fireEvent(eventName: string, eventObj?: any): boolean; - - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "a"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "abbr"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "address"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "area"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "article"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "aside"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "audio"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "b"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "base"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "bdi"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "bdo"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "blockquote"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "body"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "br"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "button"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "canvas"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "caption"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "cite"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "code"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "col"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "colgroup"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "datalist"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "dd"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "del"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "dfn"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "div"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "dl"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "dt"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "em"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "embed"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "fieldset"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "figcaption"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "figure"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "footer"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "form"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "h1"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "h2"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "h3"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "h4"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "h5"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "h6"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "head"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "header"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "hgroup"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "hr"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "html"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "i"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "iframe"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "img"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "input"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "ins"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "kbd"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "label"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "legend"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "li"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "link"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "main"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "map"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "mark"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "menu"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "meta"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "nav"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "noscript"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "object"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "ol"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "optgroup"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "option"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "p"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "param"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "pre"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "progress"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "q"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "rp"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "rt"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "ruby"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "s"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "samp"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "script"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "section"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "select"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "small"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "source"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "span"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "strong"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "style"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "sub"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "summary"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "sup"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "table"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "tbody"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "td"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "textarea"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "tfoot"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "th"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "thead"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "title"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "tr"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "track"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "u"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "ul"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "var"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "video"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: "wbr"): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(name: string): NodeList; - - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - - /** - * Creates a style sheet for the document. - * @param href Specifies how to add the style sheet to the document. If a file name is specified for the URL, the style information is added as a link object. If the URL contains style information, it is added to the style object. - * @param index Specifies the index that indicates where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style sheet at the end of the collection. - */ - createStyleSheet(href?: string, index?: number): CSSStyleSheet; - - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeList; - - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): NodeIterator; - - /** - * Generates an event object to pass event context information when you use the fireEvent method. - * @param eventObj An object that specifies an existing event object on which to base the new object. - */ - createEventObject(eventObj?: any): MSEventObj; - - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement; -} - -declare var Document: { - prototype: Document; - new (): Document; -} - -interface MessageEvent extends Event { - source: Window; - origin: string; - data: any; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} -declare var MessageEvent: { - prototype: MessageEvent; - new (): MessageEvent; -} - -interface SVGElement extends Element { - onmouseover: (ev: MouseEvent) => any; - viewportElement: SVGElement; - onmousemove: (ev: MouseEvent) => any; - onmouseout: (ev: MouseEvent) => any; - ondblclick: (ev: MouseEvent) => any; - onfocusout: (ev: FocusEvent) => any; - onfocusin: (ev: FocusEvent) => any; - xmlbase: string; - onmousedown: (ev: MouseEvent) => any; - onload: (ev: Event) => any; - onmouseup: (ev: MouseEvent) => any; - onclick: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - id: string; -} -declare var SVGElement: { - prototype: SVGElement; - new (): SVGElement; -} - -interface HTMLScriptElement extends HTMLElement { - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; -} -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new (): HTMLScriptElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { - /** - * Retrieves the position of the object in the rows collection for the table. - */ - rowIndex: number; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollection; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. - */ - borderColorLight: any; - /** - * Retrieves the position of the object in the collection. - */ - sectionRowIndex: number; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. - */ - borderColorDark: any; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLElement; -} -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new (): HTMLTableRowElement; -} - -interface CanvasRenderingContext2D { - miterLimit: number; - font: string; - globalCompositeOperation: string; - msFillRule: string; - lineCap: string; - msImageSmoothingEnabled: boolean; - lineDashOffset: number; - shadowColor: string; - lineJoin: string; - shadowOffsetX: number; - lineWidth: number; - canvas: HTMLCanvasElement; - strokeStyle: any; - globalAlpha: number; - shadowOffsetY: number; - fillStyle: any; - shadowBlur: number; - textAlign: string; - textBaseline: string; - restore(): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - save(): void; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - measureText(text: string): TextMetrics; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - rotate(angle: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - translate(x: number, y: number): void; - scale(x: number, y: number): void; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - lineTo(x: number, y: number): void; - getLineDash(): Array; - fill(fillRule?: string): void; - createImageData(imageDataOrSw: any, sh?: number): ImageData; - createPattern(image: HTMLElement, repetition: string): CanvasPattern; - closePath(): void; - rect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - clearRect(x: number, y: number, w: number, h: number): void; - moveTo(x: number, y: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - fillRect(x: number, y: number, w: number, h: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - drawImage(image: HTMLElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - setLineDash(segments: Array): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - beginPath(): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; -} -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new (): CanvasRenderingContext2D; -} - -interface MSCSSRuleList { - length: number; - item(index?: number): CSSStyleRule; - [index: number]: CSSStyleRule; -} -declare var MSCSSRuleList: { - prototype: MSCSSRuleList; - new (): MSCSSRuleList; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new (): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - y: number; - sweepFlag: boolean; - r2: number; - x: number; - angle: number; - r1: number; - largeArcFlag: boolean; -} -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new (): SVGPathSegArcAbs; -} - -interface SVGTransformList { - numberOfItems: number; - getItem(index: number): SVGTransform; - consolidate(): SVGTransform; - clear(): void; - appendItem(newItem: SVGTransform): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - removeItem(index: number): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; -} -declare var SVGTransformList: { - prototype: SVGTransformList; - new (): SVGTransformList; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; -} -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new (): HTMLHtmlElement; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new (): SVGPathSegClosePath; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { - /** - * Sets or retrieves the width of the object. - */ - width: any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Retrieves the object of the specified. - */ - contentWindow: Window; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the document object of the page or frame. - */ - contentDocument: Document; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Raised when the object has been completely received from the server. - */ - onload: (ev: Event) => any; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; -} -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new (): HTMLFrameElement; -} - -interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; -} -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new (): SVGAnimatedLength; -} - -interface SVGAnimatedPoints { - points: SVGPointList; - animatedPoints: SVGPointList; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { -} -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new (): SVGDefsElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new (): HTMLQuoteElement; -} - -interface CSSMediaRule extends CSSRule { - media: MediaList; - cssRules: CSSRuleList; - insertRule(rule: string, index?: number): number; - deleteRule(index?: number): void; -} -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new (): CSSMediaRule; -} - -interface WindowModal { - dialogArguments: any; - returnValue: any; -} - -interface XMLHttpRequest extends EventTarget { - responseBody: any; - status: number; - readyState: number; - responseText: string; - responseXML: Document; - ontimeout: (ev: Event) => any; - statusText: string; - onreadystatechange: (ev: Event) => any; - timeout: number; - onload: (ev: Event) => any; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - create(): XMLHttpRequest; - send(data?: any): void; - abort(): void; - getAllResponseHeaders(): string; - setRequestHeader(header: string, value: string): void; - getResponseHeader(header: string): string; - LOADING: number; - DONE: number; - UNSENT: number; - OPENED: number; - HEADERS_RECEIVED: number; -} -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new (): XMLHttpRequest; - LOADING: number; - DONE: number; - UNSENT: number; - OPENED: number; - HEADERS_RECEIVED: number; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new (): HTMLTableHeaderCellElement; -} - -interface HTMLDListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { -} -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new (): HTMLDListElement; -} - -interface MSDataBindingExtensions { - dataSrc: string; - dataFormatAs: string; - dataFld: string; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new (): SVGPathSegLinetoHorizontalRel; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - ry: SVGAnimatedLength; - cx: SVGAnimatedLength; - rx: SVGAnimatedLength; - cy: SVGAnimatedLength; -} -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new (): SVGEllipseElement; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; -} -declare var SVGAElement: { - prototype: SVGAElement; - new (): SVGAElement; -} - -interface SVGStylable { - className: SVGAnimatedString; - style: CSSStyleDeclaration; -} - -interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; -} - -interface HTMLFrameSetElement extends HTMLElement { - ononline: (ev: Event) => any; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Fires when the object loses the input focus. - */ - onblur: (ev: FocusEvent) => any; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Fires when the object receives focus. - */ - onfocus: (ev: FocusEvent) => any; - onmessage: (ev: MessageEvent) => any; - onerror: (ev: Event) => any; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - onresize: (ev: UIEvent) => any; - name: string; - onafterprint: (ev: Event) => any; - onbeforeprint: (ev: Event) => any; - onoffline: (ev: Event) => any; - border: string; - onunload: (ev: Event) => any; - onhashchange: (ev: Event) => any; - onload: (ev: Event) => any; - onbeforeunload: (ev: BeforeUnloadEvent) => any; - onstorage: (ev: StorageEvent) => any; -} -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new (): HTMLFrameSetElement; -} - -interface Screen { - width: number; - deviceXDPI: number; - fontSmoothingEnabled: boolean; - bufferDepth: number; - logicalXDPI: number; - systemXDPI: number; - availHeight: number; - height: number; - logicalYDPI: number; - systemYDPI: number; - updateInterval: number; - colorDepth: number; - availWidth: number; - deviceYDPI: number; - pixelDepth: number; -} -declare var Screen: { - prototype: Screen; - new (): Screen; -} - -interface Coordinates { - altitudeAccuracy: number; - longitude: number; - latitude: number; - speed: number; - heading: number; - altitude: number; - accuracy: number; -} -declare var Coordinates: { - prototype: Coordinates; - new (): Coordinates; -} - -interface NavigatorGeolocation { - geolocation: Geolocation; -} - -interface NavigatorContentUtils { -} - -interface EventListener { - (evt: Event): void; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface DataTransfer { - effectAllowed: string; - dropEffect: string; - clearData(format?: string): boolean; - setData(format: string, data: string): boolean; - getData(format: string): string; -} -declare var DataTransfer: { - prototype: DataTransfer; - new (): DataTransfer; -} - -interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} -declare var FocusEvent: { - prototype: FocusEvent; - new (): FocusEvent; -} - -interface Range { - startOffset: number; - collapsed: boolean; - endOffset: number; - startContainer: Node; - endContainer: Node; - commonAncestorContainer: Node; - setStart(refNode: Node, offset: number): void; - setEndBefore(refNode: Node): void; - setStartBefore(refNode: Node): void; - selectNode(refNode: Node): void; - detach(): void; - getBoundingClientRect(): ClientRect; - toString(): string; - compareBoundaryPoints(how: number, sourceRange: Range): number; - insertNode(newNode: Node): void; - collapse(toStart: boolean): void; - selectNodeContents(refNode: Node): void; - cloneContents(): DocumentFragment; - setEnd(refNode: Node, offset: number): void; - cloneRange(): Range; - getClientRects(): ClientRectList; - surroundContents(newParent: Node): void; - deleteContents(): void; - setStartAfter(refNode: Node): void; - extractContents(): DocumentFragment; - setEndAfter(refNode: Node): void; - END_TO_END: number; - START_TO_START: number; - START_TO_END: number; - END_TO_START: number; -} -declare var Range: { - prototype: Range; - new (): Range; - END_TO_END: number; - START_TO_START: number; - START_TO_END: number; - END_TO_START: number; -} - -interface SVGPoint { - y: number; - x: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} -declare var SVGPoint: { - prototype: SVGPoint; - new (): SVGPoint; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new (): MSPluginsCollection; -} - -interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; -} -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new (): SVGAnimatedNumberList; -} - -interface SVGSVGElement extends SVGElement, SVGStylable, SVGZoomAndPan, DocumentEvent, SVGLangSpace, SVGLocatable, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired { - width: SVGAnimatedLength; - x: SVGAnimatedLength; - contentStyleType: string; - onzoom: (ev: any) => any; - y: SVGAnimatedLength; - viewport: SVGRect; - onerror: (ev: Event) => any; - pixelUnitToMillimeterY: number; - onresize: (ev: UIEvent) => any; - screenPixelToMillimeterY: number; - height: SVGAnimatedLength; - onabort: (ev: UIEvent) => any; - contentScriptType: string; - pixelUnitToMillimeterX: number; - currentTranslate: SVGPoint; - onunload: (ev: Event) => any; - currentScale: number; - onscroll: (ev: UIEvent) => any; - screenPixelToMillimeterX: number; - setCurrentTime(seconds: number): void; - createSVGLength(): SVGLength; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; - unpauseAnimations(): void; - createSVGRect(): SVGRect; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - unsuspendRedrawAll(): void; - pauseAnimations(): void; - suspendRedraw(maxWaitMilliseconds: number): number; - deselectAll(): void; - createSVGAngle(): SVGAngle; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - createSVGTransform(): SVGTransform; - unsuspendRedraw(suspendHandleID: number): void; - forceRedraw(): void; - getCurrentTime(): number; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - createSVGMatrix(): SVGMatrix; - createSVGPoint(): SVGPoint; - createSVGNumber(): SVGNumber; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getElementById(elementId: string): Element; -} -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new (): SVGSVGElement; -} - -interface HTMLLabelElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; -} -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new (): HTMLLabelElement; -} - -interface MSResourceMetadata { - protocol: string; - fileSize: string; - fileUpdatedDate: string; - nameProp: string; - fileCreatedDate: string; - fileModifiedDate: string; - mimeType: string; -} - -interface HTMLLegendElement extends HTMLElement, MSDataBindingExtensions { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; -} -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new (): HTMLLegendElement; -} - -interface HTMLDirectoryElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { -} -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new (): HTMLDirectoryElement; -} - -interface SVGAnimatedInteger { - animVal: number; - baseVal: number; -} -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new (): SVGAnimatedInteger; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { -} -declare var SVGTextElement: { - prototype: SVGTextElement; - new (): SVGTextElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new (): SVGTSpanElement; -} - -interface HTMLLIElement extends HTMLElement, DOML2DeprecatedListNumberingAndBulletStyle { - /** - * Sets or retrieves the value of a list item. - */ - value: number; -} -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new (): HTMLLIElement; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new (): SVGPathSegLinetoVerticalAbs; -} - -interface MSStorageExtensions { - remainingSpace: number; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - media: string; - type: string; - title: string; -} -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new (): SVGStyleElement; -} - -interface MSCurrentStyleCSSProperties extends MSCSSProperties { - blockDirection: string; - clipBottom: string; - clipLeft: string; - clipRight: string; - clipTop: string; - hasLayout: string; -} -declare var MSCurrentStyleCSSProperties: { - prototype: MSCurrentStyleCSSProperties; - new (): MSCurrentStyleCSSProperties; -} - -interface MSHTMLCollectionExtensions { - urns(urn: any): Object; - tags(tagName: any): Object; -} - -interface Storage extends MSStorageExtensions { - length: number; - getItem(key: string): any; - [key: string]: any; - setItem(key: string, data: string): void; - clear(): void; - removeItem(key: string): void; - key(index: number): string; - [index: number]: any; -} -declare var Storage: { - prototype: Storage; - new (): Storage; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Retrieves the object of the specified. - */ - contentWindow: Window; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - contentDocument: Document; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; - /** - * Raised when the object has been completely received from the server. - */ - onload: (ev: Event) => any; -} -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new (): HTMLIFrameElement; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new (): TextRangeCollection; -} - -interface HTMLBodyElement extends HTMLElement, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { - scroll: string; - ononline: (ev: Event) => any; - onblur: (ev: FocusEvent) => any; - noWrap: boolean; - onfocus: (ev: FocusEvent) => any; - onmessage: (ev: MessageEvent) => any; - text: any; - onerror: (ev: Event) => any; - bgProperties: string; - onresize: (ev: UIEvent) => any; - link: any; - aLink: any; - bottomMargin: any; - topMargin: any; - onafterprint: (ev: Event) => any; - vLink: any; - onbeforeprint: (ev: Event) => any; - onoffline: (ev: Event) => any; - onunload: (ev: Event) => any; - onhashchange: (ev: Event) => any; - onload: (ev: Event) => any; - rightMargin: any; - onbeforeunload: (ev: BeforeUnloadEvent) => any; - leftMargin: any; - onstorage: (ev: StorageEvent) => any; - createTextRange(): TextRange; -} -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new (): HTMLBodyElement; -} - -interface DocumentType extends Node { - name: string; - notations: NamedNodeMap; - systemId: string; - internalSubset: string; - entities: NamedNodeMap; - publicId: string; -} -declare var DocumentType: { - prototype: DocumentType; - new (): DocumentType; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - r: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; -} -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new (): SVGRadialGradientElement; -} - -interface MutationEvent extends Event { - newValue: string; - attrChange: number; - attrName: string; - prevValue: string; - relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - MODIFICATION: number; - REMOVAL: number; - ADDITION: number; -} -declare var MutationEvent: { - prototype: MutationEvent; - new (): MutationEvent; - MODIFICATION: number; - REMOVAL: number; - ADDITION: number; -} - -interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; -} -declare var DragEvent: { - prototype: DragEvent; - new (): DragEvent; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollection; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Moves a table row to a new position. - * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. - * @param indexTo Number that specifies where the row is moved within the rows collection. - */ - moveRow(indexFrom?: number, indexTo?: number): Object; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLElement; -} -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new (): HTMLTableSectionElement; -} - -interface DOML2DeprecatedListNumberingAndBulletStyle { - type: string; -} - -interface HTMLInputElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves the width of the object. - */ - width: string; - status: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - indeterminate: boolean; - readOnly: boolean; - size: number; - loop: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Sets or retrieves the URL of the virtual reality modeling language (VRML) world to be displayed in the window. - */ - vrml: string; - /** - * Sets or retrieves a lower resolution image to display. - */ - lowsrc: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - dynsrc: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - /** - * Retrieves whether the object is fully loaded. - */ - complete: boolean; - start: string; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; - /** - * Makes the selection equal to the current object. - */ - select(): void; -} -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new (): HTMLInputElement; -} - -interface HTMLAnchorElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - Methods: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - protocolLong: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - nameProp: string; - urn: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - type: string; - mimeType: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new (): HTMLAnchorElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; -} -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new (): HTMLParamElement; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { - y: SVGAnimatedLength; - width: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - x: SVGAnimatedLength; - height: SVGAnimatedLength; -} -declare var SVGImageElement: { - prototype: SVGImageElement; - new (): SVGImageElement; -} - -interface SVGAnimatedNumber { - animVal: number; - baseVal: number; -} -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new (): SVGAnimatedNumber; -} - -interface PerformanceTiming { - redirectStart: number; - domainLookupEnd: number; - responseStart: number; - domComplete: number; - domainLookupStart: number; - loadEventStart: number; - msFirstPaint: number; - unloadEventEnd: number; - fetchStart: number; - requestStart: number; - domInteractive: number; - navigationStart: number; - connectEnd: number; - loadEventEnd: number; - connectStart: number; - responseEnd: number; - domLoading: number; - redirectEnd: number; - unloadEventStart: number; - domContentLoadedEventStart: number; - domContentLoadedEventEnd: number; - toJSON(): any; -} -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new (): PerformanceTiming; -} - -interface HTMLPreElement extends HTMLElement, DOML2DeprecatedTextFlowControl { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; -} -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new (): HTMLPreElement; -} - -interface EventException { - code: number; - message: string; - toString(): string; - DISPATCH_REQUEST_ERR: number; - UNSPECIFIED_EVENT_TYPE_ERR: number; -} -declare var EventException: { - prototype: EventException; - new (): EventException; - DISPATCH_REQUEST_ERR: number; - UNSPECIFIED_EVENT_TYPE_ERR: number; -} - -interface MSNavigatorDoNotTrack { - msDoNotTrack: string; -} - -interface NavigatorOnLine { - onLine: boolean; -} - -interface WindowLocalStorage { - localStorage: Storage; -} - -interface SVGMetadataElement extends SVGElement { -} -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new (): SVGMetadataElement; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - y: number; - sweepFlag: boolean; - r2: number; - x: number; - angle: number; - r1: number; - largeArcFlag: boolean; -} -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new (): SVGPathSegArcRel; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - y: number; - x: number; -} -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new (): SVGPathSegMovetoAbs; -} - -interface SVGStringList { - numberOfItems: number; - replaceItem(newItem: string, index: number): string; - getItem(index: number): string; - clear(): void; - appendItem(newItem: string): string; - initialize(newItem: string): string; - removeItem(index: number): string; - insertItemBefore(newItem: string, index: number): string; -} -declare var SVGStringList: { - prototype: SVGStringList; - new (): SVGStringList; -} - -interface XDomainRequest { - timeout: number; - onerror: (ev: Event) => any; - onload: (ev: Event) => any; - onprogress: (ev: any) => any; - ontimeout: (ev: Event) => any; - responseText: string; - contentType: string; - open(method: string, url: string): void; - create(): XDomainRequest; - abort(): void; - send(data?: any): void; -} -declare var XDomainRequest: { - prototype: XDomainRequest; - new (): XDomainRequest; -} - -interface DOML2DeprecatedBackgroundColorStyle { - bgColor: any; -} - -interface ElementTraversal { - childElementCount: number; - previousElementSibling: Element; - lastElementChild: Element; - nextElementSibling: Element; - firstElementChild: Element; -} - -interface SVGLength { - valueAsString: string; - valueInSpecifiedUnits: number; - value: number; - unitType: number; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - convertToSpecifiedUnits(unitType: number): void; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; - SVG_LENGTHTYPE_EXS: number; -} -declare var SVGLength: { - prototype: SVGLength; - new (): SVGLength; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; - SVG_LENGTHTYPE_EXS: number; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { -} -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new (): SVGPolygonElement; -} - -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new (): HTMLPhraseElement; -} - -interface NavigatorStorageUtils { -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - y: number; - y1: number; - x2: number; - x: number; - x1: number; - y2: number; -} -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new (): SVGPathSegCurvetoCubicRel; -} - -interface MSEventObj extends Event { - nextPage: string; - keyCode: number; - toElement: Element; - returnValue: any; - dataFld: string; - y: number; - dataTransfer: DataTransfer; - propertyName: string; - url: string; - offsetX: number; - recordset: Object; - screenX: number; - buttonID: number; - wheelDelta: number; - reason: number; - origin: string; - data: string; - srcFilter: Object; - boundElements: HTMLCollection; - cancelBubble: boolean; - altLeft: boolean; - behaviorCookie: number; - bookmarks: BookmarkCollection; - type: string; - repeat: boolean; - srcElement: Element; - source: Window; - fromElement: Element; - offsetY: number; - x: number; - behaviorPart: number; - qualifier: string; - altKey: boolean; - ctrlKey: boolean; - clientY: number; - shiftKey: boolean; - shiftLeft: boolean; - contentOverflow: boolean; - screenY: number; - ctrlLeft: boolean; - button: number; - srcUrn: string; - clientX: number; - actionURL: string; - getAttribute(strAttributeName: string, lFlags?: number): any; - setAttribute(strAttributeName: string, AttributeValue: any, lFlags?: number): void; - removeAttribute(strAttributeName: string, lFlags?: number): boolean; -} -declare var MSEventObj: { - prototype: MSEventObj; - new (): MSEventObj; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - textLength: SVGAnimatedLength; - lengthAdjust: SVGAnimatedEnumeration; - getCharNumAtPosition(point: SVGPoint): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getComputedTextLength(): number; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getEndPositionOfChar(charnum: number): SVGPoint; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; -} -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new (): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. - */ - toDataURL(type?: string, ...args: any[]): string; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d"): CanvasRenderingContext2D; - getContext(contextId: "experimental-webgl"): WebGLRenderingContext; - getContext(contextId: string, ...args: any[]): any; -} -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new (): HTMLCanvasElement; -} - -interface Location { - hash: string; - protocol: string; - search: string; - href: string; - hostname: string; - port: string; - pathname: string; - host: string; - reload(flag?: boolean): void; - replace(url: string): void; - assign(url: string): void; - toString(): string; -} -declare var Location: { - prototype: Location; - new (): Location; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new (): HTMLTitleElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; -} -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new (): HTMLStyleElement; -} - -interface PerformanceEntry { - name: string; - startTime: number; - duration: number; - entryType: string; -} -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new (): PerformanceEntry; -} - -interface SVGTransform { - type: number; - angle: number; - matrix: SVGMatrix; - setTranslate(tx: number, ty: number): void; - setScale(sx: number, sy: number): void; - setMatrix(matrix: SVGMatrix): void; - setSkewY(angle: number): void; - setRotate(angle: number, cx: number, cy: number): void; - setSkewX(angle: number): void; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_UNKNOWN: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SKEWY: number; -} -declare var SVGTransform: { - prototype: SVGTransform; - new (): SVGTransform; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_UNKNOWN: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SKEWY: number; -} - -interface UIEvent extends Event { - detail: number; - view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} -declare var UIEvent: { - prototype: UIEvent; - new (): UIEvent; -} - -interface SVGURIReference { - href: SVGAnimatedString; -} - -interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_MOVETO_REL: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_UNKNOWN: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_ARC_ABS: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; -} -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new (): SVGPathSeg; - PATHSEG_MOVETO_REL: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_UNKNOWN: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_ARC_ABS: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; -} - -interface WheelEvent extends MouseEvent { - deltaZ: number; - deltaX: number; - deltaMode: number; - deltaY: number; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - DOM_DELTA_PIXEL: number; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; -} -declare var WheelEvent: { - prototype: WheelEvent; - new (): WheelEvent; - DOM_DELTA_PIXEL: number; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; -} - -interface MSEventAttachmentTarget { - attachEvent(event: string, listener: EventListener): boolean; - detachEvent(event: string, listener: EventListener): void; -} - -interface SVGNumber { - value: number; -} -declare var SVGNumber: { - prototype: SVGNumber; - new (): SVGNumber; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGAnimatedPathData, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - getTotalLength(): number; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; -} -declare var SVGPathElement: { - prototype: SVGPathElement; - new (): SVGPathElement; -} - -interface MSCompatibleInfo { - version: string; - userAgent: string; -} -declare var MSCompatibleInfo: { - prototype: MSCompatibleInfo; - new (): MSCompatibleInfo; -} - -interface Text extends CharacterData, MSNodeExtensions { - wholeText: string; - splitText(offset: number): Text; - replaceWholeText(content: string): Text; -} -declare var Text: { - prototype: Text; - new (): Text; -} - -interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; -} -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new (): SVGAnimatedRect; -} - -interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; -} -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new (): CSSNamespaceRule; -} - -interface SVGPathSegList { - numberOfItems: number; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; - getItem(index: number): SVGPathSeg; - clear(): void; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; -} -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new (): SVGPathSegList; -} - -interface HTMLUnknownElement extends HTMLElement, MSDataBindingRecordSetReadonlyExtensions { -} -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new (): HTMLUnknownElement; -} - -interface HTMLAudioElement extends HTMLMediaElement { -} -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new (): HTMLAudioElement; -} - -interface MSImageResourceExtensions { - dynsrc: string; - vrml: string; - lowsrc: string; - start: string; - loop: number; -} - -interface PositionError { - code: number; - message: string; - toString(): string; - POSITION_UNAVAILABLE: number; - PERMISSION_DENIED: number; - TIMEOUT: number; -} -declare var PositionError: { - prototype: PositionError; - new (): PositionError; - POSITION_UNAVAILABLE: number; - PERMISSION_DENIED: number; - TIMEOUT: number; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { - /** - * Sets or retrieves the width of the object. - */ - width: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - cellIndex: number; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. - */ - borderColorLight: any; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. - */ - borderColorDark: any; -} -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new (): HTMLTableCellElement; -} - -interface SVGElementInstance extends EventTarget { - previousSibling: SVGElementInstance; - parentNode: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - childNodes: SVGElementInstanceList; - correspondingUseElement: SVGUseElement; - correspondingElement: SVGElement; - firstChild: SVGElementInstance; -} -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new (): SVGElementInstance; -} - -interface MSNamespaceInfoCollection { - length: number; - add(namespace?: string, urn?: string, implementationUrl?: any): Object; - item(index: any): Object; - [index: string]: Object; -} -declare var MSNamespaceInfoCollection: { - prototype: MSNamespaceInfoCollection; - new (): MSNamespaceInfoCollection; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - r: SVGAnimatedLength; - cy: SVGAnimatedLength; -} -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new (): SVGCircleElement; -} - -interface StyleSheetList { - length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} -declare var StyleSheetList: { - prototype: StyleSheetList; - new (): StyleSheetList; -} - -interface CSSImportRule extends CSSRule { - styleSheet: CSSStyleSheet; - href: string; - media: MediaList; -} -declare var CSSImportRule: { - prototype: CSSImportRule; - new (): CSSImportRule; -} - -interface CustomEvent extends Event { - detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} -declare var CustomEvent: { - prototype: CustomEvent; - new (): CustomEvent; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; -} -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new (): HTMLBaseFontElement; -} - -interface HTMLTextAreaElement extends HTMLElement, MSDataBindingExtensions { - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Retrieves the type of control. - */ - type: string; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; - /** - * Highlights the input area of a form element. - */ - select(): void; -} -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new (): HTMLTextAreaElement; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} -declare var Geolocation: { - prototype: Geolocation; - new (): Geolocation; -} - -interface DOML2DeprecatedMarginStyle { - vspace: number; - hspace: number; -} - -interface MSWindowModeless { - dialogTop: any; - dialogLeft: any; - dialogWidth: any; - dialogHeight: any; - menuArguments: any; -} - -interface DOML2DeprecatedAlignmentStyle { - align: string; -} - -interface HTMLMarqueeElement extends HTMLElement, MSDataBindingExtensions, DOML2DeprecatedBackgroundColorStyle { - width: string; - onbounce: (ev: Event) => any; - vspace: number; - trueSpeed: boolean; - scrollAmount: number; - scrollDelay: number; - behavior: string; - height: string; - loop: number; - direction: string; - hspace: number; - onstart: (ev: Event) => any; - onfinish: (ev: Event) => any; - stop(): void; - start(): void; -} -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new (): HTMLMarqueeElement; -} - -interface SVGRect { - y: number; - width: number; - x: number; - height: number; -} -declare var SVGRect: { - prototype: SVGRect; - new (): SVGRect; -} - -interface MSNodeExtensions { - swapNode(otherNode: Node): Node; - removeNode(deep?: boolean): Node; - replaceNode(replacement: Node): Node; -} - -interface History { - length: number; - back(distance?: any): void; - forward(distance?: any): void; - go(delta?: any): void; -} -declare var History: { - prototype: History; - new (): History; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - y: number; - y1: number; - x2: number; - x: number; - x1: number; - y2: number; -} -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new (): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - y: number; - y1: number; - x: number; - x1: number; -} -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new (): SVGPathSegCurvetoQuadraticAbs; -} - -interface TimeRanges { - length: number; - start(index: number): number; - end(index: number): number; -} -declare var TimeRanges: { - prototype: TimeRanges; - new (): TimeRanges; -} - -interface CSSRule { - cssText: string; - parentStyleSheet: CSSStyleSheet; - parentRule: CSSRule; - type: number; - IMPORT_RULE: number; - MEDIA_RULE: number; - STYLE_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - UNKNOWN_RULE: number; - FONT_FACE_RULE: number; - CHARSET_RULE: number; -} -declare var CSSRule: { - prototype: CSSRule; - new (): CSSRule; - IMPORT_RULE: number; - MEDIA_RULE: number; - STYLE_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - UNKNOWN_RULE: number; - FONT_FACE_RULE: number; - CHARSET_RULE: number; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - y: number; - x: number; -} -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new (): SVGPathSegLinetoAbs; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} -declare var HTMLModElement: { - prototype: HTMLModElement; - new (): HTMLModElement; -} - -interface SVGMatrix { - e: number; - c: number; - a: number; - b: number; - d: number; - f: number; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - flipY(): SVGMatrix; - skewY(angle: number): SVGMatrix; - inverse(): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - rotate(angle: number): SVGMatrix; - flipX(): SVGMatrix; - translate(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - skewX(angle: number): SVGMatrix; -} -declare var SVGMatrix: { - prototype: SVGMatrix; - new (): SVGMatrix; -} - -interface MSPopupWindow { - document: Document; - isOpen: boolean; - show(x: number, y: number, w: number, h: number, element?: any): void; - hide(): void; -} -declare var MSPopupWindow: { - prototype: MSPopupWindow; - new (): MSPopupWindow; -} - -interface BeforeUnloadEvent extends Event { - returnValue: string; -} -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new (): BeforeUnloadEvent; -} - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { - y: SVGAnimatedLength; - width: SVGAnimatedLength; - animatedInstanceRoot: SVGElementInstance; - instanceRoot: SVGElementInstance; - x: SVGAnimatedLength; - height: SVGAnimatedLength; -} -declare var SVGUseElement: { - prototype: SVGUseElement; - new (): SVGUseElement; -} - -interface Event { - timeStamp: number; - defaultPrevented: boolean; - isTrusted: boolean; - currentTarget: EventTarget; - cancelBubble: boolean; - target: EventTarget; - eventPhase: number; - cancelable: boolean; - type: string; - srcElement: Element; - bubbles: boolean; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - stopPropagation(): void; - stopImmediatePropagation(): void; - preventDefault(): void; - CAPTURING_PHASE: number; - AT_TARGET: number; - BUBBLING_PHASE: number; -} -declare var Event: { - prototype: Event; - new (): Event; - CAPTURING_PHASE: number; - AT_TARGET: number; - BUBBLING_PHASE: number; -} - -interface ImageData { - width: number; - data: Uint8Array; - height: number; -} -declare var ImageData: { - prototype: ImageData; - new (): ImageData; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the width of the object. - */ - width: any; - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; -} -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new (): HTMLTableColElement; -} - -interface SVGException { - code: number; - message: string; - toString(): string; - SVG_MATRIX_NOT_INVERTABLE: number; - SVG_WRONG_TYPE_ERR: number; - SVG_INVALID_VALUE_ERR: number; -} -declare var SVGException: { - prototype: SVGException; - new (): SVGException; - SVG_MATRIX_NOT_INVERTABLE: number; - SVG_WRONG_TYPE_ERR: number; - SVG_INVALID_VALUE_ERR: number; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - y1: SVGAnimatedLength; - x2: SVGAnimatedLength; - x1: SVGAnimatedLength; - y2: SVGAnimatedLength; -} -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new (): SVGLinearGradientElement; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; -} - -interface SVGAnimatedEnumeration { - animVal: number; - baseVal: number; -} -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new (): SVGAnimatedEnumeration; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface HTMLUListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { -} -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new (): HTMLUListElement; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - y: SVGAnimatedLength; - width: SVGAnimatedLength; - ry: SVGAnimatedLength; - rx: SVGAnimatedLength; - x: SVGAnimatedLength; - height: SVGAnimatedLength; -} -declare var SVGRectElement: { - prototype: SVGRectElement; - new (): SVGRectElement; -} - -interface ErrorEventHandler { - (event: Event, source: string, fileno: number, columnNumber: number): void; - (message: any, uri: string, lineNumber: number, columnNumber?: number): void; -} - -interface HTMLDivElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new (): HTMLDivElement; -} - -interface DOML2DeprecatedBorderStyle { - border: string; -} - -interface NamedNodeMap { - length: number; - removeNamedItemNS(namespaceURI: string, localName: string): Attr; - item(index: number): Attr; - [index: number]: Attr; - removeNamedItem(name: string): Attr; - getNamedItem(name: string): Attr; - setNamedItem(arg: Attr): Attr; - getNamedItemNS(namespaceURI: string, localName: string): Attr; - setNamedItemNS(arg: Attr): Attr; -} -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new (): NamedNodeMap; -} - -interface MediaList { - length: number; - mediaText: string; - deleteMedium(oldMedium: string): void; - appendMedium(newMedium: string): void; - item(index: number): string; - [index: number]: string; - toString(): string; -} -declare var MediaList: { - prototype: MediaList; - new (): MediaList; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - y: number; - x: number; -} -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new (): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - y: number; - x2: number; - x: number; - y2: number; -} -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new (): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGLengthList { - numberOfItems: number; - replaceItem(newItem: SVGLength, index: number): SVGLength; - getItem(index: number): SVGLength; - clear(): void; - appendItem(newItem: SVGLength): SVGLength; - initialize(newItem: SVGLength): SVGLength; - removeItem(index: number): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; -} -declare var SVGLengthList: { - prototype: SVGLengthList; - new (): SVGLengthList; -} - -interface ProcessingInstruction extends Node { - target: string; - data: string; -} -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new (): ProcessingInstruction; -} - -interface MSWindowExtensions { - status: string; - onmouseleave: (ev: MouseEvent) => any; - screenLeft: number; - offscreenBuffering: any; - maxConnectionsPerServer: number; - onmouseenter: (ev: MouseEvent) => any; - clipboardData: DataTransfer; - defaultStatus: string; - clientInformation: Navigator; - closed: boolean; - onhelp: (ev: Event) => any; - external: External; - event: MSEventObj; - onfocusout: (ev: FocusEvent) => any; - screenTop: number; - onfocusin: (ev: FocusEvent) => any; - showModelessDialog(url?: string, argument?: any, options?: any): Window; - navigate(url: string): void; - resizeBy(x?: number, y?: number): void; - item(index: any): any; - resizeTo(x?: number, y?: number): void; - createPopup(arguments?: any): MSPopupWindow; - toStaticHTML(html: string): string; - execScript(code: string, language?: string): any; - msWriteProfilerMark(profilerMarkName: string): void; - moveTo(x?: number, y?: number): void; - moveBy(x?: number, y?: number): void; - showHelp(url: string, helpArg?: any, features?: string): void; -} - -interface MSBehaviorUrnsCollection { - length: number; - item(index: number): string; -} -declare var MSBehaviorUrnsCollection: { - prototype: MSBehaviorUrnsCollection; - new (): MSBehaviorUrnsCollection; -} - -interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; -} -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new (): CSSFontFaceRule; -} - -interface DOML2DeprecatedBackgroundStyle { - background: string; -} - -interface TextEvent extends UIEvent { - inputMethod: number; - data: string; - locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_VOICE: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_MULTIMODAL: number; -} -declare var TextEvent: { - prototype: TextEvent; - new (): TextEvent; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_VOICE: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_MULTIMODAL: number; -} - -interface DocumentFragment extends Node, NodeSelector, MSEventAttachmentTarget, MSNodeExtensions { -} -declare var DocumentFragment: { - prototype: DocumentFragment; - new (): DocumentFragment; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { -} -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new (): SVGPolylineElement; -} - -interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; -} - -interface Position { - timestamp: number; - coords: Coordinates; -} -declare var Position: { - prototype: Position; - new (): Position; -} - -interface BookmarkCollection { - length: number; - item(index: number): any; - [index: number]: any; -} -declare var BookmarkCollection: { - prototype: BookmarkCollection; - new (): BookmarkCollection; -} - -interface PerformanceMark extends PerformanceEntry { -} -declare var PerformanceMark: { - prototype: PerformanceMark; - new (): PerformanceMark; -} - -interface CSSPageRule extends CSSRule { - pseudoClass: string; - selectorText: string; - selector: string; - style: CSSStyleDeclaration; -} -declare var CSSPageRule: { - prototype: CSSPageRule; - new (): CSSPageRule; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; -} -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new (): HTMLBRElement; -} - -interface MSNavigatorExtensions { - userLanguage: string; - plugins: MSPluginsCollection; - cookieEnabled: boolean; - appCodeName: string; - cpuClass: string; - appMinorVersion: string; - connectionSpeed: number; - browserLanguage: string; - mimeTypes: MSMimeTypesCollection; - systemLanguage: string; - javaEnabled(): boolean; - taintEnabled(): boolean; -} - -interface HTMLSpanElement extends HTMLElement, MSDataBindingExtensions { -} -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new (): HTMLSpanElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; -} -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new (): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement, DOML2DeprecatedTextFlowControl { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; -} -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new (): HTMLHeadingElement; -} - -interface HTMLFormElement extends HTMLElement, MSHTMLCollectionExtensions { - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - elements: HTMLCollection; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - [name: string]: any; -} -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new (): HTMLFormElement; -} - -interface SVGZoomAndPan { - zoomAndPan: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; - SVG_ZOOMANDPAN_DISABLE: number; -} -declare var SVGZoomAndPan: { - prototype: SVGZoomAndPan; - new (): SVGZoomAndPan; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; - SVG_ZOOMANDPAN_DISABLE: number; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Gets the earliest possible position, in seconds, that the playback can begin. - */ - initialTime: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - played: TimeRanges; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - currentSrc: string; - readyState: any; - /** - * The autobuffer element is not supported by Internet Explorer 9. Use the preload element instead. - */ - autobuffer: boolean; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - /** - * Gets information about whether the playback has ended or not. - */ - ended: boolean; - /** - * Gets a collection of buffered time ranges. - */ - buffered: TimeRanges; - /** - * Returns an object representing the current error state of the audio or video element. - */ - error: MediaError; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - seekable: TimeRanges; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - duration: number; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Gets a flag that specifies whether playback is paused. - */ - paused: boolean; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - seeking: boolean; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - /** - * Gets the current network activity for the element. - */ - networkState: number; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - /** - * Fires immediately after the client loads the object. - */ - load(): void; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - HAVE_METADATA: number; - HAVE_CURRENT_DATA: number; - HAVE_NOTHING: number; - NETWORK_NO_SOURCE: number; - HAVE_ENOUGH_DATA: number; - NETWORK_EMPTY: number; - NETWORK_LOADING: number; - NETWORK_IDLE: number; - HAVE_FUTURE_DATA: number; -} -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new (): HTMLMediaElement; - HAVE_METADATA: number; - HAVE_CURRENT_DATA: number; - HAVE_NOTHING: number; - NETWORK_NO_SOURCE: number; - HAVE_ENOUGH_DATA: number; - NETWORK_EMPTY: number; - NETWORK_LOADING: number; - NETWORK_IDLE: number; - HAVE_FUTURE_DATA: number; -} - -interface ElementCSSInlineStyle { - runtimeStyle: MSStyleCSSProperties; - currentStyle: MSCurrentStyleCSSProperties; - doScroll(component?: any): void; - componentFromPoint(x: number, y: number): string; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} -declare var DOMParser: { - prototype: DOMParser; - new (): DOMParser; -} - -interface MSMimeTypesCollection { - length: number; -} -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new (): MSMimeTypesCollection; -} - -interface StyleSheet { - disabled: boolean; - ownerNode: Node; - parentStyleSheet: StyleSheet; - href: string; - media: MediaList; - type: string; - title: string; -} -declare var StyleSheet: { - prototype: StyleSheet; - new (): StyleSheet; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - startOffset: SVGAnimatedLength; - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_METHODTYPE_ALIGN: number; -} -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new (): SVGTextPathElement; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_METHODTYPE_ALIGN: number; -} - -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new (): HTMLDTElement; -} - -interface NodeList { - length: number; - item(index: number): Node; - [index: number]: Node; -} -declare var NodeList: { - prototype: NodeList; - new (): NodeList; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} -declare var XMLSerializer: { - prototype: XMLSerializer; - new (): XMLSerializer; -} - -interface PerformanceMeasure extends PerformanceEntry { -} -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new (): PerformanceMeasure; -} - -interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGExternalResourcesRequired, SVGURIReference { - spreadMethod: SVGAnimatedEnumeration; - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_UNKNOWN: number; - SVG_SPREADMETHOD_REPEAT: number; -} -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new (): SVGGradientElement; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_UNKNOWN: number; - SVG_SPREADMETHOD_REPEAT: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_ENTITY: number; - SHOW_DOCUMENT: number; - SHOW_PROCESSING_INSTRUCTION: number; - FILTER_REJECT: number; - SHOW_CDATA_SECTION: number; - FILTER_ACCEPT: number; - SHOW_ALL: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_TEXT: number; - SHOW_ELEMENT: number; - SHOW_COMMENT: number; - FILTER_SKIP: number; - SHOW_ATTRIBUTE: number; - SHOW_DOCUMENT_FRAGMENT: number; -} -declare var NodeFilter: { - prototype: NodeFilter; - new (): NodeFilter; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_ENTITY: number; - SHOW_DOCUMENT: number; - SHOW_PROCESSING_INSTRUCTION: number; - FILTER_REJECT: number; - SHOW_CDATA_SECTION: number; - FILTER_ACCEPT: number; - SHOW_ALL: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_TEXT: number; - SHOW_ELEMENT: number; - SHOW_COMMENT: number; - FILTER_SKIP: number; - SHOW_ATTRIBUTE: number; - SHOW_DOCUMENT_FRAGMENT: number; -} - -interface SVGNumberList { - numberOfItems: number; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; - getItem(index: number): SVGNumber; - clear(): void; - appendItem(newItem: SVGNumber): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - removeItem(index: number): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; -} -declare var SVGNumberList: { - prototype: SVGNumberList; - new (): SVGNumberList; -} - -interface MediaError { - code: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MEDIA_ERR_DECODE: number; -} -declare var MediaError: { - prototype: MediaError; - new (): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MEDIA_ERR_DECODE: number; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; -} -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new (): HTMLFieldSetElement; -} - -interface HTMLBGSoundElement extends HTMLElement { - /** - * Sets or gets the value indicating how the volume of the background sound is divided between the left speaker and the right speaker. - */ - balance: any; - /** - * Sets or gets the volume setting for the sound. - */ - volume: any; - /** - * Sets or gets the URL of a sound to play. - */ - src: string; - /** - * Sets or retrieves the number of times a sound or video clip will loop when activated. - */ - loop: number; -} -declare var HTMLBGSoundElement: { - prototype: HTMLBGSoundElement; - new (): HTMLBGSoundElement; -} - -interface HTMLElement extends Element, ElementCSSInlineStyle, MSEventAttachmentTarget, MSNodeExtensions { - onmouseleave: (ev: MouseEvent) => any; - onbeforecut: (ev: DragEvent) => any; - onkeydown: (ev: KeyboardEvent) => any; - onmove: (ev: MSEventObj) => any; - onkeyup: (ev: KeyboardEvent) => any; - onreset: (ev: Event) => any; - onhelp: (ev: Event) => any; - ondragleave: (ev: DragEvent) => any; - className: string; - onfocusin: (ev: FocusEvent) => any; - onseeked: (ev: Event) => any; - recordNumber: any; - title: string; - parentTextEdit: Element; - outerHTML: string; - ondurationchange: (ev: Event) => any; - offsetHeight: number; - all: HTMLCollection; - onblur: (ev: FocusEvent) => any; - dir: string; - onemptied: (ev: Event) => any; - onseeking: (ev: Event) => any; - oncanplay: (ev: Event) => any; - ondeactivate: (ev: UIEvent) => any; - ondatasetchanged: (ev: MSEventObj) => any; - onrowsdelete: (ev: MSEventObj) => any; - sourceIndex: number; - onloadstart: (ev: Event) => any; - onlosecapture: (ev: MSEventObj) => any; - ondragenter: (ev: DragEvent) => any; - oncontrolselect: (ev: MSEventObj) => any; - onsubmit: (ev: Event) => any; - behaviorUrns: MSBehaviorUrnsCollection; - scopeName: string; - onchange: (ev: Event) => any; - id: string; - onlayoutcomplete: (ev: MSEventObj) => any; - uniqueID: string; - onbeforeactivate: (ev: UIEvent) => any; - oncanplaythrough: (ev: Event) => any; - onbeforeupdate: (ev: MSEventObj) => any; - onfilterchange: (ev: MSEventObj) => any; - offsetParent: Element; - ondatasetcomplete: (ev: MSEventObj) => any; - onsuspend: (ev: Event) => any; - readyState: any; - onmouseenter: (ev: MouseEvent) => any; - innerText: string; - onerrorupdate: (ev: MSEventObj) => any; - onmouseout: (ev: MouseEvent) => any; - parentElement: HTMLElement; - onmousewheel: (ev: MouseWheelEvent) => any; - onvolumechange: (ev: Event) => any; - oncellchange: (ev: MSEventObj) => any; - onrowexit: (ev: MSEventObj) => any; - onrowsinserted: (ev: MSEventObj) => any; - onpropertychange: (ev: MSEventObj) => any; - filters: Object; - children: HTMLCollection; - ondragend: (ev: DragEvent) => any; - onbeforepaste: (ev: DragEvent) => any; - ondragover: (ev: DragEvent) => any; - offsetTop: number; - onmouseup: (ev: MouseEvent) => any; - ondragstart: (ev: DragEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - ondrag: (ev: DragEvent) => any; - innerHTML: string; - onmouseover: (ev: MouseEvent) => any; - lang: string; - uniqueNumber: number; - onpause: (ev: Event) => any; - tagUrn: string; - onmousedown: (ev: MouseEvent) => any; - onclick: (ev: MouseEvent) => any; - onwaiting: (ev: Event) => any; - onresizestart: (ev: MSEventObj) => any; - offsetLeft: number; - isTextEdit: boolean; - isDisabled: boolean; - onpaste: (ev: DragEvent) => any; - canHaveHTML: boolean; - onmoveend: (ev: MSEventObj) => any; - language: string; - onstalled: (ev: Event) => any; - onmousemove: (ev: MouseEvent) => any; - style: MSStyleCSSProperties; - isContentEditable: boolean; - onbeforeeditfocus: (ev: MSEventObj) => any; - onratechange: (ev: Event) => any; - contentEditable: string; - tabIndex: number; - document: Document; - onprogress: (ev: any) => any; - ondblclick: (ev: MouseEvent) => any; - oncontextmenu: (ev: MouseEvent) => any; - onloadedmetadata: (ev: Event) => any; - onafterupdate: (ev: MSEventObj) => any; - onerror: (ev: Event) => any; - onplay: (ev: Event) => any; - onresizeend: (ev: MSEventObj) => any; - onplaying: (ev: Event) => any; - isMultiLine: boolean; - onfocusout: (ev: FocusEvent) => any; - onabort: (ev: UIEvent) => any; - ondataavailable: (ev: MSEventObj) => any; - hideFocus: boolean; - onreadystatechange: (ev: Event) => any; - onkeypress: (ev: KeyboardEvent) => any; - onloadeddata: (ev: Event) => any; - onbeforedeactivate: (ev: UIEvent) => any; - outerText: string; - disabled: boolean; - onactivate: (ev: UIEvent) => any; - accessKey: string; - onmovestart: (ev: MSEventObj) => any; - onselectstart: (ev: Event) => any; - onfocus: (ev: FocusEvent) => any; - ontimeupdate: (ev: Event) => any; - onresize: (ev: UIEvent) => any; - oncut: (ev: DragEvent) => any; - onselect: (ev: UIEvent) => any; - ondrop: (ev: DragEvent) => any; - offsetWidth: number; - oncopy: (ev: DragEvent) => any; - onended: (ev: Event) => any; - onscroll: (ev: UIEvent) => any; - onrowenter: (ev: MSEventObj) => any; - onload: (ev: Event) => any; - canHaveChildren: boolean; - oninput: (ev: Event) => any; - dragDrop(): boolean; - scrollIntoView(top?: boolean): void; - addFilter(filter: Object): void; - setCapture(containerCapture?: boolean): void; - focus(): void; - getAdjacentText(where: string): string; - insertAdjacentText(where: string, text: string): void; - getElementsByClassName(classNames: string): NodeList; - setActive(): void; - removeFilter(filter: Object): void; - blur(): void; - clearAttributes(): void; - releaseCapture(): void; - createControlRange(): ControlRangeCollection; - removeBehavior(cookie: number): boolean; - contains(child: HTMLElement): boolean; - click(): void; - insertAdjacentElement(position: string, insertedElement: Element): Element; - mergeAttributes(source: HTMLElement, preserveIdentity?: boolean): void; - replaceAdjacentText(where: string, newText: string): string; - applyElement(apply: Element, where?: string): Element; - addBehavior(bstrUrl: string, factory?: any): number; - insertAdjacentHTML(where: string, html: string): void; -} -declare var HTMLElement: { - prototype: HTMLElement; - new (): HTMLElement; -} - -interface Comment extends CharacterData { - text: string; -} -declare var Comment: { - prototype: Comment; - new (): Comment; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - redirectStart: number; - redirectEnd: number; - domainLookupEnd: number; - responseStart: number; - domainLookupStart: number; - fetchStart: number; - requestStart: number; - connectEnd: number; - connectStart: number; - initiatorType: string; - responseEnd: number; -} -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new (): PerformanceResourceTiming; -} - -interface CanvasPattern { -} -declare var CanvasPattern: { - prototype: CanvasPattern; - new (): CanvasPattern; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the width of the object. - */ - width: number; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; -} -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new (): HTMLHRElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the contained object. - */ - object: Object; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the class identifier for the object. - */ - classid: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Retrieves the document object of the page or frame. - */ - contentDocument: Document; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - declare: boolean; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - BaseHref: string; -} -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new (): HTMLObjectElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Retrieves the palette used for the embedded document. - */ - palette: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - pluginspage: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; -} -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new (): HTMLEmbedElement; -} - -interface StorageEvent extends Event { - oldValue: any; - newValue: any; - url: string; - storageArea: Storage; - key: string; - initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; -} -declare var StorageEvent: { - prototype: StorageEvent; - new (): StorageEvent; -} - -interface CharacterData extends Node { - length: number; - data: string; - deleteData(offset: number, count: number): void; - replaceData(offset: number, count: number, arg: string): void; - appendData(arg: string): void; - insertData(offset: number, arg: string): void; - substringData(offset: number, count: number): string; -} -declare var CharacterData: { - prototype: CharacterData; - new (): CharacterData; -} - -interface HTMLOptGroupElement extends HTMLElement, MSDataBindingExtensions { - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - index: number; - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; -} -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new (): HTMLOptGroupElement; -} - -interface HTMLIsIndexElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - prompt: string; -} -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new (): HTMLIsIndexElement; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - y: number; - x: number; -} -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new (): SVGPathSegLinetoRel; -} - -interface DOMException { - code: number; - message: string; - toString(): string; - HIERARCHY_REQUEST_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - INVALID_MODIFICATION_ERR: number; - NAMESPACE_ERR: number; - INVALID_CHARACTER_ERR: number; - TYPE_MISMATCH_ERR: number; - ABORT_ERR: number; - INVALID_STATE_ERR: number; - SECURITY_ERR: number; - NETWORK_ERR: number; - WRONG_DOCUMENT_ERR: number; - QUOTA_EXCEEDED_ERR: number; - INDEX_SIZE_ERR: number; - DOMSTRING_SIZE_ERR: number; - SYNTAX_ERR: number; - SERIALIZE_ERR: number; - VALIDATION_ERR: number; - NOT_FOUND_ERR: number; - URL_MISMATCH_ERR: number; - PARSE_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NOT_SUPPORTED_ERR: number; - INVALID_ACCESS_ERR: number; - INUSE_ATTRIBUTE_ERR: number; -} -declare var DOMException: { - prototype: DOMException; - new (): DOMException; - HIERARCHY_REQUEST_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - INVALID_MODIFICATION_ERR: number; - NAMESPACE_ERR: number; - INVALID_CHARACTER_ERR: number; - TYPE_MISMATCH_ERR: number; - ABORT_ERR: number; - INVALID_STATE_ERR: number; - SECURITY_ERR: number; - NETWORK_ERR: number; - WRONG_DOCUMENT_ERR: number; - QUOTA_EXCEEDED_ERR: number; - INDEX_SIZE_ERR: number; - DOMSTRING_SIZE_ERR: number; - SYNTAX_ERR: number; - SERIALIZE_ERR: number; - VALIDATION_ERR: number; - NOT_FOUND_ERR: number; - URL_MISMATCH_ERR: number; - PARSE_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NOT_SUPPORTED_ERR: number; - INVALID_ACCESS_ERR: number; - INUSE_ATTRIBUTE_ERR: number; -} - -interface SVGAnimatedBoolean { - animVal: boolean; - baseVal: boolean; -} -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new (): SVGAnimatedBoolean; -} - -interface MSCompatibleInfoCollection { - length: number; - item(index: number): MSCompatibleInfo; -} -declare var MSCompatibleInfoCollection: { - prototype: MSCompatibleInfoCollection; - new (): MSCompatibleInfoCollection; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { -} -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new (): SVGSwitchElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; - SVG_MEETORSLICE_MEET: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_MEETORSLICE_SLICE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; -} -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new (): SVGPreserveAspectRatio; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; - SVG_MEETORSLICE_MEET: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_MEETORSLICE_SLICE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; -} - -interface Attr extends Node { - expando: boolean; - specified: boolean; - ownerElement: Element; - value: string; - name: string; -} -declare var Attr: { - prototype: Attr; - new (): Attr; -} - -interface PerformanceNavigation { - redirectCount: number; - type: number; - toJSON(): any; - TYPE_RELOAD: number; - TYPE_RESERVED: number; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; -} -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new (): PerformanceNavigation; - TYPE_RELOAD: number; - TYPE_RESERVED: number; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; -} -declare var SVGStopElement: { - prototype: SVGStopElement; - new (): SVGStopElement; -} - -interface PositionCallback { - (position: Position): void; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { -} -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new (): SVGSymbolElement; -} - -interface SVGElementInstanceList { - length: number; - item(index: number): SVGElementInstance; -} -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new (): SVGElementInstanceList; -} - -interface CSSRuleList { - length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} -declare var CSSRuleList: { - prototype: CSSRuleList; - new (): CSSRuleList; -} - -interface MSDataBindingRecordSetExtensions { - recordset: Object; - namedRecordset(dataMember: string, hierarchy?: any): Object; -} - -interface LinkStyle { - styleSheet: StyleSheet; - sheet: StyleSheet; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the width of the video element. - */ - width: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - videoWidth: number; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - videoHeight: number; - /** - * Gets or sets the height of the video element. - */ - height: number; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; -} -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new (): HTMLVideoElement; -} - -interface ClientRectList { - length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} -declare var ClientRectList: { - prototype: ClientRectList; - new (): ClientRectList; -} - -interface SVGMaskElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { - y: SVGAnimatedLength; - width: SVGAnimatedLength; - maskUnits: SVGAnimatedEnumeration; - maskContentUnits: SVGAnimatedEnumeration; - x: SVGAnimatedLength; - height: SVGAnimatedLength; -} -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new (): SVGMaskElement; -} - -interface External { -} -declare var External: { - prototype: External; - new (): External; -} - -declare var Audio: { new (src?: string): HTMLAudioElement; }; -declare var Option: { new (text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var Image: { new (width?: number, height?: number): HTMLImageElement; }; - -declare var ondragend: (ev: DragEvent) => any; -declare var onkeydown: (ev: KeyboardEvent) => any; -declare var ondragover: (ev: DragEvent) => any; -declare var onkeyup: (ev: KeyboardEvent) => any; -declare var onreset: (ev: Event) => any; -declare var onmouseup: (ev: MouseEvent) => any; -declare var ondragstart: (ev: DragEvent) => any; -declare var ondrag: (ev: DragEvent) => any; -declare var screenX: number; -declare var onmouseover: (ev: MouseEvent) => any; -declare var ondragleave: (ev: DragEvent) => any; -declare var history: History; -declare var pageXOffset: number; -declare var name: string; -declare var onafterprint: (ev: Event) => any; -declare var onpause: (ev: Event) => any; -declare var onbeforeprint: (ev: Event) => any; -declare var top: Window; -declare var onmousedown: (ev: MouseEvent) => any; -declare var onseeked: (ev: Event) => any; -declare var opener: Window; -declare var onclick: (ev: MouseEvent) => any; -declare var innerHeight: number; -declare var onwaiting: (ev: Event) => any; -declare var ononline: (ev: Event) => any; -declare var ondurationchange: (ev: Event) => any; -declare var frames: Window; -declare var onblur: (ev: FocusEvent) => any; -declare var onemptied: (ev: Event) => any; -declare var onseeking: (ev: Event) => any; -declare var oncanplay: (ev: Event) => any; -declare var outerWidth: number; -declare var onstalled: (ev: Event) => any; -declare var onmousemove: (ev: MouseEvent) => any; -declare var innerWidth: number; -declare var onoffline: (ev: Event) => any; -declare var length: number; -declare var screen: Screen; -declare var onbeforeunload: (ev: BeforeUnloadEvent) => any; -declare var onratechange: (ev: Event) => any; -declare var onstorage: (ev: StorageEvent) => any; -declare var onloadstart: (ev: Event) => any; -declare var ondragenter: (ev: DragEvent) => any; -declare var onsubmit: (ev: Event) => any; -declare var self: Window; -declare var document: Document; -declare var onprogress: (ev: any) => any; -declare var ondblclick: (ev: MouseEvent) => any; -declare var pageYOffset: number; -declare var oncontextmenu: (ev: MouseEvent) => any; -declare var onchange: (ev: Event) => any; -declare var onloadedmetadata: (ev: Event) => any; -declare var onplay: (ev: Event) => any; -declare var onerror: ErrorEventHandler; -declare var onplaying: (ev: Event) => any; -declare var parent: Window; -declare var location: Location; -declare var oncanplaythrough: (ev: Event) => any; -declare var onabort: (ev: UIEvent) => any; -declare var onreadystatechange: (ev: Event) => any; -declare var outerHeight: number; -declare var onkeypress: (ev: KeyboardEvent) => any; -declare var frameElement: Element; -declare var onloadeddata: (ev: Event) => any; -declare var onsuspend: (ev: Event) => any; -declare var window: Window; -declare var onfocus: (ev: FocusEvent) => any; -declare var onmessage: (ev: MessageEvent) => any; -declare var ontimeupdate: (ev: Event) => any; -declare var onresize: (ev: UIEvent) => any; -declare var onselect: (ev: UIEvent) => any; -declare var navigator: Navigator; -declare var styleMedia: StyleMedia; -declare var ondrop: (ev: DragEvent) => any; -declare var onmouseout: (ev: MouseEvent) => any; -declare var onended: (ev: Event) => any; -declare var onhashchange: (ev: Event) => any; -declare var onunload: (ev: Event) => any; -declare var onscroll: (ev: UIEvent) => any; -declare var screenY: number; -declare var onmousewheel: (ev: MouseWheelEvent) => any; -declare var onload: (ev: Event) => any; -declare var onvolumechange: (ev: Event) => any; -declare var oninput: (ev: Event) => any; -declare var performance: Performance; -declare function alert(message?: any): void; -declare function scroll(x?: number, y?: number): void; -declare function focus(): void; -declare function scrollTo(x?: number, y?: number): void; -declare function print(): void; -declare function prompt(message?: string, defaul?: string): string; -declare function toString(): string; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function scrollBy(x?: number, y?: number): void; -declare function confirm(message?: string): boolean; -declare function close(): void; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; -declare function showModalDialog(url?: string, argument?: any, options?: any): any; -declare function blur(): void; -declare function getSelection(): Selection; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; -declare function dispatchEvent(evt: Event): boolean; -declare function attachEvent(event: string, listener: EventListener): boolean; -declare function detachEvent(event: string, listener: EventListener): void; -declare var localStorage: Storage; -declare var status: string; -declare var onmouseleave: (ev: MouseEvent) => any; -declare var screenLeft: number; -declare var offscreenBuffering: any; -declare var maxConnectionsPerServer: number; -declare var onmouseenter: (ev: MouseEvent) => any; -declare var clipboardData: DataTransfer; -declare var defaultStatus: string; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var onhelp: (ev: Event) => any; -declare var external: External; -declare var event: MSEventObj; -declare var onfocusout: (ev: FocusEvent) => any; -declare var screenTop: number; -declare var onfocusin: (ev: FocusEvent) => any; -declare function showModelessDialog(url?: string, argument?: any, options?: any): Window; -declare function navigate(url: string): void; -declare function resizeBy(x?: number, y?: number): void; -declare function item(index: any): any; -declare function resizeTo(x?: number, y?: number): void; -declare function createPopup(arguments?: any): MSPopupWindow; -declare function toStaticHTML(html: string): string; -declare function execScript(code: string, language?: string): any; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function moveTo(x?: number, y?: number): void; -declare function moveBy(x?: number, y?: number): void; -declare function showHelp(url: string, helpArg?: any, features?: string): void; -declare var sessionStorage: Storage; -declare function clearTimeout(handle: number): void; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearInterval(handle: number): void; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; - - -///////////////////////////// -/// IE10 DOM APIs -///////////////////////////// - - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface HTMLBodyElement { - onpopstate: (ev: PopStateEvent) => any; -} - -interface MSGestureEvent extends UIEvent { - offsetY: number; - translationY: number; - velocityExpansion: number; - velocityY: number; - velocityAngular: number; - translationX: number; - velocityX: number; - hwTimestamp: number; - offsetX: number; - screenX: number; - rotation: number; - expansion: number; - clientY: number; - screenY: number; - scale: number; - gestureObject: any; - clientX: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; -} -declare var MSGestureEvent: { - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; -} - -interface HTMLAnchorElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} - -interface HTMLInputElement { - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - validationMessage: string; - /** - * Returns a FileList object on a file type input object. - */ - files: FileList; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - list: HTMLElement; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -interface ErrorEvent extends Event { - colno: number; - filename: string; - error: any; - lineno: number; - message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - y: SVGAnimatedLength; - width: SVGAnimatedLength; - filterResX: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - primitiveUnits: SVGAnimatedEnumeration; - x: SVGAnimatedLength; - height: SVGAnimatedLength; - filterResY: SVGAnimatedInteger; - setFilterRes(filterResX: number, filterResY: number): void; -} - -interface TrackEvent extends Event { - track: any; -} - -interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} -declare var MSGesture: { - prototype: MSGesture; - new (): MSGesture; -} - -interface TextTrackCue extends EventTarget { - onenter: (ev: Event) => any; - track: TextTrack; - endTime: number; - text: string; - pauseOnExit: boolean; - id: string; - startTime: number; - onexit: (ev: Event) => any; - getCueAsHTML(): DocumentFragment; -} -declare var TextTrackCue: { - prototype: TextTrackCue; - new (): TextTrackCue; -} - -interface MSStreamReader extends MSBaseReader { - error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; -} -declare var MSStreamReader: { - prototype: MSStreamReader; - new (): MSStreamReader; -} - -interface DOMTokenList { - length: number; - contains(token: string): boolean; - remove(token: string): void; - toggle(token: string): boolean; - add(token: string): void; - item(index: number): string; - [index: number]: string; - toString(): string; -} - -interface EventException { - name: string; -} - -interface Performance { - now(): number; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_UNKNOWN: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_LIGHTEN: number; -} -declare var SVGFEBlendElement: { - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_UNKNOWN: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_LIGHTEN: number; -} - -interface WindowTimers extends WindowTimersExtension { -} - -interface CSSStyleDeclaration { - animationFillMode: string; - floodColor: string; - animationIterationCount: string; - textShadow: string; - backfaceVisibility: string; - msAnimationIterationCount: string; - animationDelay: string; - animationTimingFunction: string; - columnWidth: any; - msScrollSnapX: string; - columnRuleColor: any; - columnRuleWidth: any; - transitionDelay: string; - transition: string; - msFlowFrom: string; - msScrollSnapType: string; - msContentZoomSnapType: string; - msGridColumns: string; - msAnimationName: string; - msGridRowAlign: string; - msContentZoomChaining: string; - msGridColumn: any; - msHyphenateLimitZone: any; - msScrollRails: string; - msAnimationDelay: string; - enableBackground: string; - msWrapThrough: string; - columnRuleStyle: string; - msAnimation: string; - msFlexFlow: string; - msScrollSnapY: string; - msHyphenateLimitLines: any; - msTouchAction: string; - msScrollLimit: string; - animation: string; - transform: string; - filter: string; - colorInterpolationFilters: string; - transitionTimingFunction: string; - msBackfaceVisibility: string; - animationPlayState: string; - transformOrigin: string; - msScrollLimitYMin: any; - msFontFeatureSettings: string; - msContentZoomLimitMin: any; - columnGap: any; - transitionProperty: string; - msAnimationDuration: string; - msAnimationFillMode: string; - msFlexDirection: string; - msTransitionDuration: string; - fontFeatureSettings: string; - breakBefore: string; - msFlexWrap: string; - perspective: string; - msFlowInto: string; - msTransformStyle: string; - msScrollTranslation: string; - msTransitionProperty: string; - msUserSelect: string; - msOverflowStyle: string; - msScrollSnapPointsY: string; - animationDirection: string; - animationDuration: string; - msFlex: string; - msTransitionTimingFunction: string; - animationName: string; - columnRule: string; - msGridColumnSpan: any; - msFlexNegative: string; - columnFill: string; - msGridRow: any; - msFlexOrder: string; - msFlexItemAlign: string; - msFlexPositive: string; - msContentZoomLimitMax: any; - msScrollLimitYMax: any; - msGridColumnAlign: string; - perspectiveOrigin: string; - lightingColor: string; - columns: string; - msScrollChaining: string; - msHyphenateLimitChars: string; - msTouchSelect: string; - floodOpacity: string; - msAnimationDirection: string; - msAnimationPlayState: string; - columnSpan: string; - msContentZooming: string; - msPerspective: string; - msFlexPack: string; - msScrollSnapPointsX: string; - msContentZoomSnapPoints: string; - msGridRowSpan: any; - msContentZoomSnap: string; - msScrollLimitXMin: any; - breakInside: string; - msHighContrastAdjust: string; - msFlexLinePack: string; - msGridRows: string; - transitionDuration: string; - msHyphens: string; - breakAfter: string; - msTransition: string; - msPerspectiveOrigin: string; - msContentZoomLimit: string; - msScrollLimitXMax: any; - msFlexAlign: string; - msWrapMargin: any; - columnCount: any; - msAnimationTimingFunction: string; - msTransitionDelay: string; - transformStyle: string; - msWrapFlow: string; - msFlexPreferredSize: string; -} - -interface MessageChannel { - port2: MessagePort; - port1: MessagePort; -} -declare var MessageChannel: { - prototype: MessageChannel; - new (): MessageChannel; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { -} - -interface Navigator extends MSFileSaver { - msMaxTouchPoints: number; - msPointerEnabled: boolean; - msManipulationViewsEnabled: boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; -} - -interface TransitionEvent extends Event { - propertyName: string; - elapsedTime: number; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -interface MediaQueryList { - matches: boolean; - media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -interface DOMError { - name: string; - toString(): string; -} - -interface CloseEvent extends Event { - wasClean: boolean; - reason: string; - code: number; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -interface WebSocket extends EventTarget { - protocol: string; - readyState: number; - bufferedAmount: number; - onopen: (ev: Event) => any; - extensions: string; - onmessage: (ev: any) => any; - onclose: (ev: CloseEvent) => any; - onerror: (ev: ErrorEvent) => any; - binaryType: string; - url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - OPEN: number; - CLOSING: number; - CONNECTING: number; - CLOSED: number; -} -declare var WebSocket: { - prototype: WebSocket; - new (url: string): WebSocket; - new (url: string, prototcol: string): WebSocket; - new (url: string, prototcol: string[]): WebSocket; - OPEN: number; - CLOSING: number; - CONNECTING: number; - CLOSED: number; -} - -interface SVGFEPointLightElement extends SVGElement { - y: SVGAnimatedNumber; - x: SVGAnimatedNumber; - z: SVGAnimatedNumber; -} - -interface ProgressEvent extends Event { - loaded: number; - lengthComputable: boolean; - total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -interface IDBObjectStore { - indexNames: DOMStringList; - name: string; - transaction: IDBTransaction; - keyPath: string; - count(key?: any): IDBRequest; - add(value: any, key?: any): IDBRequest; - clear(): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; - put(value: any, key?: any): IDBRequest; - openCursor(range?: any, direction?: string): IDBRequest; - deleteIndex(indexName: string): void; - index(name: string): IDBIndex; - get(key: any): IDBRequest; - delete(key: any): IDBRequest; -} - -interface HTMLCanvasElement { - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - stdDeviationX: SVGAnimatedNumber; - in1: SVGAnimatedString; - stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - y: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - height: SVGAnimatedLength; - result: SVGAnimatedString; -} - -interface Element { - msRegionOverflow: string; - onmspointerdown: (ev: any) => any; - onmsgotpointercapture: (ev: any) => any; - onmsgesturedoubletap: (ev: any) => any; - onmspointerhover: (ev: any) => any; - onmsgesturehold: (ev: any) => any; - onmspointermove: (ev: any) => any; - onmsgesturechange: (ev: any) => any; - onmsgesturestart: (ev: any) => any; - onmspointercancel: (ev: any) => any; - onmsgestureend: (ev: any) => any; - onmsgesturetap: (ev: any) => any; - onmspointerout: (ev: any) => any; - onmsinertiastart: (ev: any) => any; - onmslostpointercapture: (ev: any) => any; - onmspointerover: (ev: any) => any; - msContentZoomFactor: number; - onmspointerup: (ev: any) => any; - msGetRegionContent(): MSRangeCollection; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; -} - -interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; -} - -interface IDBIndex { - unique: boolean; - name: string; - keyPath: string; - objectStore: IDBObjectStore; - count(key?: any): IDBRequest; - getKey(key: any): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - get(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; -} - -interface WheelEvent { - getCurrentPoint(element: Element): void; -} - -interface FileList { - length: number; - item(index: number): File; - [index: number]: File; -} - -interface IDBCursor { - source: any; - direction: string; - key: any; - primaryKey: any; - advance(count: number): void; - delete(): IDBRequest; - continue(key?: any): void; - update(value: any): IDBRequest; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; -} - -interface File extends Blob { - lastModifiedDate: any; - name: string; -} - -interface URL { - revokeObjectURL(url: string): void; - createObjectURL(object: any, options?: ObjectURLOptions): string; -} -declare var URL: URL; - -interface RangeException { - name: string; -} - -interface IDBCursorWithValue extends IDBCursor { - value: any; -} - -interface HTMLTextAreaElement { - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - validationMessage: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -interface XMLHttpRequestEventTarget extends EventTarget { - onprogress: (ev: ProgressEvent) => any; - onerror: (ev: ErrorEvent) => any; - onload: (ev: any) => any; - ontimeout: (ev: any) => any; - onabort: (ev: any) => any; - onloadstart: (ev: any) => any; - onloadend: (ev: ProgressEvent) => any; -} - -interface IDBEnvironment { - msIndexedDB: IDBFactory; - indexedDB: IDBFactory; -} - -interface AudioTrackList extends EventTarget { - length: number; - onchange: (ev: any) => any; - onaddtrack: (ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack; - item(index: number): AudioTrack; - [index: number]: AudioTrack; -} - -interface MSBaseReader extends EventTarget { - onprogress: (ev: ProgressEvent) => any; - readyState: number; - onabort: (ev: any) => any; - onloadend: (ev: ProgressEvent) => any; - onerror: (ev: ErrorEvent) => any; - onload: (ev: any) => any; - onloadstart: (ev: any) => any; - result: any; - abort(): void; - LOADING: number; - EMPTY: number; - DONE: number; -} - -interface History { - state: any; - replaceState(statedata: any, title: string, url?: string): void; - pushState(statedata: any, title: string, url?: string): void; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - in1: SVGAnimatedString; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; -} -declare var SVGFEMorphologyElement: { - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; -} - -interface HTMLSelectElement { - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - validationMessage: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -interface CSSRule { - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - VIEWPORT_RULE: number; -} -//declare var CSSRule: { -// KEYFRAMES_RULE: number; -// KEYFRAME_RULE: number; -// VIEWPORT_RULE: number; -//} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -interface WindowTimersExtension { - msSetImmediate(expression: any, ...args: any[]): number; - clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - setImmediate(expression: any, ...args: any[]): number; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in2: SVGAnimatedString; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - scale: SVGAnimatedNumber; - in1: SVGAnimatedString; - SVG_CHANNEL_B: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_UNKNOWN: number; - SVG_CHANNEL_A: number; -} -declare var SVGFEDisplacementMapElement: { - SVG_CHANNEL_B: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_UNKNOWN: number; - SVG_CHANNEL_A: number; -} - -interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - tableValues: SVGAnimatedNumberList; - slope: SVGAnimatedNumber; - type: SVGAnimatedEnumeration; - exponent: SVGAnimatedNumber; - amplitude: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; -} -declare var SVGComponentTransferFunctionElement: { - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; -} - -interface MSRangeCollection { - length: number; - item(index: number): Range; - [index: number]: Range; -} - -interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; -} - -interface SVGException { - name: string; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -interface IDBKeyRange { - upper: any; - upperOpen: boolean; - lower: any; - lowerOpen: boolean; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; -} - -interface WindowConsole { - console: Console; -} - -interface IDBTransaction extends EventTarget { - oncomplete: (ev: Event) => any; - db: IDBDatabase; - mode: string; - error: DOMError; - onerror: (ev: ErrorEvent) => any; - onabort: (ev: any) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; -} - -interface AudioTrack { - kind: string; - language: string; - id: string; - label: string; - enabled: boolean; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - orderY: SVGAnimatedInteger; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - kernelMatrix: SVGAnimatedNumberList; - edgeMode: SVGAnimatedEnumeration; - kernelUnitLengthX: SVGAnimatedNumber; - bias: SVGAnimatedNumber; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - divisor: SVGAnimatedNumber; - in1: SVGAnimatedString; - SVG_EDGEMODE_WRAP: number; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_NONE: number; -} -declare var SVGFEConvolveMatrixElement: { - SVG_EDGEMODE_WRAP: number; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_NONE: number; -} - -interface TextTrackCueList { - length: number; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; - getCueById(id: string): TextTrackCue; -} - -interface CSSKeyframesRule extends CSSRule { - name: string; - cssRules: CSSRuleList; - findRule(rule: string): CSSKeyframeRule; - deleteRule(rule: string): void; - appendRule(rule: string): void; -} - -interface Window extends WindowBase64, IDBEnvironment, WindowConsole { - onmspointerdown: (ev: any) => any; - animationStartTime: number; - onmsgesturedoubletap: (ev: any) => any; - onmspointerhover: (ev: any) => any; - onmsgesturehold: (ev: any) => any; - onmspointermove: (ev: any) => any; - onmsgesturechange: (ev: any) => any; - onmsgesturestart: (ev: any) => any; - onmspointercancel: (ev: any) => any; - onmsgestureend: (ev: any) => any; - onmsgesturetap: (ev: any) => any; - onmspointerout: (ev: any) => any; - msAnimationStartTime: number; - applicationCache: ApplicationCache; - onmsinertiastart: (ev: any) => any; - onmspointerover: (ev: any) => any; - onpopstate: (ev: PopStateEvent) => any; - onmspointerup: (ev: any) => any; - msCancelRequestAnimationFrame(handle: number): void; - matchMedia(mediaQuery: string): MediaQueryList; - cancelAnimationFrame(handle: number): void; - msIsStaticHTML(html: string): boolean; - msMatchMedia(mediaQuery: string): MediaQueryList; - requestAnimationFrame(callback: FrameRequestCallback): number; - msRequestAnimationFrame(callback: FrameRequestCallback): number; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - type: SVGAnimatedEnumeration; - baseFrequencyY: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - seed: SVGAnimatedNumber; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_STITCHTYPE_STITCH: number; -} -declare var SVGFETurbulenceElement: { - SVG_STITCHTYPE_UNKNOWN: number; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_STITCHTYPE_STITCH: number; -} - -interface TextTrackList { - length: number; - item(index: number): TextTrack; - [index: number]: TextTrack; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; -} -declare var SVGFEColorMatrixElement: { - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; -} - -interface Console { - info(message?: any, ...optionalParams: any[]): void; - profile(reportName?: string): void; - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - clear(): void; - dir(value?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; - error(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - profileEnd(): void; -} - -interface SVGFESpotLightElement extends SVGElement { - pointsAtY: SVGAnimatedNumber; - y: SVGAnimatedNumber; - limitingConeAngle: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - z: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; -} - -interface HTMLImageElement { - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; -} - -interface WindowBase64 { - btoa(rawString: string): string; - atob(encodedString: string): string; -} - -interface IDBDatabase extends EventTarget { - version: string; - name: string; - objectStoreNames: DOMStringList; - onerror: (ev: ErrorEvent) => any; - onabort: (ev: any) => any; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; - close(): void; - transaction(storeNames: any, mode?: string): IDBTransaction; - deleteObjectStore(name: string): void; -} - -interface DOMStringList { - length: number; - contains(str: string): boolean; - item(index: number): string; - [index: number]: string; -} - -interface HTMLButtonElement { - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - validationMessage: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -interface IDBOpenDBRequest extends IDBRequest { - onupgradeneeded: (ev: IDBVersionChangeEvent) => any; - onblocked: (ev: Event) => any; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - position: number; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; -} - -interface MSLaunchUriCallback { - (): void; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; - dx: SVGAnimatedNumber; -} - -interface HTMLFormElement { - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; -} - -interface MSUnsafeFunctionCallback { - (): any; -} - -interface Document { - onmspointerdown: (ev: any) => any; - msHidden: boolean; - msVisibilityState: string; - onmsgesturedoubletap: (ev: any) => any; - visibilityState: string; - onmsmanipulationstatechanged: (ev: any) => any; - onmspointerhover: (ev: any) => any; - onmscontentzoom: (ev: any) => any; - onmspointermove: (ev: any) => any; - onmsgesturehold: (ev: any) => any; - onmsgesturechange: (ev: any) => any; - onmsgesturestart: (ev: any) => any; - onmspointercancel: (ev: any) => any; - onmsgestureend: (ev: any) => any; - onmsgesturetap: (ev: any) => any; - onmspointerout: (ev: any) => any; - onmsinertiastart: (ev: any) => any; - msCSSOMElementFloatMetrics: boolean; - onmspointerover: (ev: any) => any; - hidden: boolean; - onmspointerup: (ev: any) => any; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - clear(): void; -} - -interface MessageEvent extends Event { - ports: any; -} - -interface HTMLScriptElement { - async: boolean; -} - -interface HTMLMediaElement { - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - textTracks: TextTrackList; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - audioTracks: AudioTrackList; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; -} - -interface TextTrack extends EventTarget { - language: string; - mode: any; - readyState: number; - activeCues: TextTrackCueList; - cues: TextTrackCueList; - oncuechange: (ev: Event) => any; - kind: string; - onload: (ev: any) => any; - onerror: (ev: ErrorEvent) => any; - label: string; - ERROR: number; - SHOWING: number; - LOADING: number; - LOADED: number; - NONE: number; - HIDDEN: number; - DISABLED: number; -} -declare var TextTrack: { - ERROR: number; - SHOWING: number; - LOADING: number; - LOADED: number; - NONE: number; - HIDDEN: number; - DISABLED: number; -} - -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} - -interface IDBRequest extends EventTarget { - source: any; - onsuccess: (ev: Event) => any; - error: DOMError; - transaction: IDBTransaction; - onerror: (ev: ErrorEvent) => any; - readyState: string; - result: any; -} - -interface MessagePort extends EventTarget { - onmessage: (ev: any) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; -} - -interface FileReader extends MSBaseReader { - error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; -} -declare var FileReader: { - prototype: FileReader; - new (): FileReader; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface Blob { - type: string; - size: number; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; - msClose(): void; -} -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface ApplicationCache extends EventTarget { - status: number; - ondownloading: (ev: Event) => any; - onprogress: (ev: ProgressEvent) => any; - onupdateready: (ev: Event) => any; - oncached: (ev: Event) => any; - onobsolete: (ev: Event) => any; - onerror: (ev: ErrorEvent) => any; - onchecking: (ev: Event) => any; - onnoupdate: (ev: Event) => any; - swapCache(): void; - abort(): void; - update(): void; - CHECKING: number; - UNCACHED: number; - UPDATEREADY: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; -} -declare var ApplicationCache: { - CHECKING: number; - UNCACHED: number; - UPDATEREADY: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; -} - -interface FrameRequestCallback { - (time: number): void; -} - -interface XMLHttpRequest { - response: any; - withCredentials: boolean; - onprogress: (ev: ProgressEvent) => any; - onabort: (ev: any) => any; - responseType: string; - onloadend: (ev: ProgressEvent) => any; - upload: XMLHttpRequestEventTarget; - onerror: (ev: ErrorEvent) => any; - onloadstart: (ev: any) => any; -} - -interface PopStateEvent extends Event { - state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - style: CSSStyleDeclaration; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSStream { - type: string; - msDetachStream(): any; - msClose(): void; -} - -interface MediaError { - msExtendedCode: number; -} - -interface HTMLFieldSetElement { - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new (): MSBlobBuilder; -} - -interface HTMLElement { - onmscontentzoom: (ev: any) => any; - oncuechange: (ev: Event) => any; - spellcheck: boolean; - classList: DOMTokenList; - onmsmanipulationstatechanged: (ev: any) => any; - draggable: boolean; -} - -interface DataTransfer { - types: DOMStringList; - files: FileList; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -interface IDBFactory { - open(name: string, version?: number): IDBOpenDBRequest; - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; -} - -interface Range { - createContextualFragment(fragment: string): DocumentFragment; -} - -interface HTMLObjectElement { - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -interface MSPointerEvent extends MouseEvent { - width: number; - rotation: number; - pressure: number; - pointerType: any; - isPrimary: boolean; - tiltY: number; - height: number; - intermediatePoints: any; - currentPoint: any; - tiltX: number; - hwTimestamp: number; - pointerId: number; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - MSPOINTER_TYPE_PEN: number; - MSPOINTER_TYPE_MOUSE: number; - MSPOINTER_TYPE_TOUCH: number; -} -declare var MSPointerEvent: { - MSPOINTER_TYPE_PEN: number; - MSPOINTER_TYPE_MOUSE: number; - MSPOINTER_TYPE_TOUCH: number; -} - -interface DOMException { - name: string; - INVALID_NODE_TYPE_ERR: number; - DATA_CLONE_ERR: number; - TIMEOUT_ERR: number; -} -//declare var DOMException: { -// INVALID_NODE_TYPE_ERR: number; -// DATA_CLONE_ERR: number; -// TIMEOUT_ERR: number; -//} - -interface MSManipulationEvent extends UIEvent { - lastState: number; - currentState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_STOPPED: number; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_INERTIA: number; -} -declare var MSManipulationEvent: { - MS_MANIPULATION_STATE_STOPPED: number; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_INERTIA: number; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; -} - -interface SVGFEImageElement extends SVGElement, SVGLangSpace, SVGFilterPrimitiveStandardAttributes, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; -} - -interface AbstractWorker extends EventTarget { - onerror: (ev: ErrorEvent) => any; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - operator: SVGAnimatedEnumeration; - in2: SVGAnimatedString; - k2: SVGAnimatedNumber; - k1: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - in1: SVGAnimatedString; - k4: SVGAnimatedNumber; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; -} -declare var SVGFECompositeElement: { - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; -} - -interface ValidityState { - customError: boolean; - valueMissing: boolean; - stepMismatch: boolean; - rangeUnderflow: boolean; - rangeOverflow: boolean; - typeMismatch: boolean; - patternMismatch: boolean; - tooLong: boolean; - valid: boolean; -} - -interface HTMLTrackElement extends HTMLElement { - kind: string; - src: string; - srclang: string; - track: TextTrack; - label: string; - default: boolean; -} - -interface MSApp { - createFileFromStorageFile(storageFile: any): File; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - terminateApp(exceptionObject: any): void; - createDataPackage(object: any): any; - execUnsafeLocalFunction(unsafeFunction: MSUnsafeFunctionCallback): any; - getHtmlPrintDocumentSource(htmlDoc: any): any; - addPublicLocalApplicationUri(uri: string): void; - createDataPackageFromSelection(): any; -} -declare var MSApp: MSApp; - -interface HTMLVideoElement { - msIsStereo3D: boolean; - msStereo3DPackingMode: string; - onMSVideoOptimalLayoutChanged: (ev: any) => any; - onMSVideoFrameStepCompleted: (ev: any) => any; - msStereo3DRenderMode: string; - msIsLayoutOptimalForPlayback: boolean; - msHorizontalMirror: boolean; - onMSVideoFormatChanged: (ev: any) => any; - msZoom: boolean; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - msFrameStep(forward: boolean): void; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - diffuseConstant: SVGAnimatedNumber; -} - -interface MSCSSMatrix { - m24: number; - m34: number; - a: number; - d: number; - m32: number; - m41: number; - m11: number; - f: number; - e: number; - m23: number; - m14: number; - m33: number; - m22: number; - m21: number; - c: number; - m12: number; - b: number; - m42: number; - m31: number; - m43: number; - m13: number; - m44: number; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - setMatrixValue(value: string): void; - inverse(): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - toString(): string; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - translate(x: number, y: number, z?: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - skewX(angle: number): MSCSSMatrix; -} -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new (text?: string): MSCSSMatrix; -} - -interface Worker extends AbstractWorker { - onmessage: (ev: any) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; -} -declare var Worker: { - prototype: Worker; - new (stringUrl: string): Worker; -} - -interface HTMLIFrameElement { - sandbox: DOMSettableTokenList; -} - -declare var onmspointerdown: (ev: any) => any; -declare var animationStartTime: number; -declare var onmsgesturedoubletap: (ev: any) => any; -declare var onmspointerhover: (ev: any) => any; -declare var onmsgesturehold: (ev: any) => any; -declare var onmspointermove: (ev: any) => any; -declare var onmsgesturechange: (ev: any) => any; -declare var onmsgesturestart: (ev: any) => any; -declare var onmspointercancel: (ev: any) => any; -declare var onmsgestureend: (ev: any) => any; -declare var onmsgesturetap: (ev: any) => any; -declare var onmspointerout: (ev: any) => any; -declare var msAnimationStartTime: number; -declare var applicationCache: ApplicationCache; -declare var onmsinertiastart: (ev: any) => any; -declare var onmspointerover: (ev: any) => any; -declare var onpopstate: (ev: PopStateEvent) => any; -declare var onmspointerup: (ev: any) => any; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function cancelAnimationFrame(handle: number): void; -declare function msIsStaticHTML(html: string): boolean; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; -declare function btoa(rawString: string): string; -declare function atob(encodedString: string): string; -declare var msIndexedDB: IDBFactory; -declare var indexedDB: IDBFactory; -declare var console: Console; - - -///////////////////////////// -/// IE11 DOM APIs -///////////////////////////// - - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: Array; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: Array; -} - -interface AlgorithmParameters { -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: Array; -} - -interface ExceptionInformation { - domain?: string; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface Algorithm { - name?: string; - params?: AlgorithmParameters; -} - -interface NavigatorID { - product: string; - vendor: string; -} - -interface HTMLBodyElement { - onpageshow: (ev: PageTransitionEvent) => any; - onpagehide: (ev: PageTransitionEvent) => any; -} - -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} - -interface MSWindowExtensions { - captureEvents(): void; - releaseEvents(): void; -} - -interface MSGraphicsTrust { - status: string; - constrictionActive: boolean; -} - -interface AudioTrack { - sourceBuffer: SourceBuffer; -} - -interface DragEvent { - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -interface SubtleCrypto { - unwrapKey(wrappedKey: ArrayBufferView, keyAlgorithm: any, keyEncryptionKey: Key, extractable?: boolean, keyUsages?: string[]): KeyOperation; - encrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; - importKey(format: string, keyData: ArrayBufferView, algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; - wrapKey(key: Key, keyEncryptionKey: Key, keyWrappingAlgorithm: any): KeyOperation; - verify(algorithm: any, key: Key, signature: ArrayBufferView, buffer?: ArrayBufferView): CryptoOperation; - deriveKey(algorithm: any, baseKey: Key, derivedKeyType: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; - digest(algorithm: any, buffer?: ArrayBufferView): CryptoOperation; - exportKey(format: string, key: Key): KeyOperation; - generateKey(algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; - sign(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; - decrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; -} - -interface Crypto extends RandomSource { - subtle: SubtleCrypto; -} - -interface VideoPlaybackQuality { - totalFrameDelay: number; - creationTime: number; - totalVideoFrames: number; - droppedVideoFrames: number; -} - -interface GlobalEventHandlers { - onpointerenter: (ev: PointerEvent) => any; - onpointerout: (ev: PointerEvent) => any; - onpointerdown: (ev: PointerEvent) => any; - onpointerup: (ev: PointerEvent) => any; - onpointercancel: (ev: PointerEvent) => any; - onpointerover: (ev: PointerEvent) => any; - onpointermove: (ev: PointerEvent) => any; - onpointerleave: (ev: PointerEvent) => any; -} - -interface Window extends GlobalEventHandlers { - onpageshow: (ev: PageTransitionEvent) => any; - ondevicemotion: (ev: DeviceMotionEvent) => any; - devicePixelRatio: number; - msCrypto: Crypto; - ondeviceorientation: (ev: DeviceOrientationEvent) => any; - doNotTrack: string; - onmspointerenter: (ev: any) => any; - onpagehide: (ev: PageTransitionEvent) => any; - onmspointerleave: (ev: any) => any; -} - -interface Key { - algorithm: Algorithm; - type: string; - extractable: boolean; - keyUsage: string[]; -} - -interface TextTrackList extends EventTarget { - onaddtrack: (ev: any) => any; -} - -interface DeviceAcceleration { - y: number; - x: number; - z: number; -} - -interface Console { - count(countTitle?: string): void; - groupEnd(): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(): void; - group(groupTitle?: string): void; - dirxml(value: any): void; - debug(message?: string, ...optionalParams: any[]): void; - groupCollapsed(groupTitle?: string): void; - select(element: Element): void; -} - -interface MSNavigatorDoNotTrack { - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; -} - -interface HTMLImageElement { - crossOrigin: string; - msPlayToPreferredSourceUri: string; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; - //[name: string]: Element; -} - -interface MSNavigatorExtensions { - language: string; -} - -interface AesGcmEncryptResult { - ciphertext: ArrayBuffer; - tag: ArrayBuffer; -} - -interface HTMLSourceElement { - msKeySystem: string; -} - -interface CSSStyleDeclaration { - alignItems: string; - borderImageSource: string; - flexBasis: string; - borderImageWidth: string; - borderImageRepeat: string; - order: string; - flex: string; - alignContent: string; - msImeAlign: string; - flexShrink: string; - flexGrow: string; - borderImageSlice: string; - flexWrap: string; - borderImageOutset: string; - flexDirection: string; - touchAction: string; - flexFlow: string; - borderImage: string; - justifyContent: string; - alignSelf: string; - msTextCombineHorizontal: string; -} - -interface NavigationCompletedEvent extends NavigationEvent { - webErrorStatus: number; - isSuccess: boolean; -} - -interface MutationRecord { - oldValue: string; - previousSibling: Node; - addedNodes: NodeList; - attributeName: string; - removedNodes: NodeList; - target: Node; - nextSibling: Node; - attributeNamespace: string; - type: string; -} - -interface Navigator { - pointerEnabled: boolean; - maxTouchPoints: number; -} - -interface Document extends MSDocumentExtensions, GlobalEventHandlers { - msFullscreenEnabled: boolean; - onmsfullscreenerror: (ev: any) => any; - onmspointerenter: (ev: any) => any; - msFullscreenElement: Element; - onmsfullscreenchange: (ev: any) => any; - onmspointerleave: (ev: any) => any; - msExitFullscreen(): void; -} - -interface MimeTypeArray { - length: number; - item(index: number): Plugin; - [index: number]: Plugin; - namedItem(type: string): Plugin; - //[type: string]: Plugin; -} - -interface HTMLMediaElement { - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - msKeys: MSMediaKeys; - msGraphicsTrustStatus: MSGraphicsTrust; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; -} - -interface TextTrack { - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; -} - -interface KeyOperation extends EventTarget { - oncomplete: (ev: any) => any; - onerror: (ev: any) => any; - result: any; -} - -interface DOMStringMap { -} - -interface DeviceOrientationEvent extends Event { - gamma: number; - alpha: number; - absolute: boolean; - beta: number; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; -} - -interface MSMediaKeys { - keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; - isTypeSupported(keySystem: string, type?: string): boolean; -} -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new (): MSMediaKeys; -} - -interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; -} - -interface MSHTMLWebViewElement extends HTMLElement { - documentTitle: string; - width: number; - src: string; - canGoForward: boolean; - height: number; - canGoBack: boolean; - navigateWithHttpRequestMessage(requestMessage: any): void; - goBack(): void; - navigate(uri: string): void; - stop(): void; - navigateToString(contents: string): void; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - refresh(): void; - goForward(): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; -} - -interface NavigationEvent extends Event { - uri: string; -} - -interface Element extends GlobalEventHandlers { - onlostpointercapture: (ev: PointerEvent) => any; - onmspointerenter: (ev: any) => any; - ongotpointercapture: (ev: PointerEvent) => any; - onmspointerleave: (ev: any) => any; - msZoomTo(args: MsZoomToOptions): void; - setPointerCapture(pointerId: number): void; - msGetUntransformedBounds(): ClientRect; - releasePointerCapture(pointerId: number): void; - msRequestFullscreen(): void; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface XMLHttpRequest { - msCaching: string; - msCachingEnabled(): boolean; - overrideMimeType(mime: string): void; -} - -interface SourceBuffer extends EventTarget { - updating: boolean; - appendWindowStart: number; - appendWindowEnd: number; - buffered: TimeRanges; - timestampOffset: number; - audioTracks: AudioTrackList; - appendBuffer(data: ArrayBuffer): void; - remove(start: number, end: number): void; - abort(): void; - appendStream(stream: MSStream, maxSize?: number): void; -} - -interface MSInputMethodContext extends EventTarget { - oncandidatewindowshow: (ev: any) => any; - target: HTMLElement; - compositionStartOffset: number; - oncandidatewindowhide: (ev: any) => any; - oncandidatewindowupdate: (ev: any) => any; - compositionEndOffset: number; - getCompositionAlternatives(): string[]; - getCandidateWindowClientRect(): ClientRect; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; -} - -interface DeviceRotationRate { - gamma: number; - alpha: number; - beta: number; -} - -interface PluginArray { - length: number; - refresh(reload?: boolean): void; - item(index: number): Plugin; - [index: number]: Plugin; - namedItem(name: string): Plugin; - //[name: string]: Plugin; -} - -interface MSMediaKeyError { - systemCode: number; - code: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_UNKNOWN: number; - MS_MEDIA_KEYERR_CLIENT: number; -} -declare var MSMediaKeyError: { - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_UNKNOWN: number; - MS_MEDIA_KEYERR_CLIENT: number; -} - -interface Plugin { - length: number; - filename: string; - version: string; - name: string; - description: string; - item(index: number): MimeType; - [index: number]: MimeType; - namedItem(type: string): MimeType; - //[type: string]: MimeType; -} - -interface HTMLFrameSetElement { - onpageshow: (ev: PageTransitionEvent) => any; - onpagehide: (ev: PageTransitionEvent) => any; -} - -interface Screen extends EventTarget { - msOrientation: string; - onmsorientationchange: (ev: any) => any; - msLockOrientation(orientation: string): boolean; - msLockOrientation(orientations: string[]): boolean; - msUnlockOrientation(): void; -} - -interface MediaSource extends EventTarget { - sourceBuffers: SourceBufferList; - duration: number; - readyState: string; - activeSourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: string): void; - isTypeSupported(type: string): boolean; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} -declare var MediaSource: { - prototype: MediaSource; - new (): MediaSource; -} - -interface MediaError { - MS_MEDIA_ERR_ENCRYPTED: number; -} -//declare var MediaError: { -// MS_MEDIA_ERR_ENCRYPTED: number; -//} - -interface SourceBufferList extends EventTarget { - length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -interface XMLDocument extends Document { -} - -interface DeviceMotionEvent extends Event { - rotationRate: DeviceRotationRate; - acceleration: DeviceAcceleration; - interval: number; - accelerationIncludingGravity: DeviceAcceleration; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; -} - -interface MimeType { - enabledPlugin: Plugin; - suffixes: string; - type: string; - description: string; -} - -interface PointerEvent extends MouseEvent { - width: number; - rotation: number; - pressure: number; - pointerType: any; - isPrimary: boolean; - tiltY: number; - height: number; - intermediatePoints: any; - currentPoint: any; - tiltX: number; - hwTimestamp: number; - pointerId: number; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; -} - -interface MSDocumentExtensions { - captureEvents(): void; - releaseEvents(): void; -} - -interface HTMLElement { - dataset: DOMStringMap; - hidden: boolean; - msGetInputContext(): MSInputMethodContext; -} - -interface MutationObserver { - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; - disconnect(): void; -} -declare var MutationObserver: { - prototype: MutationObserver; - new (callback: (arr: MutationRecord[], observer: MutationObserver)=>any): MutationObserver; -} - -interface AudioTrackList { - onremovetrack: (ev: PluginArray) => any; -} - -interface HTMLObjectElement { - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - readyState: number; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; -} - -interface HTMLEmbedElement { - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - readyState: string; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; -} - -interface MSWebViewAsyncOperation extends EventTarget { - target: MSHTMLWebViewElement; - oncomplete: (ev: any) => any; - error: DOMError; - onerror: (ev: any) => any; - readyState: number; - type: number; - result: any; - start(): void; - ERROR: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; - COMPLETED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - STARTED: number; -} -declare var MSWebViewAsyncOperation: { - ERROR: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; - COMPLETED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - STARTED: number; -} - -interface ScriptNotifyEvent extends Event { - value: string; - callingUri: string; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - redirectStart: number; - domainLookupEnd: number; - responseStart: number; - domComplete: number; - domainLookupStart: number; - loadEventStart: number; - unloadEventEnd: number; - fetchStart: number; - requestStart: number; - domInteractive: number; - navigationStart: number; - connectEnd: number; - loadEventEnd: number; - connectStart: number; - responseEnd: number; - domLoading: number; - redirectEnd: number; - redirectCount: number; - unloadEventStart: number; - domContentLoadedEventStart: number; - domContentLoadedEventEnd: number; - type: string; -} - -interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; -} - -interface MSManipulationEvent { - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_CANCELLED: number; -} -//declare var MSManipulationEvent: { -// MS_MANIPULATION_STATE_SELECTING: number; -// MS_MANIPULATION_STATE_COMMITTED: number; -// MS_MANIPULATION_STATE_PRESELECT: number; -// MS_MANIPULATION_STATE_DRAGGING: number; -// MS_MANIPULATION_STATE_CANCELLED: number; -//} - -interface LongRunningScriptDetectedEvent extends Event { - stopPageScriptExecution: boolean; - executionTime: number; -} - -interface MSAppView { - viewId: number; - close(): void; - postMessage(message: any, targetOrigin: string, ports?: any): void; -} - -interface PerfWidgetExternal { - maxCpuSpeed: number; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - performanceCounter: number; - averagePaintTime: number; - activeNetworkRequestCount: number; - paintRequestsPerSecond: number; - extraInformationEnabled: boolean; - performanceCounterFrequency: number; - averageFrameTime: number; - repositionWindow(x: number, y: number): void; - getRecentMemoryUsage(last: number): any; - getMemoryUsage(): number; - resizeWindow(width: number, height: number): void; - getProcessCpuUsage(): number; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; - removeEventListener(eventType: string, callback: (ev: any) => any): void; - getRecentCpuUsage(last: number): any; - addEventListener(eventType: string, callback: (ev: any) => any): void; - getRecentFrames(last: number): any; - getRecentPaintRequests(last: number): any; -} - -interface PageTransitionEvent extends Event { - persisted: boolean; -} - -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} - -interface HTMLDocument extends Document { -} - -interface KeyPair { - privateKey: Key; - publicKey: Key; -} - -interface MSApp { - getViewOpener(): MSAppView; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - createNewView(uri: string): MSAppView; - getCurrentPriority(): string; - NORMAL: string; - HIGH: string; - IDLE: string; - CURRENT: string; -} -//declare var MSApp: { -// NORMAL: string; -// HIGH: string; -// IDLE: string; -// CURRENT: string; -//} - -interface MSMediaKeySession extends EventTarget { - sessionId: string; - error: MSMediaKeyError; - keySystem: string; - close(): void; - update(key: Uint8Array): void; -} - -interface HTMLTrackElement { - readyState: number; - ERROR: number; - LOADING: number; - LOADED: number; - NONE: number; -} -//declare var HTMLTrackElement: { -// ERROR: number; -// LOADING: number; -// LOADED: number; -// NONE: number; -//} - -interface HTMLVideoElement { - getVideoPlaybackQuality(): VideoPlaybackQuality; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEvent { - referrer: string; -} - -interface CryptoOperation extends EventTarget { - algorithm: Algorithm; - oncomplete: (ev: any) => any; - onerror: (ev: any) => any; - onprogress: (ev: any) => any; - onabort: (ev: any) => any; - key: Key; - result: any; - abort(): void; - finish(): void; - process(buffer: ArrayBufferView): void; -} - -declare var onpageshow: (ev: PageTransitionEvent) => any; -declare var ondevicemotion: (ev: DeviceMotionEvent) => any; -declare var devicePixelRatio: number; -declare var msCrypto: Crypto; -declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; -declare var doNotTrack: string; -declare var onmspointerenter: (ev: any) => any; -declare var onpagehide: (ev: PageTransitionEvent) => any; -declare var onmspointerleave: (ev: any) => any; -declare var onpointerenter: (ev: PointerEvent) => any; -declare var onpointerout: (ev: PointerEvent) => any; -declare var onpointerdown: (ev: PointerEvent) => any; -declare var onpointerup: (ev: PointerEvent) => any; -declare var onpointercancel: (ev: PointerEvent) => any; -declare var onpointerover: (ev: PointerEvent) => any; -declare var onpointermove: (ev: PointerEvent) => any; -declare var onpointerleave: (ev: PointerEvent) => any; - - -///////////////////////////// -/// WebGL APIs -///////////////////////////// - - -interface WebGLTexture extends WebGLObject { -} - -interface OES_texture_float { -} - -interface WebGLContextEvent extends Event { - statusMessage: string; -} -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new (): WebGLContextEvent; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -interface WebGLUniformLocation { -} - -interface WebGLActiveInfo { - name: string; - type: number; - size: number; -} - -interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} -declare var WEBGL_compressed_texture_s3tc: { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WebGLContextAttributes { - alpha: boolean; - depth: boolean; - stencil: boolean; - antialias: boolean; - premultipliedAlpha: boolean; - preserveDrawingBuffer: boolean; -} - -interface WebGLRenderingContext { - drawingBufferWidth: number; - drawingBufferHeight: number; - canvas: HTMLCanvasElement; - getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; - bindTexture(target: number, texture: WebGLTexture): void; - bufferData(target: number, data: ArrayBufferView, usage: number): void; - bufferData(target: number, data: ArrayBuffer, usage: number): void; - bufferData(target: number, size: number, usage: number): void; - depthMask(flag: boolean): void; - getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; - vertexAttrib3fv(indx: number, values: number[]): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; - linkProgram(program: WebGLProgram): void; - getSupportedExtensions(): string[]; - bufferSubData(target: number, offset: number, data: ArrayBuffer): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - polygonOffset(factor: number, units: number): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - createTexture(): WebGLTexture; - hint(target: number, mode: number): void; - getVertexAttrib(index: number, pname: number): any; - enableVertexAttribArray(index: number): void; - depthRange(zNear: number, zFar: number): void; - cullFace(mode: number): void; - createFramebuffer(): WebGLFramebuffer; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - getExtension(name: string): Object; - createProgram(): WebGLProgram; - deleteShader(shader: WebGLShader): void; - getAttachedShaders(program: WebGLProgram): WebGLShader[]; - enable(cap: number): void; - blendEquation(mode: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void; - createBuffer(): WebGLBuffer; - deleteTexture(texture: WebGLTexture): void; - useProgram(program: WebGLProgram): void; - vertexAttrib2fv(indx: number, values: number[]): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; - checkFramebufferStatus(target: number): number; - frontFace(mode: number): void; - getBufferParameter(target: number, pname: number): any; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - getVertexAttribOffset(index: number, pname: number): number; - disableVertexAttribArray(index: number): void; - blendFunc(sfactor: number, dfactor: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - isFramebuffer(framebuffer: WebGLFramebuffer): boolean; - uniform3iv(location: WebGLUniformLocation, v: number[]): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; - lineWidth(width: number): void; - getShaderInfoLog(shader: WebGLShader): string; - getTexParameter(target: number, pname: number): any; - getParameter(pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; - getContextAttributes(): WebGLContextAttributes; - vertexAttrib1f(indx: number, x: number): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - isContextLost(): boolean; - uniform1iv(location: WebGLUniformLocation, v: number[]): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; - getRenderbufferParameter(target: number, pname: number): any; - uniform2fv(location: WebGLUniformLocation, v: number[]): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; - isTexture(texture: WebGLTexture): boolean; - getError(): number; - shaderSource(shader: WebGLShader, source: string): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; - stencilMask(mask: number): void; - bindBuffer(target: number, buffer: WebGLBuffer): void; - getAttribLocation(program: WebGLProgram, name: string): number; - uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - clear(mask: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; - scissor(x: number, y: number, width: number, height: number): void; - uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; - getShaderSource(shader: WebGLShader): string; - generateMipmap(target: number): void; - bindAttribLocation(program: WebGLProgram, index: number, name: string): void; - uniform1fv(location: WebGLUniformLocation, v: number[]): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform2iv(location: WebGLUniformLocation, v: number[]): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - uniform4fv(location: WebGLUniformLocation, v: number[]): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; - vertexAttrib1fv(indx: number, values: number[]): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; - flush(): void; - uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - deleteProgram(program: WebGLProgram): void; - isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; - uniform1i(location: WebGLUniformLocation, x: number): void; - getProgramParameter(program: WebGLProgram, pname: number): any; - getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; - stencilFunc(func: number, ref: number, mask: number): void; - pixelStorei(pname: number, param: number): void; - disable(cap: number): void; - vertexAttrib4fv(indx: number, values: number[]): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; - createRenderbuffer(): WebGLRenderbuffer; - isBuffer(buffer: WebGLBuffer): boolean; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - sampleCoverage(value: number, invert: boolean): void; - depthFunc(func: number): void; - texParameterf(target: number, pname: number, param: number): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - drawArrays(mode: number, first: number, count: number): void; - texParameteri(target: number, pname: number, param: number): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - getShaderParameter(shader: WebGLShader, pname: number): any; - clearDepth(depth: number): void; - activeTexture(texture: number): void; - viewport(x: number, y: number, width: number, height: number): void; - detachShader(program: WebGLProgram, shader: WebGLShader): void; - uniform1f(location: WebGLUniformLocation, x: number): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - deleteBuffer(buffer: WebGLBuffer): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - uniform3fv(location: WebGLUniformLocation, v: number[]): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; - stencilMaskSeparate(face: number, mask: number): void; - attachShader(program: WebGLProgram, shader: WebGLShader): void; - compileShader(shader: WebGLShader): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - isShader(shader: WebGLShader): boolean; - clearStencil(s: number): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; - finish(): void; - uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - getProgramInfoLog(program: WebGLProgram): string; - validateProgram(program: WebGLProgram): void; - isEnabled(cap: number): boolean; - vertexAttrib2f(indx: number, x: number, y: number): void; - isProgram(program: WebGLProgram): boolean; - createShader(type: number): WebGLShader; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; - uniform4iv(location: WebGLUniformLocation, v: number[]): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - DEPTH_FUNC: number; - DEPTH_COMPONENT16: number; - REPLACE: number; - REPEAT: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - STENCIL_BUFFER_BIT: number; - RENDERER: number; - STENCIL_BACK_REF: number; - TEXTURE26: number; - RGB565: number; - DITHER: number; - CONSTANT_COLOR: number; - GENERATE_MIPMAP_HINT: number; - POINTS: number; - DECR: number; - INT_VEC3: number; - TEXTURE28: number; - ONE_MINUS_CONSTANT_ALPHA: number; - BACK: number; - RENDERBUFFER_STENCIL_SIZE: number; - UNPACK_FLIP_Y_WEBGL: number; - BLEND: number; - TEXTURE9: number; - ARRAY_BUFFER_BINDING: number; - MAX_VIEWPORT_DIMS: number; - INVALID_FRAMEBUFFER_OPERATION: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE31: number; - TEXTURE24: number; - HIGH_INT: number; - RENDERBUFFER_BINDING: number; - BLEND_COLOR: number; - FASTEST: number; - STENCIL_WRITEMASK: number; - ALIASED_POINT_SIZE_RANGE: number; - TEXTURE12: number; - DST_ALPHA: number; - BLEND_EQUATION_RGB: number; - FRAMEBUFFER_COMPLETE: number; - NEAREST_MIPMAP_NEAREST: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - TEXTURE3: number; - DEPTH_WRITEMASK: number; - CONTEXT_LOST_WEBGL: number; - INVALID_VALUE: number; - TEXTURE_MAG_FILTER: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - NOTEQUAL: number; - ALPHA: number; - DEPTH_STENCIL: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - DEPTH_COMPONENT: number; - RENDERBUFFER_RED_SIZE: number; - TEXTURE20: number; - RED_BITS: number; - RENDERBUFFER_BLUE_SIZE: number; - SCISSOR_BOX: number; - VENDOR: number; - FRONT_AND_BACK: number; - CONSTANT_ALPHA: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - NEAREST: number; - CULL_FACE: number; - ALIASED_LINE_WIDTH_RANGE: number; - TEXTURE19: number; - FRONT: number; - DEPTH_CLEAR_VALUE: number; - GREEN_BITS: number; - TEXTURE29: number; - TEXTURE23: number; - MAX_RENDERBUFFER_SIZE: number; - STENCIL_ATTACHMENT: number; - TEXTURE27: number; - BOOL_VEC2: number; - OUT_OF_MEMORY: number; - MIRRORED_REPEAT: number; - POLYGON_OFFSET_UNITS: number; - TEXTURE_MIN_FILTER: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - LINE_LOOP: number; - FLOAT_MAT3: number; - TEXTURE14: number; - LINEAR: number; - RGB5_A1: number; - ONE_MINUS_SRC_COLOR: number; - SAMPLE_COVERAGE_INVERT: number; - DONT_CARE: number; - FRAMEBUFFER_BINDING: number; - RENDERBUFFER_ALPHA_SIZE: number; - STENCIL_REF: number; - ZERO: number; - DECR_WRAP: number; - SAMPLE_COVERAGE: number; - STENCIL_BACK_FUNC: number; - TEXTURE30: number; - VIEWPORT: number; - STENCIL_BITS: number; - FLOAT: number; - COLOR_WRITEMASK: number; - SAMPLE_COVERAGE_VALUE: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - STENCIL_BACK_FAIL: number; - FLOAT_MAT4: number; - UNSIGNED_SHORT_4_4_4_4: number; - TEXTURE6: number; - RENDERBUFFER_WIDTH: number; - RGBA4: number; - ALWAYS: number; - BLEND_EQUATION_ALPHA: number; - COLOR_BUFFER_BIT: number; - TEXTURE_CUBE_MAP: number; - DEPTH_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - BLEND_EQUATION: number; - RENDERBUFFER_GREEN_SIZE: number; - NEAREST_MIPMAP_LINEAR: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - INCR_WRAP: number; - ONE_MINUS_DST_COLOR: number; - HIGH_FLOAT: number; - BYTE: number; - FRONT_FACE: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - CCW: number; - TEXTURE13: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - TEXTURE_WRAP_T: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - FLOAT_VEC2: number; - LUMINANCE: number; - GREATER: number; - INT_VEC2: number; - VALIDATE_STATUS: number; - FRAMEBUFFER: number; - FRAMEBUFFER_UNSUPPORTED: number; - TEXTURE5: number; - FUNC_SUBTRACT: number; - BLEND_DST_ALPHA: number; - SAMPLER_CUBE: number; - ONE_MINUS_DST_ALPHA: number; - LESS: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - BLUE_BITS: number; - DEPTH_TEST: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - DELETE_STATUS: number; - TEXTURE18: number; - POLYGON_OFFSET_FACTOR: number; - UNSIGNED_INT: number; - TEXTURE_2D: number; - DST_COLOR: number; - FLOAT_MAT2: number; - COMPRESSED_TEXTURE_FORMATS: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - DEPTH_STENCIL_ATTACHMENT: number; - LUMINANCE_ALPHA: number; - CW: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - LINEAR_MIPMAP_LINEAR: number; - BUFFER_SIZE: number; - SAMPLE_BUFFERS: number; - TEXTURE15: number; - ACTIVE_TEXTURE: number; - VERTEX_SHADER: number; - TEXTURE22: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - INCR: number; - COMPILE_STATUS: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - TEXTURE7: number; - UNSIGNED_SHORT_5_5_5_1: number; - DEPTH_BITS: number; - RGBA: number; - TRIANGLE_STRIP: number; - COLOR_CLEAR_VALUE: number; - BROWSER_DEFAULT_WEBGL: number; - INVALID_ENUM: number; - SCISSOR_TEST: number; - LINE_STRIP: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - STENCIL_FUNC: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - RENDERBUFFER_HEIGHT: number; - TEXTURE8: number; - TRIANGLES: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - STENCIL_BACK_VALUE_MASK: number; - TEXTURE25: number; - RENDERBUFFER: number; - LEQUAL: number; - TEXTURE1: number; - STENCIL_INDEX8: number; - FUNC_ADD: number; - STENCIL_FAIL: number; - BLEND_SRC_ALPHA: number; - BOOL: number; - ALPHA_BITS: number; - LOW_INT: number; - TEXTURE10: number; - SRC_COLOR: number; - MAX_VARYING_VECTORS: number; - BLEND_DST_RGB: number; - TEXTURE_BINDING_CUBE_MAP: number; - STENCIL_INDEX: number; - TEXTURE_BINDING_2D: number; - MEDIUM_INT: number; - SHADER_TYPE: number; - POLYGON_OFFSET_FILL: number; - DYNAMIC_DRAW: number; - TEXTURE4: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STREAM_DRAW: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - TEXTURE17: number; - TRIANGLE_FAN: number; - UNPACK_ALIGNMENT: number; - CURRENT_PROGRAM: number; - LINES: number; - INVALID_OPERATION: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - LINEAR_MIPMAP_NEAREST: number; - CLAMP_TO_EDGE: number; - RENDERBUFFER_DEPTH_SIZE: number; - TEXTURE_WRAP_S: number; - ELEMENT_ARRAY_BUFFER: number; - UNSIGNED_SHORT_5_6_5: number; - ACTIVE_UNIFORMS: number; - FLOAT_VEC3: number; - NO_ERROR: number; - ATTACHED_SHADERS: number; - DEPTH_ATTACHMENT: number; - TEXTURE11: number; - STENCIL_TEST: number; - ONE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - STATIC_DRAW: number; - GEQUAL: number; - BOOL_VEC4: number; - COLOR_ATTACHMENT0: number; - PACK_ALIGNMENT: number; - MAX_TEXTURE_SIZE: number; - STENCIL_PASS_DEPTH_FAIL: number; - CULL_FACE_MODE: number; - TEXTURE16: number; - STENCIL_BACK_WRITEMASK: number; - SRC_ALPHA: number; - UNSIGNED_SHORT: number; - TEXTURE21: number; - FUNC_REVERSE_SUBTRACT: number; - SHADING_LANGUAGE_VERSION: number; - EQUAL: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - BOOL_VEC3: number; - SAMPLER_2D: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - MAX_TEXTURE_IMAGE_UNITS: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - STENCIL_VALUE_MASK: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - ARRAY_BUFFER: number; - DEPTH_RANGE: number; - NICEST: number; - ACTIVE_ATTRIBUTES: number; - NEVER: number; - FLOAT_VEC4: number; - CURRENT_VERTEX_ATTRIB: number; - STENCIL_PASS_DEPTH_PASS: number; - INVERT: number; - LINK_STATUS: number; - RGB: number; - INT_VEC4: number; - TEXTURE2: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - MEDIUM_FLOAT: number; - SRC_ALPHA_SATURATE: number; - BUFFER_USAGE: number; - SHORT: number; - NONE: number; - UNSIGNED_BYTE: number; - INT: number; - SUBPIXEL_BITS: number; - KEEP: number; - SAMPLES: number; - FRAGMENT_SHADER: number; - LINE_WIDTH: number; - BLEND_SRC_RGB: number; - LOW_FLOAT: number; - VERSION: number; -} -declare var WebGLRenderingContext: { - DEPTH_FUNC: number; - DEPTH_COMPONENT16: number; - REPLACE: number; - REPEAT: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - STENCIL_BUFFER_BIT: number; - RENDERER: number; - STENCIL_BACK_REF: number; - TEXTURE26: number; - RGB565: number; - DITHER: number; - CONSTANT_COLOR: number; - GENERATE_MIPMAP_HINT: number; - POINTS: number; - DECR: number; - INT_VEC3: number; - TEXTURE28: number; - ONE_MINUS_CONSTANT_ALPHA: number; - BACK: number; - RENDERBUFFER_STENCIL_SIZE: number; - UNPACK_FLIP_Y_WEBGL: number; - BLEND: number; - TEXTURE9: number; - ARRAY_BUFFER_BINDING: number; - MAX_VIEWPORT_DIMS: number; - INVALID_FRAMEBUFFER_OPERATION: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE31: number; - TEXTURE24: number; - HIGH_INT: number; - RENDERBUFFER_BINDING: number; - BLEND_COLOR: number; - FASTEST: number; - STENCIL_WRITEMASK: number; - ALIASED_POINT_SIZE_RANGE: number; - TEXTURE12: number; - DST_ALPHA: number; - BLEND_EQUATION_RGB: number; - FRAMEBUFFER_COMPLETE: number; - NEAREST_MIPMAP_NEAREST: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - TEXTURE3: number; - DEPTH_WRITEMASK: number; - CONTEXT_LOST_WEBGL: number; - INVALID_VALUE: number; - TEXTURE_MAG_FILTER: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - NOTEQUAL: number; - ALPHA: number; - DEPTH_STENCIL: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - DEPTH_COMPONENT: number; - RENDERBUFFER_RED_SIZE: number; - TEXTURE20: number; - RED_BITS: number; - RENDERBUFFER_BLUE_SIZE: number; - SCISSOR_BOX: number; - VENDOR: number; - FRONT_AND_BACK: number; - CONSTANT_ALPHA: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - NEAREST: number; - CULL_FACE: number; - ALIASED_LINE_WIDTH_RANGE: number; - TEXTURE19: number; - FRONT: number; - DEPTH_CLEAR_VALUE: number; - GREEN_BITS: number; - TEXTURE29: number; - TEXTURE23: number; - MAX_RENDERBUFFER_SIZE: number; - STENCIL_ATTACHMENT: number; - TEXTURE27: number; - BOOL_VEC2: number; - OUT_OF_MEMORY: number; - MIRRORED_REPEAT: number; - POLYGON_OFFSET_UNITS: number; - TEXTURE_MIN_FILTER: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - LINE_LOOP: number; - FLOAT_MAT3: number; - TEXTURE14: number; - LINEAR: number; - RGB5_A1: number; - ONE_MINUS_SRC_COLOR: number; - SAMPLE_COVERAGE_INVERT: number; - DONT_CARE: number; - FRAMEBUFFER_BINDING: number; - RENDERBUFFER_ALPHA_SIZE: number; - STENCIL_REF: number; - ZERO: number; - DECR_WRAP: number; - SAMPLE_COVERAGE: number; - STENCIL_BACK_FUNC: number; - TEXTURE30: number; - VIEWPORT: number; - STENCIL_BITS: number; - FLOAT: number; - COLOR_WRITEMASK: number; - SAMPLE_COVERAGE_VALUE: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - STENCIL_BACK_FAIL: number; - FLOAT_MAT4: number; - UNSIGNED_SHORT_4_4_4_4: number; - TEXTURE6: number; - RENDERBUFFER_WIDTH: number; - RGBA4: number; - ALWAYS: number; - BLEND_EQUATION_ALPHA: number; - COLOR_BUFFER_BIT: number; - TEXTURE_CUBE_MAP: number; - DEPTH_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - BLEND_EQUATION: number; - RENDERBUFFER_GREEN_SIZE: number; - NEAREST_MIPMAP_LINEAR: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - INCR_WRAP: number; - ONE_MINUS_DST_COLOR: number; - HIGH_FLOAT: number; - BYTE: number; - FRONT_FACE: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - CCW: number; - TEXTURE13: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - TEXTURE_WRAP_T: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - FLOAT_VEC2: number; - LUMINANCE: number; - GREATER: number; - INT_VEC2: number; - VALIDATE_STATUS: number; - FRAMEBUFFER: number; - FRAMEBUFFER_UNSUPPORTED: number; - TEXTURE5: number; - FUNC_SUBTRACT: number; - BLEND_DST_ALPHA: number; - SAMPLER_CUBE: number; - ONE_MINUS_DST_ALPHA: number; - LESS: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - BLUE_BITS: number; - DEPTH_TEST: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - DELETE_STATUS: number; - TEXTURE18: number; - POLYGON_OFFSET_FACTOR: number; - UNSIGNED_INT: number; - TEXTURE_2D: number; - DST_COLOR: number; - FLOAT_MAT2: number; - COMPRESSED_TEXTURE_FORMATS: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - DEPTH_STENCIL_ATTACHMENT: number; - LUMINANCE_ALPHA: number; - CW: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - LINEAR_MIPMAP_LINEAR: number; - BUFFER_SIZE: number; - SAMPLE_BUFFERS: number; - TEXTURE15: number; - ACTIVE_TEXTURE: number; - VERTEX_SHADER: number; - TEXTURE22: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - INCR: number; - COMPILE_STATUS: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - TEXTURE7: number; - UNSIGNED_SHORT_5_5_5_1: number; - DEPTH_BITS: number; - RGBA: number; - TRIANGLE_STRIP: number; - COLOR_CLEAR_VALUE: number; - BROWSER_DEFAULT_WEBGL: number; - INVALID_ENUM: number; - SCISSOR_TEST: number; - LINE_STRIP: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - STENCIL_FUNC: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - RENDERBUFFER_HEIGHT: number; - TEXTURE8: number; - TRIANGLES: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - STENCIL_BACK_VALUE_MASK: number; - TEXTURE25: number; - RENDERBUFFER: number; - LEQUAL: number; - TEXTURE1: number; - STENCIL_INDEX8: number; - FUNC_ADD: number; - STENCIL_FAIL: number; - BLEND_SRC_ALPHA: number; - BOOL: number; - ALPHA_BITS: number; - LOW_INT: number; - TEXTURE10: number; - SRC_COLOR: number; - MAX_VARYING_VECTORS: number; - BLEND_DST_RGB: number; - TEXTURE_BINDING_CUBE_MAP: number; - STENCIL_INDEX: number; - TEXTURE_BINDING_2D: number; - MEDIUM_INT: number; - SHADER_TYPE: number; - POLYGON_OFFSET_FILL: number; - DYNAMIC_DRAW: number; - TEXTURE4: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STREAM_DRAW: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - TEXTURE17: number; - TRIANGLE_FAN: number; - UNPACK_ALIGNMENT: number; - CURRENT_PROGRAM: number; - LINES: number; - INVALID_OPERATION: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - LINEAR_MIPMAP_NEAREST: number; - CLAMP_TO_EDGE: number; - RENDERBUFFER_DEPTH_SIZE: number; - TEXTURE_WRAP_S: number; - ELEMENT_ARRAY_BUFFER: number; - UNSIGNED_SHORT_5_6_5: number; - ACTIVE_UNIFORMS: number; - FLOAT_VEC3: number; - NO_ERROR: number; - ATTACHED_SHADERS: number; - DEPTH_ATTACHMENT: number; - TEXTURE11: number; - STENCIL_TEST: number; - ONE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - STATIC_DRAW: number; - GEQUAL: number; - BOOL_VEC4: number; - COLOR_ATTACHMENT0: number; - PACK_ALIGNMENT: number; - MAX_TEXTURE_SIZE: number; - STENCIL_PASS_DEPTH_FAIL: number; - CULL_FACE_MODE: number; - TEXTURE16: number; - STENCIL_BACK_WRITEMASK: number; - SRC_ALPHA: number; - UNSIGNED_SHORT: number; - TEXTURE21: number; - FUNC_REVERSE_SUBTRACT: number; - SHADING_LANGUAGE_VERSION: number; - EQUAL: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - BOOL_VEC3: number; - SAMPLER_2D: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - MAX_TEXTURE_IMAGE_UNITS: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - STENCIL_VALUE_MASK: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - ARRAY_BUFFER: number; - DEPTH_RANGE: number; - NICEST: number; - ACTIVE_ATTRIBUTES: number; - NEVER: number; - FLOAT_VEC4: number; - CURRENT_VERTEX_ATTRIB: number; - STENCIL_PASS_DEPTH_PASS: number; - INVERT: number; - LINK_STATUS: number; - RGB: number; - INT_VEC4: number; - TEXTURE2: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - MEDIUM_FLOAT: number; - SRC_ALPHA_SATURATE: number; - BUFFER_USAGE: number; - SHORT: number; - NONE: number; - UNSIGNED_BYTE: number; - INT: number; - SUBPIXEL_BITS: number; - KEEP: number; - SAMPLES: number; - FRAGMENT_SHADER: number; - LINE_WIDTH: number; - BLEND_SRC_RGB: number; - LOW_FLOAT: number; - VERSION: number; +interface HTMLElement extends Element, ElementCSSInlineStyle, MSEventAttachmentTarget, MSNodeExtensions { + hidden: any; + readyState: any; + onmouseleave: (ev: MouseEvent) => any; + onbeforecut: (ev: DragEvent) => any; + onkeydown: (ev: KeyboardEvent) => any; + onmove: (ev: MSEventObj) => any; + onkeyup: (ev: KeyboardEvent) => any; + onreset: (ev: Event) => any; + onhelp: (ev: Event) => any; + ondragleave: (ev: DragEvent) => any; + className: string; + onfocusin: (ev: FocusEvent) => any; + onseeked: (ev: Event) => any; + recordNumber: any; + title: string; + parentTextEdit: Element; + outerHTML: string; + ondurationchange: (ev: Event) => any; + offsetHeight: number; + all: HTMLCollection; + onblur: (ev: FocusEvent) => any; + dir: string; + onemptied: (ev: Event) => any; + onseeking: (ev: Event) => any; + oncanplay: (ev: Event) => any; + ondeactivate: (ev: UIEvent) => any; + ondatasetchanged: (ev: MSEventObj) => any; + onrowsdelete: (ev: MSEventObj) => any; + sourceIndex: number; + onloadstart: (ev: Event) => any; + onlosecapture: (ev: MSEventObj) => any; + ondragenter: (ev: DragEvent) => any; + oncontrolselect: (ev: MSEventObj) => any; + onsubmit: (ev: Event) => any; + behaviorUrns: MSBehaviorUrnsCollection; + scopeName: string; + onchange: (ev: Event) => any; + id: string; + onlayoutcomplete: (ev: MSEventObj) => any; + uniqueID: string; + onbeforeactivate: (ev: UIEvent) => any; + oncanplaythrough: (ev: Event) => any; + onbeforeupdate: (ev: MSEventObj) => any; + onfilterchange: (ev: MSEventObj) => any; + offsetParent: Element; + ondatasetcomplete: (ev: MSEventObj) => any; + onsuspend: (ev: Event) => any; + onmouseenter: (ev: MouseEvent) => any; + innerText: string; + onerrorupdate: (ev: MSEventObj) => any; + onmouseout: (ev: MouseEvent) => any; + parentElement: HTMLElement; + onmousewheel: (ev: MouseWheelEvent) => any; + onvolumechange: (ev: Event) => any; + oncellchange: (ev: MSEventObj) => any; + onrowexit: (ev: MSEventObj) => any; + onrowsinserted: (ev: MSEventObj) => any; + onpropertychange: (ev: MSEventObj) => any; + filters: any; + children: HTMLCollection; + ondragend: (ev: DragEvent) => any; + onbeforepaste: (ev: DragEvent) => any; + ondragover: (ev: DragEvent) => any; + offsetTop: number; + onmouseup: (ev: MouseEvent) => any; + ondragstart: (ev: DragEvent) => any; + onbeforecopy: (ev: DragEvent) => any; + ondrag: (ev: DragEvent) => any; + innerHTML: string; + onmouseover: (ev: MouseEvent) => any; + lang: string; + uniqueNumber: number; + onpause: (ev: Event) => any; + tagUrn: string; + onmousedown: (ev: MouseEvent) => any; + onclick: (ev: MouseEvent) => any; + onwaiting: (ev: Event) => any; + onresizestart: (ev: MSEventObj) => any; + offsetLeft: number; + isTextEdit: boolean; + isDisabled: boolean; + onpaste: (ev: DragEvent) => any; + canHaveHTML: boolean; + onmoveend: (ev: MSEventObj) => any; + language: string; + onstalled: (ev: Event) => any; + onmousemove: (ev: MouseEvent) => any; + style: MSStyleCSSProperties; + isContentEditable: boolean; + onbeforeeditfocus: (ev: MSEventObj) => any; + onratechange: (ev: Event) => any; + contentEditable: string; + tabIndex: number; + document: Document; + onprogress: (ev: ProgressEvent) => any; + ondblclick: (ev: MouseEvent) => any; + oncontextmenu: (ev: MouseEvent) => any; + onloadedmetadata: (ev: Event) => any; + onafterupdate: (ev: MSEventObj) => any; + onerror: (ev: ErrorEvent) => any; + onplay: (ev: Event) => any; + onresizeend: (ev: MSEventObj) => any; + onplaying: (ev: Event) => any; + isMultiLine: boolean; + onfocusout: (ev: FocusEvent) => any; + onabort: (ev: UIEvent) => any; + ondataavailable: (ev: MSEventObj) => any; + hideFocus: boolean; + onreadystatechange: (ev: Event) => any; + onkeypress: (ev: KeyboardEvent) => any; + onloadeddata: (ev: Event) => any; + onbeforedeactivate: (ev: UIEvent) => any; + outerText: string; + disabled: boolean; + onactivate: (ev: UIEvent) => any; + accessKey: string; + onmovestart: (ev: MSEventObj) => any; + onselectstart: (ev: Event) => any; + onfocus: (ev: FocusEvent) => any; + ontimeupdate: (ev: Event) => any; + onresize: (ev: UIEvent) => any; + oncut: (ev: DragEvent) => any; + onselect: (ev: UIEvent) => any; + ondrop: (ev: DragEvent) => any; + offsetWidth: number; + oncopy: (ev: DragEvent) => any; + onended: (ev: Event) => any; + onscroll: (ev: UIEvent) => any; + onrowenter: (ev: MSEventObj) => any; + onload: (ev: Event) => any; + canHaveChildren: boolean; + oninput: (ev: Event) => any; + onmscontentzoom: (ev: MSEventObj) => any; + oncuechange: (ev: Event) => any; + spellcheck: boolean; + classList: DOMTokenList; + onmsmanipulationstatechanged: (ev: any) => any; + draggable: boolean; + dataset: DOMStringMap; + dragDrop(): boolean; + scrollIntoView(top?: boolean): void; + addFilter(filter: any): void; + setCapture(containerCapture?: boolean): void; + focus(): void; + getAdjacentText(where: string): string; + insertAdjacentText(where: string, text: string): void; + getElementsByClassName(classNames: string): NodeList; + setActive(): void; + removeFilter(filter: any): void; + blur(): void; + clearAttributes(): void; + releaseCapture(): void; + createControlRange(): ControlRangeCollection; + removeBehavior(cookie: number): boolean; + contains(child: HTMLElement): boolean; + click(): void; + insertAdjacentElement(position: string, insertedElement: Element): Element; + mergeAttributes(source: HTMLElement, preserveIdentity?: boolean): void; + replaceAdjacentText(where: string, newText: string): string; + applyElement(apply: Element, where?: string): Element; + addBehavior(bstrUrl: string, factory?: any): number; + insertAdjacentHTML(where: string, html: string): void; + msGetInputContext(): MSInputMethodContext; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface Document extends Node, NodeSelector, MSEventAttachmentTarget, DocumentEvent, MSResourceMetadata, MSNodeExtensions, MSDocumentExtensions, GlobalEventHandlers { + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Retrieves the collection of user agents and versions declared in the X-UA-Compatible + */ + compatible: MSCompatibleInfoCollection; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (ev: KeyboardEvent) => any; + /** + * Gets the implementation object of the current document. + */ + implementation: DOMImplementation; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (ev: Event) => any; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollection; + /** + * Fires when the user presses the F1 key while the browser is the active window. + * @param ev The event. + */ + onhelp: (ev: Event) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (ev: DragEvent) => any; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Fires for an element just prior to setting focus on that element. + * @param ev The focus event + */ + onfocusin: (ev: FocusEvent) => any; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (ev: Event) => any; + security: string; + /** + * Contains the title of the document. + */ + title: string; + /** + * Retrieves a collection of namespace objects. + */ + namespaces: MSNamespaceInfoCollection; + /** + * Gets the default character set from the current regional language settings. + */ + defaultCharset: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollection; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + styleSheets: StyleSheetList; + /** + * Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window. + */ + frames: Window; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (ev: Event) => any; + /** + * Returns a reference to the collection of elements contained by the object. + */ + all: HTMLCollection; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollection; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (ev: FocusEvent) => any; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (ev: Event) => any; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (ev: Event) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (ev: UIEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (ev: Event) => any; + /** + * Fires when the data set exposed by a data source object changes. + * @param ev The event. + */ + ondatasetchanged: (ev: MSEventObj) => any; + /** + * Fires when rows are about to be deleted from the recordset. + * @param ev The event + */ + onrowsdelete: (ev: MSEventObj) => any; + Script: MSScriptHost; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (ev: Event) => any; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + URLUnencoded: string; + defaultView: Window; + /** + * Fires when the user is about to make a control selection of the object. + * @param ev The event. + */ + oncontrolselect: (ev: MSEventObj) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (ev: DragEvent) => any; + onsubmit: (ev: Event) => any; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + inputEncoding: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + activeElement: Element; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (ev: Event) => any; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollection; + /** + * Retrieves an autogenerated, unique identifier for the object. + */ + uniqueID: string; + /** + * Sets or gets the URL for the current document. + */ + URL: string; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (ev: UIEvent) => any; + head: HTMLHeadElement; + cookie: string; + xmlEncoding: string; + oncanplaythrough: (ev: Event) => any; + /** + * Retrieves the document compatibility mode of the document. + */ + documentMode: number; + characterSet: string; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollection; + onbeforeupdate: (ev: MSEventObj) => any; + /** + * Fires to indicate that all data is available from the data source object. + * @param ev The event. + */ + ondatasetcomplete: (ev: MSEventObj) => any; + plugins: HTMLCollection; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (ev: Event) => any; + /** + * Gets the root svg element in the document hierarchy. + */ + rootElement: SVGSVGElement; + /** + * Retrieves a value that indicates the current state of the object. + */ + readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + referrer: string; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Fires on a databound object when an error occurs while updating the associated data in the data source object. + * @param ev The event. + */ + onerrorupdate: (ev: MSEventObj) => any; + /** + * Gets a reference to the container object of the window. + */ + parentWindow: Window; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (ev: MouseEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (ev: MSSiteModeEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (ev: MouseWheelEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (ev: Event) => any; + /** + * Fires when data changes in the data provider. + * @param ev The event. + */ + oncellchange: (ev: MSEventObj) => any; + /** + * Fires just before the data source control changes the current row in the object. + * @param ev The event. + */ + onrowexit: (ev: MSEventObj) => any; + /** + * Fires just after new rows are inserted in the current recordset. + * @param ev The event. + */ + onrowsinserted: (ev: MSEventObj) => any; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string; + msCapsLockWarningOff: boolean; + /** + * Fires when a property changes on the object. + * @param ev The event. + */ + onpropertychange: (ev: MSEventObj) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (ev: DragEvent) => any; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + doctype: DocumentType; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (ev: DragEvent) => any; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (ev: DragEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (ev: MouseEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (ev: DragEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (ev: MouseEvent) => any; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (ev: MouseEvent) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (ev: MouseEvent) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (ev: Event) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollection; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + xmlStandalone: boolean; + /** + * Represents the active selection, which is a highlighted block of text or other elements in the document that a user or a script can carry out some action on. + */ + selection: MSSelection; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (ev: Event) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (ev: MouseEvent) => any; + /** + * Fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected. + * @param ev The event. + */ + onbeforeeditfocus: (ev: MSEventObj) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (ev: ProgressEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (ev: MouseEvent) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (ev: Event) => any; + media: string; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (ev: ErrorEvent) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (ev: Event) => any; + onafterupdate: (ev: MSEventObj) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (ev: Event) => any; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollection; + /** + * Contains information about the current URL. + */ + location: Location; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (ev: UIEvent) => any; + /** + * Fires for the current element with focus immediately after moving focus to another element. + * @param ev The event. + */ + onfocusout: (ev: FocusEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; + /** + * Fires when a local DOM Storage area is written to disk. + * @param ev The event. + */ + onstoragecommit: (ev: StorageEvent) => any; + /** + * Fires periodically as data arrives from data source objects that asynchronously transmit their data. + * @param ev The event. + */ + ondataavailable: (ev: MSEventObj) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (ev: Event) => any; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + lastModified: string; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (ev: KeyboardEvent) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (ev: Event) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (ev: UIEvent) => any; + onselectstart: (ev: Event) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (ev: FocusEvent) => any; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (ev: UIEvent) => any; + ondrop: (ev: DragEvent) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (ev: Event) => any; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + compatMode: string; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (ev: UIEvent) => any; + /** + * Fires to indicate that the current row has changed in the data source and new data values are available on the object. + * @param ev The event. + */ + onrowenter: (ev: MSEventObj) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (ev: Event) => any; + oninput: (ev: Event) => any; + onmspointerdown: (ev: any) => any; + msHidden: boolean; + msVisibilityState: string; + onmsgesturedoubletap: (ev: any) => any; + visibilityState: string; + onmsmanipulationstatechanged: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmscontentzoom: (ev: MSEventObj) => any; + onmspointermove: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + onmsinertiastart: (ev: any) => any; + msCSSOMElementFloatMetrics: boolean; + onmspointerover: (ev: any) => any; + hidden: boolean; + onmspointerup: (ev: any) => any; + msFullscreenEnabled: boolean; + onmsfullscreenerror: (ev: any) => any; + onmspointerenter: (ev: any) => any; + msFullscreenElement: Element; + onmsfullscreenchange: (ev: any) => any; + onmspointerleave: (ev: any) => any; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + adoptNode(source: Node): Node; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + createCDATASection(data: string): CDATASection; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: "a"): HTMLAnchorElement; + createElement(tagName: "abbr"): HTMLPhraseElement; + createElement(tagName: "acronym"): HTMLPhraseElement; + createElement(tagName: "address"): HTMLBlockElement; + createElement(tagName: "applet"): HTMLAppletElement; + createElement(tagName: "area"): HTMLAreaElement; + createElement(tagName: "article"): HTMLElement; + createElement(tagName: "aside"): HTMLElement; + createElement(tagName: "audio"): HTMLAudioElement; + createElement(tagName: "b"): HTMLPhraseElement; + createElement(tagName: "base"): HTMLBaseElement; + createElement(tagName: "basefont"): HTMLBaseFontElement; + createElement(tagName: "bdo"): HTMLPhraseElement; + createElement(tagName: "bgsound"): HTMLBGSoundElement; + createElement(tagName: "big"): HTMLPhraseElement; + createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "body"): HTMLBodyElement; + createElement(tagName: "br"): HTMLBRElement; + createElement(tagName: "button"): HTMLButtonElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: "caption"): HTMLTableCaptionElement; + createElement(tagName: "center"): HTMLBlockElement; + createElement(tagName: "cite"): HTMLPhraseElement; + createElement(tagName: "code"): HTMLPhraseElement; + createElement(tagName: "col"): HTMLTableColElement; + createElement(tagName: "colgroup"): HTMLTableColElement; + createElement(tagName: "datalist"): HTMLDataListElement; + createElement(tagName: "dd"): HTMLDDElement; + createElement(tagName: "del"): HTMLModElement; + createElement(tagName: "dfn"): HTMLPhraseElement; + createElement(tagName: "dir"): HTMLDirectoryElement; + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "dl"): HTMLDListElement; + createElement(tagName: "dt"): HTMLDTElement; + createElement(tagName: "em"): HTMLPhraseElement; + createElement(tagName: "embed"): HTMLEmbedElement; + createElement(tagName: "fieldset"): HTMLFieldSetElement; + createElement(tagName: "figcaption"): HTMLElement; + createElement(tagName: "figure"): HTMLElement; + createElement(tagName: "font"): HTMLFontElement; + createElement(tagName: "footer"): HTMLElement; + createElement(tagName: "form"): HTMLFormElement; + createElement(tagName: "frame"): HTMLFrameElement; + createElement(tagName: "frameset"): HTMLFrameSetElement; + createElement(tagName: "h1"): HTMLHeadingElement; + createElement(tagName: "h2"): HTMLHeadingElement; + createElement(tagName: "h3"): HTMLHeadingElement; + createElement(tagName: "h4"): HTMLHeadingElement; + createElement(tagName: "h5"): HTMLHeadingElement; + createElement(tagName: "h6"): HTMLHeadingElement; + createElement(tagName: "head"): HTMLHeadElement; + createElement(tagName: "header"): HTMLElement; + createElement(tagName: "hgroup"): HTMLElement; + createElement(tagName: "hr"): HTMLHRElement; + createElement(tagName: "html"): HTMLHtmlElement; + createElement(tagName: "i"): HTMLPhraseElement; + createElement(tagName: "iframe"): HTMLIFrameElement; + createElement(tagName: "img"): HTMLImageElement; + createElement(tagName: "input"): HTMLInputElement; + createElement(tagName: "ins"): HTMLModElement; + createElement(tagName: "isindex"): HTMLIsIndexElement; + createElement(tagName: "kbd"): HTMLPhraseElement; + createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "label"): HTMLLabelElement; + createElement(tagName: "legend"): HTMLLegendElement; + createElement(tagName: "li"): HTMLLIElement; + createElement(tagName: "link"): HTMLLinkElement; + createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "map"): HTMLMapElement; + createElement(tagName: "mark"): HTMLElement; + createElement(tagName: "marquee"): HTMLMarqueeElement; + createElement(tagName: "menu"): HTMLMenuElement; + createElement(tagName: "meta"): HTMLMetaElement; + createElement(tagName: "nav"): HTMLElement; + createElement(tagName: "nextid"): HTMLNextIdElement; + createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "noframes"): HTMLElement; + createElement(tagName: "noscript"): HTMLElement; + createElement(tagName: "object"): HTMLObjectElement; + createElement(tagName: "ol"): HTMLOListElement; + createElement(tagName: "optgroup"): HTMLOptGroupElement; + createElement(tagName: "option"): HTMLOptionElement; + createElement(tagName: "p"): HTMLParagraphElement; + createElement(tagName: "param"): HTMLParamElement; + createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "pre"): HTMLPreElement; + createElement(tagName: "progress"): HTMLProgressElement; + createElement(tagName: "q"): HTMLQuoteElement; + createElement(tagName: "rt"): HTMLPhraseElement; + createElement(tagName: "ruby"): HTMLPhraseElement; + createElement(tagName: "s"): HTMLPhraseElement; + createElement(tagName: "samp"): HTMLPhraseElement; + createElement(tagName: "script"): HTMLScriptElement; + createElement(tagName: "section"): HTMLElement; + createElement(tagName: "select"): HTMLSelectElement; + createElement(tagName: "small"): HTMLPhraseElement; + createElement(tagName: "SOURCE"): HTMLSourceElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "strike"): HTMLPhraseElement; + createElement(tagName: "strong"): HTMLPhraseElement; + createElement(tagName: "style"): HTMLStyleElement; + createElement(tagName: "sub"): HTMLPhraseElement; + createElement(tagName: "sup"): HTMLPhraseElement; + createElement(tagName: "table"): HTMLTableElement; + createElement(tagName: "tbody"): HTMLTableSectionElement; + createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "textarea"): HTMLTextAreaElement; + createElement(tagName: "tfoot"): HTMLTableSectionElement; + createElement(tagName: "th"): HTMLTableHeaderCellElement; + createElement(tagName: "thead"): HTMLTableSectionElement; + createElement(tagName: "title"): HTMLTitleElement; + createElement(tagName: "tr"): HTMLTableRowElement; + createElement(tagName: "track"): HTMLTrackElement; + createElement(tagName: "tt"): HTMLPhraseElement; + createElement(tagName: "u"): HTMLPhraseElement; + createElement(tagName: "ul"): HTMLUListElement; + createElement(tagName: "var"): HTMLPhraseElement; + createElement(tagName: "video"): HTMLVideoElement; + createElement(tagName: "wbr"): HTMLElement; + createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; + createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: string): HTMLElement; + /** + * Removes mouse capture from the object in the current document. + */ + releaseCapture(): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): void; + createElementNS(namespaceURI: string, qualifiedName: string): Element; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): any; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): TreeWalker; + createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + getElementsByClassName(classNames: string): NodeList; + importNode(importedNode: Node, deep: boolean): Node; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Fires a specified event on the object. + * @param eventName Specifies the name of the event to fire. + * @param eventObj Object that specifies the event object from which to obtain event object properties. + */ + fireEvent(eventName: string, eventObj?: any): boolean; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "bgsound"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "SOURCE"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeList; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates a style sheet for the document. + * @param href Specifies how to add the style sheet to the document. If a file name is specified for the URL, the style information is added as a link object. If the URL contains style information, it is added to the style object. + * @param index Specifies the index that indicates where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style sheet at the end of the collection. + */ + createStyleSheet(href?: string, index?: number): CSSStyleSheet; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeList; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): NodeIterator; + /** + * Generates an event object to pass event context information when you use the fireEvent method. + * @param eventObj An object that specifies an existing event object on which to base the new object. + */ + createEventObject(eventObj?: any): MSEventObj; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + msElementsFromPoint(x: number, y: number): NodeList; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + clear(): void; + msExitFullscreen(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storagecommit", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msfullscreenerror", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msfullscreenchange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Document: { + prototype: Document; + new(): Document; +} + +interface Console { + info(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; + error(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + profile(reportName?: string): void; + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + clear(): void; + dir(value?: any, ...optionalParams: any[]): void; + profileEnd(): void; + count(countTitle?: string): void; + groupEnd(): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(): void; + group(groupTitle?: string): void; + dirxml(value: any): void; + debug(message?: string, ...optionalParams: any[]): void; + groupCollapsed(groupTitle?: string): void; + select(element: Element): void; +} +declare var Console: { + prototype: Console; + new(): Console; +} + +interface MSEventObj extends Event { + nextPage: string; + keyCode: number; + toElement: Element; + returnValue: any; + dataFld: string; + y: number; + dataTransfer: DataTransfer; + propertyName: string; + url: string; + offsetX: number; + recordset: any; + screenX: number; + buttonID: number; + wheelDelta: number; + reason: number; + origin: string; + data: string; + srcFilter: any; + boundElements: HTMLCollection; + cancelBubble: boolean; + altLeft: boolean; + behaviorCookie: number; + bookmarks: BookmarkCollection; + type: string; + repeat: boolean; + srcElement: Element; + source: Window; + fromElement: Element; + offsetY: number; + x: number; + behaviorPart: number; + qualifier: string; + altKey: boolean; + ctrlKey: boolean; + clientY: number; + shiftKey: boolean; + shiftLeft: boolean; + contentOverflow: boolean; + screenY: number; + ctrlLeft: boolean; + button: number; + srcUrn: string; + clientX: number; + actionURL: string; + getAttribute(strAttributeName: string, lFlags?: number): any; + setAttribute(strAttributeName: string, AttributeValue: any, lFlags?: number): void; + removeAttribute(strAttributeName: string, lFlags?: number): boolean; +} +declare var MSEventObj: { + prototype: MSEventObj; + new(): MSEventObj; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: string, ...args: any[]): any; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. + */ + toDataURL(type?: string, ...args: any[]): string; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; +} +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface Window extends EventTarget, MSEventAttachmentTarget, WindowLocalStorage, MSWindowExtensions, WindowSessionStorage, WindowTimers, WindowBase64, IDBEnvironment, WindowConsole, GlobalEventHandlers { + ondragend: (ev: DragEvent) => any; + onkeydown: (ev: KeyboardEvent) => any; + ondragover: (ev: DragEvent) => any; + onkeyup: (ev: KeyboardEvent) => any; + onreset: (ev: Event) => any; + onmouseup: (ev: MouseEvent) => any; + ondragstart: (ev: DragEvent) => any; + ondrag: (ev: DragEvent) => any; + screenX: number; + onmouseover: (ev: MouseEvent) => any; + ondragleave: (ev: DragEvent) => any; + history: History; + pageXOffset: number; + name: string; + onafterprint: (ev: Event) => any; + onpause: (ev: Event) => any; + onbeforeprint: (ev: Event) => any; + top: Window; + onmousedown: (ev: MouseEvent) => any; + onseeked: (ev: Event) => any; + opener: Window; + onclick: (ev: MouseEvent) => any; + innerHeight: number; + onwaiting: (ev: Event) => any; + ononline: (ev: Event) => any; + ondurationchange: (ev: Event) => any; + frames: Window; + onblur: (ev: FocusEvent) => any; + onemptied: (ev: Event) => any; + onseeking: (ev: Event) => any; + oncanplay: (ev: Event) => any; + outerWidth: number; + onstalled: (ev: Event) => any; + onmousemove: (ev: MouseEvent) => any; + innerWidth: number; + onoffline: (ev: Event) => any; + length: number; + screen: Screen; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + onratechange: (ev: Event) => any; + onstorage: (ev: StorageEvent) => any; + onloadstart: (ev: Event) => any; + ondragenter: (ev: DragEvent) => any; + onsubmit: (ev: Event) => any; + self: Window; + document: Document; + onprogress: (ev: ProgressEvent) => any; + ondblclick: (ev: MouseEvent) => any; + pageYOffset: number; + oncontextmenu: (ev: MouseEvent) => any; + onchange: (ev: Event) => any; + onloadedmetadata: (ev: Event) => any; + onplay: (ev: Event) => any; + onerror: ErrorEventHandler; + onplaying: (ev: Event) => any; + parent: Window; + location: Location; + oncanplaythrough: (ev: Event) => any; + onabort: (ev: UIEvent) => any; + onreadystatechange: (ev: Event) => any; + outerHeight: number; + onkeypress: (ev: KeyboardEvent) => any; + frameElement: Element; + onloadeddata: (ev: Event) => any; + onsuspend: (ev: Event) => any; + window: Window; + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + ontimeupdate: (ev: Event) => any; + onresize: (ev: UIEvent) => any; + onselect: (ev: UIEvent) => any; + navigator: Navigator; + styleMedia: StyleMedia; + ondrop: (ev: DragEvent) => any; + onmouseout: (ev: MouseEvent) => any; + onended: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onunload: (ev: Event) => any; + onscroll: (ev: UIEvent) => any; + screenY: number; + onmousewheel: (ev: MouseWheelEvent) => any; + onload: (ev: Event) => any; + onvolumechange: (ev: Event) => any; + oninput: (ev: Event) => any; + performance: Performance; + onmspointerdown: (ev: any) => any; + animationStartTime: number; + onmsgesturedoubletap: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmspointermove: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + msAnimationStartTime: number; + applicationCache: ApplicationCache; + onmsinertiastart: (ev: any) => any; + onmspointerover: (ev: any) => any; + onpopstate: (ev: PopStateEvent) => any; + onmspointerup: (ev: any) => any; + onpageshow: (ev: PageTransitionEvent) => any; + ondevicemotion: (ev: DeviceMotionEvent) => any; + devicePixelRatio: number; + msCrypto: Crypto; + ondeviceorientation: (ev: DeviceOrientationEvent) => any; + doNotTrack: string; + onmspointerenter: (ev: any) => any; + onpagehide: (ev: PageTransitionEvent) => any; + onmspointerleave: (ev: any) => any; + alert(message?: any): void; + scroll(x?: number, y?: number): void; + focus(): void; + scrollTo(x?: number, y?: number): void; + print(): void; + prompt(message?: string, _default?: string): string; + toString(): string; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + scrollBy(x?: number, y?: number): void; + confirm(message?: string): boolean; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; + showModalDialog(url?: string, argument?: any, options?: any): any; + blur(): void; + getSelection(): Selection; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + msCancelRequestAnimationFrame(handle: number): void; + matchMedia(mediaQuery: string): MediaQueryList; + cancelAnimationFrame(handle: number): void; + msIsStaticHTML(html: string): boolean; + msMatchMedia(mediaQuery: string): MediaQueryList; + requestAnimationFrame(callback: FrameRequestCallback): number; + msRequestAnimationFrame(callback: FrameRequestCallback): number; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Window: { + prototype: Window; + new(): Window; +} + +interface HTMLCollection extends MSHTMLCollectionExtensions { + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Retrieves an object from various collections. + */ + item(nameOrIndex?: any, optionalIndex?: any): Element; + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element; + // [name: string]: Element; + [index: number]: Element; +} +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface Blob { + type: string; + size: number; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; + msClose(): void; +} +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface NavigatorID { + appVersion: string; + appName: string; + userAgent: string; + platform: string; + product: string; + vendor: string; +} + +interface HTMLTableElement extends HTMLElement, MSDataBindingTableExtensions, MSDataBindingExtensions, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollection; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollection; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Retrieves a collection of all cells in the table row or in the entire table. + */ + cells: HTMLCollection; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLElement; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLElement; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLElement; + /** + * Moves a table row to a new position. + * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. + * @param indexTo Number that specifies where the row is moved within the rows collection. + */ + moveRow(indexFrom?: number, indexTo?: number): any; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLElement; +} +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface TreeWalker { + whatToShow: number; + filter: NodeFilter; + root: Node; + currentNode: Node; + expandEntityReferences: boolean; + previousSibling(): Node; + lastChild(): Node; + nextSibling(): Node; + nextNode(): Node; + parentNode(): Node; + firstChild(): Node; + previousNode(): Node; +} +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + y: number; + y1: number; + x: number; + x1: number; +} +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface Performance { + navigation: PerformanceNavigation; + timing: PerformanceTiming; + getEntriesByType(entryType: string): any; + toJSON(): any; + getMeasures(measureName?: string): any; + clearMarks(markName?: string): void; + getMarks(markName?: string): any; + clearResourceTimings(): void; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + getEntriesByName(name: string, entryType?: string): any; + getEntries(): any; + clearMeasures(measureName?: string): void; + setResourceTimingBufferSize(maxSize: number): void; + now(): number; +} +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface MSDataBindingTableExtensions { + dataPageSize: number; + nextPage(): void; + firstPage(): void; + refresh(): void; + previousPage(): void; + lastPage(): void; +} + +interface CompositionEvent extends UIEvent { + data: string; + locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} +declare var CompositionEvent: { + prototype: CompositionEvent; + new(): CompositionEvent; +} + +interface WindowTimers extends WindowTimersExtension { + clearTimeout(handle: number): void; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; + clearInterval(handle: number): void; + setInterval(handler: any, timeout?: any, ...args: any[]): number; +} + +interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { + orientType: SVGAnimatedEnumeration; + markerUnits: SVGAnimatedEnumeration; + markerWidth: SVGAnimatedLength; + markerHeight: SVGAnimatedLength; + orientAngle: SVGAnimatedAngle; + refY: SVGAnimatedLength; + refX: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + SVG_MARKER_ORIENT_UNKNOWN: number; + SVG_MARKER_ORIENT_ANGLE: number; + SVG_MARKERUNITS_UNKNOWN: number; + SVG_MARKERUNITS_STROKEWIDTH: number; + SVG_MARKER_ORIENT_AUTO: number; + SVG_MARKERUNITS_USERSPACEONUSE: number; +} +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + SVG_MARKER_ORIENT_UNKNOWN: number; + SVG_MARKER_ORIENT_ANGLE: number; + SVG_MARKERUNITS_UNKNOWN: number; + SVG_MARKERUNITS_STROKEWIDTH: number; + SVG_MARKER_ORIENT_AUTO: number; + SVG_MARKERUNITS_USERSPACEONUSE: number; +} + +interface CSSStyleDeclaration { + backgroundAttachment: string; + visibility: string; + textAlignLast: string; + borderRightStyle: string; + counterIncrement: string; + orphans: string; + cssText: string; + borderStyle: string; + pointerEvents: string; + borderTopColor: string; + markerEnd: string; + textIndent: string; + listStyleImage: string; + cursor: string; + listStylePosition: string; + wordWrap: string; + borderTopStyle: string; + alignmentBaseline: string; + opacity: string; + direction: string; + strokeMiterlimit: string; + maxWidth: string; + color: string; + clip: string; + borderRightWidth: string; + verticalAlign: string; + overflow: string; + mask: string; + borderLeftStyle: string; + emptyCells: string; + stopOpacity: string; + paddingRight: string; + parentRule: CSSRule; + background: string; + boxSizing: string; + textJustify: string; + height: string; + paddingTop: string; + length: number; + right: string; + baselineShift: string; + borderLeft: string; + widows: string; + lineHeight: string; + left: string; + textUnderlinePosition: string; + glyphOrientationHorizontal: string; + display: string; + textAnchor: string; + cssFloat: string; + strokeDasharray: string; + rubyAlign: string; + fontSizeAdjust: string; + borderLeftColor: string; + backgroundImage: string; + listStyleType: string; + strokeWidth: string; + textOverflow: string; + fillRule: string; + borderBottomColor: string; + zIndex: string; + position: string; + listStyle: string; + msTransformOrigin: string; + dominantBaseline: string; + overflowY: string; + fill: string; + captionSide: string; + borderCollapse: string; + boxShadow: string; + quotes: string; + tableLayout: string; + unicodeBidi: string; + borderBottomWidth: string; + backgroundSize: string; + textDecoration: string; + strokeDashoffset: string; + fontSize: string; + border: string; + pageBreakBefore: string; + borderTopRightRadius: string; + msTransform: string; + borderBottomLeftRadius: string; + textTransform: string; + rubyPosition: string; + strokeLinejoin: string; + clipPath: string; + borderRightColor: string; + fontFamily: string; + clear: string; + content: string; + backgroundClip: string; + marginBottom: string; + counterReset: string; + outlineWidth: string; + marginRight: string; + paddingLeft: string; + borderBottom: string; + wordBreak: string; + marginTop: string; + top: string; + fontWeight: string; + borderRight: string; + width: string; + kerning: string; + pageBreakAfter: string; + borderBottomStyle: string; + fontStretch: string; + padding: string; + strokeOpacity: string; + markerStart: string; + bottom: string; + borderLeftWidth: string; + clipRule: string; + backgroundPosition: string; + backgroundColor: string; + pageBreakInside: string; + backgroundOrigin: string; + strokeLinecap: string; + borderTopWidth: string; + outlineStyle: string; + borderTop: string; + outlineColor: string; + paddingBottom: string; + marginLeft: string; + font: string; + outline: string; + wordSpacing: string; + maxHeight: string; + fillOpacity: string; + letterSpacing: string; + borderSpacing: string; + backgroundRepeat: string; + borderRadius: string; + borderWidth: string; + borderBottomRightRadius: string; + whiteSpace: string; + fontStyle: string; + minWidth: string; + stopColor: string; + borderTopLeftRadius: string; + borderColor: string; + marker: string; + glyphOrientationVertical: string; + markerMid: string; + fontVariant: string; + minHeight: string; + stroke: string; + rubyOverhang: string; + overflowX: string; + textAlign: string; + margin: string; + animationFillMode: string; + floodColor: string; + animationIterationCount: string; + textShadow: string; + backfaceVisibility: string; + msAnimationIterationCount: string; + animationDelay: string; + animationTimingFunction: string; + columnWidth: any; + msScrollSnapX: string; + columnRuleColor: any; + columnRuleWidth: any; + transitionDelay: string; + transition: string; + msFlowFrom: string; + msScrollSnapType: string; + msContentZoomSnapType: string; + msGridColumns: string; + msAnimationName: string; + msGridRowAlign: string; + msContentZoomChaining: string; + msGridColumn: any; + msHyphenateLimitZone: any; + msScrollRails: string; + msAnimationDelay: string; + enableBackground: string; + msWrapThrough: string; + columnRuleStyle: string; + msAnimation: string; + msFlexFlow: string; + msScrollSnapY: string; + msHyphenateLimitLines: any; + msTouchAction: string; + msScrollLimit: string; + animation: string; + transform: string; + filter: string; + colorInterpolationFilters: string; + transitionTimingFunction: string; + msBackfaceVisibility: string; + animationPlayState: string; + transformOrigin: string; + msScrollLimitYMin: any; + msFontFeatureSettings: string; + msContentZoomLimitMin: any; + columnGap: any; + transitionProperty: string; + msAnimationDuration: string; + msAnimationFillMode: string; + msFlexDirection: string; + msTransitionDuration: string; + fontFeatureSettings: string; + breakBefore: string; + msFlexWrap: string; + perspective: string; + msFlowInto: string; + msTransformStyle: string; + msScrollTranslation: string; + msTransitionProperty: string; + msUserSelect: string; + msOverflowStyle: string; + msScrollSnapPointsY: string; + animationDirection: string; + animationDuration: string; + msFlex: string; + msTransitionTimingFunction: string; + animationName: string; + columnRule: string; + msGridColumnSpan: any; + msFlexNegative: string; + columnFill: string; + msGridRow: any; + msFlexOrder: string; + msFlexItemAlign: string; + msFlexPositive: string; + msContentZoomLimitMax: any; + msScrollLimitYMax: any; + msGridColumnAlign: string; + perspectiveOrigin: string; + lightingColor: string; + columns: string; + msScrollChaining: string; + msHyphenateLimitChars: string; + msTouchSelect: string; + floodOpacity: string; + msAnimationDirection: string; + msAnimationPlayState: string; + columnSpan: string; + msContentZooming: string; + msPerspective: string; + msFlexPack: string; + msScrollSnapPointsX: string; + msContentZoomSnapPoints: string; + msGridRowSpan: any; + msContentZoomSnap: string; + msScrollLimitXMin: any; + breakInside: string; + msHighContrastAdjust: string; + msFlexLinePack: string; + msGridRows: string; + transitionDuration: string; + msHyphens: string; + breakAfter: string; + msTransition: string; + msPerspectiveOrigin: string; + msContentZoomLimit: string; + msScrollLimitXMax: any; + msFlexAlign: string; + msWrapMargin: any; + columnCount: any; + msAnimationTimingFunction: string; + msTransitionDelay: string; + transformStyle: string; + msWrapFlow: string; + msFlexPreferredSize: string; + alignItems: string; + borderImageSource: string; + flexBasis: string; + borderImageWidth: string; + borderImageRepeat: string; + order: string; + flex: string; + alignContent: string; + msImeAlign: string; + flexShrink: string; + flexGrow: string; + borderImageSlice: string; + flexWrap: string; + borderImageOutset: string; + flexDirection: string; + touchAction: string; + flexFlow: string; + borderImage: string; + justifyContent: string; + alignSelf: string; + msTextCombineHorizontal: string; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + removeProperty(propertyName: string): string; + item(index: number): string; + [index: number]: string; + setProperty(propertyName: string, value: string, priority?: string): void; +} +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface MSStyleCSSProperties extends MSCSSProperties { + pixelWidth: number; + posHeight: number; + posLeft: number; + pixelTop: number; + pixelBottom: number; + textDecorationNone: boolean; + pixelLeft: number; + posTop: number; + posBottom: number; + textDecorationOverline: boolean; + posWidth: number; + textDecorationLineThrough: boolean; + pixelHeight: number; + textDecorationBlink: boolean; + posRight: number; + pixelRight: number; + textDecorationUnderline: boolean; +} +declare var MSStyleCSSProperties: { + prototype: MSStyleCSSProperties; + new(): MSStyleCSSProperties; +} + +interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, MSNavigatorExtensions, NavigatorGeolocation, MSNavigatorDoNotTrack, NavigatorStorageUtils, MSFileSaver { + msMaxTouchPoints: number; + msPointerEnabled: boolean; + msManipulationViewsEnabled: boolean; + pointerEnabled: boolean; + maxTouchPoints: number; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; +} +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + y: number; + x2: number; + x: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGZoomEvent extends UIEvent { + zoomRectScreen: SVGRect; + previousScale: number; + newScale: number; + previousTranslate: SVGPoint; + newTranslate: SVGPoint; +} +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface NodeSelector { + querySelectorAll(selectors: string): NodeList; + querySelector(selectors: string): Element; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { +} +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; +} +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface ClientRect { + left: number; + width: number; + right: number; + top: number; + bottom: number; + height: number; +} +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface PositionErrorCallback { + (error: PositionError): void; +} + +interface DOMImplementation { + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; + hasFeature(feature: string, version?: string): boolean; + createHTMLDocument(title: string): Document; +} +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface SVGUnitTypes { + SVG_UNIT_TYPE_UNKNOWN: number; + SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface Element extends Node, NodeSelector, ElementTraversal, GlobalEventHandlers { + scrollTop: number; + clientLeft: number; + scrollLeft: number; + tagName: string; + clientWidth: number; + scrollWidth: number; + clientHeight: number; + clientTop: number; + scrollHeight: number; + msRegionOverflow: string; + onmspointerdown: (ev: any) => any; + onmsgotpointercapture: (ev: any) => any; + onmsgesturedoubletap: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmspointermove: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + onmsinertiastart: (ev: any) => any; + onmslostpointercapture: (ev: any) => any; + onmspointerover: (ev: any) => any; + msContentZoomFactor: number; + onmspointerup: (ev: any) => any; + onlostpointercapture: (ev: PointerEvent) => any; + onmspointerenter: (ev: any) => any; + ongotpointercapture: (ev: PointerEvent) => any; + onmspointerleave: (ev: any) => any; + getAttribute(name?: string): string; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + getBoundingClientRect(): ClientRect; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + msMatchesSelector(selectors: string): boolean; + hasAttribute(name: string): boolean; + removeAttribute(name?: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + getAttributeNode(name: string): Attr; + fireEvent(eventName: string, eventObj?: any): boolean; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "bgsound"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "SOURCE"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeList; + getClientRects(): ClientRectList; + setAttributeNode(newAttr: Attr): Attr; + removeAttributeNode(oldAttr: Attr): Attr; + setAttribute(name?: string, value?: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + msGetRegionContent(): MSRangeCollection; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + setPointerCapture(pointerId: number): void; + msGetUntransformedBounds(): ClientRect; + releasePointerCapture(pointerId: number): void; + msRequestFullscreen(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Element: { + prototype: Element; + new(): Element; +} + +interface HTMLNextIdElement extends HTMLElement { + n: string; +} +declare var HTMLNextIdElement: { + prototype: HTMLNextIdElement; + new(): HTMLNextIdElement; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y1: SVGAnimatedLength; + x2: SVGAnimatedLength; + x1: SVGAnimatedLength; + y2: SVGAnimatedLength; +} +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface HTMLParagraphElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; +} +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLAreasCollection extends HTMLCollection { + /** + * Removes an element from the collection. + */ + remove(index?: number): void; + /** + * Adds an element to the areas, controlRange, or options collection. + */ + add(element: HTMLElement, before?: any): void; +} +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { +} +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface Node extends EventTarget { + nodeType: number; + previousSibling: Node; + localName: string; + namespaceURI: string; + textContent: string; + parentNode: Node; + nextSibling: Node; + nodeValue: string; + lastChild: Node; + childNodes: NodeList; + nodeName: string; + ownerDocument: Document; + attributes: NamedNodeMap; + firstChild: Node; + prefix: string; + removeChild(oldChild: Node): Node; + appendChild(newChild: Node): Node; + isSupported(feature: string, version: string): boolean; + isEqualNode(arg: Node): boolean; + lookupPrefix(namespaceURI: string): string; + isDefaultNamespace(namespaceURI: string): boolean; + compareDocumentPosition(other: Node): number; + normalize(): void; + isSameNode(other: Node): boolean; + hasAttributes(): boolean; + lookupNamespaceURI(prefix: string): string; + cloneNode(deep?: boolean): Node; + hasChildNodes(): boolean; + replaceChild(newChild: Node, oldChild: Node): Node; + insertBefore(newChild: Node, refChild?: Node): Node; + ENTITY_REFERENCE_NODE: number; + ATTRIBUTE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + TEXT_NODE: number; + ELEMENT_NODE: number; + COMMENT_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + DOCUMENT_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + CDATA_SECTION_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_PRECEDING: number; +} +declare var Node: { + prototype: Node; + new(): Node; + ENTITY_REFERENCE_NODE: number; + ATTRIBUTE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + TEXT_NODE: number; + ELEMENT_NODE: number; + COMMENT_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + DOCUMENT_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + CDATA_SECTION_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_PRECEDING: number; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface DOML2DeprecatedListSpaceReduction { + compact: boolean; +} + +interface MSScriptHost { +} +declare var MSScriptHost: { + prototype: MSScriptHost; + new(): MSScriptHost; +} + +interface SVGClipPathElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + clipPathUnits: SVGAnimatedEnumeration; +} +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface MouseEvent extends UIEvent { + toElement: Element; + layerY: number; + fromElement: Element; + which: number; + pageX: number; + offsetY: number; + x: number; + y: number; + metaKey: boolean; + altKey: boolean; + ctrlKey: boolean; + offsetX: number; + screenX: number; + clientY: number; + shiftKey: boolean; + layerX: number; + screenY: number; + relatedTarget: EventTarget; + button: number; + pageY: number; + buttons: number; + clientX: number; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; + getModifierState(keyArg: string): boolean; +} +declare var MouseEvent: { + prototype: MouseEvent; + new(): MouseEvent; +} + +interface RangeException { + code: number; + message: string; + name: string; + toString(): string; + INVALID_NODE_TYPE_ERR: number; + BAD_BOUNDARYPOINTS_ERR: number; +} +declare var RangeException: { + prototype: RangeException; + new(): RangeException; + INVALID_NODE_TYPE_ERR: number; + BAD_BOUNDARYPOINTS_ERR: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + y: SVGAnimatedLengthList; + rotate: SVGAnimatedNumberList; + dy: SVGAnimatedLengthList; + x: SVGAnimatedLengthList; + dx: SVGAnimatedLengthList; +} +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface HTMLAppletElement extends HTMLElement, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { + width: number; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + object: string; + form: HTMLFormElement; + code: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the class identifier for the object. + */ + classid: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + contentDocument: Document; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + BaseHref: string; +} +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface TextMetrics { + width: number; +} +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface DocumentEvent { + createEvent(eventInterface: "AnimationEvent"): AnimationEvent; + createEvent(eventInterface: "CloseEvent"): CloseEvent; + createEvent(eventInterface: "CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; + createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface: "DragEvent"): DragEvent; + createEvent(eventInterface: "ErrorEvent"): ErrorEvent; + createEvent(eventInterface: "Event"): Event; + createEvent(eventInterface: "Events"): Event; + createEvent(eventInterface: "FocusEvent"): FocusEvent; + createEvent(eventInterface: "HTMLEvents"): Event; + createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface: "LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface: "MessageEvent"): MessageEvent; + createEvent(eventInterface: "MouseEvent"): MouseEvent; + createEvent(eventInterface: "MouseEvents"): MouseEvent; + createEvent(eventInterface: "MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface: "MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface: "MutationEvent"): MutationEvent; + createEvent(eventInterface: "MutationEvents"): MutationEvent; + createEvent(eventInterface: "NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface: "NavigationEvent"): NavigationEvent; + createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface: "PointerEvent"): MSPointerEvent; + createEvent(eventInterface: "PopStateEvent"): PopStateEvent; + createEvent(eventInterface: "ProgressEvent"): ProgressEvent; + createEvent(eventInterface: "StorageEvent"): StorageEvent; + createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface: "TextEvent"): TextEvent; + createEvent(eventInterface: "TrackEvent"): TrackEvent; + createEvent(eventInterface: "TransitionEvent"): TransitionEvent; + createEvent(eventInterface: "UIEvent"): UIEvent; + createEvent(eventInterface: "UIEvents"): UIEvent; + createEvent(eventInterface: "UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface: "WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface HTMLOListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { + /** + * The starting number. + */ + start: number; +} +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGAnimatedString { + animVal: string; + baseVal: string; +} +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface CDATASection extends Text { +} +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface StyleMedia { + type: string; + matchMedium(mediaquery: string): boolean; +} +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface HTMLSelectElement extends HTMLElement, MSHTMLCollectionExtensions, MSDataBindingExtensions { + options: HTMLSelectElement; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: any): void; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + [name: string]: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface TextRange { + boundingLeft: number; + htmlText: string; + offsetLeft: number; + boundingWidth: number; + boundingHeight: number; + boundingTop: number; + text: string; + offsetTop: number; + moveToPoint(x: number, y: number): void; + queryCommandValue(cmdID: string): any; + getBookmark(): string; + move(unit: string, count?: number): number; + queryCommandIndeterm(cmdID: string): boolean; + scrollIntoView(fStart?: boolean): void; + findText(string: string, count?: number, flags?: number): boolean; + execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; + getBoundingClientRect(): ClientRect; + moveToBookmark(bookmark: string): boolean; + isEqual(range: TextRange): boolean; + duplicate(): TextRange; + collapse(start?: boolean): void; + queryCommandText(cmdID: string): string; + select(): void; + pasteHTML(html: string): void; + inRange(range: TextRange): boolean; + moveEnd(unit: string, count?: number): number; + getClientRects(): ClientRectList; + moveStart(unit: string, count?: number): number; + parentElement(): Element; + queryCommandState(cmdID: string): boolean; + compareEndPoints(how: string, sourceRange: TextRange): number; + execCommandShowHelp(cmdID: string): boolean; + moveToElementText(element: Element): void; + expand(Unit: string): boolean; + queryCommandSupported(cmdID: string): boolean; + setEndPoint(how: string, SourceRange: TextRange): void; + queryCommandEnabled(cmdID: string): boolean; +} +declare var TextRange: { + prototype: TextRange; + new(): TextRange; +} + +interface SVGTests { + requiredFeatures: SVGStringList; + requiredExtensions: SVGStringList; + systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface HTMLBlockElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLBlockElement: { + prototype: HTMLBlockElement; + new(): HTMLBlockElement; +} + +interface CSSStyleSheet extends StyleSheet { + owningElement: Element; + imports: StyleSheetList; + isAlternate: boolean; + rules: MSCSSRuleList; + isPrefAlternate: boolean; + readOnly: boolean; + cssText: string; + ownerRule: CSSRule; + href: string; + cssRules: CSSRuleList; + id: string; + pages: StyleSheetPageList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + insertRule(rule: string, index?: number): number; + removeRule(lIndex: number): void; + deleteRule(index?: number): void; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + removeImport(lIndex: number): void; +} +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface MSSelection { + type: string; + typeDetail: string; + createRange(): TextRange; + clear(): void; + createRangeCollection(): TextRangeCollection; + empty(): void; +} +declare var MSSelection: { + prototype: MSSelection; + new(): MSSelection; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; +} +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface SVGPatternElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired, SVGURIReference { + patternUnits: SVGAnimatedEnumeration; + y: SVGAnimatedLength; + width: SVGAnimatedLength; + x: SVGAnimatedLength; + patternContentUnits: SVGAnimatedEnumeration; + patternTransform: SVGAnimatedTransformList; + height: SVGAnimatedLength; +} +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGAnimatedAngle { + animVal: SVGAngle; + baseVal: SVGAngle; +} +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface Selection { + isCollapsed: boolean; + anchorNode: Node; + focusNode: Node; + anchorOffset: number; + focusOffset: number; + rangeCount: number; + addRange(range: Range): void; + collapseToEnd(): void; + toString(): string; + selectAllChildren(parentNode: Node): void; + getRangeAt(index: number): Range; + collapse(parentNode: Node, offset: number): void; + removeAllRanges(): void; + collapseToStart(): void; + deleteFromDocument(): void; + removeRange(range: Range): void; +} +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { + type: string; +} +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface HTMLDDElement extends HTMLElement { + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDDElement: { + prototype: HTMLDDElement; + new(): HTMLDDElement; +} + +interface MSDataBindingRecordSetReadonlyExtensions { + recordset: any; + namedRecordset(dataMember: string, hierarchy?: any): any; +} + +interface CSSStyleRule extends CSSRule { + selectorText: string; + style: MSStyleCSSProperties; + readOnly: boolean; +} +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface NodeIterator { + whatToShow: number; + filter: NodeFilter; + root: Node; + expandEntityReferences: boolean; + nextNode(): Node; + detach(): void; + previousNode(): Node; +} +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox, SVGExternalResourcesRequired { + viewTarget: SVGStringList; +} +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; +} +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface SVGLocatable { + farthestViewportElement: SVGElement; + nearestViewportElement: SVGElement; + getBBox(): SVGRect; + getTransformToElement(element: SVGElement): SVGMatrix; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; +} +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { +} +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface ControlRangeCollection { + length: number; + queryCommandValue(cmdID: string): any; + remove(index: number): void; + add(item: Element): void; + queryCommandIndeterm(cmdID: string): boolean; + scrollIntoView(varargStart?: any): void; + item(index: number): Element; + [index: number]: Element; + execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; + addElement(item: Element): void; + queryCommandState(cmdID: string): boolean; + queryCommandSupported(cmdID: string): boolean; + queryCommandEnabled(cmdID: string): boolean; + queryCommandText(cmdID: string): string; + select(): void; +} +declare var ControlRangeCollection: { + prototype: ControlRangeCollection; + new(): ControlRangeCollection; +} + +interface MSNamespaceInfo extends MSEventAttachmentTarget { + urn: string; + onreadystatechange: (ev: Event) => any; + name: string; + readyState: string; + doImport(implementationUrl: string): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSNamespaceInfo: { + prototype: MSNamespaceInfo; + new(): MSNamespaceInfo; +} + +interface WindowSessionStorage { + sessionStorage: Storage; +} + +interface SVGAnimatedTransformList { + animVal: SVGTransformList; + baseVal: SVGTransformList; +} +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; +} +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLOptionElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + index: number; + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; +} +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; + create(): HTMLOptionElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + areas: HTMLAreasCollection; +} +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMenuElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { + type: string; +} +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface MouseWheelEvent extends MouseEvent { + wheelDelta: number; + initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; +} +declare var MouseWheelEvent: { + prototype: MouseWheelEvent; + new(): MouseWheelEvent; +} + +interface SVGFitToViewBox { + viewBox: SVGAnimatedRect; + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; +} + +interface SVGPointList { + numberOfItems: number; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; + getItem(index: number): SVGPoint; + clear(): void; + appendItem(newItem: SVGPoint): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + removeItem(index: number): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; +} +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGAnimatedLengthList { + animVal: SVGLengthList; + baseVal: SVGLengthList; +} +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedPreserveAspectRatio { + animVal: SVGPreserveAspectRatio; + baseVal: SVGPreserveAspectRatio; +} +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface MSSiteModeEvent extends Event { + buttonID: number; + actionURL: string; +} +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface DOML2DeprecatedTextFlowControl { + clear: string; +} + +interface StyleSheetPageList { + length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface MSCSSProperties extends CSSStyleDeclaration { + scrollbarShadowColor: string; + scrollbarHighlightColor: string; + layoutGridChar: string; + layoutGridType: string; + textAutospace: string; + textKashidaSpace: string; + writingMode: string; + scrollbarFaceColor: string; + backgroundPositionY: string; + lineBreak: string; + imeMode: string; + msBlockProgression: string; + layoutGridLine: string; + scrollbarBaseColor: string; + layoutGrid: string; + layoutFlow: string; + textKashida: string; + filter: string; + zoom: string; + scrollbarArrowColor: string; + behavior: string; + backgroundPositionX: string; + accelerator: string; + layoutGridMode: string; + textJustifyTrim: string; + scrollbar3dLightColor: string; + msInterpolationMode: string; + scrollbarTrackColor: string; + scrollbarDarkShadowColor: string; + styleFloat: string; + getAttribute(attributeName: string, flags?: number): any; + setAttribute(attributeName: string, AttributeValue: any, flags?: number): void; + removeAttribute(attributeName: string, flags?: number): boolean; +} +declare var MSCSSProperties: { + prototype: MSCSSProperties; + new(): MSCSSProperties; +} + +interface SVGExternalResourcesRequired { + externalResourcesRequired: SVGAnimatedBoolean; +} + +interface HTMLImageElement extends HTMLElement, MSImageResourceExtensions, MSDataBindingExtensions, MSResourceMetadata { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * The original height of the image resource before sizing. + */ + naturalHeight: number; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * The original width of the image resource before sizing. + */ + naturalWidth: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + /** + * Contains the hypertext reference (HREF) of the URL. + */ + href: string; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + complete: boolean; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + crossOrigin: string; + msPlayToPreferredSourceUri: string; +} +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; + create(): HTMLImageElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface EventTarget { + removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; +} + +interface SVGAngle { + valueAsString: string; + valueInSpecifiedUnits: number; + value: number; + unitType: number; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + SVG_ANGLETYPE_RAD: number; + SVG_ANGLETYPE_UNKNOWN: number; + SVG_ANGLETYPE_UNSPECIFIED: number; + SVG_ANGLETYPE_DEG: number; + SVG_ANGLETYPE_GRAD: number; +} +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + SVG_ANGLETYPE_RAD: number; + SVG_ANGLETYPE_UNKNOWN: number; + SVG_ANGLETYPE_UNSPECIFIED: number; + SVG_ANGLETYPE_DEG: number; + SVG_ANGLETYPE_GRAD: number; +} + +interface HTMLButtonElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + status: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; + msKeySystem: string; +} +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface KeyboardEvent extends UIEvent { + location: number; + keyCode: number; + shiftKey: boolean; + which: number; + locale: string; + key: string; + altKey: boolean; + metaKey: boolean; + char: string; + ctrlKey: boolean; + repeat: boolean; + charCode: number; + getModifierState(keyArg: string): boolean; + initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; + DOM_KEY_LOCATION_RIGHT: number; + DOM_KEY_LOCATION_STANDARD: number; + DOM_KEY_LOCATION_LEFT: number; + DOM_KEY_LOCATION_NUMPAD: number; + DOM_KEY_LOCATION_JOYSTICK: number; + DOM_KEY_LOCATION_MOBILE: number; +} +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(): KeyboardEvent; + DOM_KEY_LOCATION_RIGHT: number; + DOM_KEY_LOCATION_STANDARD: number; + DOM_KEY_LOCATION_LEFT: number; + DOM_KEY_LOCATION_NUMPAD: number; + DOM_KEY_LOCATION_JOYSTICK: number; + DOM_KEY_LOCATION_MOBILE: number; +} + +interface MessageEvent extends Event { + source: Window; + origin: string; + data: any; + ports: any; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} +declare var MessageEvent: { + prototype: MessageEvent; + new(): MessageEvent; +} + +interface SVGElement extends Element { + onmouseover: (ev: MouseEvent) => any; + viewportElement: SVGElement; + onmousemove: (ev: MouseEvent) => any; + onmouseout: (ev: MouseEvent) => any; + ondblclick: (ev: MouseEvent) => any; + onfocusout: (ev: FocusEvent) => any; + onfocusin: (ev: FocusEvent) => any; + xmlbase: string; + onmousedown: (ev: MouseEvent) => any; + onload: (ev: Event) => any; + onmouseup: (ev: MouseEvent) => any; + onclick: (ev: MouseEvent) => any; + ownerSVGElement: SVGSVGElement; + id: string; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface HTMLScriptElement extends HTMLElement { + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + async: boolean; +} +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { + /** + * Retrieves the position of the object in the rows collection for the table. + */ + rowIndex: number; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollection; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Retrieves the position of the object in the collection. + */ + sectionRowIndex: number; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLElement; +} +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface CanvasRenderingContext2D { + miterLimit: number; + font: string; + globalCompositeOperation: string; + msFillRule: string; + lineCap: string; + msImageSmoothingEnabled: boolean; + lineDashOffset: number; + shadowColor: string; + lineJoin: string; + shadowOffsetX: number; + lineWidth: number; + canvas: HTMLCanvasElement; + strokeStyle: any; + globalAlpha: number; + shadowOffsetY: number; + fillStyle: any; + shadowBlur: number; + textAlign: string; + textBaseline: string; + restore(): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + save(): void; + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + measureText(text: string): TextMetrics; + isPointInPath(x: number, y: number, fillRule?: string): boolean; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + rotate(angle: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + translate(x: number, y: number): void; + scale(x: number, y: number): void; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + lineTo(x: number, y: number): void; + getLineDash(): number[]; + fill(fillRule?: string): void; + createImageData(imageDataOrSw: any, sh?: number): ImageData; + createPattern(image: HTMLElement, repetition: string): CanvasPattern; + closePath(): void; + rect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: string): void; + clearRect(x: number, y: number, w: number, h: number): void; + moveTo(x: number, y: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + fillRect(x: number, y: number, w: number, h: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + drawImage(image: HTMLElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(): void; + strokeRect(x: number, y: number, w: number, h: number): void; + setLineDash(segments: number[]): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + beginPath(): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; +} +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface MSCSSRuleList { + length: number; + item(index?: number): CSSStyleRule; + [index: number]: CSSStyleRule; +} +declare var MSCSSRuleList: { + prototype: MSCSSRuleList; + new(): MSCSSRuleList; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + y: number; + sweepFlag: boolean; + r2: number; + x: number; + angle: number; + r1: number; + largeArcFlag: boolean; +} +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGTransformList { + numberOfItems: number; + getItem(index: number): SVGTransform; + consolidate(): SVGTransform; + clear(): void; + appendItem(newItem: SVGTransform): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + removeItem(index: number): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; +} +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; +} +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Retrieves the object of the specified. + */ + contentWindow: Window; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Raised when the object has been completely received from the server. + */ + onload: (ev: Event) => any; + /** + * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. + */ + security: any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface SVGAnimatedLength { + animVal: SVGLength; + baseVal: SVGLength; +} +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedPoints { + points: SVGPointList; + animatedPoints: SVGPointList; +} + +interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface CSSMediaRule extends CSSRule { + media: MediaList; + cssRules: CSSRuleList; + insertRule(rule: string, index?: number): number; + deleteRule(index?: number): void; +} +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface WindowModal { + dialogArguments: any; + returnValue: any; +} + +interface XMLHttpRequest extends EventTarget { + responseBody: any; + status: number; + readyState: number; + responseText: string; + responseXML: any; + ontimeout: (ev: Event) => any; + statusText: string; + onreadystatechange: (ev: Event) => any; + timeout: number; + onload: (ev: Event) => any; + response: any; + withCredentials: boolean; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: UIEvent) => any; + responseType: string; + onloadend: (ev: ProgressEvent) => any; + upload: XMLHttpRequestEventTarget; + onerror: (ev: ErrorEvent) => any; + onloadstart: (ev: Event) => any; + msCaching: string; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + send(data?: any): void; + abort(): void; + getAllResponseHeaders(): string; + setRequestHeader(header: string, value: string): void; + getResponseHeader(header: string): string; + msCachingEnabled(): boolean; + overrideMimeType(mime: string): void; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + create(): XMLHttpRequest; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; +} +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLDListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { +} +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface MSDataBindingExtensions { + dataSrc: string; + dataFormatAs: string; + dataFld: string; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + ry: SVGAnimatedLength; + cx: SVGAnimatedLength; + rx: SVGAnimatedLength; + cy: SVGAnimatedLength; +} +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + target: SVGAnimatedString; +} +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGStylable { + className: SVGAnimatedString; + style: CSSStyleDeclaration; +} + +interface SVGTransformable extends SVGLocatable { + transform: SVGAnimatedTransformList; +} + +interface HTMLFrameSetElement extends HTMLElement { + ononline: (ev: Event) => any; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Fires when the object loses the input focus. + */ + onblur: (ev: FocusEvent) => any; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Fires when the object receives focus. + */ + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + onerror: (ev: ErrorEvent) => any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + onresize: (ev: UIEvent) => any; + name: string; + onafterprint: (ev: Event) => any; + onbeforeprint: (ev: Event) => any; + onoffline: (ev: Event) => any; + border: string; + onunload: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onload: (ev: Event) => any; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + onstorage: (ev: StorageEvent) => any; + onpageshow: (ev: PageTransitionEvent) => any; + onpagehide: (ev: PageTransitionEvent) => any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface Screen extends EventTarget { + width: number; + deviceXDPI: number; + fontSmoothingEnabled: boolean; + bufferDepth: number; + logicalXDPI: number; + systemXDPI: number; + availHeight: number; + height: number; + logicalYDPI: number; + systemYDPI: number; + updateInterval: number; + colorDepth: number; + availWidth: number; + deviceYDPI: number; + pixelDepth: number; + msOrientation: string; + onmsorientationchange: (ev: any) => any; + msLockOrientation(orientation: string): boolean; + msLockOrientation(orientations: string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: "msorientationchange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface Coordinates { + altitudeAccuracy: number; + longitude: number; + latitude: number; + speed: number; + heading: number; + altitude: number; + accuracy: number; +} +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface NavigatorGeolocation { + geolocation: Geolocation; +} + +interface NavigatorContentUtils { +} + +interface EventListener { + (evt: Event): void; +} + +interface SVGLangSpace { + xmllang: string; + xmlspace: string; +} + +interface DataTransfer { + effectAllowed: string; + dropEffect: string; + types: DOMStringList; + files: FileList; + clearData(format?: string): boolean; + setData(format: string, data: string): boolean; + getData(format: string): string; +} +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface FocusEvent extends UIEvent { + relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} +declare var FocusEvent: { + prototype: FocusEvent; + new(): FocusEvent; +} + +interface Range { + startOffset: number; + collapsed: boolean; + endOffset: number; + startContainer: Node; + endContainer: Node; + commonAncestorContainer: Node; + setStart(refNode: Node, offset: number): void; + setEndBefore(refNode: Node): void; + setStartBefore(refNode: Node): void; + selectNode(refNode: Node): void; + detach(): void; + getBoundingClientRect(): ClientRect; + toString(): string; + compareBoundaryPoints(how: number, sourceRange: Range): number; + insertNode(newNode: Node): void; + collapse(toStart: boolean): void; + selectNodeContents(refNode: Node): void; + cloneContents(): DocumentFragment; + setEnd(refNode: Node, offset: number): void; + cloneRange(): Range; + getClientRects(): ClientRectList; + surroundContents(newParent: Node): void; + deleteContents(): void; + setStartAfter(refNode: Node): void; + extractContents(): DocumentFragment; + setEndAfter(refNode: Node): void; + createContextualFragment(fragment: string): DocumentFragment; + END_TO_END: number; + START_TO_START: number; + START_TO_END: number; + END_TO_START: number; +} +declare var Range: { + prototype: Range; + new(): Range; + END_TO_END: number; + START_TO_START: number; + START_TO_END: number; + END_TO_START: number; +} + +interface SVGPoint { + y: number; + x: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface MSPluginsCollection { + length: number; + refresh(reload?: boolean): void; +} +declare var MSPluginsCollection: { + prototype: MSPluginsCollection; + new(): MSPluginsCollection; +} + +interface SVGAnimatedNumberList { + animVal: SVGNumberList; + baseVal: SVGNumberList; +} +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGSVGElement extends SVGElement, SVGStylable, SVGZoomAndPan, DocumentEvent, SVGLangSpace, SVGLocatable, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired { + width: SVGAnimatedLength; + x: SVGAnimatedLength; + contentStyleType: string; + onzoom: (ev: any) => any; + y: SVGAnimatedLength; + viewport: SVGRect; + onerror: (ev: ErrorEvent) => any; + pixelUnitToMillimeterY: number; + onresize: (ev: UIEvent) => any; + screenPixelToMillimeterY: number; + height: SVGAnimatedLength; + onabort: (ev: UIEvent) => any; + contentScriptType: string; + pixelUnitToMillimeterX: number; + currentTranslate: SVGPoint; + onunload: (ev: Event) => any; + currentScale: number; + onscroll: (ev: UIEvent) => any; + screenPixelToMillimeterX: number; + setCurrentTime(seconds: number): void; + createSVGLength(): SVGLength; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + unpauseAnimations(): void; + createSVGRect(): SVGRect; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + unsuspendRedrawAll(): void; + pauseAnimations(): void; + suspendRedraw(maxWaitMilliseconds: number): number; + deselectAll(): void; + createSVGAngle(): SVGAngle; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; + createSVGTransform(): SVGTransform; + unsuspendRedraw(suspendHandleID: number): void; + forceRedraw(): void; + getCurrentTime(): number; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + createSVGMatrix(): SVGMatrix; + createSVGPoint(): SVGPoint; + createSVGNumber(): SVGNumber; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getElementById(elementId: string): Element; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "zoom", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface HTMLLabelElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface MSResourceMetadata { + protocol: string; + fileSize: string; + fileUpdatedDate: string; + nameProp: string; + fileCreatedDate: string; + fileModifiedDate: string; + mimeType: string; +} + +interface HTMLLegendElement extends HTMLElement, MSDataBindingExtensions { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLDirectoryElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { +} +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface SVGAnimatedInteger { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { +} +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { +} +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface HTMLLIElement extends HTMLElement, DOML2DeprecatedListNumberingAndBulletStyle { + /** + * Sets or retrieves the value of a list item. + */ + value: number; +} +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface MSStorageExtensions { + remainingSpace: number; +} + +interface SVGStyleElement extends SVGElement, SVGLangSpace { + media: string; + type: string; + title: string; +} +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface MSCurrentStyleCSSProperties extends MSCSSProperties { + blockDirection: string; + clipBottom: string; + clipLeft: string; + clipRight: string; + clipTop: string; + hasLayout: string; +} +declare var MSCurrentStyleCSSProperties: { + prototype: MSCurrentStyleCSSProperties; + new(): MSCurrentStyleCSSProperties; +} + +interface MSHTMLCollectionExtensions { + urns(urn: any): any; + tags(tagName: any): any; +} + +interface Storage extends MSStorageExtensions { + length: number; + getItem(key: string): any; + [key: string]: any; + setItem(key: string, data: string): void; + clear(): void; + removeItem(key: string): void; + key(index: number): string; + [index: number]: string; +} +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Retrieves the object of the specified. + */ + contentWindow: Window; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. + */ + security: any; + /** + * Raised when the object has been completely received from the server. + */ + onload: (ev: Event) => any; + sandbox: DOMSettableTokenList; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface TextRangeCollection { + length: number; + item(index: number): TextRange; + [index: number]: TextRange; +} +declare var TextRangeCollection: { + prototype: TextRangeCollection; + new(): TextRangeCollection; +} + +interface HTMLBodyElement extends HTMLElement, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + scroll: string; + ononline: (ev: Event) => any; + onblur: (ev: FocusEvent) => any; + noWrap: boolean; + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + text: any; + onerror: (ev: ErrorEvent) => any; + bgProperties: string; + onresize: (ev: UIEvent) => any; + link: any; + aLink: any; + bottomMargin: any; + topMargin: any; + onafterprint: (ev: Event) => any; + vLink: any; + onbeforeprint: (ev: Event) => any; + onoffline: (ev: Event) => any; + onunload: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onload: (ev: Event) => any; + rightMargin: any; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + leftMargin: any; + onstorage: (ev: StorageEvent) => any; + onpopstate: (ev: PopStateEvent) => any; + onpageshow: (ev: PageTransitionEvent) => any; + onpagehide: (ev: PageTransitionEvent) => any; + createTextRange(): TextRange; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface DocumentType extends Node { + name: string; + notations: NamedNodeMap; + systemId: string; + internalSubset: string; + entities: NamedNodeMap; + publicId: string; +} +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + cx: SVGAnimatedLength; + r: SVGAnimatedLength; + cy: SVGAnimatedLength; + fx: SVGAnimatedLength; + fy: SVGAnimatedLength; +} +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface MutationEvent extends Event { + newValue: string; + attrChange: number; + attrName: string; + prevValue: string; + relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + MODIFICATION: number; + REMOVAL: number; + ADDITION: number; +} +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + MODIFICATION: number; + REMOVAL: number; + ADDITION: number; +} + +interface DragEvent extends MouseEvent { + dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollection; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Moves a table row to a new position. + * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. + * @param indexTo Number that specifies where the row is moved within the rows collection. + */ + moveRow(indexFrom?: number, indexTo?: number): any; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLElement; +} +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface DOML2DeprecatedListNumberingAndBulletStyle { + type: string; +} + +interface HTMLInputElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + status: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + indeterminate: boolean; + readOnly: boolean; + size: number; + loop: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Sets or retrieves the URL of the virtual reality modeling language (VRML) world to be displayed in the window. + */ + vrml: string; + /** + * Sets or retrieves a lower resolution image to display. + */ + lowsrc: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + dynsrc: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + /** + * Retrieves whether the object is fully loaded. + */ + complete: boolean; + start: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a FileList object on a file type input object. + */ + files: FileList; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + list: HTMLElement; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLAnchorElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + Methods: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + protocolLong: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + nameProp: string; + urn: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + type: string; + mimeType: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; +} +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGAnimatedNumber { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface PerformanceTiming { + redirectStart: number; + domainLookupEnd: number; + responseStart: number; + domComplete: number; + domainLookupStart: number; + loadEventStart: number; + msFirstPaint: number; + unloadEventEnd: number; + fetchStart: number; + requestStart: number; + domInteractive: number; + navigationStart: number; + connectEnd: number; + loadEventEnd: number; + connectStart: number; + responseEnd: number; + domLoading: number; + redirectEnd: number; + unloadEventStart: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + toJSON(): any; +} +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface HTMLPreElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; + /** + * Indicates a citation by rendering text in italic type. + */ + cite: string; +} +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface EventException { + code: number; + message: string; + name: string; + toString(): string; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} +declare var EventException: { + prototype: EventException; + new(): EventException; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} + +interface MSNavigatorDoNotTrack { + msDoNotTrack: string; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; +} + +interface NavigatorOnLine { + onLine: boolean; +} + +interface WindowLocalStorage { + localStorage: Storage; +} + +interface SVGMetadataElement extends SVGElement { +} +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + y: number; + sweepFlag: boolean; + r2: number; + x: number; + angle: number; + r1: number; + largeArcFlag: boolean; +} +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGStringList { + numberOfItems: number; + replaceItem(newItem: string, index: number): string; + getItem(index: number): string; + clear(): void; + appendItem(newItem: string): string; + initialize(newItem: string): string; + removeItem(index: number): string; + insertItemBefore(newItem: string, index: number): string; +} +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface XDomainRequest { + timeout: number; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onprogress: (ev: ProgressEvent) => any; + ontimeout: (ev: Event) => any; + responseText: string; + contentType: string; + open(method: string, url: string): void; + abort(): void; + send(data?: any): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XDomainRequest: { + prototype: XDomainRequest; + new(): XDomainRequest; + create(): XDomainRequest; +} + +interface DOML2DeprecatedBackgroundColorStyle { + bgColor: any; +} + +interface ElementTraversal { + childElementCount: number; + previousElementSibling: Element; + lastElementChild: Element; + nextElementSibling: Element; + firstElementChild: Element; +} + +interface SVGLength { + valueAsString: string; + valueInSpecifiedUnits: number; + value: number; + unitType: number; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + SVG_LENGTHTYPE_NUMBER: number; + SVG_LENGTHTYPE_CM: number; + SVG_LENGTHTYPE_PC: number; + SVG_LENGTHTYPE_PERCENTAGE: number; + SVG_LENGTHTYPE_MM: number; + SVG_LENGTHTYPE_PT: number; + SVG_LENGTHTYPE_IN: number; + SVG_LENGTHTYPE_EMS: number; + SVG_LENGTHTYPE_PX: number; + SVG_LENGTHTYPE_UNKNOWN: number; + SVG_LENGTHTYPE_EXS: number; +} +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + SVG_LENGTHTYPE_NUMBER: number; + SVG_LENGTHTYPE_CM: number; + SVG_LENGTHTYPE_PC: number; + SVG_LENGTHTYPE_PERCENTAGE: number; + SVG_LENGTHTYPE_MM: number; + SVG_LENGTHTYPE_PT: number; + SVG_LENGTHTYPE_IN: number; + SVG_LENGTHTYPE_EMS: number; + SVG_LENGTHTYPE_PX: number; + SVG_LENGTHTYPE_UNKNOWN: number; + SVG_LENGTHTYPE_EXS: number; +} + +interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface HTMLPhraseElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLPhraseElement: { + prototype: HTMLPhraseElement; + new(): HTMLPhraseElement; +} + +interface NavigatorStorageUtils { +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + y: number; + y1: number; + x2: number; + x: number; + x1: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGTextContentElement extends SVGElement, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + textLength: SVGAnimatedLength; + lengthAdjust: SVGAnimatedEnumeration; + getCharNumAtPosition(point: SVGPoint): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getComputedTextLength(): number; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getEndPositionOfChar(charnum: number): SVGPoint; + LENGTHADJUST_SPACING: number; + LENGTHADJUST_SPACINGANDGLYPHS: number; + LENGTHADJUST_UNKNOWN: number; +} +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + LENGTHADJUST_SPACING: number; + LENGTHADJUST_SPACINGANDGLYPHS: number; + LENGTHADJUST_UNKNOWN: number; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface Location { + hash: string; + protocol: string; + search: string; + href: string; + hostname: string; + port: string; + pathname: string; + host: string; + reload(flag?: boolean): void; + replace(url: string): void; + assign(url: string): void; + toString(): string; +} +declare var Location: { + prototype: Location; + new(): Location; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; +} +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; +} +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface PerformanceEntry { + name: string; + startTime: number; + duration: number; + entryType: string; +} +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface SVGTransform { + type: number; + angle: number; + matrix: SVGMatrix; + setTranslate(tx: number, ty: number): void; + setScale(sx: number, sy: number): void; + setMatrix(matrix: SVGMatrix): void; + setSkewY(angle: number): void; + setRotate(angle: number, cx: number, cy: number): void; + setSkewX(angle: number): void; + SVG_TRANSFORM_SKEWX: number; + SVG_TRANSFORM_UNKNOWN: number; + SVG_TRANSFORM_SCALE: number; + SVG_TRANSFORM_TRANSLATE: number; + SVG_TRANSFORM_MATRIX: number; + SVG_TRANSFORM_ROTATE: number; + SVG_TRANSFORM_SKEWY: number; +} +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + SVG_TRANSFORM_SKEWX: number; + SVG_TRANSFORM_UNKNOWN: number; + SVG_TRANSFORM_SCALE: number; + SVG_TRANSFORM_TRANSLATE: number; + SVG_TRANSFORM_MATRIX: number; + SVG_TRANSFORM_ROTATE: number; + SVG_TRANSFORM_SKEWY: number; +} + +interface UIEvent extends Event { + detail: number; + view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} +declare var UIEvent: { + prototype: UIEvent; + new(): UIEvent; +} + +interface SVGURIReference { + href: SVGAnimatedString; +} + +interface SVGPathSeg { + pathSegType: number; + pathSegTypeAsLetter: string; + PATHSEG_MOVETO_REL: number; + PATHSEG_LINETO_VERTICAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + PATHSEG_CURVETO_QUADRATIC_REL: number; + PATHSEG_CURVETO_CUBIC_ABS: number; + PATHSEG_LINETO_HORIZONTAL_ABS: number; + PATHSEG_CURVETO_QUADRATIC_ABS: number; + PATHSEG_LINETO_ABS: number; + PATHSEG_CLOSEPATH: number; + PATHSEG_LINETO_HORIZONTAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + PATHSEG_LINETO_REL: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + PATHSEG_ARC_REL: number; + PATHSEG_CURVETO_CUBIC_REL: number; + PATHSEG_UNKNOWN: number; + PATHSEG_LINETO_VERTICAL_ABS: number; + PATHSEG_ARC_ABS: number; + PATHSEG_MOVETO_ABS: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; +} +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + PATHSEG_MOVETO_REL: number; + PATHSEG_LINETO_VERTICAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + PATHSEG_CURVETO_QUADRATIC_REL: number; + PATHSEG_CURVETO_CUBIC_ABS: number; + PATHSEG_LINETO_HORIZONTAL_ABS: number; + PATHSEG_CURVETO_QUADRATIC_ABS: number; + PATHSEG_LINETO_ABS: number; + PATHSEG_CLOSEPATH: number; + PATHSEG_LINETO_HORIZONTAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + PATHSEG_LINETO_REL: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + PATHSEG_ARC_REL: number; + PATHSEG_CURVETO_CUBIC_REL: number; + PATHSEG_UNKNOWN: number; + PATHSEG_LINETO_VERTICAL_ABS: number; + PATHSEG_ARC_ABS: number; + PATHSEG_MOVETO_ABS: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; +} + +interface WheelEvent extends MouseEvent { + deltaZ: number; + deltaX: number; + deltaMode: number; + deltaY: number; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + getCurrentPoint(element: Element): void; + DOM_DELTA_PIXEL: number; + DOM_DELTA_LINE: number; + DOM_DELTA_PAGE: number; +} +declare var WheelEvent: { + prototype: WheelEvent; + new(): WheelEvent; + DOM_DELTA_PIXEL: number; + DOM_DELTA_LINE: number; + DOM_DELTA_PAGE: number; +} + +interface MSEventAttachmentTarget { + attachEvent(event: string, listener: EventListener): boolean; + detachEvent(event: string, listener: EventListener): void; +} + +interface SVGNumber { + value: number; +} +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGPathElement extends SVGElement, SVGStylable, SVGAnimatedPathData, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + getTotalLength(): number; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; +} +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface MSCompatibleInfo { + version: string; + userAgent: string; +} +declare var MSCompatibleInfo: { + prototype: MSCompatibleInfo; + new(): MSCompatibleInfo; +} + +interface Text extends CharacterData, MSNodeExtensions { + wholeText: string; + splitText(offset: number): Text; + replaceWholeText(content: string): Text; +} +declare var Text: { + prototype: Text; + new(): Text; +} + +interface SVGAnimatedRect { + animVal: SVGRect; + baseVal: SVGRect; +} +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface CSSNamespaceRule extends CSSRule { + namespaceURI: string; + prefix: string; +} +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface SVGPathSegList { + numberOfItems: number; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; + getItem(index: number): SVGPathSeg; + clear(): void; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; +} +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface HTMLUnknownElement extends HTMLElement, MSDataBindingRecordSetReadonlyExtensions { +} +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLAudioElement extends HTMLMediaElement { +} +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface MSImageResourceExtensions { + dynsrc: string; + vrml: string; + lowsrc: string; + start: string; + loop: number; +} + +interface PositionError { + code: number; + message: string; + toString(): string; + POSITION_UNAVAILABLE: number; + PERMISSION_DENIED: number; + TIMEOUT: number; +} +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + POSITION_UNAVAILABLE: number; + PERMISSION_DENIED: number; + TIMEOUT: number; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + cellIndex: number; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; +} +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface SVGElementInstance extends EventTarget { + previousSibling: SVGElementInstance; + parentNode: SVGElementInstance; + lastChild: SVGElementInstance; + nextSibling: SVGElementInstance; + childNodes: SVGElementInstanceList; + correspondingUseElement: SVGUseElement; + correspondingElement: SVGElement; + firstChild: SVGElementInstance; +} +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface MSNamespaceInfoCollection { + length: number; + add(namespace?: string, urn?: string, implementationUrl?: any): any; + item(index: any): any; + // [index: any]: any; +} +declare var MSNamespaceInfoCollection: { + prototype: MSNamespaceInfoCollection; + new(): MSNamespaceInfoCollection; +} + +interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + cx: SVGAnimatedLength; + r: SVGAnimatedLength; + cy: SVGAnimatedLength; +} +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface StyleSheetList { + length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface CSSImportRule extends CSSRule { + styleSheet: CSSStyleSheet; + href: string; + media: MediaList; +} +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CustomEvent extends Event { + detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} +declare var CustomEvent: { + prototype: CustomEvent; + new(): CustomEvent; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; +} +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLTextAreaElement extends HTMLElement, MSDataBindingExtensions { + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Retrieves the type of control. + */ + type: string; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface DOML2DeprecatedMarginStyle { + vspace: number; + hspace: number; +} + +interface MSWindowModeless { + dialogTop: any; + dialogLeft: any; + dialogWidth: any; + dialogHeight: any; + menuArguments: any; +} + +interface DOML2DeprecatedAlignmentStyle { + align: string; +} + +interface HTMLMarqueeElement extends HTMLElement, MSDataBindingExtensions, DOML2DeprecatedBackgroundColorStyle { + width: string; + onbounce: (ev: Event) => any; + vspace: number; + trueSpeed: boolean; + scrollAmount: number; + scrollDelay: number; + behavior: string; + height: string; + loop: number; + direction: string; + hspace: number; + onstart: (ev: Event) => any; + onfinish: (ev: Event) => any; + stop(): void; + start(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "start", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface SVGRect { + y: number; + width: number; + x: number; + height: number; +} +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface MSNodeExtensions { + swapNode(otherNode: Node): Node; + removeNode(deep?: boolean): Node; + replaceNode(replacement: Node): Node; +} + +interface History { + length: number; + state: any; + back(distance?: any): void; + forward(distance?: any): void; + go(delta?: any): void; + replaceState(statedata: any, title: string, url?: string): void; + pushState(statedata: any, title: string, url?: string): void; +} +declare var History: { + prototype: History; + new(): History; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + y: number; + y1: number; + x2: number; + x: number; + x1: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + y: number; + y1: number; + x: number; + x1: number; +} +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface TimeRanges { + length: number; + start(index: number): number; + end(index: number): number; +} +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface CSSRule { + cssText: string; + parentStyleSheet: CSSStyleSheet; + parentRule: CSSRule; + type: number; + IMPORT_RULE: number; + MEDIA_RULE: number; + STYLE_RULE: number; + NAMESPACE_RULE: number; + PAGE_RULE: number; + UNKNOWN_RULE: number; + FONT_FACE_RULE: number; + CHARSET_RULE: number; + KEYFRAMES_RULE: number; + KEYFRAME_RULE: number; + VIEWPORT_RULE: number; +} +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + IMPORT_RULE: number; + MEDIA_RULE: number; + STYLE_RULE: number; + NAMESPACE_RULE: number; + PAGE_RULE: number; + UNKNOWN_RULE: number; + FONT_FACE_RULE: number; + CHARSET_RULE: number; + KEYFRAMES_RULE: number; + KEYFRAME_RULE: number; + VIEWPORT_RULE: number; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface SVGMatrix { + e: number; + c: number; + a: number; + b: number; + d: number; + f: number; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + flipY(): SVGMatrix; + skewY(angle: number): SVGMatrix; + inverse(): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + rotate(angle: number): SVGMatrix; + flipX(): SVGMatrix; + translate(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + skewX(angle: number): SVGMatrix; +} +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface MSPopupWindow { + document: Document; + isOpen: boolean; + show(x: number, y: number, w: number, h: number, element?: any): void; + hide(): void; +} +declare var MSPopupWindow: { + prototype: MSPopupWindow; + new(): MSPopupWindow; +} + +interface BeforeUnloadEvent extends Event { + returnValue: string; +} +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + animatedInstanceRoot: SVGElementInstance; + instanceRoot: SVGElementInstance; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface Event { + timeStamp: number; + defaultPrevented: boolean; + isTrusted: boolean; + currentTarget: EventTarget; + cancelBubble: boolean; + target: EventTarget; + eventPhase: number; + cancelable: boolean; + type: string; + srcElement: Element; + bubbles: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + stopPropagation(): void; + stopImmediatePropagation(): void; + preventDefault(): void; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} +declare var Event: { + prototype: Event; + new(): Event; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} + +interface ImageData { + width: number; + data: number[]; + height: number; +} +declare var ImageData: { + prototype: ImageData; + new(): ImageData; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the width of the object. + */ + width: any; + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; +} +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface SVGException { + code: number; + message: string; + name: string; + toString(): string; + SVG_MATRIX_NOT_INVERTABLE: number; + SVG_WRONG_TYPE_ERR: number; + SVG_INVALID_VALUE_ERR: number; +} +declare var SVGException: { + prototype: SVGException; + new(): SVGException; + SVG_MATRIX_NOT_INVERTABLE: number; + SVG_WRONG_TYPE_ERR: number; + SVG_INVALID_VALUE_ERR: number; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + y1: SVGAnimatedLength; + x2: SVGAnimatedLength; + x1: SVGAnimatedLength; + y2: SVGAnimatedLength; +} +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; +} + +interface SVGAnimatedEnumeration { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface HTMLUListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { +} +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + ry: SVGAnimatedLength; + rx: SVGAnimatedLength; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface ErrorEventHandler { + (event: Event, source: string, fileno: number, columnNumber: number): void; +} + +interface HTMLDivElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface DOML2DeprecatedBorderStyle { + border: string; +} + +interface NamedNodeMap { + length: number; + removeNamedItemNS(namespaceURI: string, localName: string): Attr; + item(index: number): Attr; + [index: number]: Attr; + removeNamedItem(name: string): Attr; + getNamedItem(name: string): Attr; + // [name: string]: Attr; + setNamedItem(arg: Attr): Attr; + getNamedItemNS(namespaceURI: string, localName: string): Attr; + setNamedItemNS(arg: Attr): Attr; +} +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface MediaList { + length: number; + mediaText: string; + deleteMedium(oldMedium: string): void; + appendMedium(newMedium: string): void; + item(index: number): string; + [index: number]: string; + toString(): string; +} +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + y: number; + x2: number; + x: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGLengthList { + numberOfItems: number; + replaceItem(newItem: SVGLength, index: number): SVGLength; + getItem(index: number): SVGLength; + clear(): void; + appendItem(newItem: SVGLength): SVGLength; + initialize(newItem: SVGLength): SVGLength; + removeItem(index: number): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; +} +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface ProcessingInstruction extends Node { + target: string; + data: string; +} +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface MSWindowExtensions { + status: string; + onmouseleave: (ev: MouseEvent) => any; + screenLeft: number; + offscreenBuffering: any; + maxConnectionsPerServer: number; + onmouseenter: (ev: MouseEvent) => any; + clipboardData: DataTransfer; + defaultStatus: string; + clientInformation: Navigator; + closed: boolean; + onhelp: (ev: Event) => any; + external: External; + event: MSEventObj; + onfocusout: (ev: FocusEvent) => any; + screenTop: number; + onfocusin: (ev: FocusEvent) => any; + showModelessDialog(url?: string, argument?: any, options?: any): Window; + navigate(url: string): void; + resizeBy(x?: number, y?: number): void; + item(index: any): any; + resizeTo(x?: number, y?: number): void; + createPopup(arguments?: any): MSPopupWindow; + toStaticHTML(html: string): string; + execScript(code: string, language?: string): any; + msWriteProfilerMark(profilerMarkName: string): void; + moveTo(x?: number, y?: number): void; + moveBy(x?: number, y?: number): void; + showHelp(url: string, helpArg?: any, features?: string): void; + captureEvents(): void; + releaseEvents(): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface MSBehaviorUrnsCollection { + length: number; + item(index: number): string; +} +declare var MSBehaviorUrnsCollection: { + prototype: MSBehaviorUrnsCollection; + new(): MSBehaviorUrnsCollection; +} + +interface CSSFontFaceRule extends CSSRule { + style: CSSStyleDeclaration; +} +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface DOML2DeprecatedBackgroundStyle { + background: string; +} + +interface TextEvent extends UIEvent { + inputMethod: number; + data: string; + locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + DOM_INPUT_METHOD_KEYBOARD: number; + DOM_INPUT_METHOD_DROP: number; + DOM_INPUT_METHOD_IME: number; + DOM_INPUT_METHOD_SCRIPT: number; + DOM_INPUT_METHOD_VOICE: number; + DOM_INPUT_METHOD_UNKNOWN: number; + DOM_INPUT_METHOD_PASTE: number; + DOM_INPUT_METHOD_HANDWRITING: number; + DOM_INPUT_METHOD_OPTION: number; + DOM_INPUT_METHOD_MULTIMODAL: number; +} +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + DOM_INPUT_METHOD_KEYBOARD: number; + DOM_INPUT_METHOD_DROP: number; + DOM_INPUT_METHOD_IME: number; + DOM_INPUT_METHOD_SCRIPT: number; + DOM_INPUT_METHOD_VOICE: number; + DOM_INPUT_METHOD_UNKNOWN: number; + DOM_INPUT_METHOD_PASTE: number; + DOM_INPUT_METHOD_HANDWRITING: number; + DOM_INPUT_METHOD_OPTION: number; + DOM_INPUT_METHOD_MULTIMODAL: number; +} + +interface DocumentFragment extends Node, NodeSelector, MSEventAttachmentTarget, MSNodeExtensions { +} +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGAnimatedPathData { + pathSegList: SVGPathSegList; +} + +interface Position { + timestamp: Date; + coords: Coordinates; +} +declare var Position: { + prototype: Position; + new(): Position; +} + +interface BookmarkCollection { + length: number; + item(index: number): any; + [index: number]: any; +} +declare var BookmarkCollection: { + prototype: BookmarkCollection; + new(): BookmarkCollection; +} + +interface PerformanceMark extends PerformanceEntry { +} +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface CSSPageRule extends CSSRule { + pseudoClass: string; + selectorText: string; + selector: string; + style: CSSStyleDeclaration; +} +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; +} +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface MSNavigatorExtensions { + userLanguage: string; + plugins: MSPluginsCollection; + cookieEnabled: boolean; + appCodeName: string; + cpuClass: string; + appMinorVersion: string; + connectionSpeed: number; + browserLanguage: string; + mimeTypes: MSMimeTypesCollection; + systemLanguage: string; + language: string; + javaEnabled(): boolean; + taintEnabled(): boolean; +} + +interface HTMLSpanElement extends HTMLElement, MSDataBindingExtensions { +} +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; +} +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; +} +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLFormElement extends HTMLElement, MSHTMLCollectionExtensions { + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + elements: HTMLCollection; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + [name: string]: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; +} +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface SVGZoomAndPan { + zoomAndPan: number; + SVG_ZOOMANDPAN_MAGNIFY: number; + SVG_ZOOMANDPAN_UNKNOWN: number; + SVG_ZOOMANDPAN_DISABLE: number; +} +declare var SVGZoomAndPan: SVGZoomAndPan; + +interface HTMLMediaElement extends HTMLElement { + /** + * Gets the earliest possible position, in seconds, that the playback can begin. + */ + initialTime: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + played: TimeRanges; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + currentSrc: string; + readyState: any; + /** + * The autobuffer element is not supported by Internet Explorer 9. Use the preload element instead. + */ + autobuffer: boolean; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + /** + * Gets information about whether the playback has ended or not. + */ + ended: boolean; + /** + * Gets a collection of buffered time ranges. + */ + buffered: TimeRanges; + /** + * Returns an object representing the current error state of the audio or video element. + */ + error: MediaError; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + seekable: TimeRanges; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + duration: number; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Gets a flag that specifies whether playback is paused. + */ + paused: boolean; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + seeking: boolean; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + /** + * Gets the current network activity for the element. + */ + networkState: number; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + textTracks: TextTrackList; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + audioTracks: AudioTrackList; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + msKeys: MSMediaKeys; + msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + /** + * Fires immediately after the client loads the object. + */ + load(): void; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + HAVE_METADATA: number; + HAVE_CURRENT_DATA: number; + HAVE_NOTHING: number; + NETWORK_NO_SOURCE: number; + HAVE_ENOUGH_DATA: number; + NETWORK_EMPTY: number; + NETWORK_LOADING: number; + NETWORK_IDLE: number; + HAVE_FUTURE_DATA: number; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + HAVE_METADATA: number; + HAVE_CURRENT_DATA: number; + HAVE_NOTHING: number; + NETWORK_NO_SOURCE: number; + HAVE_ENOUGH_DATA: number; + NETWORK_EMPTY: number; + NETWORK_LOADING: number; + NETWORK_IDLE: number; + HAVE_FUTURE_DATA: number; +} + +interface ElementCSSInlineStyle { + runtimeStyle: MSStyleCSSProperties; + currentStyle: MSCurrentStyleCSSProperties; + doScroll(component?: any): void; + componentFromPoint(x: number, y: number): string; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface MSMimeTypesCollection { + length: number; +} +declare var MSMimeTypesCollection: { + prototype: MSMimeTypesCollection; + new(): MSMimeTypesCollection; +} + +interface StyleSheet { + disabled: boolean; + ownerNode: Node; + parentStyleSheet: StyleSheet; + href: string; + media: MediaList; + type: string; + title: string; +} +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + startOffset: SVGAnimatedLength; + method: SVGAnimatedEnumeration; + spacing: SVGAnimatedEnumeration; + TEXTPATH_SPACINGTYPE_EXACT: number; + TEXTPATH_METHODTYPE_STRETCH: number; + TEXTPATH_SPACINGTYPE_AUTO: number; + TEXTPATH_SPACINGTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_ALIGN: number; +} +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + TEXTPATH_SPACINGTYPE_EXACT: number; + TEXTPATH_METHODTYPE_STRETCH: number; + TEXTPATH_SPACINGTYPE_AUTO: number; + TEXTPATH_SPACINGTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_ALIGN: number; +} + +interface HTMLDTElement extends HTMLElement { + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDTElement: { + prototype: HTMLDTElement; + new(): HTMLDTElement; +} + +interface NodeList { + length: number; + item(index: number): Node; + [index: number]: Node; +} +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface PerformanceMeasure extends PerformanceEntry { +} +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGExternalResourcesRequired, SVGURIReference { + spreadMethod: SVGAnimatedEnumeration; + gradientTransform: SVGAnimatedTransformList; + gradientUnits: SVGAnimatedEnumeration; + SVG_SPREADMETHOD_REFLECT: number; + SVG_SPREADMETHOD_PAD: number; + SVG_SPREADMETHOD_UNKNOWN: number; + SVG_SPREADMETHOD_REPEAT: number; +} +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + SVG_SPREADMETHOD_REFLECT: number; + SVG_SPREADMETHOD_PAD: number; + SVG_SPREADMETHOD_UNKNOWN: number; + SVG_SPREADMETHOD_REPEAT: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; + SHOW_ENTITY_REFERENCE: number; + SHOW_NOTATION: number; + SHOW_ENTITY: number; + SHOW_DOCUMENT: number; + SHOW_PROCESSING_INSTRUCTION: number; + FILTER_REJECT: number; + SHOW_CDATA_SECTION: number; + FILTER_ACCEPT: number; + SHOW_ALL: number; + SHOW_DOCUMENT_TYPE: number; + SHOW_TEXT: number; + SHOW_ELEMENT: number; + SHOW_COMMENT: number; + FILTER_SKIP: number; + SHOW_ATTRIBUTE: number; + SHOW_DOCUMENT_FRAGMENT: number; +} +declare var NodeFilter: NodeFilter; + +interface SVGNumberList { + numberOfItems: number; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; + getItem(index: number): SVGNumber; + clear(): void; + appendItem(newItem: SVGNumber): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + removeItem(index: number): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; +} +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface MediaError { + code: number; + msExtendedCode: number; + MEDIA_ERR_ABORTED: number; + MEDIA_ERR_NETWORK: number; + MEDIA_ERR_SRC_NOT_SUPPORTED: number; + MEDIA_ERR_DECODE: number; + MS_MEDIA_ERR_ENCRYPTED: number; +} +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + MEDIA_ERR_ABORTED: number; + MEDIA_ERR_NETWORK: number; + MEDIA_ERR_SRC_NOT_SUPPORTED: number; + MEDIA_ERR_DECODE: number; + MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLBGSoundElement extends HTMLElement { + /** + * Sets or gets the value indicating how the volume of the background sound is divided between the left speaker and the right speaker. + */ + balance: any; + /** + * Sets or gets the volume setting for the sound. + */ + volume: any; + /** + * Sets or gets the URL of a sound to play. + */ + src: string; + /** + * Sets or retrieves the number of times a sound or video clip will loop when activated. + */ + loop: number; +} +declare var HTMLBGSoundElement: { + prototype: HTMLBGSoundElement; + new(): HTMLBGSoundElement; +} + +interface Comment extends CharacterData { + text: string; +} +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + redirectStart: number; + redirectEnd: number; + domainLookupEnd: number; + responseStart: number; + domainLookupStart: number; + fetchStart: number; + requestStart: number; + connectEnd: number; + connectStart: number; + initiatorType: string; + responseEnd: number; +} +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface CanvasPattern { +} +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; +} +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the contained object. + */ + object: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the class identifier for the object. + */ + classid: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + declare: boolean; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + BaseHref: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + readyState: number; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Retrieves the palette used for the embedded document. + */ + palette: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + hidden: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + pluginspage: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + readyState: string; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; +} +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface StorageEvent extends Event { + oldValue: any; + newValue: any; + url: string; + storageArea: Storage; + key: string; + initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; +} +declare var StorageEvent: { + prototype: StorageEvent; + new(): StorageEvent; +} + +interface CharacterData extends Node { + length: number; + data: string; + deleteData(offset: number, count: number): void; + replaceData(offset: number, count: number, arg: string): void; + appendData(arg: string): void; + insertData(offset: number, arg: string): void; + substringData(offset: number, count: number): string; +} +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface HTMLOptGroupElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + index: number; + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; +} +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLIsIndexElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + prompt: string; +} +declare var HTMLIsIndexElement: { + prototype: HTMLIsIndexElement; + new(): HTMLIsIndexElement; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface DOMException { + code: number; + message: string; + name: string; + toString(): string; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} + +interface SVGAnimatedBoolean { + animVal: boolean; + baseVal: boolean; +} +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface MSCompatibleInfoCollection { + length: number; + item(index: number): MSCompatibleInfo; +} +declare var MSCompatibleInfoCollection: { + prototype: MSCompatibleInfoCollection; + new(): MSCompatibleInfoCollection; +} + +interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + SVG_PRESERVEASPECTRATIO_NONE: number; + SVG_PRESERVEASPECTRATIO_XMINYMID: number; + SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + SVG_MEETORSLICE_UNKNOWN: number; + SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + SVG_MEETORSLICE_MEET: number; + SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + SVG_MEETORSLICE_SLICE: number; + SVG_PRESERVEASPECTRATIO_UNKNOWN: number; +} +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + SVG_PRESERVEASPECTRATIO_NONE: number; + SVG_PRESERVEASPECTRATIO_XMINYMID: number; + SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + SVG_MEETORSLICE_UNKNOWN: number; + SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + SVG_MEETORSLICE_MEET: number; + SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + SVG_MEETORSLICE_SLICE: number; + SVG_PRESERVEASPECTRATIO_UNKNOWN: number; +} + +interface Attr extends Node { + expando: boolean; + specified: boolean; + ownerElement: Element; + value: string; + name: string; +} +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface PerformanceNavigation { + redirectCount: number; + type: number; + toJSON(): any; + TYPE_RELOAD: number; + TYPE_RESERVED: number; + TYPE_BACK_FORWARD: number; + TYPE_NAVIGATE: number; +} +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + TYPE_RELOAD: number; + TYPE_RESERVED: number; + TYPE_BACK_FORWARD: number; + TYPE_NAVIGATE: number; +} + +interface SVGStopElement extends SVGElement, SVGStylable { + offset: SVGAnimatedNumber; +} +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface PositionCallback { + (position: Position): void; +} + +interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { +} +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGElementInstanceList { + length: number; + item(index: number): SVGElementInstance; +} +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface CSSRuleList { + length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface MSDataBindingRecordSetExtensions { + recordset: any; + namedRecordset(dataMember: string, hierarchy?: any): any; +} + +interface LinkStyle { + styleSheet: StyleSheet; + sheet: StyleSheet; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the width of the video element. + */ + width: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + videoWidth: number; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + videoHeight: number; + /** + * Gets or sets the height of the video element. + */ + height: number; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + msIsStereo3D: boolean; + msStereo3DPackingMode: string; + onMSVideoOptimalLayoutChanged: (ev: any) => any; + onMSVideoFrameStepCompleted: (ev: any) => any; + msStereo3DRenderMode: string; + msIsLayoutOptimalForPlayback: boolean; + msHorizontalMirror: boolean; + onMSVideoFormatChanged: (ev: any) => any; + msZoom: boolean; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + msFrameStep(forward: boolean): void; + getVideoPlaybackQuality(): VideoPlaybackQuality; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFrameStepCompleted", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFormatChanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface ClientRectList { + length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface SVGMaskElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + maskUnits: SVGAnimatedEnumeration; + maskContentUnits: SVGAnimatedEnumeration; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface External { +} +declare var External: { + prototype: External; + new(): External; +} + +interface MSGestureEvent extends UIEvent { + offsetY: number; + translationY: number; + velocityExpansion: number; + velocityY: number; + velocityAngular: number; + translationX: number; + velocityX: number; + hwTimestamp: number; + offsetX: number; + screenX: number; + rotation: number; + expansion: number; + clientY: number; + screenY: number; + scale: number; + gestureObject: any; + clientX: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + MSGESTURE_FLAG_BEGIN: number; + MSGESTURE_FLAG_END: number; + MSGESTURE_FLAG_CANCEL: number; + MSGESTURE_FLAG_INERTIA: number; + MSGESTURE_FLAG_NONE: number; +} +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + MSGESTURE_FLAG_BEGIN: number; + MSGESTURE_FLAG_END: number; + MSGESTURE_FLAG_CANCEL: number; + MSGESTURE_FLAG_INERTIA: number; + MSGESTURE_FLAG_NONE: number; +} + +interface ErrorEvent extends Event { + colno: number; + filename: string; + error: any; + lineno: number; + message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + filterResX: SVGAnimatedInteger; + filterUnits: SVGAnimatedEnumeration; + primitiveUnits: SVGAnimatedEnumeration; + x: SVGAnimatedLength; + height: SVGAnimatedLength; + filterResY: SVGAnimatedInteger; + setFilterRes(filterResX: number, filterResY: number): void; +} +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface TrackEvent extends Event { + track: any; +} +declare var TrackEvent: { + prototype: TrackEvent; + new(): TrackEvent; +} + +interface SVGFEMergeNodeElement extends SVGElement { + in1: SVGAnimatedString; +} +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { +} +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface TextTrackCue extends EventTarget { + onenter: (ev: Event) => any; + track: TextTrack; + endTime: number; + text: string; + pauseOnExit: boolean; + id: string; + startTime: number; + onexit: (ev: Event) => any; + getCueAsHTML(): DocumentFragment; + addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface MSStreamReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; +} +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface DOMTokenList { + length: number; + contains(token: string): boolean; + remove(token: string): void; + toggle(token: string): boolean; + add(token: string): void; + item(index: number): string; + [index: number]: string; + toString(): string; +} +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; +} +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in2: SVGAnimatedString; + mode: SVGAnimatedEnumeration; + in1: SVGAnimatedString; + SVG_FEBLEND_MODE_DARKEN: number; + SVG_FEBLEND_MODE_UNKNOWN: number; + SVG_FEBLEND_MODE_MULTIPLY: number; + SVG_FEBLEND_MODE_NORMAL: number; + SVG_FEBLEND_MODE_SCREEN: number; + SVG_FEBLEND_MODE_LIGHTEN: number; +} +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + SVG_FEBLEND_MODE_DARKEN: number; + SVG_FEBLEND_MODE_UNKNOWN: number; + SVG_FEBLEND_MODE_MULTIPLY: number; + SVG_FEBLEND_MODE_NORMAL: number; + SVG_FEBLEND_MODE_SCREEN: number; + SVG_FEBLEND_MODE_LIGHTEN: number; +} + +interface MessageChannel { + port2: MessagePort; + port1: MessagePort; +} +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { +} +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface TransitionEvent extends Event { + propertyName: string; + elapsedTime: number; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} +declare var TransitionEvent: { + prototype: TransitionEvent; + new(): TransitionEvent; +} + +interface MediaQueryList { + matches: boolean; + media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface DOMError { + name: string; + toString(): string; +} +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface CloseEvent extends Event { + wasClean: boolean; + reason: string; + code: number; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface WebSocket extends EventTarget { + protocol: string; + readyState: number; + bufferedAmount: number; + onopen: (ev: Event) => any; + extensions: string; + onmessage: (ev: MessageEvent) => any; + onclose: (ev: CloseEvent) => any; + onerror: (ev: ErrorEvent) => any; + binaryType: string; + url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; + addEventListener(type: "open", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string): WebSocket; + new(url: string, protocols?: string[]): WebSocket; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; +} + +interface SVGFEPointLightElement extends SVGElement { + y: SVGAnimatedNumber; + x: SVGAnimatedNumber; + z: SVGAnimatedNumber; +} +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface ProgressEvent extends Event { + loaded: number; + lengthComputable: boolean; + total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} +declare var ProgressEvent: { + prototype: ProgressEvent; + new(): ProgressEvent; +} + +interface IDBObjectStore { + indexNames: DOMStringList; + name: string; + transaction: IDBTransaction; + keyPath: string; + count(key?: any): IDBRequest; + add(value: any, key?: any): IDBRequest; + clear(): IDBRequest; + createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + put(value: any, key?: any): IDBRequest; + openCursor(range?: any, direction?: string): IDBRequest; + deleteIndex(indexName: string): void; + index(name: string): IDBIndex; + get(key: any): IDBRequest; + delete(key: any): IDBRequest; +} +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + stdDeviationX: SVGAnimatedNumber; + in1: SVGAnimatedString; + stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; +} +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + x: SVGAnimatedLength; + height: SVGAnimatedLength; + result: SVGAnimatedString; +} + +interface IDBVersionChangeEvent extends Event { + newVersion: number; + oldVersion: number; +} +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IDBIndex { + unique: boolean; + name: string; + keyPath: string; + objectStore: IDBObjectStore; + count(key?: any): IDBRequest; + getKey(key: any): IDBRequest; + openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + get(key: any): IDBRequest; + openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; +} +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface FileList { + length: number; + item(index: number): File; + [index: number]: File; +} +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface IDBCursor { + source: any; + direction: string; + key: any; + primaryKey: any; + advance(count: number): void; + delete(): IDBRequest; + continue(key?: any): void; + update(value: any): IDBRequest; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + kernelUnitLengthY: SVGAnimatedNumber; + surfaceScale: SVGAnimatedNumber; + specularExponent: SVGAnimatedNumber; + in1: SVGAnimatedString; + kernelUnitLengthX: SVGAnimatedNumber; + specularConstant: SVGAnimatedNumber; +} +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface File extends Blob { + lastModifiedDate: any; + name: string; +} +declare var File: { + prototype: File; + new(): File; +} + +interface URL { + revokeObjectURL(url: string): void; + createObjectURL(object: any, options?: ObjectURLOptions): string; +} +declare var URL: URL; + +interface IDBCursorWithValue extends IDBCursor { + value: any; +} +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface XMLHttpRequestEventTarget extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + ontimeout: (ev: Event) => any; + onabort: (ev: UIEvent) => any; + onloadstart: (ev: Event) => any; + onloadend: (ev: ProgressEvent) => any; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequestEventTarget: { + prototype: XMLHttpRequestEventTarget; + new(): XMLHttpRequestEventTarget; } -interface WebGLProgram extends WebGLObject { +interface IDBEnvironment { + msIndexedDB: IDBFactory; + indexedDB: IDBFactory; } -interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +interface AudioTrackList extends EventTarget { + length: number; + onchange: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + onremovetrack: (ev: any /*PluginArray*/) => any; + getTrackById(id: string): AudioTrack; + item(index: number): AudioTrack; + [index: number]: AudioTrack; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: any /*PluginArray*/) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface MSBaseReader extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + readyState: number; + onabort: (ev: UIEvent) => any; + onloadend: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onloadstart: (ev: Event) => any; + result: any; + abort(): void; + LOADING: number; + EMPTY: number; + DONE: number; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + operator: SVGAnimatedEnumeration; + radiusX: SVGAnimatedNumber; + radiusY: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + SVG_MORPHOLOGY_OPERATOR_ERODE: number; + SVG_MORPHOLOGY_OPERATOR_DILATE: number; +} +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + SVG_MORPHOLOGY_OPERATOR_ERODE: number; + SVG_MORPHOLOGY_OPERATOR_DILATE: number; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface WindowTimersExtension { + msSetImmediate(expression: any, ...args: any[]): number; + clearImmediate(handle: number): void; + msClearImmediate(handle: number): void; + setImmediate(expression: any, ...args: any[]): number; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in2: SVGAnimatedString; + xChannelSelector: SVGAnimatedEnumeration; + yChannelSelector: SVGAnimatedEnumeration; + scale: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_CHANNEL_B: number; + SVG_CHANNEL_R: number; + SVG_CHANNEL_G: number; + SVG_CHANNEL_UNKNOWN: number; + SVG_CHANNEL_A: number; +} +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + SVG_CHANNEL_B: number; + SVG_CHANNEL_R: number; + SVG_CHANNEL_G: number; + SVG_CHANNEL_UNKNOWN: number; + SVG_CHANNEL_A: number; +} + +interface AnimationEvent extends Event { + animationName: string; + elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} +declare var AnimationEvent: { + prototype: AnimationEvent; + new(): AnimationEvent; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + tableValues: SVGAnimatedNumberList; + slope: SVGAnimatedNumber; + type: SVGAnimatedEnumeration; + exponent: SVGAnimatedNumber; + amplitude: SVGAnimatedNumber; + intercept: SVGAnimatedNumber; + offset: SVGAnimatedNumber; + SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; +} +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; +} + +interface MSRangeCollection { + length: number; + item(index: number): Range; + [index: number]: Range; +} +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface SVGFEDistantLightElement extends SVGElement { + azimuth: SVGAnimatedNumber; + elevation: SVGAnimatedNumber; +} +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface IDBKeyRange { + upper: any; + upperOpen: boolean; + lower: any; + lowerOpen: boolean; +} +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + lowerBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(bound: any, open?: boolean): IDBKeyRange; +} + +interface WindowConsole { + console: Console; +} + +interface IDBTransaction extends EventTarget { + oncomplete: (ev: Event) => any; + db: IDBDatabase; + mode: string; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: UIEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; +} + +interface AudioTrack { + kind: string; + language: string; + id: string; + label: string; + enabled: boolean; + sourceBuffer: SourceBuffer; +} +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + orderY: SVGAnimatedInteger; + kernelUnitLengthY: SVGAnimatedNumber; + orderX: SVGAnimatedInteger; + preserveAlpha: SVGAnimatedBoolean; + kernelMatrix: SVGAnimatedNumberList; + edgeMode: SVGAnimatedEnumeration; + kernelUnitLengthX: SVGAnimatedNumber; + bias: SVGAnimatedNumber; + targetX: SVGAnimatedInteger; + targetY: SVGAnimatedInteger; + divisor: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_EDGEMODE_WRAP: number; + SVG_EDGEMODE_DUPLICATE: number; + SVG_EDGEMODE_UNKNOWN: number; + SVG_EDGEMODE_NONE: number; +} +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + SVG_EDGEMODE_WRAP: number; + SVG_EDGEMODE_DUPLICATE: number; + SVG_EDGEMODE_UNKNOWN: number; + SVG_EDGEMODE_NONE: number; +} + +interface TextTrackCueList { + length: number; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; + getCueById(id: string): TextTrackCue; +} +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface CSSKeyframesRule extends CSSRule { + name: string; + cssRules: CSSRuleList; + findRule(rule: string): CSSKeyframeRule; + deleteRule(rule: string): void; + appendRule(rule: string): void; +} +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + baseFrequencyX: SVGAnimatedNumber; + numOctaves: SVGAnimatedInteger; + type: SVGAnimatedEnumeration; + baseFrequencyY: SVGAnimatedNumber; + stitchTiles: SVGAnimatedEnumeration; + seed: SVGAnimatedNumber; + SVG_STITCHTYPE_UNKNOWN: number; + SVG_STITCHTYPE_NOSTITCH: number; + SVG_TURBULENCE_TYPE_UNKNOWN: number; + SVG_TURBULENCE_TYPE_TURBULENCE: number; + SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + SVG_STITCHTYPE_STITCH: number; +} +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + SVG_STITCHTYPE_UNKNOWN: number; + SVG_STITCHTYPE_NOSTITCH: number; + SVG_TURBULENCE_TYPE_UNKNOWN: number; + SVG_TURBULENCE_TYPE_TURBULENCE: number; + SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + SVG_STITCHTYPE_STITCH: number; +} + +interface TextTrackList extends EventTarget { + length: number; + onaddtrack: (ev: TrackEvent) => any; + item(index: number): TextTrack; + [index: number]: TextTrack; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } -declare var OES_standard_derivatives: { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; } -interface WebGLFramebuffer extends WebGLObject { +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { } - -interface WebGLShader extends WebGLObject { +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; } -interface OES_texture_float_linear { +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; + type: SVGAnimatedEnumeration; + values: SVGAnimatedNumberList; + SVG_FECOLORMATRIX_TYPE_SATURATE: number; + SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + SVG_FECOLORMATRIX_TYPE_MATRIX: number; + SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; } - -interface WebGLObject { +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + SVG_FECOLORMATRIX_TYPE_SATURATE: number; + SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + SVG_FECOLORMATRIX_TYPE_MATRIX: number; + SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; } -interface WebGLBuffer extends WebGLObject { +interface SVGFESpotLightElement extends SVGElement { + pointsAtY: SVGAnimatedNumber; + y: SVGAnimatedNumber; + limitingConeAngle: SVGAnimatedNumber; + specularExponent: SVGAnimatedNumber; + x: SVGAnimatedNumber; + pointsAtZ: SVGAnimatedNumber; + z: SVGAnimatedNumber; + pointsAtX: SVGAnimatedNumber; } - -interface WebGLShaderPrecisionFormat { - rangeMin: number; - rangeMax: number; - precision: number; +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; } -interface EXT_texture_filter_anisotropic { - TEXTURE_MAX_ANISOTROPY_EXT: number; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; -} -declare var EXT_texture_filter_anisotropic: { - TEXTURE_MAX_ANISOTROPY_EXT: number; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; +interface WindowBase64 { + btoa(rawString: string): string; + atob(encodedString: string): string; } - -///////////////////////////// -/// addEventListener overloads -///////////////////////////// - -interface HTMLElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; +interface IDBDatabase extends EventTarget { + version: string; + name: string; + objectStoreNames: DOMStringList; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: UIEvent) => any; + createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + close(): void; + transaction(storeNames: any, mode?: string): IDBTransaction; + deleteObjectStore(name: string): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} -interface Document { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; +interface DOMStringList { + length: number; + contains(str: string): boolean; + item(index: number): string; + [index: number]: string; +} +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface IDBOpenDBRequest extends IDBRequest { + onupgradeneeded: (ev: IDBVersionChangeEvent) => any; + onblocked: (ev: Event) => any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storagecommit", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msfullscreenerror", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msfullscreenchange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blocked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} -interface Element { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; +interface HTMLProgressElement extends HTMLElement { + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + position: number; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface MSLaunchUriCallback { + (): void; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + dy: SVGAnimatedNumber; + in1: SVGAnimatedString; + dx: SVGAnimatedNumber; +} +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface MSUnsafeFunctionCallback { + (): any; +} + +interface TextTrack extends EventTarget { + language: string; + mode: any; + readyState: number; + activeCues: TextTrackCueList; + cues: TextTrackCueList; + oncuechange: (ev: Event) => any; + kind: string; + onload: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + label: string; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + ERROR: number; + SHOWING: number; + LOADING: number; + LOADED: number; + NONE: number; + HIDDEN: number; + DISABLED: number; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + ERROR: number; + SHOWING: number; + LOADING: number; + LOADED: number; + NONE: number; + HIDDEN: number; + DISABLED: number; +} -interface MSNamespaceInfo { - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} + +interface IDBRequest extends EventTarget { + source: any; + onsuccess: (ev: Event) => any; + error: DOMError; + transaction: IDBTransaction; + onerror: (ev: ErrorEvent) => any; + readyState: string; + result: any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} -interface Window { - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; +interface MessagePort extends EventTarget { + onmessage: (ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} -interface SVGElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface FileReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; +} +declare var FileReader: { + prototype: FileReader; + new(): FileReader; } -interface HTMLFrameElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; +interface ApplicationCache extends EventTarget { + status: number; + ondownloading: (ev: Event) => any; + onprogress: (ev: ProgressEvent) => any; + onupdateready: (ev: Event) => any; + oncached: (ev: Event) => any; + onobsolete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + onchecking: (ev: Event) => any; + onnoupdate: (ev: Event) => any; + swapCache(): void; + abort(): void; + update(): void; + CHECKING: number; + UNCACHED: number; + UPDATEREADY: number; + DOWNLOADING: number; + IDLE: number; + OBSOLETE: number; + addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "updateready", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "obsolete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "noupdate", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + CHECKING: number; + UNCACHED: number; + UPDATEREADY: number; + DOWNLOADING: number; + IDLE: number; + OBSOLETE: number; +} + +interface FrameRequestCallback { + (time: number): void; +} + +interface PopStateEvent extends Event { + state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} +declare var PopStateEvent: { + prototype: PopStateEvent; + new(): PopStateEvent; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + style: CSSStyleDeclaration; +} +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSStream { + type: string; + msDetachStream(): any; + msClose(): void; +} +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface IDBFactory { + open(name: string, version?: number): IDBOpenDBRequest; + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; +} +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface MSPointerEvent extends MouseEvent { + width: number; + rotation: number; + pressure: number; + pointerType: any; + isPrimary: boolean; + tiltY: number; + height: number; + intermediatePoints: any; + currentPoint: any; + tiltX: number; + hwTimestamp: number; + pointerId: number; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + MSPOINTER_TYPE_PEN: number; + MSPOINTER_TYPE_MOUSE: number; + MSPOINTER_TYPE_TOUCH: number; +} +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(): MSPointerEvent; + MSPOINTER_TYPE_PEN: number; + MSPOINTER_TYPE_MOUSE: number; + MSPOINTER_TYPE_TOUCH: number; +} -interface XMLHttpRequest { - addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface MSManipulationEvent extends UIEvent { + lastState: number; + currentState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + MS_MANIPULATION_STATE_STOPPED: number; + MS_MANIPULATION_STATE_ACTIVE: number; + MS_MANIPULATION_STATE_INERTIA: number; + MS_MANIPULATION_STATE_SELECTING: number; + MS_MANIPULATION_STATE_COMMITTED: number; + MS_MANIPULATION_STATE_PRESELECT: number; + MS_MANIPULATION_STATE_DRAGGING: number; + MS_MANIPULATION_STATE_CANCELLED: number; +} +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + MS_MANIPULATION_STATE_STOPPED: number; + MS_MANIPULATION_STATE_ACTIVE: number; + MS_MANIPULATION_STATE_INERTIA: number; + MS_MANIPULATION_STATE_SELECTING: number; + MS_MANIPULATION_STATE_COMMITTED: number; + MS_MANIPULATION_STATE_PRESELECT: number; + MS_MANIPULATION_STATE_DRAGGING: number; + MS_MANIPULATION_STATE_CANCELLED: number; } -interface HTMLFrameSetElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; +interface FormData { + append(name: any, value: any, blobName?: string): void; +} +declare var FormData: { + prototype: FormData; + new(): FormData; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollection; +} +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface SVGFEImageElement extends SVGElement, SVGLangSpace, SVGFilterPrimitiveStandardAttributes, SVGURIReference, SVGExternalResourcesRequired { + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; +} +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface AbstractWorker extends EventTarget { + onerror: (ev: ErrorEvent) => any; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } -interface Screen { - addEventListener(type: "msorientationchange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + operator: SVGAnimatedEnumeration; + in2: SVGAnimatedString; + k2: SVGAnimatedNumber; + k1: SVGAnimatedNumber; + k3: SVGAnimatedNumber; + in1: SVGAnimatedString; + k4: SVGAnimatedNumber; + SVG_FECOMPOSITE_OPERATOR_OUT: number; + SVG_FECOMPOSITE_OPERATOR_OVER: number; + SVG_FECOMPOSITE_OPERATOR_XOR: number; + SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + SVG_FECOMPOSITE_OPERATOR_IN: number; + SVG_FECOMPOSITE_OPERATOR_ATOP: number; +} +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + SVG_FECOMPOSITE_OPERATOR_OUT: number; + SVG_FECOMPOSITE_OPERATOR_OVER: number; + SVG_FECOMPOSITE_OPERATOR_XOR: number; + SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + SVG_FECOMPOSITE_OPERATOR_IN: number; + SVG_FECOMPOSITE_OPERATOR_ATOP: number; +} + +interface ValidityState { + customError: boolean; + valueMissing: boolean; + stepMismatch: boolean; + rangeUnderflow: boolean; + rangeOverflow: boolean; + typeMismatch: boolean; + patternMismatch: boolean; + tooLong: boolean; + valid: boolean; +} +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface HTMLTrackElement extends HTMLElement { + kind: string; + src: string; + srclang: string; + track: TextTrack; + label: string; + default: boolean; + readyState: number; + ERROR: number; + LOADING: number; + LOADED: number; + NONE: number; +} +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + ERROR: number; + LOADING: number; + LOADED: number; + NONE: number; +} + +interface MSApp { + createFileFromStorageFile(storageFile: any): File; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + terminateApp(exceptionObject: any): void; + createDataPackage(object: any): any; + execUnsafeLocalFunction(unsafeFunction: MSUnsafeFunctionCallback): any; + getHtmlPrintDocumentSource(htmlDoc: any): any; + addPublicLocalApplicationUri(uri: string): void; + createDataPackageFromSelection(): any; + getViewOpener(): MSAppView; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + createNewView(uri: string): MSAppView; + getCurrentPriority(): string; + NORMAL: string; + HIGH: string; + IDLE: string; + CURRENT: string; } +declare var MSApp: MSApp; -interface SVGSVGElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "zoom", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; +} +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; } -interface HTMLIFrameElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + kernelUnitLengthY: SVGAnimatedNumber; + surfaceScale: SVGAnimatedNumber; + in1: SVGAnimatedString; + kernelUnitLengthX: SVGAnimatedNumber; + diffuseConstant: SVGAnimatedNumber; +} +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface MSCSSMatrix { + m24: number; + m34: number; + a: number; + d: number; + m32: number; + m41: number; + m11: number; + f: number; + e: number; + m23: number; + m14: number; + m33: number; + m22: number; + m21: number; + c: number; + m12: number; + b: number; + m42: number; + m31: number; + m43: number; + m13: number; + m44: number; + multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; + skewY(angle: number): MSCSSMatrix; + setMatrixValue(value: string): void; + inverse(): MSCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; + toString(): string; + rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; + translate(x: number, y: number, z?: number): MSCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; + skewX(angle: number): MSCSSMatrix; +} +declare var MSCSSMatrix: { + prototype: MSCSSMatrix; + new(text?: string): MSCSSMatrix; +} + +interface Worker extends AbstractWorker { + onmessage: (ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} + +interface MSGraphicsTrust { + status: string; + constrictionActive: boolean; +} +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface SubtleCrypto { + unwrapKey(wrappedKey: ArrayBufferView, keyAlgorithm: any, keyEncryptionKey: Key, extractable?: boolean, keyUsages?: string[]): KeyOperation; + encrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; + importKey(format: string, keyData: ArrayBufferView, algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + wrapKey(key: Key, keyEncryptionKey: Key, keyWrappingAlgorithm: any): KeyOperation; + verify(algorithm: any, key: Key, signature: ArrayBufferView, buffer?: ArrayBufferView): CryptoOperation; + deriveKey(algorithm: any, baseKey: Key, derivedKeyType: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + digest(algorithm: any, buffer?: ArrayBufferView): CryptoOperation; + exportKey(format: string, key: Key): KeyOperation; + generateKey(algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + sign(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; + decrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; +} +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface Crypto extends RandomSource { + subtle: SubtleCrypto; +} +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface VideoPlaybackQuality { + totalFrameDelay: number; + creationTime: number; + totalVideoFrames: number; + droppedVideoFrames: number; +} +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} -interface HTMLBodyElement { +interface GlobalEventHandlers { + onpointerenter: (ev: PointerEvent) => any; + onpointerout: (ev: PointerEvent) => any; + onpointerdown: (ev: PointerEvent) => any; + onpointerup: (ev: PointerEvent) => any; + onpointercancel: (ev: PointerEvent) => any; + onpointerover: (ev: PointerEvent) => any; + onpointermove: (ev: PointerEvent) => any; + onpointerleave: (ev: PointerEvent) => any; addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; @@ -14159,680 +12453,1647 @@ interface HTMLBodyElement { addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface Key { + algorithm: Algorithm; + type: string; + extractable: boolean; + keyUsage: string[]; +} +declare var Key: { + prototype: Key; + new(): Key; +} + +interface DeviceAcceleration { + y: number; + x: number; + z: number; +} +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface HTMLAllCollection extends HTMLCollection { + namedItem(name: string): Element; + // [name: string]: Element; +} +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface AesGcmEncryptResult { + ciphertext: ArrayBuffer; + tag: ArrayBuffer; +} +declare var AesGcmEncryptResult: { + prototype: AesGcmEncryptResult; + new(): AesGcmEncryptResult; +} + +interface NavigationCompletedEvent extends NavigationEvent { + webErrorStatus: number; + isSuccess: boolean; +} +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface MutationRecord { + oldValue: string; + previousSibling: Node; + addedNodes: NodeList; + attributeName: string; + removedNodes: NodeList; + target: Node; + nextSibling: Node; + attributeNamespace: string; + type: string; +} +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface MimeTypeArray { + length: number; + item(index: number): Plugin; + [index: number]: Plugin; + namedItem(type: string): Plugin; + // [type: string]: Plugin; +} +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface KeyOperation extends EventTarget { + oncomplete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + result: any; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var KeyOperation: { + prototype: KeyOperation; + new(): KeyOperation; +} + +interface DOMStringMap { +} +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DeviceOrientationEvent extends Event { + gamma: number; + alpha: number; + absolute: boolean; + beta: number; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; +} +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(): DeviceOrientationEvent; +} + +interface MSMediaKeys { + keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; +} + +interface MSMediaKeyMessageEvent extends Event { + destinationURL: string; + message: Uint8Array; +} +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} -interface XDomainRequest { - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface MSHTMLWebViewElement extends HTMLElement { + documentTitle: string; + width: number; + src: string; + canGoForward: boolean; + height: number; + canGoBack: boolean; + navigateWithHttpRequestMessage(requestMessage: any): void; + goBack(): void; + navigate(uri: string): void; + stop(): void; + navigateToString(contents: string): void; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + refresh(): void; + goForward(): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; +} +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; } -interface HTMLMarqueeElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface NavigationEvent extends Event { + uri: string; +} +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; } -interface MSWindowExtensions { - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SourceBuffer extends EventTarget { + updating: boolean; + appendWindowStart: number; + appendWindowEnd: number; + buffered: TimeRanges; + timestampOffset: number; + audioTracks: AudioTrackList; + appendBuffer(data: ArrayBuffer): void; + remove(start: number, end: number): void; + abort(): void; + appendStream(stream: MSStream, maxSize?: number): void; +} +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface MSInputMethodContext extends EventTarget { + oncandidatewindowshow: (ev: any) => any; + target: HTMLElement; + compositionStartOffset: number; + oncandidatewindowhide: (ev: any) => any; + oncandidatewindowupdate: (ev: any) => any; + compositionEndOffset: number; + getCompositionAlternatives(): string[]; + getCandidateWindowClientRect(): ClientRect; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: "candidatewindowshow", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "candidatewindowhide", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "candidatewindowupdate", listener: (ev: any) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface DeviceRotationRate { + gamma: number; + alpha: number; + beta: number; +} +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface PluginArray { + length: number; + refresh(reload?: boolean): void; + item(index: number): Plugin; + [index: number]: Plugin; + namedItem(name: string): Plugin; + // [name: string]: Plugin; +} +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface MSMediaKeyError { + systemCode: number; + code: number; + MS_MEDIA_KEYERR_SERVICE: number; + MS_MEDIA_KEYERR_HARDWARECHANGE: number; + MS_MEDIA_KEYERR_OUTPUT: number; + MS_MEDIA_KEYERR_DOMAIN: number; + MS_MEDIA_KEYERR_UNKNOWN: number; + MS_MEDIA_KEYERR_CLIENT: number; +} +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + MS_MEDIA_KEYERR_SERVICE: number; + MS_MEDIA_KEYERR_HARDWARECHANGE: number; + MS_MEDIA_KEYERR_OUTPUT: number; + MS_MEDIA_KEYERR_DOMAIN: number; + MS_MEDIA_KEYERR_UNKNOWN: number; + MS_MEDIA_KEYERR_CLIENT: number; +} + +interface Plugin { + length: number; + filename: string; + version: string; + name: string; + description: string; + item(index: number): MimeType; + [index: number]: MimeType; + namedItem(type: string): MimeType; + // [type: string]: MimeType; +} +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface MediaSource extends EventTarget { + sourceBuffers: SourceBufferList; + duration: number; + readyState: string; + activeSourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: string): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface SourceBufferList extends EventTarget { + length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} -interface HTMLMediaElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface XMLDocument extends Document { +} +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; } -interface HTMLVideoElement { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface DeviceMotionEvent extends Event { + rotationRate: DeviceRotationRate; + acceleration: DeviceAcceleration; + interval: number; + accelerationIncludingGravity: DeviceAcceleration; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; +} +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(): DeviceMotionEvent; } -interface TextTrackCue { - addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface MimeType { + enabledPlugin: Plugin; + suffixes: string; + type: string; + description: string; +} +declare var MimeType: { + prototype: MimeType; + new(): MimeType; } -interface WebSocket { - addEventListener(type: "open", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface PointerEvent extends MouseEvent { + width: number; + rotation: number; + pressure: number; + pointerType: any; + isPrimary: boolean; + tiltY: number; + height: number; + intermediatePoints: any; + currentPoint: any; + tiltX: number; + hwTimestamp: number; + pointerId: number; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; +} +declare var PointerEvent: { + prototype: PointerEvent; + new(): PointerEvent; } -interface XMLHttpRequestEventTarget { - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface MSDocumentExtensions { + captureEvents(): void; + releaseEvents(): void; } -interface AudioTrackList { - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (ev: any /*PluginArray*/) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface MutationObserver { + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; + disconnect(): void; +} +declare var MutationObserver: { + prototype: MutationObserver; + new (callback: (arr: MutationRecord[], observer: MutationObserver)=>any): MutationObserver; } -interface MSBaseReader { - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; +interface MSWebViewAsyncOperation extends EventTarget { + target: MSHTMLWebViewElement; + oncomplete: (ev: Event) => any; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + readyState: number; + type: number; + result: any; + start(): void; + ERROR: number; + TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + TYPE_INVOKE_SCRIPT: number; + COMPLETED: number; + TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + STARTED: number; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } -interface IDBTransaction { +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + ERROR: number; + TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + TYPE_INVOKE_SCRIPT: number; + COMPLETED: number; + TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + STARTED: number; +} + +interface ScriptNotifyEvent extends Event { + value: string; + callingUri: string; +} +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + redirectStart: number; + domainLookupEnd: number; + responseStart: number; + domComplete: number; + domainLookupStart: number; + loadEventStart: number; + unloadEventEnd: number; + fetchStart: number; + requestStart: number; + domInteractive: number; + navigationStart: number; + connectEnd: number; + loadEventEnd: number; + connectStart: number; + responseEnd: number; + domLoading: number; + redirectEnd: number; + redirectCount: number; + unloadEventStart: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + type: string; +} +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface MSMediaKeyNeededEvent extends Event { + initData: Uint8Array; +} +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface LongRunningScriptDetectedEvent extends Event { + stopPageScriptExecution: boolean; + executionTime: number; +} +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSAppView { + viewId: number; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; +} +declare var MSAppView: { + prototype: MSAppView; + new(): MSAppView; +} + +interface PerfWidgetExternal { + maxCpuSpeed: number; + independentRenderingEnabled: boolean; + irDisablingContentString: string; + irStatusAvailable: boolean; + performanceCounter: number; + averagePaintTime: number; + activeNetworkRequestCount: number; + paintRequestsPerSecond: number; + extraInformationEnabled: boolean; + performanceCounterFrequency: number; + averageFrameTime: number; + repositionWindow(x: number, y: number): void; + getRecentMemoryUsage(last: number): any; + getMemoryUsage(): number; + resizeWindow(width: number, height: number): void; + getProcessCpuUsage(): number; + removeEventListener(eventType: string, callback: (ev: any) => any): void; + getRecentCpuUsage(last: number): any; + addEventListener(eventType: string, callback: (ev: any) => any): void; + getRecentFrames(last: number): any; + getRecentPaintRequests(last: number): any; +} +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface PageTransitionEvent extends Event { + persisted: boolean; +} +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} + +interface HTMLDocument extends Document { +} +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface KeyPair { + privateKey: Key; + publicKey: Key; +} +declare var KeyPair: { + prototype: KeyPair; + new(): KeyPair; +} + +interface MSMediaKeySession extends EventTarget { + sessionId: string; + error: MSMediaKeyError; + keySystem: string; + close(): void; + update(key: Uint8Array): void; +} +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEvent { + referrer: string; +} +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface CryptoOperation extends EventTarget { + algorithm: Algorithm; + oncomplete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: UIEvent) => any; + key: Key; + result: any; + abort(): void; + finish(): void; + process(buffer: ArrayBufferView): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } +declare var CryptoOperation: { + prototype: CryptoOperation; + new(): CryptoOperation; +} -interface TextTrackList { - addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLTexture extends WebGLObject { +} +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; } -interface IDBDatabase { - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface OES_texture_float { +} +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface WebGLContextEvent extends Event { + statusMessage: string; +} +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(): WebGLContextEvent; +} + +interface WebGLRenderbuffer extends WebGLObject { +} +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLUniformLocation { +} +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebGLActiveInfo { + name: string; + type: number; + size: number; +} +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WEBGL_compressed_texture_s3tc { + COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WebGLRenderingContext { + drawingBufferWidth: number; + drawingBufferHeight: number; + canvas: HTMLCanvasElement; + getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; + bindTexture(target: number, texture: WebGLTexture): void; + bufferData(target: number, data: ArrayBufferView, usage: number): void; + bufferData(target: number, data: ArrayBuffer, usage: number): void; + bufferData(target: number, size: number, usage: number): void; + depthMask(flag: boolean): void; + getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; + vertexAttrib3fv(indx: number, values: number[]): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; + linkProgram(program: WebGLProgram): void; + getSupportedExtensions(): string[]; + bufferSubData(target: number, offset: number, data: ArrayBuffer): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + polygonOffset(factor: number, units: number): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + createTexture(): WebGLTexture; + hint(target: number, mode: number): void; + getVertexAttrib(index: number, pname: number): any; + enableVertexAttribArray(index: number): void; + depthRange(zNear: number, zFar: number): void; + cullFace(mode: number): void; + createFramebuffer(): WebGLFramebuffer; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + getExtension(name: string): any; + createProgram(): WebGLProgram; + deleteShader(shader: WebGLShader): void; + getAttachedShaders(program: WebGLProgram): WebGLShader[]; + enable(cap: number): void; + blendEquation(mode: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void; + createBuffer(): WebGLBuffer; + deleteTexture(texture: WebGLTexture): void; + useProgram(program: WebGLProgram): void; + vertexAttrib2fv(indx: number, values: number[]): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; + checkFramebufferStatus(target: number): number; + frontFace(mode: number): void; + getBufferParameter(target: number, pname: number): any; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + getVertexAttribOffset(index: number, pname: number): number; + disableVertexAttribArray(index: number): void; + blendFunc(sfactor: number, dfactor: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + isFramebuffer(framebuffer: WebGLFramebuffer): boolean; + uniform3iv(location: WebGLUniformLocation, v: number[]): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + lineWidth(width: number): void; + getShaderInfoLog(shader: WebGLShader): string; + getTexParameter(target: number, pname: number): any; + getParameter(pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; + getContextAttributes(): WebGLContextAttributes; + vertexAttrib1f(indx: number, x: number): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + isContextLost(): boolean; + uniform1iv(location: WebGLUniformLocation, v: number[]): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + getRenderbufferParameter(target: number, pname: number): any; + uniform2fv(location: WebGLUniformLocation, v: number[]): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + isTexture(texture: WebGLTexture): boolean; + getError(): number; + shaderSource(shader: WebGLShader, source: string): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; + stencilMask(mask: number): void; + bindBuffer(target: number, buffer: WebGLBuffer): void; + getAttribLocation(program: WebGLProgram, name: string): number; + uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + clear(mask: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + scissor(x: number, y: number, width: number, height: number): void; + uniform2i(location: WebGLUniformLocation, x: number, y: number): void; + getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; + getShaderSource(shader: WebGLShader): string; + generateMipmap(target: number): void; + bindAttribLocation(program: WebGLProgram, index: number, name: string): void; + uniform1fv(location: WebGLUniformLocation, v: number[]): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2iv(location: WebGLUniformLocation, v: number[]): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + uniform4fv(location: WebGLUniformLocation, v: number[]): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + vertexAttrib1fv(indx: number, values: number[]): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; + flush(): void; + uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + deleteProgram(program: WebGLProgram): void; + isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; + uniform1i(location: WebGLUniformLocation, x: number): void; + getProgramParameter(program: WebGLProgram, pname: number): any; + getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; + stencilFunc(func: number, ref: number, mask: number): void; + pixelStorei(pname: number, param: number): void; + disable(cap: number): void; + vertexAttrib4fv(indx: number, values: number[]): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; + createRenderbuffer(): WebGLRenderbuffer; + isBuffer(buffer: WebGLBuffer): boolean; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + sampleCoverage(value: number, invert: boolean): void; + depthFunc(func: number): void; + texParameterf(target: number, pname: number, param: number): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + drawArrays(mode: number, first: number, count: number): void; + texParameteri(target: number, pname: number, param: number): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + getShaderParameter(shader: WebGLShader, pname: number): any; + clearDepth(depth: number): void; + activeTexture(texture: number): void; + viewport(x: number, y: number, width: number, height: number): void; + detachShader(program: WebGLProgram, shader: WebGLShader): void; + uniform1f(location: WebGLUniformLocation, x: number): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + deleteBuffer(buffer: WebGLBuffer): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + uniform3fv(location: WebGLUniformLocation, v: number[]): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + stencilMaskSeparate(face: number, mask: number): void; + attachShader(program: WebGLProgram, shader: WebGLShader): void; + compileShader(shader: WebGLShader): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + isShader(shader: WebGLShader): boolean; + clearStencil(s: number): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; + finish(): void; + uniform2f(location: WebGLUniformLocation, x: number, y: number): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; + getProgramInfoLog(program: WebGLProgram): string; + validateProgram(program: WebGLProgram): void; + isEnabled(cap: number): boolean; + vertexAttrib2f(indx: number, x: number, y: number): void; + isProgram(program: WebGLProgram): boolean; + createShader(type: number): WebGLShader; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; + uniform4iv(location: WebGLUniformLocation, v: number[]): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; + DEPTH_FUNC: number; + DEPTH_COMPONENT16: number; + REPLACE: number; + REPEAT: number; + VERTEX_ATTRIB_ARRAY_ENABLED: number; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + STENCIL_BUFFER_BIT: number; + RENDERER: number; + STENCIL_BACK_REF: number; + TEXTURE26: number; + RGB565: number; + DITHER: number; + CONSTANT_COLOR: number; + GENERATE_MIPMAP_HINT: number; + POINTS: number; + DECR: number; + INT_VEC3: number; + TEXTURE28: number; + ONE_MINUS_CONSTANT_ALPHA: number; + BACK: number; + RENDERBUFFER_STENCIL_SIZE: number; + UNPACK_FLIP_Y_WEBGL: number; + BLEND: number; + TEXTURE9: number; + ARRAY_BUFFER_BINDING: number; + MAX_VIEWPORT_DIMS: number; + INVALID_FRAMEBUFFER_OPERATION: number; + TEXTURE: number; + TEXTURE0: number; + TEXTURE31: number; + TEXTURE24: number; + HIGH_INT: number; + RENDERBUFFER_BINDING: number; + BLEND_COLOR: number; + FASTEST: number; + STENCIL_WRITEMASK: number; + ALIASED_POINT_SIZE_RANGE: number; + TEXTURE12: number; + DST_ALPHA: number; + BLEND_EQUATION_RGB: number; + FRAMEBUFFER_COMPLETE: number; + NEAREST_MIPMAP_NEAREST: number; + VERTEX_ATTRIB_ARRAY_SIZE: number; + TEXTURE3: number; + DEPTH_WRITEMASK: number; + CONTEXT_LOST_WEBGL: number; + INVALID_VALUE: number; + TEXTURE_MAG_FILTER: number; + ONE_MINUS_CONSTANT_COLOR: number; + ONE_MINUS_SRC_ALPHA: number; + TEXTURE_CUBE_MAP_POSITIVE_Z: number; + NOTEQUAL: number; + ALPHA: number; + DEPTH_STENCIL: number; + MAX_VERTEX_UNIFORM_VECTORS: number; + DEPTH_COMPONENT: number; + RENDERBUFFER_RED_SIZE: number; + TEXTURE20: number; + RED_BITS: number; + RENDERBUFFER_BLUE_SIZE: number; + SCISSOR_BOX: number; + VENDOR: number; + FRONT_AND_BACK: number; + CONSTANT_ALPHA: number; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + NEAREST: number; + CULL_FACE: number; + ALIASED_LINE_WIDTH_RANGE: number; + TEXTURE19: number; + FRONT: number; + DEPTH_CLEAR_VALUE: number; + GREEN_BITS: number; + TEXTURE29: number; + TEXTURE23: number; + MAX_RENDERBUFFER_SIZE: number; + STENCIL_ATTACHMENT: number; + TEXTURE27: number; + BOOL_VEC2: number; + OUT_OF_MEMORY: number; + MIRRORED_REPEAT: number; + POLYGON_OFFSET_UNITS: number; + TEXTURE_MIN_FILTER: number; + STENCIL_BACK_PASS_DEPTH_PASS: number; + LINE_LOOP: number; + FLOAT_MAT3: number; + TEXTURE14: number; + LINEAR: number; + RGB5_A1: number; + ONE_MINUS_SRC_COLOR: number; + SAMPLE_COVERAGE_INVERT: number; + DONT_CARE: number; + FRAMEBUFFER_BINDING: number; + RENDERBUFFER_ALPHA_SIZE: number; + STENCIL_REF: number; + ZERO: number; + DECR_WRAP: number; + SAMPLE_COVERAGE: number; + STENCIL_BACK_FUNC: number; + TEXTURE30: number; + VIEWPORT: number; + STENCIL_BITS: number; + FLOAT: number; + COLOR_WRITEMASK: number; + SAMPLE_COVERAGE_VALUE: number; + TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + STENCIL_BACK_FAIL: number; + FLOAT_MAT4: number; + UNSIGNED_SHORT_4_4_4_4: number; + TEXTURE6: number; + RENDERBUFFER_WIDTH: number; + RGBA4: number; + ALWAYS: number; + BLEND_EQUATION_ALPHA: number; + COLOR_BUFFER_BIT: number; + TEXTURE_CUBE_MAP: number; + DEPTH_BUFFER_BIT: number; + STENCIL_CLEAR_VALUE: number; + BLEND_EQUATION: number; + RENDERBUFFER_GREEN_SIZE: number; + NEAREST_MIPMAP_LINEAR: number; + VERTEX_ATTRIB_ARRAY_TYPE: number; + INCR_WRAP: number; + ONE_MINUS_DST_COLOR: number; + HIGH_FLOAT: number; + BYTE: number; + FRONT_FACE: number; + SAMPLE_ALPHA_TO_COVERAGE: number; + CCW: number; + TEXTURE13: number; + MAX_VERTEX_ATTRIBS: number; + MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_WRAP_T: number; + UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + FLOAT_VEC2: number; + LUMINANCE: number; + GREATER: number; + INT_VEC2: number; + VALIDATE_STATUS: number; + FRAMEBUFFER: number; + FRAMEBUFFER_UNSUPPORTED: number; + TEXTURE5: number; + FUNC_SUBTRACT: number; + BLEND_DST_ALPHA: number; + SAMPLER_CUBE: number; + ONE_MINUS_DST_ALPHA: number; + LESS: number; + TEXTURE_CUBE_MAP_POSITIVE_X: number; + BLUE_BITS: number; + DEPTH_TEST: number; + VERTEX_ATTRIB_ARRAY_STRIDE: number; + DELETE_STATUS: number; + TEXTURE18: number; + POLYGON_OFFSET_FACTOR: number; + UNSIGNED_INT: number; + TEXTURE_2D: number; + DST_COLOR: number; + FLOAT_MAT2: number; + COMPRESSED_TEXTURE_FORMATS: number; + MAX_FRAGMENT_UNIFORM_VECTORS: number; + DEPTH_STENCIL_ATTACHMENT: number; + LUMINANCE_ALPHA: number; + CW: number; + VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + LINEAR_MIPMAP_LINEAR: number; + BUFFER_SIZE: number; + SAMPLE_BUFFERS: number; + TEXTURE15: number; + ACTIVE_TEXTURE: number; + VERTEX_SHADER: number; + TEXTURE22: number; + VERTEX_ATTRIB_ARRAY_POINTER: number; + INCR: number; + COMPILE_STATUS: number; + MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + TEXTURE7: number; + UNSIGNED_SHORT_5_5_5_1: number; + DEPTH_BITS: number; + RGBA: number; + TRIANGLE_STRIP: number; + COLOR_CLEAR_VALUE: number; + BROWSER_DEFAULT_WEBGL: number; + INVALID_ENUM: number; + SCISSOR_TEST: number; + LINE_STRIP: number; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + STENCIL_FUNC: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + RENDERBUFFER_HEIGHT: number; + TEXTURE8: number; + TRIANGLES: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + STENCIL_BACK_VALUE_MASK: number; + TEXTURE25: number; + RENDERBUFFER: number; + LEQUAL: number; + TEXTURE1: number; + STENCIL_INDEX8: number; + FUNC_ADD: number; + STENCIL_FAIL: number; + BLEND_SRC_ALPHA: number; + BOOL: number; + ALPHA_BITS: number; + LOW_INT: number; + TEXTURE10: number; + SRC_COLOR: number; + MAX_VARYING_VECTORS: number; + BLEND_DST_RGB: number; + TEXTURE_BINDING_CUBE_MAP: number; + STENCIL_INDEX: number; + TEXTURE_BINDING_2D: number; + MEDIUM_INT: number; + SHADER_TYPE: number; + POLYGON_OFFSET_FILL: number; + DYNAMIC_DRAW: number; + TEXTURE4: number; + STENCIL_BACK_PASS_DEPTH_FAIL: number; + STREAM_DRAW: number; + MAX_CUBE_MAP_TEXTURE_SIZE: number; + TEXTURE17: number; + TRIANGLE_FAN: number; + UNPACK_ALIGNMENT: number; + CURRENT_PROGRAM: number; + LINES: number; + INVALID_OPERATION: number; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + LINEAR_MIPMAP_NEAREST: number; + CLAMP_TO_EDGE: number; + RENDERBUFFER_DEPTH_SIZE: number; + TEXTURE_WRAP_S: number; + ELEMENT_ARRAY_BUFFER: number; + UNSIGNED_SHORT_5_6_5: number; + ACTIVE_UNIFORMS: number; + FLOAT_VEC3: number; + NO_ERROR: number; + ATTACHED_SHADERS: number; + DEPTH_ATTACHMENT: number; + TEXTURE11: number; + STENCIL_TEST: number; + ONE: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + STATIC_DRAW: number; + GEQUAL: number; + BOOL_VEC4: number; + COLOR_ATTACHMENT0: number; + PACK_ALIGNMENT: number; + MAX_TEXTURE_SIZE: number; + STENCIL_PASS_DEPTH_FAIL: number; + CULL_FACE_MODE: number; + TEXTURE16: number; + STENCIL_BACK_WRITEMASK: number; + SRC_ALPHA: number; + UNSIGNED_SHORT: number; + TEXTURE21: number; + FUNC_REVERSE_SUBTRACT: number; + SHADING_LANGUAGE_VERSION: number; + EQUAL: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + BOOL_VEC3: number; + SAMPLER_2D: number; + TEXTURE_CUBE_MAP_NEGATIVE_X: number; + MAX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_CUBE_MAP_POSITIVE_Y: number; + RENDERBUFFER_INTERNAL_FORMAT: number; + STENCIL_VALUE_MASK: number; + ELEMENT_ARRAY_BUFFER_BINDING: number; + ARRAY_BUFFER: number; + DEPTH_RANGE: number; + NICEST: number; + ACTIVE_ATTRIBUTES: number; + NEVER: number; + FLOAT_VEC4: number; + CURRENT_VERTEX_ATTRIB: number; + STENCIL_PASS_DEPTH_PASS: number; + INVERT: number; + LINK_STATUS: number; + RGB: number; + INT_VEC4: number; + TEXTURE2: number; + UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + MEDIUM_FLOAT: number; + SRC_ALPHA_SATURATE: number; + BUFFER_USAGE: number; + SHORT: number; + NONE: number; + UNSIGNED_BYTE: number; + INT: number; + SUBPIXEL_BITS: number; + KEEP: number; + SAMPLES: number; + FRAGMENT_SHADER: number; + LINE_WIDTH: number; + BLEND_SRC_RGB: number; + LOW_FLOAT: number; + VERSION: number; } - -interface IDBOpenDBRequest { - addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blocked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + DEPTH_FUNC: number; + DEPTH_COMPONENT16: number; + REPLACE: number; + REPEAT: number; + VERTEX_ATTRIB_ARRAY_ENABLED: number; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + STENCIL_BUFFER_BIT: number; + RENDERER: number; + STENCIL_BACK_REF: number; + TEXTURE26: number; + RGB565: number; + DITHER: number; + CONSTANT_COLOR: number; + GENERATE_MIPMAP_HINT: number; + POINTS: number; + DECR: number; + INT_VEC3: number; + TEXTURE28: number; + ONE_MINUS_CONSTANT_ALPHA: number; + BACK: number; + RENDERBUFFER_STENCIL_SIZE: number; + UNPACK_FLIP_Y_WEBGL: number; + BLEND: number; + TEXTURE9: number; + ARRAY_BUFFER_BINDING: number; + MAX_VIEWPORT_DIMS: number; + INVALID_FRAMEBUFFER_OPERATION: number; + TEXTURE: number; + TEXTURE0: number; + TEXTURE31: number; + TEXTURE24: number; + HIGH_INT: number; + RENDERBUFFER_BINDING: number; + BLEND_COLOR: number; + FASTEST: number; + STENCIL_WRITEMASK: number; + ALIASED_POINT_SIZE_RANGE: number; + TEXTURE12: number; + DST_ALPHA: number; + BLEND_EQUATION_RGB: number; + FRAMEBUFFER_COMPLETE: number; + NEAREST_MIPMAP_NEAREST: number; + VERTEX_ATTRIB_ARRAY_SIZE: number; + TEXTURE3: number; + DEPTH_WRITEMASK: number; + CONTEXT_LOST_WEBGL: number; + INVALID_VALUE: number; + TEXTURE_MAG_FILTER: number; + ONE_MINUS_CONSTANT_COLOR: number; + ONE_MINUS_SRC_ALPHA: number; + TEXTURE_CUBE_MAP_POSITIVE_Z: number; + NOTEQUAL: number; + ALPHA: number; + DEPTH_STENCIL: number; + MAX_VERTEX_UNIFORM_VECTORS: number; + DEPTH_COMPONENT: number; + RENDERBUFFER_RED_SIZE: number; + TEXTURE20: number; + RED_BITS: number; + RENDERBUFFER_BLUE_SIZE: number; + SCISSOR_BOX: number; + VENDOR: number; + FRONT_AND_BACK: number; + CONSTANT_ALPHA: number; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + NEAREST: number; + CULL_FACE: number; + ALIASED_LINE_WIDTH_RANGE: number; + TEXTURE19: number; + FRONT: number; + DEPTH_CLEAR_VALUE: number; + GREEN_BITS: number; + TEXTURE29: number; + TEXTURE23: number; + MAX_RENDERBUFFER_SIZE: number; + STENCIL_ATTACHMENT: number; + TEXTURE27: number; + BOOL_VEC2: number; + OUT_OF_MEMORY: number; + MIRRORED_REPEAT: number; + POLYGON_OFFSET_UNITS: number; + TEXTURE_MIN_FILTER: number; + STENCIL_BACK_PASS_DEPTH_PASS: number; + LINE_LOOP: number; + FLOAT_MAT3: number; + TEXTURE14: number; + LINEAR: number; + RGB5_A1: number; + ONE_MINUS_SRC_COLOR: number; + SAMPLE_COVERAGE_INVERT: number; + DONT_CARE: number; + FRAMEBUFFER_BINDING: number; + RENDERBUFFER_ALPHA_SIZE: number; + STENCIL_REF: number; + ZERO: number; + DECR_WRAP: number; + SAMPLE_COVERAGE: number; + STENCIL_BACK_FUNC: number; + TEXTURE30: number; + VIEWPORT: number; + STENCIL_BITS: number; + FLOAT: number; + COLOR_WRITEMASK: number; + SAMPLE_COVERAGE_VALUE: number; + TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + STENCIL_BACK_FAIL: number; + FLOAT_MAT4: number; + UNSIGNED_SHORT_4_4_4_4: number; + TEXTURE6: number; + RENDERBUFFER_WIDTH: number; + RGBA4: number; + ALWAYS: number; + BLEND_EQUATION_ALPHA: number; + COLOR_BUFFER_BIT: number; + TEXTURE_CUBE_MAP: number; + DEPTH_BUFFER_BIT: number; + STENCIL_CLEAR_VALUE: number; + BLEND_EQUATION: number; + RENDERBUFFER_GREEN_SIZE: number; + NEAREST_MIPMAP_LINEAR: number; + VERTEX_ATTRIB_ARRAY_TYPE: number; + INCR_WRAP: number; + ONE_MINUS_DST_COLOR: number; + HIGH_FLOAT: number; + BYTE: number; + FRONT_FACE: number; + SAMPLE_ALPHA_TO_COVERAGE: number; + CCW: number; + TEXTURE13: number; + MAX_VERTEX_ATTRIBS: number; + MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_WRAP_T: number; + UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + FLOAT_VEC2: number; + LUMINANCE: number; + GREATER: number; + INT_VEC2: number; + VALIDATE_STATUS: number; + FRAMEBUFFER: number; + FRAMEBUFFER_UNSUPPORTED: number; + TEXTURE5: number; + FUNC_SUBTRACT: number; + BLEND_DST_ALPHA: number; + SAMPLER_CUBE: number; + ONE_MINUS_DST_ALPHA: number; + LESS: number; + TEXTURE_CUBE_MAP_POSITIVE_X: number; + BLUE_BITS: number; + DEPTH_TEST: number; + VERTEX_ATTRIB_ARRAY_STRIDE: number; + DELETE_STATUS: number; + TEXTURE18: number; + POLYGON_OFFSET_FACTOR: number; + UNSIGNED_INT: number; + TEXTURE_2D: number; + DST_COLOR: number; + FLOAT_MAT2: number; + COMPRESSED_TEXTURE_FORMATS: number; + MAX_FRAGMENT_UNIFORM_VECTORS: number; + DEPTH_STENCIL_ATTACHMENT: number; + LUMINANCE_ALPHA: number; + CW: number; + VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + LINEAR_MIPMAP_LINEAR: number; + BUFFER_SIZE: number; + SAMPLE_BUFFERS: number; + TEXTURE15: number; + ACTIVE_TEXTURE: number; + VERTEX_SHADER: number; + TEXTURE22: number; + VERTEX_ATTRIB_ARRAY_POINTER: number; + INCR: number; + COMPILE_STATUS: number; + MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + TEXTURE7: number; + UNSIGNED_SHORT_5_5_5_1: number; + DEPTH_BITS: number; + RGBA: number; + TRIANGLE_STRIP: number; + COLOR_CLEAR_VALUE: number; + BROWSER_DEFAULT_WEBGL: number; + INVALID_ENUM: number; + SCISSOR_TEST: number; + LINE_STRIP: number; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + STENCIL_FUNC: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + RENDERBUFFER_HEIGHT: number; + TEXTURE8: number; + TRIANGLES: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + STENCIL_BACK_VALUE_MASK: number; + TEXTURE25: number; + RENDERBUFFER: number; + LEQUAL: number; + TEXTURE1: number; + STENCIL_INDEX8: number; + FUNC_ADD: number; + STENCIL_FAIL: number; + BLEND_SRC_ALPHA: number; + BOOL: number; + ALPHA_BITS: number; + LOW_INT: number; + TEXTURE10: number; + SRC_COLOR: number; + MAX_VARYING_VECTORS: number; + BLEND_DST_RGB: number; + TEXTURE_BINDING_CUBE_MAP: number; + STENCIL_INDEX: number; + TEXTURE_BINDING_2D: number; + MEDIUM_INT: number; + SHADER_TYPE: number; + POLYGON_OFFSET_FILL: number; + DYNAMIC_DRAW: number; + TEXTURE4: number; + STENCIL_BACK_PASS_DEPTH_FAIL: number; + STREAM_DRAW: number; + MAX_CUBE_MAP_TEXTURE_SIZE: number; + TEXTURE17: number; + TRIANGLE_FAN: number; + UNPACK_ALIGNMENT: number; + CURRENT_PROGRAM: number; + LINES: number; + INVALID_OPERATION: number; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + LINEAR_MIPMAP_NEAREST: number; + CLAMP_TO_EDGE: number; + RENDERBUFFER_DEPTH_SIZE: number; + TEXTURE_WRAP_S: number; + ELEMENT_ARRAY_BUFFER: number; + UNSIGNED_SHORT_5_6_5: number; + ACTIVE_UNIFORMS: number; + FLOAT_VEC3: number; + NO_ERROR: number; + ATTACHED_SHADERS: number; + DEPTH_ATTACHMENT: number; + TEXTURE11: number; + STENCIL_TEST: number; + ONE: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + STATIC_DRAW: number; + GEQUAL: number; + BOOL_VEC4: number; + COLOR_ATTACHMENT0: number; + PACK_ALIGNMENT: number; + MAX_TEXTURE_SIZE: number; + STENCIL_PASS_DEPTH_FAIL: number; + CULL_FACE_MODE: number; + TEXTURE16: number; + STENCIL_BACK_WRITEMASK: number; + SRC_ALPHA: number; + UNSIGNED_SHORT: number; + TEXTURE21: number; + FUNC_REVERSE_SUBTRACT: number; + SHADING_LANGUAGE_VERSION: number; + EQUAL: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + BOOL_VEC3: number; + SAMPLER_2D: number; + TEXTURE_CUBE_MAP_NEGATIVE_X: number; + MAX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_CUBE_MAP_POSITIVE_Y: number; + RENDERBUFFER_INTERNAL_FORMAT: number; + STENCIL_VALUE_MASK: number; + ELEMENT_ARRAY_BUFFER_BINDING: number; + ARRAY_BUFFER: number; + DEPTH_RANGE: number; + NICEST: number; + ACTIVE_ATTRIBUTES: number; + NEVER: number; + FLOAT_VEC4: number; + CURRENT_VERTEX_ATTRIB: number; + STENCIL_PASS_DEPTH_PASS: number; + INVERT: number; + LINK_STATUS: number; + RGB: number; + INT_VEC4: number; + TEXTURE2: number; + UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + MEDIUM_FLOAT: number; + SRC_ALPHA_SATURATE: number; + BUFFER_USAGE: number; + SHORT: number; + NONE: number; + UNSIGNED_BYTE: number; + INT: number; + SUBPIXEL_BITS: number; + KEEP: number; + SAMPLES: number; + FRAGMENT_SHADER: number; + LINE_WIDTH: number; + BLEND_SRC_RGB: number; + LOW_FLOAT: number; + VERSION: number; } -interface TextTrack { - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLProgram extends WebGLObject { +} +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; } -interface IDBRequest { - addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface OES_standard_derivatives { + FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } -interface MessagePort { - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLFramebuffer extends WebGLObject { +} +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; } -interface ApplicationCache { - addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLShader extends WebGLObject { +} +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; } -interface AbstractWorker { - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface OES_texture_float_linear { } -interface Worker { - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; } -interface GlobalEventHandlers { - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLObject { } -interface KeyOperation { - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; } -interface MSInputMethodContext { - addEventListener(type: "candidatewindowshow", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "candidatewindowhide", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: "candidatewindowupdate", listener: (ev: any) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLBuffer extends WebGLObject { +} +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; } -interface MSWebViewAsyncOperation { - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface WebGLShaderPrecisionFormat { + rangeMin: number; + rangeMax: number; + precision: number; +} +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; } -interface CryptoOperation { - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +interface EXT_texture_filter_anisotropic { + TEXTURE_MAX_ANISOTROPY_EXT: number; + MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; +} +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + TEXTURE_MAX_ANISOTROPY_EXT: number; + MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; } +declare var Option: { new(text?: string, value?: string, defaultSelected?: boolean, selected?:boolean): HTMLOptionElement; }; +declare var Image: { new(width?: number, height?: number): HTMLImageElement; }; +declare var Audio: { new(src?: string): HTMLAudioElement; }; +declare var ondragend: (ev: DragEvent) => any; +declare var onkeydown: (ev: KeyboardEvent) => any; +declare var ondragover: (ev: DragEvent) => any; +declare var onkeyup: (ev: KeyboardEvent) => any; +declare var onreset: (ev: Event) => any; +declare var onmouseup: (ev: MouseEvent) => any; +declare var ondragstart: (ev: DragEvent) => any; +declare var ondrag: (ev: DragEvent) => any; +declare var screenX: number; +declare var onmouseover: (ev: MouseEvent) => any; +declare var ondragleave: (ev: DragEvent) => any; +declare var history: History; +declare var pageXOffset: number; +declare var name: string; +declare var onafterprint: (ev: Event) => any; +declare var onpause: (ev: Event) => any; +declare var onbeforeprint: (ev: Event) => any; +declare var top: Window; +declare var onmousedown: (ev: MouseEvent) => any; +declare var onseeked: (ev: Event) => any; +declare var opener: Window; +declare var onclick: (ev: MouseEvent) => any; +declare var innerHeight: number; +declare var onwaiting: (ev: Event) => any; +declare var ononline: (ev: Event) => any; +declare var ondurationchange: (ev: Event) => any; +declare var frames: Window; +declare var onblur: (ev: FocusEvent) => any; +declare var onemptied: (ev: Event) => any; +declare var onseeking: (ev: Event) => any; +declare var oncanplay: (ev: Event) => any; +declare var outerWidth: number; +declare var onstalled: (ev: Event) => any; +declare var onmousemove: (ev: MouseEvent) => any; +declare var innerWidth: number; +declare var onoffline: (ev: Event) => any; +declare var length: number; +declare var screen: Screen; +declare var onbeforeunload: (ev: BeforeUnloadEvent) => any; +declare var onratechange: (ev: Event) => any; +declare var onstorage: (ev: StorageEvent) => any; +declare var onloadstart: (ev: Event) => any; +declare var ondragenter: (ev: DragEvent) => any; +declare var onsubmit: (ev: Event) => any; +declare var self: Window; +declare var document: Document; +declare var onprogress: (ev: ProgressEvent) => any; +declare var ondblclick: (ev: MouseEvent) => any; +declare var pageYOffset: number; +declare var oncontextmenu: (ev: MouseEvent) => any; +declare var onchange: (ev: Event) => any; +declare var onloadedmetadata: (ev: Event) => any; +declare var onplay: (ev: Event) => any; +declare var onerror: ErrorEventHandler; +declare var onplaying: (ev: Event) => any; +declare var parent: Window; +declare var location: Location; +declare var oncanplaythrough: (ev: Event) => any; +declare var onabort: (ev: UIEvent) => any; +declare var onreadystatechange: (ev: Event) => any; +declare var outerHeight: number; +declare var onkeypress: (ev: KeyboardEvent) => any; +declare var frameElement: Element; +declare var onloadeddata: (ev: Event) => any; +declare var onsuspend: (ev: Event) => any; +declare var window: Window; +declare var onfocus: (ev: FocusEvent) => any; +declare var onmessage: (ev: MessageEvent) => any; +declare var ontimeupdate: (ev: Event) => any; +declare var onresize: (ev: UIEvent) => any; +declare var onselect: (ev: UIEvent) => any; +declare var navigator: Navigator; +declare var styleMedia: StyleMedia; +declare var ondrop: (ev: DragEvent) => any; +declare var onmouseout: (ev: MouseEvent) => any; +declare var onended: (ev: Event) => any; +declare var onhashchange: (ev: Event) => any; +declare var onunload: (ev: Event) => any; +declare var onscroll: (ev: UIEvent) => any; +declare var screenY: number; +declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onload: (ev: Event) => any; +declare var onvolumechange: (ev: Event) => any; +declare var oninput: (ev: Event) => any; +declare var performance: Performance; +declare var onmspointerdown: (ev: any) => any; +declare var animationStartTime: number; +declare var onmsgesturedoubletap: (ev: any) => any; +declare var onmspointerhover: (ev: any) => any; +declare var onmsgesturehold: (ev: any) => any; +declare var onmspointermove: (ev: any) => any; +declare var onmsgesturechange: (ev: any) => any; +declare var onmsgesturestart: (ev: any) => any; +declare var onmspointercancel: (ev: any) => any; +declare var onmsgestureend: (ev: any) => any; +declare var onmsgesturetap: (ev: any) => any; +declare var onmspointerout: (ev: any) => any; +declare var msAnimationStartTime: number; +declare var applicationCache: ApplicationCache; +declare var onmsinertiastart: (ev: any) => any; +declare var onmspointerover: (ev: any) => any; +declare var onpopstate: (ev: PopStateEvent) => any; +declare var onmspointerup: (ev: any) => any; +declare var onpageshow: (ev: PageTransitionEvent) => any; +declare var ondevicemotion: (ev: DeviceMotionEvent) => any; +declare var devicePixelRatio: number; +declare var msCrypto: Crypto; +declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; +declare var doNotTrack: string; +declare var onmspointerenter: (ev: any) => any; +declare var onpagehide: (ev: PageTransitionEvent) => any; +declare var onmspointerleave: (ev: any) => any; +declare function alert(message?: any): void; +declare function scroll(x?: number, y?: number): void; +declare function focus(): void; +declare function scrollTo(x?: number, y?: number): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string; +declare function toString(): string; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function scrollBy(x?: number, y?: number): void; +declare function confirm(message?: string): boolean; +declare function close(): void; +declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function showModalDialog(url?: string, argument?: any, options?: any): any; +declare function blur(): void; +declare function getSelection(): Selection; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function msCancelRequestAnimationFrame(handle: number): void; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function cancelAnimationFrame(handle: number): void; +declare function msIsStaticHTML(html: string): boolean; +declare function msMatchMedia(mediaQuery: string): MediaQueryList; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare function dispatchEvent(evt: Event): boolean; +declare function attachEvent(event: string, listener: EventListener): boolean; +declare function detachEvent(event: string, listener: EventListener): void; +declare var localStorage: Storage; +declare var status: string; +declare var onmouseleave: (ev: MouseEvent) => any; +declare var screenLeft: number; +declare var offscreenBuffering: any; +declare var maxConnectionsPerServer: number; +declare var onmouseenter: (ev: MouseEvent) => any; +declare var clipboardData: DataTransfer; +declare var defaultStatus: string; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var onhelp: (ev: Event) => any; +declare var external: External; +declare var event: MSEventObj; +declare var onfocusout: (ev: FocusEvent) => any; +declare var screenTop: number; +declare var onfocusin: (ev: FocusEvent) => any; +declare function showModelessDialog(url?: string, argument?: any, options?: any): Window; +declare function navigate(url: string): void; +declare function resizeBy(x?: number, y?: number): void; +declare function item(index: any): any; +declare function resizeTo(x?: number, y?: number): void; +declare function createPopup(arguments?: any): MSPopupWindow; +declare function toStaticHTML(html: string): string; +declare function execScript(code: string, language?: string): any; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function moveTo(x?: number, y?: number): void; +declare function moveBy(x?: number, y?: number): void; +declare function showHelp(url: string, helpArg?: any, features?: string): void; +declare function captureEvents(): void; +declare function releaseEvents(): void; +declare var sessionStorage: Storage; +declare function clearTimeout(handle: number): void; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearInterval(handle: number): void; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function msSetImmediate(expression: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function msClearImmediate(handle: number): void; +declare function setImmediate(expression: any, ...args: any[]): number; +declare function btoa(rawString: string): string; +declare function atob(encodedString: string): string; +declare var msIndexedDB: IDBFactory; +declare var indexedDB: IDBFactory; +declare var console: Console; +declare var onpointerenter: (ev: PointerEvent) => any; +declare var onpointerout: (ev: PointerEvent) => any; +declare var onpointerdown: (ev: PointerEvent) => any; +declare var onpointerup: (ev: PointerEvent) => any; +declare var onpointercancel: (ev: PointerEvent) => any; +declare var onpointerover: (ev: PointerEvent) => any; +declare var onpointermove: (ev: PointerEvent) => any; +declare var onpointerleave: (ev: PointerEvent) => any; declare function addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14929,17 +14190,17 @@ declare function addEventListener(type: "pagehide", listener: (ev: PageTransitio declare function addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; - ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// -// TODO: These are only available in a Web Worker - should be in a separate lib file +// These are only available in a Web Worker declare function importScripts(...urls: string[]): void; ///////////////////////////// /// Windows Script Host APIS ///////////////////////////// + declare var ActiveXObject: { new (s: string): any; }; interface ITextWriter { diff --git a/lib/typescript-src/support/typescript/bin/lib.dom.d.ts b/lib/typescript-src/support/typescript/bin/lib.dom.d.ts new file mode 100644 index 0000000..5b2c075 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/lib.dom.d.ts @@ -0,0 +1,13043 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// + +///////////////////////////// +/// IE10 ECMAScript Extensions +///////////////////////////// + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +declare var ArrayBuffer: { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; +} + +interface ArrayBufferView { + buffer: ArrayBuffer; + byteOffset: number; + byteLength: number; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Int8Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int8Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; +} +declare var Int8Array: { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: Int8Array): Int8Array; + new (array: number[]): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Uint8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; +} +declare var Uint8Array: { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: Uint8Array): Uint8Array; + new (array: number[]): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 16-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int16Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int16Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; +} +declare var Int16Array: { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: Int16Array): Int16Array; + new (array: number[]): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint16Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Uint16Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; +} +declare var Uint16Array: { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: Uint16Array): Uint16Array; + new (array: number[]): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 32-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int32Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; +} +declare var Int32Array: { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: Int32Array): Int32Array; + new (array: number[]): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint32Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; +} +declare var Uint32Array: { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: Uint32Array): Uint32Array; + new (array: number[]): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Float32Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float32Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Float32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; +} +declare var Float32Array: { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: Float32Array): Float32Array; + new (array: number[]): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Float64Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float64Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Float64Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; +} +declare var Float64Array: { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: Float64Array): Float64Array; + new (array: number[]): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + BYTES_PER_ELEMENT: number; +} + +/** + * You can use a DataView object to read and write the different kinds of binary data to any location in the ArrayBuffer. + */ +interface DataView extends ArrayBufferView { + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; +} +declare var DataView: { + prototype: DataView; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): DataView; +} + +///////////////////////////// +/// IE11 ECMAScript Extensions +///////////////////////////// + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value: V): Map; + size: number; +} +declare var Map: { + new (): Map; + prototype: Map; +} + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value: V): WeakMap; +} +declare var WeakMap: { + new (): WeakMap; + prototype: WeakMap; +} + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + size: number; +} +declare var Set: { + new (): Set; + prototype: Set; +} +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumintegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): Collator; + new (locale?: string, options?: NumberFormatOptions): Collator; + (locales?: string[], options?: NumberFormatOptions): Collator; + (locale?: string, options?: NumberFormatOptions): Collator; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12: boolean; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date: number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): Collator; + new (locale?: string, options?: DateTimeFormatOptions): Collator; + (locales?: string[], options?: DateTimeFormatOptions): Collator; + (locale?: string, options?: DateTimeFormatOptions): Collator; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface AlgorithmParameters { +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface Algorithm { + name?: string; + params?: AlgorithmParameters; +} + +interface MouseEventInit { + bubbles?: boolean; + cancelable?: boolean; + view?: Window; + detail?: number; + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface WebGLContextAttributes { + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLElement extends Element, ElementCSSInlineStyle, MSEventAttachmentTarget, MSNodeExtensions { + hidden: any; + readyState: any; + onmouseleave: (ev: MouseEvent) => any; + onbeforecut: (ev: DragEvent) => any; + onkeydown: (ev: KeyboardEvent) => any; + onmove: (ev: MSEventObj) => any; + onkeyup: (ev: KeyboardEvent) => any; + onreset: (ev: Event) => any; + onhelp: (ev: Event) => any; + ondragleave: (ev: DragEvent) => any; + className: string; + onfocusin: (ev: FocusEvent) => any; + onseeked: (ev: Event) => any; + recordNumber: any; + title: string; + parentTextEdit: Element; + outerHTML: string; + ondurationchange: (ev: Event) => any; + offsetHeight: number; + all: HTMLCollection; + onblur: (ev: FocusEvent) => any; + dir: string; + onemptied: (ev: Event) => any; + onseeking: (ev: Event) => any; + oncanplay: (ev: Event) => any; + ondeactivate: (ev: UIEvent) => any; + ondatasetchanged: (ev: MSEventObj) => any; + onrowsdelete: (ev: MSEventObj) => any; + sourceIndex: number; + onloadstart: (ev: Event) => any; + onlosecapture: (ev: MSEventObj) => any; + ondragenter: (ev: DragEvent) => any; + oncontrolselect: (ev: MSEventObj) => any; + onsubmit: (ev: Event) => any; + behaviorUrns: MSBehaviorUrnsCollection; + scopeName: string; + onchange: (ev: Event) => any; + id: string; + onlayoutcomplete: (ev: MSEventObj) => any; + uniqueID: string; + onbeforeactivate: (ev: UIEvent) => any; + oncanplaythrough: (ev: Event) => any; + onbeforeupdate: (ev: MSEventObj) => any; + onfilterchange: (ev: MSEventObj) => any; + offsetParent: Element; + ondatasetcomplete: (ev: MSEventObj) => any; + onsuspend: (ev: Event) => any; + onmouseenter: (ev: MouseEvent) => any; + innerText: string; + onerrorupdate: (ev: MSEventObj) => any; + onmouseout: (ev: MouseEvent) => any; + parentElement: HTMLElement; + onmousewheel: (ev: MouseWheelEvent) => any; + onvolumechange: (ev: Event) => any; + oncellchange: (ev: MSEventObj) => any; + onrowexit: (ev: MSEventObj) => any; + onrowsinserted: (ev: MSEventObj) => any; + onpropertychange: (ev: MSEventObj) => any; + filters: any; + children: HTMLCollection; + ondragend: (ev: DragEvent) => any; + onbeforepaste: (ev: DragEvent) => any; + ondragover: (ev: DragEvent) => any; + offsetTop: number; + onmouseup: (ev: MouseEvent) => any; + ondragstart: (ev: DragEvent) => any; + onbeforecopy: (ev: DragEvent) => any; + ondrag: (ev: DragEvent) => any; + innerHTML: string; + onmouseover: (ev: MouseEvent) => any; + lang: string; + uniqueNumber: number; + onpause: (ev: Event) => any; + tagUrn: string; + onmousedown: (ev: MouseEvent) => any; + onclick: (ev: MouseEvent) => any; + onwaiting: (ev: Event) => any; + onresizestart: (ev: MSEventObj) => any; + offsetLeft: number; + isTextEdit: boolean; + isDisabled: boolean; + onpaste: (ev: DragEvent) => any; + canHaveHTML: boolean; + onmoveend: (ev: MSEventObj) => any; + language: string; + onstalled: (ev: Event) => any; + onmousemove: (ev: MouseEvent) => any; + style: MSStyleCSSProperties; + isContentEditable: boolean; + onbeforeeditfocus: (ev: MSEventObj) => any; + onratechange: (ev: Event) => any; + contentEditable: string; + tabIndex: number; + document: Document; + onprogress: (ev: ProgressEvent) => any; + ondblclick: (ev: MouseEvent) => any; + oncontextmenu: (ev: MouseEvent) => any; + onloadedmetadata: (ev: Event) => any; + onafterupdate: (ev: MSEventObj) => any; + onerror: (ev: ErrorEvent) => any; + onplay: (ev: Event) => any; + onresizeend: (ev: MSEventObj) => any; + onplaying: (ev: Event) => any; + isMultiLine: boolean; + onfocusout: (ev: FocusEvent) => any; + onabort: (ev: UIEvent) => any; + ondataavailable: (ev: MSEventObj) => any; + hideFocus: boolean; + onreadystatechange: (ev: Event) => any; + onkeypress: (ev: KeyboardEvent) => any; + onloadeddata: (ev: Event) => any; + onbeforedeactivate: (ev: UIEvent) => any; + outerText: string; + disabled: boolean; + onactivate: (ev: UIEvent) => any; + accessKey: string; + onmovestart: (ev: MSEventObj) => any; + onselectstart: (ev: Event) => any; + onfocus: (ev: FocusEvent) => any; + ontimeupdate: (ev: Event) => any; + onresize: (ev: UIEvent) => any; + oncut: (ev: DragEvent) => any; + onselect: (ev: UIEvent) => any; + ondrop: (ev: DragEvent) => any; + offsetWidth: number; + oncopy: (ev: DragEvent) => any; + onended: (ev: Event) => any; + onscroll: (ev: UIEvent) => any; + onrowenter: (ev: MSEventObj) => any; + onload: (ev: Event) => any; + canHaveChildren: boolean; + oninput: (ev: Event) => any; + onmscontentzoom: (ev: MSEventObj) => any; + oncuechange: (ev: Event) => any; + spellcheck: boolean; + classList: DOMTokenList; + onmsmanipulationstatechanged: (ev: any) => any; + draggable: boolean; + dataset: DOMStringMap; + dragDrop(): boolean; + scrollIntoView(top?: boolean): void; + addFilter(filter: any): void; + setCapture(containerCapture?: boolean): void; + focus(): void; + getAdjacentText(where: string): string; + insertAdjacentText(where: string, text: string): void; + getElementsByClassName(classNames: string): NodeList; + setActive(): void; + removeFilter(filter: any): void; + blur(): void; + clearAttributes(): void; + releaseCapture(): void; + createControlRange(): ControlRangeCollection; + removeBehavior(cookie: number): boolean; + contains(child: HTMLElement): boolean; + click(): void; + insertAdjacentElement(position: string, insertedElement: Element): Element; + mergeAttributes(source: HTMLElement, preserveIdentity?: boolean): void; + replaceAdjacentText(where: string, newText: string): string; + applyElement(apply: Element, where?: string): Element; + addBehavior(bstrUrl: string, factory?: any): number; + insertAdjacentHTML(where: string, html: string): void; + msGetInputContext(): MSInputMethodContext; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface Document extends Node, NodeSelector, MSEventAttachmentTarget, DocumentEvent, MSResourceMetadata, MSNodeExtensions, MSDocumentExtensions, GlobalEventHandlers { + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Retrieves the collection of user agents and versions declared in the X-UA-Compatible + */ + compatible: MSCompatibleInfoCollection; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (ev: KeyboardEvent) => any; + /** + * Gets the implementation object of the current document. + */ + implementation: DOMImplementation; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (ev: Event) => any; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollection; + /** + * Fires when the user presses the F1 key while the browser is the active window. + * @param ev The event. + */ + onhelp: (ev: Event) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (ev: DragEvent) => any; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Fires for an element just prior to setting focus on that element. + * @param ev The focus event + */ + onfocusin: (ev: FocusEvent) => any; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (ev: Event) => any; + security: string; + /** + * Contains the title of the document. + */ + title: string; + /** + * Retrieves a collection of namespace objects. + */ + namespaces: MSNamespaceInfoCollection; + /** + * Gets the default character set from the current regional language settings. + */ + defaultCharset: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollection; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + styleSheets: StyleSheetList; + /** + * Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window. + */ + frames: Window; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (ev: Event) => any; + /** + * Returns a reference to the collection of elements contained by the object. + */ + all: HTMLCollection; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollection; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (ev: FocusEvent) => any; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (ev: Event) => any; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (ev: Event) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (ev: UIEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (ev: Event) => any; + /** + * Fires when the data set exposed by a data source object changes. + * @param ev The event. + */ + ondatasetchanged: (ev: MSEventObj) => any; + /** + * Fires when rows are about to be deleted from the recordset. + * @param ev The event + */ + onrowsdelete: (ev: MSEventObj) => any; + Script: MSScriptHost; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (ev: Event) => any; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + URLUnencoded: string; + defaultView: Window; + /** + * Fires when the user is about to make a control selection of the object. + * @param ev The event. + */ + oncontrolselect: (ev: MSEventObj) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (ev: DragEvent) => any; + onsubmit: (ev: Event) => any; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + inputEncoding: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + activeElement: Element; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (ev: Event) => any; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollection; + /** + * Retrieves an autogenerated, unique identifier for the object. + */ + uniqueID: string; + /** + * Sets or gets the URL for the current document. + */ + URL: string; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (ev: UIEvent) => any; + head: HTMLHeadElement; + cookie: string; + xmlEncoding: string; + oncanplaythrough: (ev: Event) => any; + /** + * Retrieves the document compatibility mode of the document. + */ + documentMode: number; + characterSet: string; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollection; + onbeforeupdate: (ev: MSEventObj) => any; + /** + * Fires to indicate that all data is available from the data source object. + * @param ev The event. + */ + ondatasetcomplete: (ev: MSEventObj) => any; + plugins: HTMLCollection; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (ev: Event) => any; + /** + * Gets the root svg element in the document hierarchy. + */ + rootElement: SVGSVGElement; + /** + * Retrieves a value that indicates the current state of the object. + */ + readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + referrer: string; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Fires on a databound object when an error occurs while updating the associated data in the data source object. + * @param ev The event. + */ + onerrorupdate: (ev: MSEventObj) => any; + /** + * Gets a reference to the container object of the window. + */ + parentWindow: Window; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (ev: MouseEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (ev: MSSiteModeEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (ev: MouseWheelEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (ev: Event) => any; + /** + * Fires when data changes in the data provider. + * @param ev The event. + */ + oncellchange: (ev: MSEventObj) => any; + /** + * Fires just before the data source control changes the current row in the object. + * @param ev The event. + */ + onrowexit: (ev: MSEventObj) => any; + /** + * Fires just after new rows are inserted in the current recordset. + * @param ev The event. + */ + onrowsinserted: (ev: MSEventObj) => any; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string; + msCapsLockWarningOff: boolean; + /** + * Fires when a property changes on the object. + * @param ev The event. + */ + onpropertychange: (ev: MSEventObj) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (ev: DragEvent) => any; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + doctype: DocumentType; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (ev: DragEvent) => any; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (ev: DragEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (ev: MouseEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (ev: DragEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (ev: MouseEvent) => any; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (ev: MouseEvent) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (ev: MouseEvent) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (ev: Event) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollection; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + xmlStandalone: boolean; + /** + * Represents the active selection, which is a highlighted block of text or other elements in the document that a user or a script can carry out some action on. + */ + selection: MSSelection; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (ev: Event) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (ev: MouseEvent) => any; + /** + * Fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected. + * @param ev The event. + */ + onbeforeeditfocus: (ev: MSEventObj) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (ev: ProgressEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (ev: MouseEvent) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (ev: Event) => any; + media: string; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (ev: ErrorEvent) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (ev: Event) => any; + onafterupdate: (ev: MSEventObj) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (ev: Event) => any; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollection; + /** + * Contains information about the current URL. + */ + location: Location; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (ev: UIEvent) => any; + /** + * Fires for the current element with focus immediately after moving focus to another element. + * @param ev The event. + */ + onfocusout: (ev: FocusEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; + /** + * Fires when a local DOM Storage area is written to disk. + * @param ev The event. + */ + onstoragecommit: (ev: StorageEvent) => any; + /** + * Fires periodically as data arrives from data source objects that asynchronously transmit their data. + * @param ev The event. + */ + ondataavailable: (ev: MSEventObj) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (ev: Event) => any; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + lastModified: string; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (ev: KeyboardEvent) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (ev: Event) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (ev: UIEvent) => any; + onselectstart: (ev: Event) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (ev: FocusEvent) => any; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (ev: UIEvent) => any; + ondrop: (ev: DragEvent) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (ev: Event) => any; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + compatMode: string; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (ev: UIEvent) => any; + /** + * Fires to indicate that the current row has changed in the data source and new data values are available on the object. + * @param ev The event. + */ + onrowenter: (ev: MSEventObj) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (ev: Event) => any; + oninput: (ev: Event) => any; + onmspointerdown: (ev: any) => any; + msHidden: boolean; + msVisibilityState: string; + onmsgesturedoubletap: (ev: any) => any; + visibilityState: string; + onmsmanipulationstatechanged: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmscontentzoom: (ev: MSEventObj) => any; + onmspointermove: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + onmsinertiastart: (ev: any) => any; + msCSSOMElementFloatMetrics: boolean; + onmspointerover: (ev: any) => any; + hidden: boolean; + onmspointerup: (ev: any) => any; + msFullscreenEnabled: boolean; + onmsfullscreenerror: (ev: any) => any; + onmspointerenter: (ev: any) => any; + msFullscreenElement: Element; + onmsfullscreenchange: (ev: any) => any; + onmspointerleave: (ev: any) => any; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + adoptNode(source: Node): Node; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + createCDATASection(data: string): CDATASection; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: "a"): HTMLAnchorElement; + createElement(tagName: "abbr"): HTMLPhraseElement; + createElement(tagName: "acronym"): HTMLPhraseElement; + createElement(tagName: "address"): HTMLBlockElement; + createElement(tagName: "applet"): HTMLAppletElement; + createElement(tagName: "area"): HTMLAreaElement; + createElement(tagName: "article"): HTMLElement; + createElement(tagName: "aside"): HTMLElement; + createElement(tagName: "audio"): HTMLAudioElement; + createElement(tagName: "b"): HTMLPhraseElement; + createElement(tagName: "base"): HTMLBaseElement; + createElement(tagName: "basefont"): HTMLBaseFontElement; + createElement(tagName: "bdo"): HTMLPhraseElement; + createElement(tagName: "bgsound"): HTMLBGSoundElement; + createElement(tagName: "big"): HTMLPhraseElement; + createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "body"): HTMLBodyElement; + createElement(tagName: "br"): HTMLBRElement; + createElement(tagName: "button"): HTMLButtonElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: "caption"): HTMLTableCaptionElement; + createElement(tagName: "center"): HTMLBlockElement; + createElement(tagName: "cite"): HTMLPhraseElement; + createElement(tagName: "code"): HTMLPhraseElement; + createElement(tagName: "col"): HTMLTableColElement; + createElement(tagName: "colgroup"): HTMLTableColElement; + createElement(tagName: "datalist"): HTMLDataListElement; + createElement(tagName: "dd"): HTMLDDElement; + createElement(tagName: "del"): HTMLModElement; + createElement(tagName: "dfn"): HTMLPhraseElement; + createElement(tagName: "dir"): HTMLDirectoryElement; + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "dl"): HTMLDListElement; + createElement(tagName: "dt"): HTMLDTElement; + createElement(tagName: "em"): HTMLPhraseElement; + createElement(tagName: "embed"): HTMLEmbedElement; + createElement(tagName: "fieldset"): HTMLFieldSetElement; + createElement(tagName: "figcaption"): HTMLElement; + createElement(tagName: "figure"): HTMLElement; + createElement(tagName: "font"): HTMLFontElement; + createElement(tagName: "footer"): HTMLElement; + createElement(tagName: "form"): HTMLFormElement; + createElement(tagName: "frame"): HTMLFrameElement; + createElement(tagName: "frameset"): HTMLFrameSetElement; + createElement(tagName: "h1"): HTMLHeadingElement; + createElement(tagName: "h2"): HTMLHeadingElement; + createElement(tagName: "h3"): HTMLHeadingElement; + createElement(tagName: "h4"): HTMLHeadingElement; + createElement(tagName: "h5"): HTMLHeadingElement; + createElement(tagName: "h6"): HTMLHeadingElement; + createElement(tagName: "head"): HTMLHeadElement; + createElement(tagName: "header"): HTMLElement; + createElement(tagName: "hgroup"): HTMLElement; + createElement(tagName: "hr"): HTMLHRElement; + createElement(tagName: "html"): HTMLHtmlElement; + createElement(tagName: "i"): HTMLPhraseElement; + createElement(tagName: "iframe"): HTMLIFrameElement; + createElement(tagName: "img"): HTMLImageElement; + createElement(tagName: "input"): HTMLInputElement; + createElement(tagName: "ins"): HTMLModElement; + createElement(tagName: "isindex"): HTMLIsIndexElement; + createElement(tagName: "kbd"): HTMLPhraseElement; + createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "label"): HTMLLabelElement; + createElement(tagName: "legend"): HTMLLegendElement; + createElement(tagName: "li"): HTMLLIElement; + createElement(tagName: "link"): HTMLLinkElement; + createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "map"): HTMLMapElement; + createElement(tagName: "mark"): HTMLElement; + createElement(tagName: "marquee"): HTMLMarqueeElement; + createElement(tagName: "menu"): HTMLMenuElement; + createElement(tagName: "meta"): HTMLMetaElement; + createElement(tagName: "nav"): HTMLElement; + createElement(tagName: "nextid"): HTMLNextIdElement; + createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "noframes"): HTMLElement; + createElement(tagName: "noscript"): HTMLElement; + createElement(tagName: "object"): HTMLObjectElement; + createElement(tagName: "ol"): HTMLOListElement; + createElement(tagName: "optgroup"): HTMLOptGroupElement; + createElement(tagName: "option"): HTMLOptionElement; + createElement(tagName: "p"): HTMLParagraphElement; + createElement(tagName: "param"): HTMLParamElement; + createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "pre"): HTMLPreElement; + createElement(tagName: "progress"): HTMLProgressElement; + createElement(tagName: "q"): HTMLQuoteElement; + createElement(tagName: "rt"): HTMLPhraseElement; + createElement(tagName: "ruby"): HTMLPhraseElement; + createElement(tagName: "s"): HTMLPhraseElement; + createElement(tagName: "samp"): HTMLPhraseElement; + createElement(tagName: "script"): HTMLScriptElement; + createElement(tagName: "section"): HTMLElement; + createElement(tagName: "select"): HTMLSelectElement; + createElement(tagName: "small"): HTMLPhraseElement; + createElement(tagName: "SOURCE"): HTMLSourceElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "strike"): HTMLPhraseElement; + createElement(tagName: "strong"): HTMLPhraseElement; + createElement(tagName: "style"): HTMLStyleElement; + createElement(tagName: "sub"): HTMLPhraseElement; + createElement(tagName: "sup"): HTMLPhraseElement; + createElement(tagName: "table"): HTMLTableElement; + createElement(tagName: "tbody"): HTMLTableSectionElement; + createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "textarea"): HTMLTextAreaElement; + createElement(tagName: "tfoot"): HTMLTableSectionElement; + createElement(tagName: "th"): HTMLTableHeaderCellElement; + createElement(tagName: "thead"): HTMLTableSectionElement; + createElement(tagName: "title"): HTMLTitleElement; + createElement(tagName: "tr"): HTMLTableRowElement; + createElement(tagName: "track"): HTMLTrackElement; + createElement(tagName: "tt"): HTMLPhraseElement; + createElement(tagName: "u"): HTMLPhraseElement; + createElement(tagName: "ul"): HTMLUListElement; + createElement(tagName: "var"): HTMLPhraseElement; + createElement(tagName: "video"): HTMLVideoElement; + createElement(tagName: "wbr"): HTMLElement; + createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; + createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: string): HTMLElement; + /** + * Removes mouse capture from the object in the current document. + */ + releaseCapture(): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): void; + createElementNS(namespaceURI: string, qualifiedName: string): Element; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): any; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): TreeWalker; + createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + getElementsByClassName(classNames: string): NodeList; + importNode(importedNode: Node, deep: boolean): Node; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Fires a specified event on the object. + * @param eventName Specifies the name of the event to fire. + * @param eventObj Object that specifies the event object from which to obtain event object properties. + */ + fireEvent(eventName: string, eventObj?: any): boolean; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "bgsound"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "SOURCE"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeList; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates a style sheet for the document. + * @param href Specifies how to add the style sheet to the document. If a file name is specified for the URL, the style information is added as a link object. If the URL contains style information, it is added to the style object. + * @param index Specifies the index that indicates where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style sheet at the end of the collection. + */ + createStyleSheet(href?: string, index?: number): CSSStyleSheet; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeList; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): NodeIterator; + /** + * Generates an event object to pass event context information when you use the fireEvent method. + * @param eventObj An object that specifies an existing event object on which to base the new object. + */ + createEventObject(eventObj?: any): MSEventObj; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + msElementsFromPoint(x: number, y: number): NodeList; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + clear(): void; + msExitFullscreen(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storagecommit", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msfullscreenerror", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msfullscreenchange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Document: { + prototype: Document; + new(): Document; +} + +interface Console { + info(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; + error(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + profile(reportName?: string): void; + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + clear(): void; + dir(value?: any, ...optionalParams: any[]): void; + profileEnd(): void; + count(countTitle?: string): void; + groupEnd(): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(): void; + group(groupTitle?: string): void; + dirxml(value: any): void; + debug(message?: string, ...optionalParams: any[]): void; + groupCollapsed(groupTitle?: string): void; + select(element: Element): void; +} +declare var Console: { + prototype: Console; + new(): Console; +} + +interface MSEventObj extends Event { + nextPage: string; + keyCode: number; + toElement: Element; + returnValue: any; + dataFld: string; + y: number; + dataTransfer: DataTransfer; + propertyName: string; + url: string; + offsetX: number; + recordset: any; + screenX: number; + buttonID: number; + wheelDelta: number; + reason: number; + origin: string; + data: string; + srcFilter: any; + boundElements: HTMLCollection; + cancelBubble: boolean; + altLeft: boolean; + behaviorCookie: number; + bookmarks: BookmarkCollection; + type: string; + repeat: boolean; + srcElement: Element; + source: Window; + fromElement: Element; + offsetY: number; + x: number; + behaviorPart: number; + qualifier: string; + altKey: boolean; + ctrlKey: boolean; + clientY: number; + shiftKey: boolean; + shiftLeft: boolean; + contentOverflow: boolean; + screenY: number; + ctrlLeft: boolean; + button: number; + srcUrn: string; + clientX: number; + actionURL: string; + getAttribute(strAttributeName: string, lFlags?: number): any; + setAttribute(strAttributeName: string, AttributeValue: any, lFlags?: number): void; + removeAttribute(strAttributeName: string, lFlags?: number): boolean; +} +declare var MSEventObj: { + prototype: MSEventObj; + new(): MSEventObj; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: string, ...args: any[]): any; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. + */ + toDataURL(type?: string, ...args: any[]): string; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; +} +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface Window extends EventTarget, MSEventAttachmentTarget, WindowLocalStorage, MSWindowExtensions, WindowSessionStorage, WindowTimers, WindowBase64, IDBEnvironment, WindowConsole, GlobalEventHandlers { + ondragend: (ev: DragEvent) => any; + onkeydown: (ev: KeyboardEvent) => any; + ondragover: (ev: DragEvent) => any; + onkeyup: (ev: KeyboardEvent) => any; + onreset: (ev: Event) => any; + onmouseup: (ev: MouseEvent) => any; + ondragstart: (ev: DragEvent) => any; + ondrag: (ev: DragEvent) => any; + screenX: number; + onmouseover: (ev: MouseEvent) => any; + ondragleave: (ev: DragEvent) => any; + history: History; + pageXOffset: number; + name: string; + onafterprint: (ev: Event) => any; + onpause: (ev: Event) => any; + onbeforeprint: (ev: Event) => any; + top: Window; + onmousedown: (ev: MouseEvent) => any; + onseeked: (ev: Event) => any; + opener: Window; + onclick: (ev: MouseEvent) => any; + innerHeight: number; + onwaiting: (ev: Event) => any; + ononline: (ev: Event) => any; + ondurationchange: (ev: Event) => any; + frames: Window; + onblur: (ev: FocusEvent) => any; + onemptied: (ev: Event) => any; + onseeking: (ev: Event) => any; + oncanplay: (ev: Event) => any; + outerWidth: number; + onstalled: (ev: Event) => any; + onmousemove: (ev: MouseEvent) => any; + innerWidth: number; + onoffline: (ev: Event) => any; + length: number; + screen: Screen; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + onratechange: (ev: Event) => any; + onstorage: (ev: StorageEvent) => any; + onloadstart: (ev: Event) => any; + ondragenter: (ev: DragEvent) => any; + onsubmit: (ev: Event) => any; + self: Window; + document: Document; + onprogress: (ev: ProgressEvent) => any; + ondblclick: (ev: MouseEvent) => any; + pageYOffset: number; + oncontextmenu: (ev: MouseEvent) => any; + onchange: (ev: Event) => any; + onloadedmetadata: (ev: Event) => any; + onplay: (ev: Event) => any; + onerror: ErrorEventHandler; + onplaying: (ev: Event) => any; + parent: Window; + location: Location; + oncanplaythrough: (ev: Event) => any; + onabort: (ev: UIEvent) => any; + onreadystatechange: (ev: Event) => any; + outerHeight: number; + onkeypress: (ev: KeyboardEvent) => any; + frameElement: Element; + onloadeddata: (ev: Event) => any; + onsuspend: (ev: Event) => any; + window: Window; + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + ontimeupdate: (ev: Event) => any; + onresize: (ev: UIEvent) => any; + onselect: (ev: UIEvent) => any; + navigator: Navigator; + styleMedia: StyleMedia; + ondrop: (ev: DragEvent) => any; + onmouseout: (ev: MouseEvent) => any; + onended: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onunload: (ev: Event) => any; + onscroll: (ev: UIEvent) => any; + screenY: number; + onmousewheel: (ev: MouseWheelEvent) => any; + onload: (ev: Event) => any; + onvolumechange: (ev: Event) => any; + oninput: (ev: Event) => any; + performance: Performance; + onmspointerdown: (ev: any) => any; + animationStartTime: number; + onmsgesturedoubletap: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmspointermove: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + msAnimationStartTime: number; + applicationCache: ApplicationCache; + onmsinertiastart: (ev: any) => any; + onmspointerover: (ev: any) => any; + onpopstate: (ev: PopStateEvent) => any; + onmspointerup: (ev: any) => any; + onpageshow: (ev: PageTransitionEvent) => any; + ondevicemotion: (ev: DeviceMotionEvent) => any; + devicePixelRatio: number; + msCrypto: Crypto; + ondeviceorientation: (ev: DeviceOrientationEvent) => any; + doNotTrack: string; + onmspointerenter: (ev: any) => any; + onpagehide: (ev: PageTransitionEvent) => any; + onmspointerleave: (ev: any) => any; + alert(message?: any): void; + scroll(x?: number, y?: number): void; + focus(): void; + scrollTo(x?: number, y?: number): void; + print(): void; + prompt(message?: string, _default?: string): string; + toString(): string; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + scrollBy(x?: number, y?: number): void; + confirm(message?: string): boolean; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; + showModalDialog(url?: string, argument?: any, options?: any): any; + blur(): void; + getSelection(): Selection; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + msCancelRequestAnimationFrame(handle: number): void; + matchMedia(mediaQuery: string): MediaQueryList; + cancelAnimationFrame(handle: number): void; + msIsStaticHTML(html: string): boolean; + msMatchMedia(mediaQuery: string): MediaQueryList; + requestAnimationFrame(callback: FrameRequestCallback): number; + msRequestAnimationFrame(callback: FrameRequestCallback): number; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Window: { + prototype: Window; + new(): Window; +} + +interface HTMLCollection extends MSHTMLCollectionExtensions { + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Retrieves an object from various collections. + */ + item(nameOrIndex?: any, optionalIndex?: any): Element; + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element; + // [name: string]: Element; + [index: number]: Element; +} +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface Blob { + type: string; + size: number; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; + msClose(): void; +} +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface NavigatorID { + appVersion: string; + appName: string; + userAgent: string; + platform: string; + product: string; + vendor: string; +} + +interface HTMLTableElement extends HTMLElement, MSDataBindingTableExtensions, MSDataBindingExtensions, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollection; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollection; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Retrieves a collection of all cells in the table row or in the entire table. + */ + cells: HTMLCollection; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLElement; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLElement; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLElement; + /** + * Moves a table row to a new position. + * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. + * @param indexTo Number that specifies where the row is moved within the rows collection. + */ + moveRow(indexFrom?: number, indexTo?: number): any; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLElement; +} +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface TreeWalker { + whatToShow: number; + filter: NodeFilter; + root: Node; + currentNode: Node; + expandEntityReferences: boolean; + previousSibling(): Node; + lastChild(): Node; + nextSibling(): Node; + nextNode(): Node; + parentNode(): Node; + firstChild(): Node; + previousNode(): Node; +} +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + y: number; + y1: number; + x: number; + x1: number; +} +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface Performance { + navigation: PerformanceNavigation; + timing: PerformanceTiming; + getEntriesByType(entryType: string): any; + toJSON(): any; + getMeasures(measureName?: string): any; + clearMarks(markName?: string): void; + getMarks(markName?: string): any; + clearResourceTimings(): void; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + getEntriesByName(name: string, entryType?: string): any; + getEntries(): any; + clearMeasures(measureName?: string): void; + setResourceTimingBufferSize(maxSize: number): void; + now(): number; +} +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface MSDataBindingTableExtensions { + dataPageSize: number; + nextPage(): void; + firstPage(): void; + refresh(): void; + previousPage(): void; + lastPage(): void; +} + +interface CompositionEvent extends UIEvent { + data: string; + locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} +declare var CompositionEvent: { + prototype: CompositionEvent; + new(): CompositionEvent; +} + +interface WindowTimers extends WindowTimersExtension { + clearTimeout(handle: number): void; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; + clearInterval(handle: number): void; + setInterval(handler: any, timeout?: any, ...args: any[]): number; +} + +interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { + orientType: SVGAnimatedEnumeration; + markerUnits: SVGAnimatedEnumeration; + markerWidth: SVGAnimatedLength; + markerHeight: SVGAnimatedLength; + orientAngle: SVGAnimatedAngle; + refY: SVGAnimatedLength; + refX: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + SVG_MARKER_ORIENT_UNKNOWN: number; + SVG_MARKER_ORIENT_ANGLE: number; + SVG_MARKERUNITS_UNKNOWN: number; + SVG_MARKERUNITS_STROKEWIDTH: number; + SVG_MARKER_ORIENT_AUTO: number; + SVG_MARKERUNITS_USERSPACEONUSE: number; +} +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + SVG_MARKER_ORIENT_UNKNOWN: number; + SVG_MARKER_ORIENT_ANGLE: number; + SVG_MARKERUNITS_UNKNOWN: number; + SVG_MARKERUNITS_STROKEWIDTH: number; + SVG_MARKER_ORIENT_AUTO: number; + SVG_MARKERUNITS_USERSPACEONUSE: number; +} + +interface CSSStyleDeclaration { + backgroundAttachment: string; + visibility: string; + textAlignLast: string; + borderRightStyle: string; + counterIncrement: string; + orphans: string; + cssText: string; + borderStyle: string; + pointerEvents: string; + borderTopColor: string; + markerEnd: string; + textIndent: string; + listStyleImage: string; + cursor: string; + listStylePosition: string; + wordWrap: string; + borderTopStyle: string; + alignmentBaseline: string; + opacity: string; + direction: string; + strokeMiterlimit: string; + maxWidth: string; + color: string; + clip: string; + borderRightWidth: string; + verticalAlign: string; + overflow: string; + mask: string; + borderLeftStyle: string; + emptyCells: string; + stopOpacity: string; + paddingRight: string; + parentRule: CSSRule; + background: string; + boxSizing: string; + textJustify: string; + height: string; + paddingTop: string; + length: number; + right: string; + baselineShift: string; + borderLeft: string; + widows: string; + lineHeight: string; + left: string; + textUnderlinePosition: string; + glyphOrientationHorizontal: string; + display: string; + textAnchor: string; + cssFloat: string; + strokeDasharray: string; + rubyAlign: string; + fontSizeAdjust: string; + borderLeftColor: string; + backgroundImage: string; + listStyleType: string; + strokeWidth: string; + textOverflow: string; + fillRule: string; + borderBottomColor: string; + zIndex: string; + position: string; + listStyle: string; + msTransformOrigin: string; + dominantBaseline: string; + overflowY: string; + fill: string; + captionSide: string; + borderCollapse: string; + boxShadow: string; + quotes: string; + tableLayout: string; + unicodeBidi: string; + borderBottomWidth: string; + backgroundSize: string; + textDecoration: string; + strokeDashoffset: string; + fontSize: string; + border: string; + pageBreakBefore: string; + borderTopRightRadius: string; + msTransform: string; + borderBottomLeftRadius: string; + textTransform: string; + rubyPosition: string; + strokeLinejoin: string; + clipPath: string; + borderRightColor: string; + fontFamily: string; + clear: string; + content: string; + backgroundClip: string; + marginBottom: string; + counterReset: string; + outlineWidth: string; + marginRight: string; + paddingLeft: string; + borderBottom: string; + wordBreak: string; + marginTop: string; + top: string; + fontWeight: string; + borderRight: string; + width: string; + kerning: string; + pageBreakAfter: string; + borderBottomStyle: string; + fontStretch: string; + padding: string; + strokeOpacity: string; + markerStart: string; + bottom: string; + borderLeftWidth: string; + clipRule: string; + backgroundPosition: string; + backgroundColor: string; + pageBreakInside: string; + backgroundOrigin: string; + strokeLinecap: string; + borderTopWidth: string; + outlineStyle: string; + borderTop: string; + outlineColor: string; + paddingBottom: string; + marginLeft: string; + font: string; + outline: string; + wordSpacing: string; + maxHeight: string; + fillOpacity: string; + letterSpacing: string; + borderSpacing: string; + backgroundRepeat: string; + borderRadius: string; + borderWidth: string; + borderBottomRightRadius: string; + whiteSpace: string; + fontStyle: string; + minWidth: string; + stopColor: string; + borderTopLeftRadius: string; + borderColor: string; + marker: string; + glyphOrientationVertical: string; + markerMid: string; + fontVariant: string; + minHeight: string; + stroke: string; + rubyOverhang: string; + overflowX: string; + textAlign: string; + margin: string; + animationFillMode: string; + floodColor: string; + animationIterationCount: string; + textShadow: string; + backfaceVisibility: string; + msAnimationIterationCount: string; + animationDelay: string; + animationTimingFunction: string; + columnWidth: any; + msScrollSnapX: string; + columnRuleColor: any; + columnRuleWidth: any; + transitionDelay: string; + transition: string; + msFlowFrom: string; + msScrollSnapType: string; + msContentZoomSnapType: string; + msGridColumns: string; + msAnimationName: string; + msGridRowAlign: string; + msContentZoomChaining: string; + msGridColumn: any; + msHyphenateLimitZone: any; + msScrollRails: string; + msAnimationDelay: string; + enableBackground: string; + msWrapThrough: string; + columnRuleStyle: string; + msAnimation: string; + msFlexFlow: string; + msScrollSnapY: string; + msHyphenateLimitLines: any; + msTouchAction: string; + msScrollLimit: string; + animation: string; + transform: string; + filter: string; + colorInterpolationFilters: string; + transitionTimingFunction: string; + msBackfaceVisibility: string; + animationPlayState: string; + transformOrigin: string; + msScrollLimitYMin: any; + msFontFeatureSettings: string; + msContentZoomLimitMin: any; + columnGap: any; + transitionProperty: string; + msAnimationDuration: string; + msAnimationFillMode: string; + msFlexDirection: string; + msTransitionDuration: string; + fontFeatureSettings: string; + breakBefore: string; + msFlexWrap: string; + perspective: string; + msFlowInto: string; + msTransformStyle: string; + msScrollTranslation: string; + msTransitionProperty: string; + msUserSelect: string; + msOverflowStyle: string; + msScrollSnapPointsY: string; + animationDirection: string; + animationDuration: string; + msFlex: string; + msTransitionTimingFunction: string; + animationName: string; + columnRule: string; + msGridColumnSpan: any; + msFlexNegative: string; + columnFill: string; + msGridRow: any; + msFlexOrder: string; + msFlexItemAlign: string; + msFlexPositive: string; + msContentZoomLimitMax: any; + msScrollLimitYMax: any; + msGridColumnAlign: string; + perspectiveOrigin: string; + lightingColor: string; + columns: string; + msScrollChaining: string; + msHyphenateLimitChars: string; + msTouchSelect: string; + floodOpacity: string; + msAnimationDirection: string; + msAnimationPlayState: string; + columnSpan: string; + msContentZooming: string; + msPerspective: string; + msFlexPack: string; + msScrollSnapPointsX: string; + msContentZoomSnapPoints: string; + msGridRowSpan: any; + msContentZoomSnap: string; + msScrollLimitXMin: any; + breakInside: string; + msHighContrastAdjust: string; + msFlexLinePack: string; + msGridRows: string; + transitionDuration: string; + msHyphens: string; + breakAfter: string; + msTransition: string; + msPerspectiveOrigin: string; + msContentZoomLimit: string; + msScrollLimitXMax: any; + msFlexAlign: string; + msWrapMargin: any; + columnCount: any; + msAnimationTimingFunction: string; + msTransitionDelay: string; + transformStyle: string; + msWrapFlow: string; + msFlexPreferredSize: string; + alignItems: string; + borderImageSource: string; + flexBasis: string; + borderImageWidth: string; + borderImageRepeat: string; + order: string; + flex: string; + alignContent: string; + msImeAlign: string; + flexShrink: string; + flexGrow: string; + borderImageSlice: string; + flexWrap: string; + borderImageOutset: string; + flexDirection: string; + touchAction: string; + flexFlow: string; + borderImage: string; + justifyContent: string; + alignSelf: string; + msTextCombineHorizontal: string; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + removeProperty(propertyName: string): string; + item(index: number): string; + [index: number]: string; + setProperty(propertyName: string, value: string, priority?: string): void; +} +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface MSStyleCSSProperties extends MSCSSProperties { + pixelWidth: number; + posHeight: number; + posLeft: number; + pixelTop: number; + pixelBottom: number; + textDecorationNone: boolean; + pixelLeft: number; + posTop: number; + posBottom: number; + textDecorationOverline: boolean; + posWidth: number; + textDecorationLineThrough: boolean; + pixelHeight: number; + textDecorationBlink: boolean; + posRight: number; + pixelRight: number; + textDecorationUnderline: boolean; +} +declare var MSStyleCSSProperties: { + prototype: MSStyleCSSProperties; + new(): MSStyleCSSProperties; +} + +interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, MSNavigatorExtensions, NavigatorGeolocation, MSNavigatorDoNotTrack, NavigatorStorageUtils, MSFileSaver { + msMaxTouchPoints: number; + msPointerEnabled: boolean; + msManipulationViewsEnabled: boolean; + pointerEnabled: boolean; + maxTouchPoints: number; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; +} +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + y: number; + x2: number; + x: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGZoomEvent extends UIEvent { + zoomRectScreen: SVGRect; + previousScale: number; + newScale: number; + previousTranslate: SVGPoint; + newTranslate: SVGPoint; +} +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface NodeSelector { + querySelectorAll(selectors: string): NodeList; + querySelector(selectors: string): Element; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { +} +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; +} +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface ClientRect { + left: number; + width: number; + right: number; + top: number; + bottom: number; + height: number; +} +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface PositionErrorCallback { + (error: PositionError): void; +} + +interface DOMImplementation { + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; + hasFeature(feature: string, version?: string): boolean; + createHTMLDocument(title: string): Document; +} +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface SVGUnitTypes { + SVG_UNIT_TYPE_UNKNOWN: number; + SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface Element extends Node, NodeSelector, ElementTraversal, GlobalEventHandlers { + scrollTop: number; + clientLeft: number; + scrollLeft: number; + tagName: string; + clientWidth: number; + scrollWidth: number; + clientHeight: number; + clientTop: number; + scrollHeight: number; + msRegionOverflow: string; + onmspointerdown: (ev: any) => any; + onmsgotpointercapture: (ev: any) => any; + onmsgesturedoubletap: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmspointermove: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + onmsinertiastart: (ev: any) => any; + onmslostpointercapture: (ev: any) => any; + onmspointerover: (ev: any) => any; + msContentZoomFactor: number; + onmspointerup: (ev: any) => any; + onlostpointercapture: (ev: PointerEvent) => any; + onmspointerenter: (ev: any) => any; + ongotpointercapture: (ev: PointerEvent) => any; + onmspointerleave: (ev: any) => any; + getAttribute(name?: string): string; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + getBoundingClientRect(): ClientRect; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + msMatchesSelector(selectors: string): boolean; + hasAttribute(name: string): boolean; + removeAttribute(name?: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + getAttributeNode(name: string): Attr; + fireEvent(eventName: string, eventObj?: any): boolean; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "bgsound"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "SOURCE"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeList; + getClientRects(): ClientRectList; + setAttributeNode(newAttr: Attr): Attr; + removeAttributeNode(oldAttr: Attr): Attr; + setAttribute(name?: string, value?: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + msGetRegionContent(): MSRangeCollection; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + setPointerCapture(pointerId: number): void; + msGetUntransformedBounds(): ClientRect; + releasePointerCapture(pointerId: number): void; + msRequestFullscreen(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Element: { + prototype: Element; + new(): Element; +} + +interface HTMLNextIdElement extends HTMLElement { + n: string; +} +declare var HTMLNextIdElement: { + prototype: HTMLNextIdElement; + new(): HTMLNextIdElement; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y1: SVGAnimatedLength; + x2: SVGAnimatedLength; + x1: SVGAnimatedLength; + y2: SVGAnimatedLength; +} +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface HTMLParagraphElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; +} +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLAreasCollection extends HTMLCollection { + /** + * Removes an element from the collection. + */ + remove(index?: number): void; + /** + * Adds an element to the areas, controlRange, or options collection. + */ + add(element: HTMLElement, before?: any): void; +} +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { +} +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface Node extends EventTarget { + nodeType: number; + previousSibling: Node; + localName: string; + namespaceURI: string; + textContent: string; + parentNode: Node; + nextSibling: Node; + nodeValue: string; + lastChild: Node; + childNodes: NodeList; + nodeName: string; + ownerDocument: Document; + attributes: NamedNodeMap; + firstChild: Node; + prefix: string; + removeChild(oldChild: Node): Node; + appendChild(newChild: Node): Node; + isSupported(feature: string, version: string): boolean; + isEqualNode(arg: Node): boolean; + lookupPrefix(namespaceURI: string): string; + isDefaultNamespace(namespaceURI: string): boolean; + compareDocumentPosition(other: Node): number; + normalize(): void; + isSameNode(other: Node): boolean; + hasAttributes(): boolean; + lookupNamespaceURI(prefix: string): string; + cloneNode(deep?: boolean): Node; + hasChildNodes(): boolean; + replaceChild(newChild: Node, oldChild: Node): Node; + insertBefore(newChild: Node, refChild?: Node): Node; + ENTITY_REFERENCE_NODE: number; + ATTRIBUTE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + TEXT_NODE: number; + ELEMENT_NODE: number; + COMMENT_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + DOCUMENT_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + CDATA_SECTION_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_PRECEDING: number; +} +declare var Node: { + prototype: Node; + new(): Node; + ENTITY_REFERENCE_NODE: number; + ATTRIBUTE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + TEXT_NODE: number; + ELEMENT_NODE: number; + COMMENT_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + DOCUMENT_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + CDATA_SECTION_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_PRECEDING: number; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface DOML2DeprecatedListSpaceReduction { + compact: boolean; +} + +interface MSScriptHost { +} +declare var MSScriptHost: { + prototype: MSScriptHost; + new(): MSScriptHost; +} + +interface SVGClipPathElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + clipPathUnits: SVGAnimatedEnumeration; +} +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface MouseEvent extends UIEvent { + toElement: Element; + layerY: number; + fromElement: Element; + which: number; + pageX: number; + offsetY: number; + x: number; + y: number; + metaKey: boolean; + altKey: boolean; + ctrlKey: boolean; + offsetX: number; + screenX: number; + clientY: number; + shiftKey: boolean; + layerX: number; + screenY: number; + relatedTarget: EventTarget; + button: number; + pageY: number; + buttons: number; + clientX: number; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; + getModifierState(keyArg: string): boolean; +} +declare var MouseEvent: { + prototype: MouseEvent; + new(): MouseEvent; +} + +interface RangeException { + code: number; + message: string; + name: string; + toString(): string; + INVALID_NODE_TYPE_ERR: number; + BAD_BOUNDARYPOINTS_ERR: number; +} +declare var RangeException: { + prototype: RangeException; + new(): RangeException; + INVALID_NODE_TYPE_ERR: number; + BAD_BOUNDARYPOINTS_ERR: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + y: SVGAnimatedLengthList; + rotate: SVGAnimatedNumberList; + dy: SVGAnimatedLengthList; + x: SVGAnimatedLengthList; + dx: SVGAnimatedLengthList; +} +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface HTMLAppletElement extends HTMLElement, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { + width: number; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + object: string; + form: HTMLFormElement; + code: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the class identifier for the object. + */ + classid: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + contentDocument: Document; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + BaseHref: string; +} +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface TextMetrics { + width: number; +} +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface DocumentEvent { + createEvent(eventInterface: "AnimationEvent"): AnimationEvent; + createEvent(eventInterface: "CloseEvent"): CloseEvent; + createEvent(eventInterface: "CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; + createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface: "DragEvent"): DragEvent; + createEvent(eventInterface: "ErrorEvent"): ErrorEvent; + createEvent(eventInterface: "Event"): Event; + createEvent(eventInterface: "Events"): Event; + createEvent(eventInterface: "FocusEvent"): FocusEvent; + createEvent(eventInterface: "HTMLEvents"): Event; + createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface: "LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface: "MessageEvent"): MessageEvent; + createEvent(eventInterface: "MouseEvent"): MouseEvent; + createEvent(eventInterface: "MouseEvents"): MouseEvent; + createEvent(eventInterface: "MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface: "MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface: "MutationEvent"): MutationEvent; + createEvent(eventInterface: "MutationEvents"): MutationEvent; + createEvent(eventInterface: "NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface: "NavigationEvent"): NavigationEvent; + createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface: "PointerEvent"): MSPointerEvent; + createEvent(eventInterface: "PopStateEvent"): PopStateEvent; + createEvent(eventInterface: "ProgressEvent"): ProgressEvent; + createEvent(eventInterface: "StorageEvent"): StorageEvent; + createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface: "TextEvent"): TextEvent; + createEvent(eventInterface: "TrackEvent"): TrackEvent; + createEvent(eventInterface: "TransitionEvent"): TransitionEvent; + createEvent(eventInterface: "UIEvent"): UIEvent; + createEvent(eventInterface: "UIEvents"): UIEvent; + createEvent(eventInterface: "UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface: "WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface HTMLOListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { + /** + * The starting number. + */ + start: number; +} +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGAnimatedString { + animVal: string; + baseVal: string; +} +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface CDATASection extends Text { +} +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface StyleMedia { + type: string; + matchMedium(mediaquery: string): boolean; +} +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface HTMLSelectElement extends HTMLElement, MSHTMLCollectionExtensions, MSDataBindingExtensions { + options: HTMLSelectElement; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: any): void; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + [name: string]: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface TextRange { + boundingLeft: number; + htmlText: string; + offsetLeft: number; + boundingWidth: number; + boundingHeight: number; + boundingTop: number; + text: string; + offsetTop: number; + moveToPoint(x: number, y: number): void; + queryCommandValue(cmdID: string): any; + getBookmark(): string; + move(unit: string, count?: number): number; + queryCommandIndeterm(cmdID: string): boolean; + scrollIntoView(fStart?: boolean): void; + findText(string: string, count?: number, flags?: number): boolean; + execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; + getBoundingClientRect(): ClientRect; + moveToBookmark(bookmark: string): boolean; + isEqual(range: TextRange): boolean; + duplicate(): TextRange; + collapse(start?: boolean): void; + queryCommandText(cmdID: string): string; + select(): void; + pasteHTML(html: string): void; + inRange(range: TextRange): boolean; + moveEnd(unit: string, count?: number): number; + getClientRects(): ClientRectList; + moveStart(unit: string, count?: number): number; + parentElement(): Element; + queryCommandState(cmdID: string): boolean; + compareEndPoints(how: string, sourceRange: TextRange): number; + execCommandShowHelp(cmdID: string): boolean; + moveToElementText(element: Element): void; + expand(Unit: string): boolean; + queryCommandSupported(cmdID: string): boolean; + setEndPoint(how: string, SourceRange: TextRange): void; + queryCommandEnabled(cmdID: string): boolean; +} +declare var TextRange: { + prototype: TextRange; + new(): TextRange; +} + +interface SVGTests { + requiredFeatures: SVGStringList; + requiredExtensions: SVGStringList; + systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface HTMLBlockElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLBlockElement: { + prototype: HTMLBlockElement; + new(): HTMLBlockElement; +} + +interface CSSStyleSheet extends StyleSheet { + owningElement: Element; + imports: StyleSheetList; + isAlternate: boolean; + rules: MSCSSRuleList; + isPrefAlternate: boolean; + readOnly: boolean; + cssText: string; + ownerRule: CSSRule; + href: string; + cssRules: CSSRuleList; + id: string; + pages: StyleSheetPageList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + insertRule(rule: string, index?: number): number; + removeRule(lIndex: number): void; + deleteRule(index?: number): void; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + removeImport(lIndex: number): void; +} +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface MSSelection { + type: string; + typeDetail: string; + createRange(): TextRange; + clear(): void; + createRangeCollection(): TextRangeCollection; + empty(): void; +} +declare var MSSelection: { + prototype: MSSelection; + new(): MSSelection; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; +} +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface SVGPatternElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired, SVGURIReference { + patternUnits: SVGAnimatedEnumeration; + y: SVGAnimatedLength; + width: SVGAnimatedLength; + x: SVGAnimatedLength; + patternContentUnits: SVGAnimatedEnumeration; + patternTransform: SVGAnimatedTransformList; + height: SVGAnimatedLength; +} +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGAnimatedAngle { + animVal: SVGAngle; + baseVal: SVGAngle; +} +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface Selection { + isCollapsed: boolean; + anchorNode: Node; + focusNode: Node; + anchorOffset: number; + focusOffset: number; + rangeCount: number; + addRange(range: Range): void; + collapseToEnd(): void; + toString(): string; + selectAllChildren(parentNode: Node): void; + getRangeAt(index: number): Range; + collapse(parentNode: Node, offset: number): void; + removeAllRanges(): void; + collapseToStart(): void; + deleteFromDocument(): void; + removeRange(range: Range): void; +} +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { + type: string; +} +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface HTMLDDElement extends HTMLElement { + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDDElement: { + prototype: HTMLDDElement; + new(): HTMLDDElement; +} + +interface MSDataBindingRecordSetReadonlyExtensions { + recordset: any; + namedRecordset(dataMember: string, hierarchy?: any): any; +} + +interface CSSStyleRule extends CSSRule { + selectorText: string; + style: MSStyleCSSProperties; + readOnly: boolean; +} +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface NodeIterator { + whatToShow: number; + filter: NodeFilter; + root: Node; + expandEntityReferences: boolean; + nextNode(): Node; + detach(): void; + previousNode(): Node; +} +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox, SVGExternalResourcesRequired { + viewTarget: SVGStringList; +} +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; +} +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface SVGLocatable { + farthestViewportElement: SVGElement; + nearestViewportElement: SVGElement; + getBBox(): SVGRect; + getTransformToElement(element: SVGElement): SVGMatrix; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; +} +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { +} +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface ControlRangeCollection { + length: number; + queryCommandValue(cmdID: string): any; + remove(index: number): void; + add(item: Element): void; + queryCommandIndeterm(cmdID: string): boolean; + scrollIntoView(varargStart?: any): void; + item(index: number): Element; + [index: number]: Element; + execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; + addElement(item: Element): void; + queryCommandState(cmdID: string): boolean; + queryCommandSupported(cmdID: string): boolean; + queryCommandEnabled(cmdID: string): boolean; + queryCommandText(cmdID: string): string; + select(): void; +} +declare var ControlRangeCollection: { + prototype: ControlRangeCollection; + new(): ControlRangeCollection; +} + +interface MSNamespaceInfo extends MSEventAttachmentTarget { + urn: string; + onreadystatechange: (ev: Event) => any; + name: string; + readyState: string; + doImport(implementationUrl: string): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSNamespaceInfo: { + prototype: MSNamespaceInfo; + new(): MSNamespaceInfo; +} + +interface WindowSessionStorage { + sessionStorage: Storage; +} + +interface SVGAnimatedTransformList { + animVal: SVGTransformList; + baseVal: SVGTransformList; +} +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; +} +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLOptionElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + index: number; + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; +} +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; + create(): HTMLOptionElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + areas: HTMLAreasCollection; +} +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMenuElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { + type: string; +} +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface MouseWheelEvent extends MouseEvent { + wheelDelta: number; + initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; +} +declare var MouseWheelEvent: { + prototype: MouseWheelEvent; + new(): MouseWheelEvent; +} + +interface SVGFitToViewBox { + viewBox: SVGAnimatedRect; + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; +} + +interface SVGPointList { + numberOfItems: number; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; + getItem(index: number): SVGPoint; + clear(): void; + appendItem(newItem: SVGPoint): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + removeItem(index: number): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; +} +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGAnimatedLengthList { + animVal: SVGLengthList; + baseVal: SVGLengthList; +} +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedPreserveAspectRatio { + animVal: SVGPreserveAspectRatio; + baseVal: SVGPreserveAspectRatio; +} +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface MSSiteModeEvent extends Event { + buttonID: number; + actionURL: string; +} +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface DOML2DeprecatedTextFlowControl { + clear: string; +} + +interface StyleSheetPageList { + length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface MSCSSProperties extends CSSStyleDeclaration { + scrollbarShadowColor: string; + scrollbarHighlightColor: string; + layoutGridChar: string; + layoutGridType: string; + textAutospace: string; + textKashidaSpace: string; + writingMode: string; + scrollbarFaceColor: string; + backgroundPositionY: string; + lineBreak: string; + imeMode: string; + msBlockProgression: string; + layoutGridLine: string; + scrollbarBaseColor: string; + layoutGrid: string; + layoutFlow: string; + textKashida: string; + filter: string; + zoom: string; + scrollbarArrowColor: string; + behavior: string; + backgroundPositionX: string; + accelerator: string; + layoutGridMode: string; + textJustifyTrim: string; + scrollbar3dLightColor: string; + msInterpolationMode: string; + scrollbarTrackColor: string; + scrollbarDarkShadowColor: string; + styleFloat: string; + getAttribute(attributeName: string, flags?: number): any; + setAttribute(attributeName: string, AttributeValue: any, flags?: number): void; + removeAttribute(attributeName: string, flags?: number): boolean; +} +declare var MSCSSProperties: { + prototype: MSCSSProperties; + new(): MSCSSProperties; +} + +interface SVGExternalResourcesRequired { + externalResourcesRequired: SVGAnimatedBoolean; +} + +interface HTMLImageElement extends HTMLElement, MSImageResourceExtensions, MSDataBindingExtensions, MSResourceMetadata { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * The original height of the image resource before sizing. + */ + naturalHeight: number; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * The original width of the image resource before sizing. + */ + naturalWidth: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + /** + * Contains the hypertext reference (HREF) of the URL. + */ + href: string; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + complete: boolean; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + crossOrigin: string; + msPlayToPreferredSourceUri: string; +} +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; + create(): HTMLImageElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface EventTarget { + removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; +} + +interface SVGAngle { + valueAsString: string; + valueInSpecifiedUnits: number; + value: number; + unitType: number; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + SVG_ANGLETYPE_RAD: number; + SVG_ANGLETYPE_UNKNOWN: number; + SVG_ANGLETYPE_UNSPECIFIED: number; + SVG_ANGLETYPE_DEG: number; + SVG_ANGLETYPE_GRAD: number; +} +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + SVG_ANGLETYPE_RAD: number; + SVG_ANGLETYPE_UNKNOWN: number; + SVG_ANGLETYPE_UNSPECIFIED: number; + SVG_ANGLETYPE_DEG: number; + SVG_ANGLETYPE_GRAD: number; +} + +interface HTMLButtonElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + status: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; + msKeySystem: string; +} +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface KeyboardEvent extends UIEvent { + location: number; + keyCode: number; + shiftKey: boolean; + which: number; + locale: string; + key: string; + altKey: boolean; + metaKey: boolean; + char: string; + ctrlKey: boolean; + repeat: boolean; + charCode: number; + getModifierState(keyArg: string): boolean; + initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; + DOM_KEY_LOCATION_RIGHT: number; + DOM_KEY_LOCATION_STANDARD: number; + DOM_KEY_LOCATION_LEFT: number; + DOM_KEY_LOCATION_NUMPAD: number; + DOM_KEY_LOCATION_JOYSTICK: number; + DOM_KEY_LOCATION_MOBILE: number; +} +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(): KeyboardEvent; + DOM_KEY_LOCATION_RIGHT: number; + DOM_KEY_LOCATION_STANDARD: number; + DOM_KEY_LOCATION_LEFT: number; + DOM_KEY_LOCATION_NUMPAD: number; + DOM_KEY_LOCATION_JOYSTICK: number; + DOM_KEY_LOCATION_MOBILE: number; +} + +interface MessageEvent extends Event { + source: Window; + origin: string; + data: any; + ports: any; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} +declare var MessageEvent: { + prototype: MessageEvent; + new(): MessageEvent; +} + +interface SVGElement extends Element { + onmouseover: (ev: MouseEvent) => any; + viewportElement: SVGElement; + onmousemove: (ev: MouseEvent) => any; + onmouseout: (ev: MouseEvent) => any; + ondblclick: (ev: MouseEvent) => any; + onfocusout: (ev: FocusEvent) => any; + onfocusin: (ev: FocusEvent) => any; + xmlbase: string; + onmousedown: (ev: MouseEvent) => any; + onload: (ev: Event) => any; + onmouseup: (ev: MouseEvent) => any; + onclick: (ev: MouseEvent) => any; + ownerSVGElement: SVGSVGElement; + id: string; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface HTMLScriptElement extends HTMLElement { + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + async: boolean; +} +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { + /** + * Retrieves the position of the object in the rows collection for the table. + */ + rowIndex: number; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollection; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Retrieves the position of the object in the collection. + */ + sectionRowIndex: number; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLElement; +} +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface CanvasRenderingContext2D { + miterLimit: number; + font: string; + globalCompositeOperation: string; + msFillRule: string; + lineCap: string; + msImageSmoothingEnabled: boolean; + lineDashOffset: number; + shadowColor: string; + lineJoin: string; + shadowOffsetX: number; + lineWidth: number; + canvas: HTMLCanvasElement; + strokeStyle: any; + globalAlpha: number; + shadowOffsetY: number; + fillStyle: any; + shadowBlur: number; + textAlign: string; + textBaseline: string; + restore(): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + save(): void; + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + measureText(text: string): TextMetrics; + isPointInPath(x: number, y: number, fillRule?: string): boolean; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + rotate(angle: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + translate(x: number, y: number): void; + scale(x: number, y: number): void; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + lineTo(x: number, y: number): void; + getLineDash(): number[]; + fill(fillRule?: string): void; + createImageData(imageDataOrSw: any, sh?: number): ImageData; + createPattern(image: HTMLElement, repetition: string): CanvasPattern; + closePath(): void; + rect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: string): void; + clearRect(x: number, y: number, w: number, h: number): void; + moveTo(x: number, y: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + fillRect(x: number, y: number, w: number, h: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + drawImage(image: HTMLElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(): void; + strokeRect(x: number, y: number, w: number, h: number): void; + setLineDash(segments: number[]): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + beginPath(): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; +} +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface MSCSSRuleList { + length: number; + item(index?: number): CSSStyleRule; + [index: number]: CSSStyleRule; +} +declare var MSCSSRuleList: { + prototype: MSCSSRuleList; + new(): MSCSSRuleList; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + y: number; + sweepFlag: boolean; + r2: number; + x: number; + angle: number; + r1: number; + largeArcFlag: boolean; +} +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGTransformList { + numberOfItems: number; + getItem(index: number): SVGTransform; + consolidate(): SVGTransform; + clear(): void; + appendItem(newItem: SVGTransform): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + removeItem(index: number): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; +} +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; +} +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Retrieves the object of the specified. + */ + contentWindow: Window; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Raised when the object has been completely received from the server. + */ + onload: (ev: Event) => any; + /** + * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. + */ + security: any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface SVGAnimatedLength { + animVal: SVGLength; + baseVal: SVGLength; +} +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedPoints { + points: SVGPointList; + animatedPoints: SVGPointList; +} + +interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface CSSMediaRule extends CSSRule { + media: MediaList; + cssRules: CSSRuleList; + insertRule(rule: string, index?: number): number; + deleteRule(index?: number): void; +} +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface WindowModal { + dialogArguments: any; + returnValue: any; +} + +interface XMLHttpRequest extends EventTarget { + responseBody: any; + status: number; + readyState: number; + responseText: string; + responseXML: any; + ontimeout: (ev: Event) => any; + statusText: string; + onreadystatechange: (ev: Event) => any; + timeout: number; + onload: (ev: Event) => any; + response: any; + withCredentials: boolean; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: UIEvent) => any; + responseType: string; + onloadend: (ev: ProgressEvent) => any; + upload: XMLHttpRequestEventTarget; + onerror: (ev: ErrorEvent) => any; + onloadstart: (ev: Event) => any; + msCaching: string; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + send(data?: any): void; + abort(): void; + getAllResponseHeaders(): string; + setRequestHeader(header: string, value: string): void; + getResponseHeader(header: string): string; + msCachingEnabled(): boolean; + overrideMimeType(mime: string): void; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + create(): XMLHttpRequest; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; +} +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLDListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { +} +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface MSDataBindingExtensions { + dataSrc: string; + dataFormatAs: string; + dataFld: string; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + ry: SVGAnimatedLength; + cx: SVGAnimatedLength; + rx: SVGAnimatedLength; + cy: SVGAnimatedLength; +} +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + target: SVGAnimatedString; +} +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGStylable { + className: SVGAnimatedString; + style: CSSStyleDeclaration; +} + +interface SVGTransformable extends SVGLocatable { + transform: SVGAnimatedTransformList; +} + +interface HTMLFrameSetElement extends HTMLElement { + ononline: (ev: Event) => any; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Fires when the object loses the input focus. + */ + onblur: (ev: FocusEvent) => any; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Fires when the object receives focus. + */ + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + onerror: (ev: ErrorEvent) => any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + onresize: (ev: UIEvent) => any; + name: string; + onafterprint: (ev: Event) => any; + onbeforeprint: (ev: Event) => any; + onoffline: (ev: Event) => any; + border: string; + onunload: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onload: (ev: Event) => any; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + onstorage: (ev: StorageEvent) => any; + onpageshow: (ev: PageTransitionEvent) => any; + onpagehide: (ev: PageTransitionEvent) => any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface Screen extends EventTarget { + width: number; + deviceXDPI: number; + fontSmoothingEnabled: boolean; + bufferDepth: number; + logicalXDPI: number; + systemXDPI: number; + availHeight: number; + height: number; + logicalYDPI: number; + systemYDPI: number; + updateInterval: number; + colorDepth: number; + availWidth: number; + deviceYDPI: number; + pixelDepth: number; + msOrientation: string; + onmsorientationchange: (ev: any) => any; + msLockOrientation(orientation: string): boolean; + msLockOrientation(orientations: string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: "msorientationchange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface Coordinates { + altitudeAccuracy: number; + longitude: number; + latitude: number; + speed: number; + heading: number; + altitude: number; + accuracy: number; +} +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface NavigatorGeolocation { + geolocation: Geolocation; +} + +interface NavigatorContentUtils { +} + +interface EventListener { + (evt: Event): void; +} + +interface SVGLangSpace { + xmllang: string; + xmlspace: string; +} + +interface DataTransfer { + effectAllowed: string; + dropEffect: string; + types: DOMStringList; + files: FileList; + clearData(format?: string): boolean; + setData(format: string, data: string): boolean; + getData(format: string): string; +} +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface FocusEvent extends UIEvent { + relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} +declare var FocusEvent: { + prototype: FocusEvent; + new(): FocusEvent; +} + +interface Range { + startOffset: number; + collapsed: boolean; + endOffset: number; + startContainer: Node; + endContainer: Node; + commonAncestorContainer: Node; + setStart(refNode: Node, offset: number): void; + setEndBefore(refNode: Node): void; + setStartBefore(refNode: Node): void; + selectNode(refNode: Node): void; + detach(): void; + getBoundingClientRect(): ClientRect; + toString(): string; + compareBoundaryPoints(how: number, sourceRange: Range): number; + insertNode(newNode: Node): void; + collapse(toStart: boolean): void; + selectNodeContents(refNode: Node): void; + cloneContents(): DocumentFragment; + setEnd(refNode: Node, offset: number): void; + cloneRange(): Range; + getClientRects(): ClientRectList; + surroundContents(newParent: Node): void; + deleteContents(): void; + setStartAfter(refNode: Node): void; + extractContents(): DocumentFragment; + setEndAfter(refNode: Node): void; + createContextualFragment(fragment: string): DocumentFragment; + END_TO_END: number; + START_TO_START: number; + START_TO_END: number; + END_TO_START: number; +} +declare var Range: { + prototype: Range; + new(): Range; + END_TO_END: number; + START_TO_START: number; + START_TO_END: number; + END_TO_START: number; +} + +interface SVGPoint { + y: number; + x: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface MSPluginsCollection { + length: number; + refresh(reload?: boolean): void; +} +declare var MSPluginsCollection: { + prototype: MSPluginsCollection; + new(): MSPluginsCollection; +} + +interface SVGAnimatedNumberList { + animVal: SVGNumberList; + baseVal: SVGNumberList; +} +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGSVGElement extends SVGElement, SVGStylable, SVGZoomAndPan, DocumentEvent, SVGLangSpace, SVGLocatable, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired { + width: SVGAnimatedLength; + x: SVGAnimatedLength; + contentStyleType: string; + onzoom: (ev: any) => any; + y: SVGAnimatedLength; + viewport: SVGRect; + onerror: (ev: ErrorEvent) => any; + pixelUnitToMillimeterY: number; + onresize: (ev: UIEvent) => any; + screenPixelToMillimeterY: number; + height: SVGAnimatedLength; + onabort: (ev: UIEvent) => any; + contentScriptType: string; + pixelUnitToMillimeterX: number; + currentTranslate: SVGPoint; + onunload: (ev: Event) => any; + currentScale: number; + onscroll: (ev: UIEvent) => any; + screenPixelToMillimeterX: number; + setCurrentTime(seconds: number): void; + createSVGLength(): SVGLength; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + unpauseAnimations(): void; + createSVGRect(): SVGRect; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + unsuspendRedrawAll(): void; + pauseAnimations(): void; + suspendRedraw(maxWaitMilliseconds: number): number; + deselectAll(): void; + createSVGAngle(): SVGAngle; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; + createSVGTransform(): SVGTransform; + unsuspendRedraw(suspendHandleID: number): void; + forceRedraw(): void; + getCurrentTime(): number; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + createSVGMatrix(): SVGMatrix; + createSVGPoint(): SVGPoint; + createSVGNumber(): SVGNumber; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getElementById(elementId: string): Element; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "zoom", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface HTMLLabelElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface MSResourceMetadata { + protocol: string; + fileSize: string; + fileUpdatedDate: string; + nameProp: string; + fileCreatedDate: string; + fileModifiedDate: string; + mimeType: string; +} + +interface HTMLLegendElement extends HTMLElement, MSDataBindingExtensions { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLDirectoryElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { +} +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface SVGAnimatedInteger { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { +} +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { +} +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface HTMLLIElement extends HTMLElement, DOML2DeprecatedListNumberingAndBulletStyle { + /** + * Sets or retrieves the value of a list item. + */ + value: number; +} +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface MSStorageExtensions { + remainingSpace: number; +} + +interface SVGStyleElement extends SVGElement, SVGLangSpace { + media: string; + type: string; + title: string; +} +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface MSCurrentStyleCSSProperties extends MSCSSProperties { + blockDirection: string; + clipBottom: string; + clipLeft: string; + clipRight: string; + clipTop: string; + hasLayout: string; +} +declare var MSCurrentStyleCSSProperties: { + prototype: MSCurrentStyleCSSProperties; + new(): MSCurrentStyleCSSProperties; +} + +interface MSHTMLCollectionExtensions { + urns(urn: any): any; + tags(tagName: any): any; +} + +interface Storage extends MSStorageExtensions { + length: number; + getItem(key: string): any; + [key: string]: any; + setItem(key: string, data: string): void; + clear(): void; + removeItem(key: string): void; + key(index: number): string; + [index: number]: string; +} +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Retrieves the object of the specified. + */ + contentWindow: Window; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. + */ + security: any; + /** + * Raised when the object has been completely received from the server. + */ + onload: (ev: Event) => any; + sandbox: DOMSettableTokenList; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface TextRangeCollection { + length: number; + item(index: number): TextRange; + [index: number]: TextRange; +} +declare var TextRangeCollection: { + prototype: TextRangeCollection; + new(): TextRangeCollection; +} + +interface HTMLBodyElement extends HTMLElement, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + scroll: string; + ononline: (ev: Event) => any; + onblur: (ev: FocusEvent) => any; + noWrap: boolean; + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + text: any; + onerror: (ev: ErrorEvent) => any; + bgProperties: string; + onresize: (ev: UIEvent) => any; + link: any; + aLink: any; + bottomMargin: any; + topMargin: any; + onafterprint: (ev: Event) => any; + vLink: any; + onbeforeprint: (ev: Event) => any; + onoffline: (ev: Event) => any; + onunload: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onload: (ev: Event) => any; + rightMargin: any; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + leftMargin: any; + onstorage: (ev: StorageEvent) => any; + onpopstate: (ev: PopStateEvent) => any; + onpageshow: (ev: PageTransitionEvent) => any; + onpagehide: (ev: PageTransitionEvent) => any; + createTextRange(): TextRange; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface DocumentType extends Node { + name: string; + notations: NamedNodeMap; + systemId: string; + internalSubset: string; + entities: NamedNodeMap; + publicId: string; +} +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + cx: SVGAnimatedLength; + r: SVGAnimatedLength; + cy: SVGAnimatedLength; + fx: SVGAnimatedLength; + fy: SVGAnimatedLength; +} +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface MutationEvent extends Event { + newValue: string; + attrChange: number; + attrName: string; + prevValue: string; + relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + MODIFICATION: number; + REMOVAL: number; + ADDITION: number; +} +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + MODIFICATION: number; + REMOVAL: number; + ADDITION: number; +} + +interface DragEvent extends MouseEvent { + dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollection; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Moves a table row to a new position. + * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. + * @param indexTo Number that specifies where the row is moved within the rows collection. + */ + moveRow(indexFrom?: number, indexTo?: number): any; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLElement; +} +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface DOML2DeprecatedListNumberingAndBulletStyle { + type: string; +} + +interface HTMLInputElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + status: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + indeterminate: boolean; + readOnly: boolean; + size: number; + loop: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Sets or retrieves the URL of the virtual reality modeling language (VRML) world to be displayed in the window. + */ + vrml: string; + /** + * Sets or retrieves a lower resolution image to display. + */ + lowsrc: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + dynsrc: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + /** + * Retrieves whether the object is fully loaded. + */ + complete: boolean; + start: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a FileList object on a file type input object. + */ + files: FileList; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + list: HTMLElement; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLAnchorElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + Methods: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + protocolLong: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + nameProp: string; + urn: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + type: string; + mimeType: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; +} +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGAnimatedNumber { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface PerformanceTiming { + redirectStart: number; + domainLookupEnd: number; + responseStart: number; + domComplete: number; + domainLookupStart: number; + loadEventStart: number; + msFirstPaint: number; + unloadEventEnd: number; + fetchStart: number; + requestStart: number; + domInteractive: number; + navigationStart: number; + connectEnd: number; + loadEventEnd: number; + connectStart: number; + responseEnd: number; + domLoading: number; + redirectEnd: number; + unloadEventStart: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + toJSON(): any; +} +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface HTMLPreElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; + /** + * Indicates a citation by rendering text in italic type. + */ + cite: string; +} +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface EventException { + code: number; + message: string; + name: string; + toString(): string; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} +declare var EventException: { + prototype: EventException; + new(): EventException; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} + +interface MSNavigatorDoNotTrack { + msDoNotTrack: string; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; +} + +interface NavigatorOnLine { + onLine: boolean; +} + +interface WindowLocalStorage { + localStorage: Storage; +} + +interface SVGMetadataElement extends SVGElement { +} +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + y: number; + sweepFlag: boolean; + r2: number; + x: number; + angle: number; + r1: number; + largeArcFlag: boolean; +} +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGStringList { + numberOfItems: number; + replaceItem(newItem: string, index: number): string; + getItem(index: number): string; + clear(): void; + appendItem(newItem: string): string; + initialize(newItem: string): string; + removeItem(index: number): string; + insertItemBefore(newItem: string, index: number): string; +} +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface XDomainRequest { + timeout: number; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onprogress: (ev: ProgressEvent) => any; + ontimeout: (ev: Event) => any; + responseText: string; + contentType: string; + open(method: string, url: string): void; + abort(): void; + send(data?: any): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XDomainRequest: { + prototype: XDomainRequest; + new(): XDomainRequest; + create(): XDomainRequest; +} + +interface DOML2DeprecatedBackgroundColorStyle { + bgColor: any; +} + +interface ElementTraversal { + childElementCount: number; + previousElementSibling: Element; + lastElementChild: Element; + nextElementSibling: Element; + firstElementChild: Element; +} + +interface SVGLength { + valueAsString: string; + valueInSpecifiedUnits: number; + value: number; + unitType: number; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + SVG_LENGTHTYPE_NUMBER: number; + SVG_LENGTHTYPE_CM: number; + SVG_LENGTHTYPE_PC: number; + SVG_LENGTHTYPE_PERCENTAGE: number; + SVG_LENGTHTYPE_MM: number; + SVG_LENGTHTYPE_PT: number; + SVG_LENGTHTYPE_IN: number; + SVG_LENGTHTYPE_EMS: number; + SVG_LENGTHTYPE_PX: number; + SVG_LENGTHTYPE_UNKNOWN: number; + SVG_LENGTHTYPE_EXS: number; +} +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + SVG_LENGTHTYPE_NUMBER: number; + SVG_LENGTHTYPE_CM: number; + SVG_LENGTHTYPE_PC: number; + SVG_LENGTHTYPE_PERCENTAGE: number; + SVG_LENGTHTYPE_MM: number; + SVG_LENGTHTYPE_PT: number; + SVG_LENGTHTYPE_IN: number; + SVG_LENGTHTYPE_EMS: number; + SVG_LENGTHTYPE_PX: number; + SVG_LENGTHTYPE_UNKNOWN: number; + SVG_LENGTHTYPE_EXS: number; +} + +interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface HTMLPhraseElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLPhraseElement: { + prototype: HTMLPhraseElement; + new(): HTMLPhraseElement; +} + +interface NavigatorStorageUtils { +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + y: number; + y1: number; + x2: number; + x: number; + x1: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGTextContentElement extends SVGElement, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + textLength: SVGAnimatedLength; + lengthAdjust: SVGAnimatedEnumeration; + getCharNumAtPosition(point: SVGPoint): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getComputedTextLength(): number; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getEndPositionOfChar(charnum: number): SVGPoint; + LENGTHADJUST_SPACING: number; + LENGTHADJUST_SPACINGANDGLYPHS: number; + LENGTHADJUST_UNKNOWN: number; +} +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + LENGTHADJUST_SPACING: number; + LENGTHADJUST_SPACINGANDGLYPHS: number; + LENGTHADJUST_UNKNOWN: number; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface Location { + hash: string; + protocol: string; + search: string; + href: string; + hostname: string; + port: string; + pathname: string; + host: string; + reload(flag?: boolean): void; + replace(url: string): void; + assign(url: string): void; + toString(): string; +} +declare var Location: { + prototype: Location; + new(): Location; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; +} +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; +} +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface PerformanceEntry { + name: string; + startTime: number; + duration: number; + entryType: string; +} +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface SVGTransform { + type: number; + angle: number; + matrix: SVGMatrix; + setTranslate(tx: number, ty: number): void; + setScale(sx: number, sy: number): void; + setMatrix(matrix: SVGMatrix): void; + setSkewY(angle: number): void; + setRotate(angle: number, cx: number, cy: number): void; + setSkewX(angle: number): void; + SVG_TRANSFORM_SKEWX: number; + SVG_TRANSFORM_UNKNOWN: number; + SVG_TRANSFORM_SCALE: number; + SVG_TRANSFORM_TRANSLATE: number; + SVG_TRANSFORM_MATRIX: number; + SVG_TRANSFORM_ROTATE: number; + SVG_TRANSFORM_SKEWY: number; +} +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + SVG_TRANSFORM_SKEWX: number; + SVG_TRANSFORM_UNKNOWN: number; + SVG_TRANSFORM_SCALE: number; + SVG_TRANSFORM_TRANSLATE: number; + SVG_TRANSFORM_MATRIX: number; + SVG_TRANSFORM_ROTATE: number; + SVG_TRANSFORM_SKEWY: number; +} + +interface UIEvent extends Event { + detail: number; + view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} +declare var UIEvent: { + prototype: UIEvent; + new(): UIEvent; +} + +interface SVGURIReference { + href: SVGAnimatedString; +} + +interface SVGPathSeg { + pathSegType: number; + pathSegTypeAsLetter: string; + PATHSEG_MOVETO_REL: number; + PATHSEG_LINETO_VERTICAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + PATHSEG_CURVETO_QUADRATIC_REL: number; + PATHSEG_CURVETO_CUBIC_ABS: number; + PATHSEG_LINETO_HORIZONTAL_ABS: number; + PATHSEG_CURVETO_QUADRATIC_ABS: number; + PATHSEG_LINETO_ABS: number; + PATHSEG_CLOSEPATH: number; + PATHSEG_LINETO_HORIZONTAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + PATHSEG_LINETO_REL: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + PATHSEG_ARC_REL: number; + PATHSEG_CURVETO_CUBIC_REL: number; + PATHSEG_UNKNOWN: number; + PATHSEG_LINETO_VERTICAL_ABS: number; + PATHSEG_ARC_ABS: number; + PATHSEG_MOVETO_ABS: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; +} +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + PATHSEG_MOVETO_REL: number; + PATHSEG_LINETO_VERTICAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + PATHSEG_CURVETO_QUADRATIC_REL: number; + PATHSEG_CURVETO_CUBIC_ABS: number; + PATHSEG_LINETO_HORIZONTAL_ABS: number; + PATHSEG_CURVETO_QUADRATIC_ABS: number; + PATHSEG_LINETO_ABS: number; + PATHSEG_CLOSEPATH: number; + PATHSEG_LINETO_HORIZONTAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + PATHSEG_LINETO_REL: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + PATHSEG_ARC_REL: number; + PATHSEG_CURVETO_CUBIC_REL: number; + PATHSEG_UNKNOWN: number; + PATHSEG_LINETO_VERTICAL_ABS: number; + PATHSEG_ARC_ABS: number; + PATHSEG_MOVETO_ABS: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; +} + +interface WheelEvent extends MouseEvent { + deltaZ: number; + deltaX: number; + deltaMode: number; + deltaY: number; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + getCurrentPoint(element: Element): void; + DOM_DELTA_PIXEL: number; + DOM_DELTA_LINE: number; + DOM_DELTA_PAGE: number; +} +declare var WheelEvent: { + prototype: WheelEvent; + new(): WheelEvent; + DOM_DELTA_PIXEL: number; + DOM_DELTA_LINE: number; + DOM_DELTA_PAGE: number; +} + +interface MSEventAttachmentTarget { + attachEvent(event: string, listener: EventListener): boolean; + detachEvent(event: string, listener: EventListener): void; +} + +interface SVGNumber { + value: number; +} +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGPathElement extends SVGElement, SVGStylable, SVGAnimatedPathData, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + getTotalLength(): number; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; +} +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface MSCompatibleInfo { + version: string; + userAgent: string; +} +declare var MSCompatibleInfo: { + prototype: MSCompatibleInfo; + new(): MSCompatibleInfo; +} + +interface Text extends CharacterData, MSNodeExtensions { + wholeText: string; + splitText(offset: number): Text; + replaceWholeText(content: string): Text; +} +declare var Text: { + prototype: Text; + new(): Text; +} + +interface SVGAnimatedRect { + animVal: SVGRect; + baseVal: SVGRect; +} +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface CSSNamespaceRule extends CSSRule { + namespaceURI: string; + prefix: string; +} +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface SVGPathSegList { + numberOfItems: number; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; + getItem(index: number): SVGPathSeg; + clear(): void; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; +} +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface HTMLUnknownElement extends HTMLElement, MSDataBindingRecordSetReadonlyExtensions { +} +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLAudioElement extends HTMLMediaElement { +} +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface MSImageResourceExtensions { + dynsrc: string; + vrml: string; + lowsrc: string; + start: string; + loop: number; +} + +interface PositionError { + code: number; + message: string; + toString(): string; + POSITION_UNAVAILABLE: number; + PERMISSION_DENIED: number; + TIMEOUT: number; +} +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + POSITION_UNAVAILABLE: number; + PERMISSION_DENIED: number; + TIMEOUT: number; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + cellIndex: number; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; +} +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface SVGElementInstance extends EventTarget { + previousSibling: SVGElementInstance; + parentNode: SVGElementInstance; + lastChild: SVGElementInstance; + nextSibling: SVGElementInstance; + childNodes: SVGElementInstanceList; + correspondingUseElement: SVGUseElement; + correspondingElement: SVGElement; + firstChild: SVGElementInstance; +} +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface MSNamespaceInfoCollection { + length: number; + add(namespace?: string, urn?: string, implementationUrl?: any): any; + item(index: any): any; + // [index: any]: any; +} +declare var MSNamespaceInfoCollection: { + prototype: MSNamespaceInfoCollection; + new(): MSNamespaceInfoCollection; +} + +interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + cx: SVGAnimatedLength; + r: SVGAnimatedLength; + cy: SVGAnimatedLength; +} +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface StyleSheetList { + length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface CSSImportRule extends CSSRule { + styleSheet: CSSStyleSheet; + href: string; + media: MediaList; +} +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CustomEvent extends Event { + detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} +declare var CustomEvent: { + prototype: CustomEvent; + new(): CustomEvent; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; +} +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLTextAreaElement extends HTMLElement, MSDataBindingExtensions { + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Retrieves the type of control. + */ + type: string; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface DOML2DeprecatedMarginStyle { + vspace: number; + hspace: number; +} + +interface MSWindowModeless { + dialogTop: any; + dialogLeft: any; + dialogWidth: any; + dialogHeight: any; + menuArguments: any; +} + +interface DOML2DeprecatedAlignmentStyle { + align: string; +} + +interface HTMLMarqueeElement extends HTMLElement, MSDataBindingExtensions, DOML2DeprecatedBackgroundColorStyle { + width: string; + onbounce: (ev: Event) => any; + vspace: number; + trueSpeed: boolean; + scrollAmount: number; + scrollDelay: number; + behavior: string; + height: string; + loop: number; + direction: string; + hspace: number; + onstart: (ev: Event) => any; + onfinish: (ev: Event) => any; + stop(): void; + start(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "start", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface SVGRect { + y: number; + width: number; + x: number; + height: number; +} +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface MSNodeExtensions { + swapNode(otherNode: Node): Node; + removeNode(deep?: boolean): Node; + replaceNode(replacement: Node): Node; +} + +interface History { + length: number; + state: any; + back(distance?: any): void; + forward(distance?: any): void; + go(delta?: any): void; + replaceState(statedata: any, title: string, url?: string): void; + pushState(statedata: any, title: string, url?: string): void; +} +declare var History: { + prototype: History; + new(): History; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + y: number; + y1: number; + x2: number; + x: number; + x1: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + y: number; + y1: number; + x: number; + x1: number; +} +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface TimeRanges { + length: number; + start(index: number): number; + end(index: number): number; +} +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface CSSRule { + cssText: string; + parentStyleSheet: CSSStyleSheet; + parentRule: CSSRule; + type: number; + IMPORT_RULE: number; + MEDIA_RULE: number; + STYLE_RULE: number; + NAMESPACE_RULE: number; + PAGE_RULE: number; + UNKNOWN_RULE: number; + FONT_FACE_RULE: number; + CHARSET_RULE: number; + KEYFRAMES_RULE: number; + KEYFRAME_RULE: number; + VIEWPORT_RULE: number; +} +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + IMPORT_RULE: number; + MEDIA_RULE: number; + STYLE_RULE: number; + NAMESPACE_RULE: number; + PAGE_RULE: number; + UNKNOWN_RULE: number; + FONT_FACE_RULE: number; + CHARSET_RULE: number; + KEYFRAMES_RULE: number; + KEYFRAME_RULE: number; + VIEWPORT_RULE: number; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface SVGMatrix { + e: number; + c: number; + a: number; + b: number; + d: number; + f: number; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + flipY(): SVGMatrix; + skewY(angle: number): SVGMatrix; + inverse(): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + rotate(angle: number): SVGMatrix; + flipX(): SVGMatrix; + translate(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + skewX(angle: number): SVGMatrix; +} +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface MSPopupWindow { + document: Document; + isOpen: boolean; + show(x: number, y: number, w: number, h: number, element?: any): void; + hide(): void; +} +declare var MSPopupWindow: { + prototype: MSPopupWindow; + new(): MSPopupWindow; +} + +interface BeforeUnloadEvent extends Event { + returnValue: string; +} +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + animatedInstanceRoot: SVGElementInstance; + instanceRoot: SVGElementInstance; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface Event { + timeStamp: number; + defaultPrevented: boolean; + isTrusted: boolean; + currentTarget: EventTarget; + cancelBubble: boolean; + target: EventTarget; + eventPhase: number; + cancelable: boolean; + type: string; + srcElement: Element; + bubbles: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + stopPropagation(): void; + stopImmediatePropagation(): void; + preventDefault(): void; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} +declare var Event: { + prototype: Event; + new(): Event; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} + +interface ImageData { + width: number; + data: number[]; + height: number; +} +declare var ImageData: { + prototype: ImageData; + new(): ImageData; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the width of the object. + */ + width: any; + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; +} +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface SVGException { + code: number; + message: string; + name: string; + toString(): string; + SVG_MATRIX_NOT_INVERTABLE: number; + SVG_WRONG_TYPE_ERR: number; + SVG_INVALID_VALUE_ERR: number; +} +declare var SVGException: { + prototype: SVGException; + new(): SVGException; + SVG_MATRIX_NOT_INVERTABLE: number; + SVG_WRONG_TYPE_ERR: number; + SVG_INVALID_VALUE_ERR: number; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + y1: SVGAnimatedLength; + x2: SVGAnimatedLength; + x1: SVGAnimatedLength; + y2: SVGAnimatedLength; +} +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; +} + +interface SVGAnimatedEnumeration { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface HTMLUListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { +} +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + ry: SVGAnimatedLength; + rx: SVGAnimatedLength; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface ErrorEventHandler { + (event: Event, source: string, fileno: number, columnNumber: number): void; +} + +interface HTMLDivElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface DOML2DeprecatedBorderStyle { + border: string; +} + +interface NamedNodeMap { + length: number; + removeNamedItemNS(namespaceURI: string, localName: string): Attr; + item(index: number): Attr; + [index: number]: Attr; + removeNamedItem(name: string): Attr; + getNamedItem(name: string): Attr; + // [name: string]: Attr; + setNamedItem(arg: Attr): Attr; + getNamedItemNS(namespaceURI: string, localName: string): Attr; + setNamedItemNS(arg: Attr): Attr; +} +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface MediaList { + length: number; + mediaText: string; + deleteMedium(oldMedium: string): void; + appendMedium(newMedium: string): void; + item(index: number): string; + [index: number]: string; + toString(): string; +} +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + y: number; + x2: number; + x: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGLengthList { + numberOfItems: number; + replaceItem(newItem: SVGLength, index: number): SVGLength; + getItem(index: number): SVGLength; + clear(): void; + appendItem(newItem: SVGLength): SVGLength; + initialize(newItem: SVGLength): SVGLength; + removeItem(index: number): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; +} +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface ProcessingInstruction extends Node { + target: string; + data: string; +} +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface MSWindowExtensions { + status: string; + onmouseleave: (ev: MouseEvent) => any; + screenLeft: number; + offscreenBuffering: any; + maxConnectionsPerServer: number; + onmouseenter: (ev: MouseEvent) => any; + clipboardData: DataTransfer; + defaultStatus: string; + clientInformation: Navigator; + closed: boolean; + onhelp: (ev: Event) => any; + external: External; + event: MSEventObj; + onfocusout: (ev: FocusEvent) => any; + screenTop: number; + onfocusin: (ev: FocusEvent) => any; + showModelessDialog(url?: string, argument?: any, options?: any): Window; + navigate(url: string): void; + resizeBy(x?: number, y?: number): void; + item(index: any): any; + resizeTo(x?: number, y?: number): void; + createPopup(arguments?: any): MSPopupWindow; + toStaticHTML(html: string): string; + execScript(code: string, language?: string): any; + msWriteProfilerMark(profilerMarkName: string): void; + moveTo(x?: number, y?: number): void; + moveBy(x?: number, y?: number): void; + showHelp(url: string, helpArg?: any, features?: string): void; + captureEvents(): void; + releaseEvents(): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface MSBehaviorUrnsCollection { + length: number; + item(index: number): string; +} +declare var MSBehaviorUrnsCollection: { + prototype: MSBehaviorUrnsCollection; + new(): MSBehaviorUrnsCollection; +} + +interface CSSFontFaceRule extends CSSRule { + style: CSSStyleDeclaration; +} +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface DOML2DeprecatedBackgroundStyle { + background: string; +} + +interface TextEvent extends UIEvent { + inputMethod: number; + data: string; + locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + DOM_INPUT_METHOD_KEYBOARD: number; + DOM_INPUT_METHOD_DROP: number; + DOM_INPUT_METHOD_IME: number; + DOM_INPUT_METHOD_SCRIPT: number; + DOM_INPUT_METHOD_VOICE: number; + DOM_INPUT_METHOD_UNKNOWN: number; + DOM_INPUT_METHOD_PASTE: number; + DOM_INPUT_METHOD_HANDWRITING: number; + DOM_INPUT_METHOD_OPTION: number; + DOM_INPUT_METHOD_MULTIMODAL: number; +} +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + DOM_INPUT_METHOD_KEYBOARD: number; + DOM_INPUT_METHOD_DROP: number; + DOM_INPUT_METHOD_IME: number; + DOM_INPUT_METHOD_SCRIPT: number; + DOM_INPUT_METHOD_VOICE: number; + DOM_INPUT_METHOD_UNKNOWN: number; + DOM_INPUT_METHOD_PASTE: number; + DOM_INPUT_METHOD_HANDWRITING: number; + DOM_INPUT_METHOD_OPTION: number; + DOM_INPUT_METHOD_MULTIMODAL: number; +} + +interface DocumentFragment extends Node, NodeSelector, MSEventAttachmentTarget, MSNodeExtensions { +} +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGAnimatedPathData { + pathSegList: SVGPathSegList; +} + +interface Position { + timestamp: Date; + coords: Coordinates; +} +declare var Position: { + prototype: Position; + new(): Position; +} + +interface BookmarkCollection { + length: number; + item(index: number): any; + [index: number]: any; +} +declare var BookmarkCollection: { + prototype: BookmarkCollection; + new(): BookmarkCollection; +} + +interface PerformanceMark extends PerformanceEntry { +} +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface CSSPageRule extends CSSRule { + pseudoClass: string; + selectorText: string; + selector: string; + style: CSSStyleDeclaration; +} +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; +} +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface MSNavigatorExtensions { + userLanguage: string; + plugins: MSPluginsCollection; + cookieEnabled: boolean; + appCodeName: string; + cpuClass: string; + appMinorVersion: string; + connectionSpeed: number; + browserLanguage: string; + mimeTypes: MSMimeTypesCollection; + systemLanguage: string; + language: string; + javaEnabled(): boolean; + taintEnabled(): boolean; +} + +interface HTMLSpanElement extends HTMLElement, MSDataBindingExtensions { +} +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; +} +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; +} +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLFormElement extends HTMLElement, MSHTMLCollectionExtensions { + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + elements: HTMLCollection; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + [name: string]: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; +} +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface SVGZoomAndPan { + zoomAndPan: number; + SVG_ZOOMANDPAN_MAGNIFY: number; + SVG_ZOOMANDPAN_UNKNOWN: number; + SVG_ZOOMANDPAN_DISABLE: number; +} +declare var SVGZoomAndPan: SVGZoomAndPan; + +interface HTMLMediaElement extends HTMLElement { + /** + * Gets the earliest possible position, in seconds, that the playback can begin. + */ + initialTime: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + played: TimeRanges; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + currentSrc: string; + readyState: any; + /** + * The autobuffer element is not supported by Internet Explorer 9. Use the preload element instead. + */ + autobuffer: boolean; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + /** + * Gets information about whether the playback has ended or not. + */ + ended: boolean; + /** + * Gets a collection of buffered time ranges. + */ + buffered: TimeRanges; + /** + * Returns an object representing the current error state of the audio or video element. + */ + error: MediaError; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + seekable: TimeRanges; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + duration: number; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Gets a flag that specifies whether playback is paused. + */ + paused: boolean; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + seeking: boolean; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + /** + * Gets the current network activity for the element. + */ + networkState: number; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + textTracks: TextTrackList; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + audioTracks: AudioTrackList; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + msKeys: MSMediaKeys; + msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + /** + * Fires immediately after the client loads the object. + */ + load(): void; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + HAVE_METADATA: number; + HAVE_CURRENT_DATA: number; + HAVE_NOTHING: number; + NETWORK_NO_SOURCE: number; + HAVE_ENOUGH_DATA: number; + NETWORK_EMPTY: number; + NETWORK_LOADING: number; + NETWORK_IDLE: number; + HAVE_FUTURE_DATA: number; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + HAVE_METADATA: number; + HAVE_CURRENT_DATA: number; + HAVE_NOTHING: number; + NETWORK_NO_SOURCE: number; + HAVE_ENOUGH_DATA: number; + NETWORK_EMPTY: number; + NETWORK_LOADING: number; + NETWORK_IDLE: number; + HAVE_FUTURE_DATA: number; +} + +interface ElementCSSInlineStyle { + runtimeStyle: MSStyleCSSProperties; + currentStyle: MSCurrentStyleCSSProperties; + doScroll(component?: any): void; + componentFromPoint(x: number, y: number): string; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface MSMimeTypesCollection { + length: number; +} +declare var MSMimeTypesCollection: { + prototype: MSMimeTypesCollection; + new(): MSMimeTypesCollection; +} + +interface StyleSheet { + disabled: boolean; + ownerNode: Node; + parentStyleSheet: StyleSheet; + href: string; + media: MediaList; + type: string; + title: string; +} +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + startOffset: SVGAnimatedLength; + method: SVGAnimatedEnumeration; + spacing: SVGAnimatedEnumeration; + TEXTPATH_SPACINGTYPE_EXACT: number; + TEXTPATH_METHODTYPE_STRETCH: number; + TEXTPATH_SPACINGTYPE_AUTO: number; + TEXTPATH_SPACINGTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_ALIGN: number; +} +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + TEXTPATH_SPACINGTYPE_EXACT: number; + TEXTPATH_METHODTYPE_STRETCH: number; + TEXTPATH_SPACINGTYPE_AUTO: number; + TEXTPATH_SPACINGTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_ALIGN: number; +} + +interface HTMLDTElement extends HTMLElement { + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDTElement: { + prototype: HTMLDTElement; + new(): HTMLDTElement; +} + +interface NodeList { + length: number; + item(index: number): Node; + [index: number]: Node; +} +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface PerformanceMeasure extends PerformanceEntry { +} +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGExternalResourcesRequired, SVGURIReference { + spreadMethod: SVGAnimatedEnumeration; + gradientTransform: SVGAnimatedTransformList; + gradientUnits: SVGAnimatedEnumeration; + SVG_SPREADMETHOD_REFLECT: number; + SVG_SPREADMETHOD_PAD: number; + SVG_SPREADMETHOD_UNKNOWN: number; + SVG_SPREADMETHOD_REPEAT: number; +} +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + SVG_SPREADMETHOD_REFLECT: number; + SVG_SPREADMETHOD_PAD: number; + SVG_SPREADMETHOD_UNKNOWN: number; + SVG_SPREADMETHOD_REPEAT: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; + SHOW_ENTITY_REFERENCE: number; + SHOW_NOTATION: number; + SHOW_ENTITY: number; + SHOW_DOCUMENT: number; + SHOW_PROCESSING_INSTRUCTION: number; + FILTER_REJECT: number; + SHOW_CDATA_SECTION: number; + FILTER_ACCEPT: number; + SHOW_ALL: number; + SHOW_DOCUMENT_TYPE: number; + SHOW_TEXT: number; + SHOW_ELEMENT: number; + SHOW_COMMENT: number; + FILTER_SKIP: number; + SHOW_ATTRIBUTE: number; + SHOW_DOCUMENT_FRAGMENT: number; +} +declare var NodeFilter: NodeFilter; + +interface SVGNumberList { + numberOfItems: number; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; + getItem(index: number): SVGNumber; + clear(): void; + appendItem(newItem: SVGNumber): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + removeItem(index: number): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; +} +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface MediaError { + code: number; + msExtendedCode: number; + MEDIA_ERR_ABORTED: number; + MEDIA_ERR_NETWORK: number; + MEDIA_ERR_SRC_NOT_SUPPORTED: number; + MEDIA_ERR_DECODE: number; + MS_MEDIA_ERR_ENCRYPTED: number; +} +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + MEDIA_ERR_ABORTED: number; + MEDIA_ERR_NETWORK: number; + MEDIA_ERR_SRC_NOT_SUPPORTED: number; + MEDIA_ERR_DECODE: number; + MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLBGSoundElement extends HTMLElement { + /** + * Sets or gets the value indicating how the volume of the background sound is divided between the left speaker and the right speaker. + */ + balance: any; + /** + * Sets or gets the volume setting for the sound. + */ + volume: any; + /** + * Sets or gets the URL of a sound to play. + */ + src: string; + /** + * Sets or retrieves the number of times a sound or video clip will loop when activated. + */ + loop: number; +} +declare var HTMLBGSoundElement: { + prototype: HTMLBGSoundElement; + new(): HTMLBGSoundElement; +} + +interface Comment extends CharacterData { + text: string; +} +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + redirectStart: number; + redirectEnd: number; + domainLookupEnd: number; + responseStart: number; + domainLookupStart: number; + fetchStart: number; + requestStart: number; + connectEnd: number; + connectStart: number; + initiatorType: string; + responseEnd: number; +} +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface CanvasPattern { +} +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; +} +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the contained object. + */ + object: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the class identifier for the object. + */ + classid: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + declare: boolean; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + BaseHref: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + readyState: number; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Retrieves the palette used for the embedded document. + */ + palette: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + hidden: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + pluginspage: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + readyState: string; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; +} +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface StorageEvent extends Event { + oldValue: any; + newValue: any; + url: string; + storageArea: Storage; + key: string; + initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; +} +declare var StorageEvent: { + prototype: StorageEvent; + new(): StorageEvent; +} + +interface CharacterData extends Node { + length: number; + data: string; + deleteData(offset: number, count: number): void; + replaceData(offset: number, count: number, arg: string): void; + appendData(arg: string): void; + insertData(offset: number, arg: string): void; + substringData(offset: number, count: number): string; +} +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface HTMLOptGroupElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + index: number; + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; +} +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLIsIndexElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + prompt: string; +} +declare var HTMLIsIndexElement: { + prototype: HTMLIsIndexElement; + new(): HTMLIsIndexElement; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface DOMException { + code: number; + message: string; + name: string; + toString(): string; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} + +interface SVGAnimatedBoolean { + animVal: boolean; + baseVal: boolean; +} +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface MSCompatibleInfoCollection { + length: number; + item(index: number): MSCompatibleInfo; +} +declare var MSCompatibleInfoCollection: { + prototype: MSCompatibleInfoCollection; + new(): MSCompatibleInfoCollection; +} + +interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + SVG_PRESERVEASPECTRATIO_NONE: number; + SVG_PRESERVEASPECTRATIO_XMINYMID: number; + SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + SVG_MEETORSLICE_UNKNOWN: number; + SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + SVG_MEETORSLICE_MEET: number; + SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + SVG_MEETORSLICE_SLICE: number; + SVG_PRESERVEASPECTRATIO_UNKNOWN: number; +} +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + SVG_PRESERVEASPECTRATIO_NONE: number; + SVG_PRESERVEASPECTRATIO_XMINYMID: number; + SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + SVG_MEETORSLICE_UNKNOWN: number; + SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + SVG_MEETORSLICE_MEET: number; + SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + SVG_MEETORSLICE_SLICE: number; + SVG_PRESERVEASPECTRATIO_UNKNOWN: number; +} + +interface Attr extends Node { + expando: boolean; + specified: boolean; + ownerElement: Element; + value: string; + name: string; +} +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface PerformanceNavigation { + redirectCount: number; + type: number; + toJSON(): any; + TYPE_RELOAD: number; + TYPE_RESERVED: number; + TYPE_BACK_FORWARD: number; + TYPE_NAVIGATE: number; +} +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + TYPE_RELOAD: number; + TYPE_RESERVED: number; + TYPE_BACK_FORWARD: number; + TYPE_NAVIGATE: number; +} + +interface SVGStopElement extends SVGElement, SVGStylable { + offset: SVGAnimatedNumber; +} +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface PositionCallback { + (position: Position): void; +} + +interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { +} +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGElementInstanceList { + length: number; + item(index: number): SVGElementInstance; +} +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface CSSRuleList { + length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface MSDataBindingRecordSetExtensions { + recordset: any; + namedRecordset(dataMember: string, hierarchy?: any): any; +} + +interface LinkStyle { + styleSheet: StyleSheet; + sheet: StyleSheet; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the width of the video element. + */ + width: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + videoWidth: number; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + videoHeight: number; + /** + * Gets or sets the height of the video element. + */ + height: number; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + msIsStereo3D: boolean; + msStereo3DPackingMode: string; + onMSVideoOptimalLayoutChanged: (ev: any) => any; + onMSVideoFrameStepCompleted: (ev: any) => any; + msStereo3DRenderMode: string; + msIsLayoutOptimalForPlayback: boolean; + msHorizontalMirror: boolean; + onMSVideoFormatChanged: (ev: any) => any; + msZoom: boolean; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + msFrameStep(forward: boolean): void; + getVideoPlaybackQuality(): VideoPlaybackQuality; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFrameStepCompleted", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFormatChanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface ClientRectList { + length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface SVGMaskElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + maskUnits: SVGAnimatedEnumeration; + maskContentUnits: SVGAnimatedEnumeration; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface External { +} +declare var External: { + prototype: External; + new(): External; +} + +interface MSGestureEvent extends UIEvent { + offsetY: number; + translationY: number; + velocityExpansion: number; + velocityY: number; + velocityAngular: number; + translationX: number; + velocityX: number; + hwTimestamp: number; + offsetX: number; + screenX: number; + rotation: number; + expansion: number; + clientY: number; + screenY: number; + scale: number; + gestureObject: any; + clientX: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + MSGESTURE_FLAG_BEGIN: number; + MSGESTURE_FLAG_END: number; + MSGESTURE_FLAG_CANCEL: number; + MSGESTURE_FLAG_INERTIA: number; + MSGESTURE_FLAG_NONE: number; +} +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + MSGESTURE_FLAG_BEGIN: number; + MSGESTURE_FLAG_END: number; + MSGESTURE_FLAG_CANCEL: number; + MSGESTURE_FLAG_INERTIA: number; + MSGESTURE_FLAG_NONE: number; +} + +interface ErrorEvent extends Event { + colno: number; + filename: string; + error: any; + lineno: number; + message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + filterResX: SVGAnimatedInteger; + filterUnits: SVGAnimatedEnumeration; + primitiveUnits: SVGAnimatedEnumeration; + x: SVGAnimatedLength; + height: SVGAnimatedLength; + filterResY: SVGAnimatedInteger; + setFilterRes(filterResX: number, filterResY: number): void; +} +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface TrackEvent extends Event { + track: any; +} +declare var TrackEvent: { + prototype: TrackEvent; + new(): TrackEvent; +} + +interface SVGFEMergeNodeElement extends SVGElement { + in1: SVGAnimatedString; +} +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { +} +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface TextTrackCue extends EventTarget { + onenter: (ev: Event) => any; + track: TextTrack; + endTime: number; + text: string; + pauseOnExit: boolean; + id: string; + startTime: number; + onexit: (ev: Event) => any; + getCueAsHTML(): DocumentFragment; + addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface MSStreamReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; +} +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface DOMTokenList { + length: number; + contains(token: string): boolean; + remove(token: string): void; + toggle(token: string): boolean; + add(token: string): void; + item(index: number): string; + [index: number]: string; + toString(): string; +} +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; +} +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in2: SVGAnimatedString; + mode: SVGAnimatedEnumeration; + in1: SVGAnimatedString; + SVG_FEBLEND_MODE_DARKEN: number; + SVG_FEBLEND_MODE_UNKNOWN: number; + SVG_FEBLEND_MODE_MULTIPLY: number; + SVG_FEBLEND_MODE_NORMAL: number; + SVG_FEBLEND_MODE_SCREEN: number; + SVG_FEBLEND_MODE_LIGHTEN: number; +} +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + SVG_FEBLEND_MODE_DARKEN: number; + SVG_FEBLEND_MODE_UNKNOWN: number; + SVG_FEBLEND_MODE_MULTIPLY: number; + SVG_FEBLEND_MODE_NORMAL: number; + SVG_FEBLEND_MODE_SCREEN: number; + SVG_FEBLEND_MODE_LIGHTEN: number; +} + +interface MessageChannel { + port2: MessagePort; + port1: MessagePort; +} +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { +} +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface TransitionEvent extends Event { + propertyName: string; + elapsedTime: number; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} +declare var TransitionEvent: { + prototype: TransitionEvent; + new(): TransitionEvent; +} + +interface MediaQueryList { + matches: boolean; + media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface DOMError { + name: string; + toString(): string; +} +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface CloseEvent extends Event { + wasClean: boolean; + reason: string; + code: number; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface WebSocket extends EventTarget { + protocol: string; + readyState: number; + bufferedAmount: number; + onopen: (ev: Event) => any; + extensions: string; + onmessage: (ev: MessageEvent) => any; + onclose: (ev: CloseEvent) => any; + onerror: (ev: ErrorEvent) => any; + binaryType: string; + url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; + addEventListener(type: "open", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string): WebSocket; + new(url: string, protocols?: string[]): WebSocket; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; +} + +interface SVGFEPointLightElement extends SVGElement { + y: SVGAnimatedNumber; + x: SVGAnimatedNumber; + z: SVGAnimatedNumber; +} +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface ProgressEvent extends Event { + loaded: number; + lengthComputable: boolean; + total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} +declare var ProgressEvent: { + prototype: ProgressEvent; + new(): ProgressEvent; +} + +interface IDBObjectStore { + indexNames: DOMStringList; + name: string; + transaction: IDBTransaction; + keyPath: string; + count(key?: any): IDBRequest; + add(value: any, key?: any): IDBRequest; + clear(): IDBRequest; + createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + put(value: any, key?: any): IDBRequest; + openCursor(range?: any, direction?: string): IDBRequest; + deleteIndex(indexName: string): void; + index(name: string): IDBIndex; + get(key: any): IDBRequest; + delete(key: any): IDBRequest; +} +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + stdDeviationX: SVGAnimatedNumber; + in1: SVGAnimatedString; + stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; +} +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + x: SVGAnimatedLength; + height: SVGAnimatedLength; + result: SVGAnimatedString; +} + +interface IDBVersionChangeEvent extends Event { + newVersion: number; + oldVersion: number; +} +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IDBIndex { + unique: boolean; + name: string; + keyPath: string; + objectStore: IDBObjectStore; + count(key?: any): IDBRequest; + getKey(key: any): IDBRequest; + openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + get(key: any): IDBRequest; + openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; +} +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface FileList { + length: number; + item(index: number): File; + [index: number]: File; +} +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface IDBCursor { + source: any; + direction: string; + key: any; + primaryKey: any; + advance(count: number): void; + delete(): IDBRequest; + continue(key?: any): void; + update(value: any): IDBRequest; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + kernelUnitLengthY: SVGAnimatedNumber; + surfaceScale: SVGAnimatedNumber; + specularExponent: SVGAnimatedNumber; + in1: SVGAnimatedString; + kernelUnitLengthX: SVGAnimatedNumber; + specularConstant: SVGAnimatedNumber; +} +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface File extends Blob { + lastModifiedDate: any; + name: string; +} +declare var File: { + prototype: File; + new(): File; +} + +interface URL { + revokeObjectURL(url: string): void; + createObjectURL(object: any, options?: ObjectURLOptions): string; +} +declare var URL: URL; + +interface IDBCursorWithValue extends IDBCursor { + value: any; +} +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface XMLHttpRequestEventTarget extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + ontimeout: (ev: Event) => any; + onabort: (ev: UIEvent) => any; + onloadstart: (ev: Event) => any; + onloadend: (ev: ProgressEvent) => any; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequestEventTarget: { + prototype: XMLHttpRequestEventTarget; + new(): XMLHttpRequestEventTarget; +} + +interface IDBEnvironment { + msIndexedDB: IDBFactory; + indexedDB: IDBFactory; +} + +interface AudioTrackList extends EventTarget { + length: number; + onchange: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + onremovetrack: (ev: any /*PluginArray*/) => any; + getTrackById(id: string): AudioTrack; + item(index: number): AudioTrack; + [index: number]: AudioTrack; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: any /*PluginArray*/) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface MSBaseReader extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + readyState: number; + onabort: (ev: UIEvent) => any; + onloadend: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onloadstart: (ev: Event) => any; + result: any; + abort(): void; + LOADING: number; + EMPTY: number; + DONE: number; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + operator: SVGAnimatedEnumeration; + radiusX: SVGAnimatedNumber; + radiusY: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + SVG_MORPHOLOGY_OPERATOR_ERODE: number; + SVG_MORPHOLOGY_OPERATOR_DILATE: number; +} +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + SVG_MORPHOLOGY_OPERATOR_ERODE: number; + SVG_MORPHOLOGY_OPERATOR_DILATE: number; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface WindowTimersExtension { + msSetImmediate(expression: any, ...args: any[]): number; + clearImmediate(handle: number): void; + msClearImmediate(handle: number): void; + setImmediate(expression: any, ...args: any[]): number; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in2: SVGAnimatedString; + xChannelSelector: SVGAnimatedEnumeration; + yChannelSelector: SVGAnimatedEnumeration; + scale: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_CHANNEL_B: number; + SVG_CHANNEL_R: number; + SVG_CHANNEL_G: number; + SVG_CHANNEL_UNKNOWN: number; + SVG_CHANNEL_A: number; +} +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + SVG_CHANNEL_B: number; + SVG_CHANNEL_R: number; + SVG_CHANNEL_G: number; + SVG_CHANNEL_UNKNOWN: number; + SVG_CHANNEL_A: number; +} + +interface AnimationEvent extends Event { + animationName: string; + elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} +declare var AnimationEvent: { + prototype: AnimationEvent; + new(): AnimationEvent; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + tableValues: SVGAnimatedNumberList; + slope: SVGAnimatedNumber; + type: SVGAnimatedEnumeration; + exponent: SVGAnimatedNumber; + amplitude: SVGAnimatedNumber; + intercept: SVGAnimatedNumber; + offset: SVGAnimatedNumber; + SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; +} +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; +} + +interface MSRangeCollection { + length: number; + item(index: number): Range; + [index: number]: Range; +} +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface SVGFEDistantLightElement extends SVGElement { + azimuth: SVGAnimatedNumber; + elevation: SVGAnimatedNumber; +} +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface IDBKeyRange { + upper: any; + upperOpen: boolean; + lower: any; + lowerOpen: boolean; +} +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + lowerBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(bound: any, open?: boolean): IDBKeyRange; +} + +interface WindowConsole { + console: Console; +} + +interface IDBTransaction extends EventTarget { + oncomplete: (ev: Event) => any; + db: IDBDatabase; + mode: string; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: UIEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; +} + +interface AudioTrack { + kind: string; + language: string; + id: string; + label: string; + enabled: boolean; + sourceBuffer: SourceBuffer; +} +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + orderY: SVGAnimatedInteger; + kernelUnitLengthY: SVGAnimatedNumber; + orderX: SVGAnimatedInteger; + preserveAlpha: SVGAnimatedBoolean; + kernelMatrix: SVGAnimatedNumberList; + edgeMode: SVGAnimatedEnumeration; + kernelUnitLengthX: SVGAnimatedNumber; + bias: SVGAnimatedNumber; + targetX: SVGAnimatedInteger; + targetY: SVGAnimatedInteger; + divisor: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_EDGEMODE_WRAP: number; + SVG_EDGEMODE_DUPLICATE: number; + SVG_EDGEMODE_UNKNOWN: number; + SVG_EDGEMODE_NONE: number; +} +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + SVG_EDGEMODE_WRAP: number; + SVG_EDGEMODE_DUPLICATE: number; + SVG_EDGEMODE_UNKNOWN: number; + SVG_EDGEMODE_NONE: number; +} + +interface TextTrackCueList { + length: number; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; + getCueById(id: string): TextTrackCue; +} +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface CSSKeyframesRule extends CSSRule { + name: string; + cssRules: CSSRuleList; + findRule(rule: string): CSSKeyframeRule; + deleteRule(rule: string): void; + appendRule(rule: string): void; +} +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + baseFrequencyX: SVGAnimatedNumber; + numOctaves: SVGAnimatedInteger; + type: SVGAnimatedEnumeration; + baseFrequencyY: SVGAnimatedNumber; + stitchTiles: SVGAnimatedEnumeration; + seed: SVGAnimatedNumber; + SVG_STITCHTYPE_UNKNOWN: number; + SVG_STITCHTYPE_NOSTITCH: number; + SVG_TURBULENCE_TYPE_UNKNOWN: number; + SVG_TURBULENCE_TYPE_TURBULENCE: number; + SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + SVG_STITCHTYPE_STITCH: number; +} +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + SVG_STITCHTYPE_UNKNOWN: number; + SVG_STITCHTYPE_NOSTITCH: number; + SVG_TURBULENCE_TYPE_UNKNOWN: number; + SVG_TURBULENCE_TYPE_TURBULENCE: number; + SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + SVG_STITCHTYPE_STITCH: number; +} + +interface TextTrackList extends EventTarget { + length: number; + onaddtrack: (ev: TrackEvent) => any; + item(index: number): TextTrack; + [index: number]: TextTrack; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; + type: SVGAnimatedEnumeration; + values: SVGAnimatedNumberList; + SVG_FECOLORMATRIX_TYPE_SATURATE: number; + SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + SVG_FECOLORMATRIX_TYPE_MATRIX: number; + SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; +} +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + SVG_FECOLORMATRIX_TYPE_SATURATE: number; + SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + SVG_FECOLORMATRIX_TYPE_MATRIX: number; + SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; +} + +interface SVGFESpotLightElement extends SVGElement { + pointsAtY: SVGAnimatedNumber; + y: SVGAnimatedNumber; + limitingConeAngle: SVGAnimatedNumber; + specularExponent: SVGAnimatedNumber; + x: SVGAnimatedNumber; + pointsAtZ: SVGAnimatedNumber; + z: SVGAnimatedNumber; + pointsAtX: SVGAnimatedNumber; +} +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface WindowBase64 { + btoa(rawString: string): string; + atob(encodedString: string): string; +} + +interface IDBDatabase extends EventTarget { + version: string; + name: string; + objectStoreNames: DOMStringList; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: UIEvent) => any; + createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + close(): void; + transaction(storeNames: any, mode?: string): IDBTransaction; + deleteObjectStore(name: string): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface DOMStringList { + length: number; + contains(str: string): boolean; + item(index: number): string; + [index: number]: string; +} +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface IDBOpenDBRequest extends IDBRequest { + onupgradeneeded: (ev: IDBVersionChangeEvent) => any; + onblocked: (ev: Event) => any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blocked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + position: number; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface MSLaunchUriCallback { + (): void; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + dy: SVGAnimatedNumber; + in1: SVGAnimatedString; + dx: SVGAnimatedNumber; +} +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface MSUnsafeFunctionCallback { + (): any; +} + +interface TextTrack extends EventTarget { + language: string; + mode: any; + readyState: number; + activeCues: TextTrackCueList; + cues: TextTrackCueList; + oncuechange: (ev: Event) => any; + kind: string; + onload: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + label: string; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + ERROR: number; + SHOWING: number; + LOADING: number; + LOADED: number; + NONE: number; + HIDDEN: number; + DISABLED: number; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + ERROR: number; + SHOWING: number; + LOADING: number; + LOADED: number; + NONE: number; + HIDDEN: number; + DISABLED: number; +} + +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} + +interface IDBRequest extends EventTarget { + source: any; + onsuccess: (ev: Event) => any; + error: DOMError; + transaction: IDBTransaction; + onerror: (ev: ErrorEvent) => any; + readyState: string; + result: any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface MessagePort extends EventTarget { + onmessage: (ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface FileReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; +} +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface ApplicationCache extends EventTarget { + status: number; + ondownloading: (ev: Event) => any; + onprogress: (ev: ProgressEvent) => any; + onupdateready: (ev: Event) => any; + oncached: (ev: Event) => any; + onobsolete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + onchecking: (ev: Event) => any; + onnoupdate: (ev: Event) => any; + swapCache(): void; + abort(): void; + update(): void; + CHECKING: number; + UNCACHED: number; + UPDATEREADY: number; + DOWNLOADING: number; + IDLE: number; + OBSOLETE: number; + addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "updateready", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "obsolete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "noupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + CHECKING: number; + UNCACHED: number; + UPDATEREADY: number; + DOWNLOADING: number; + IDLE: number; + OBSOLETE: number; +} + +interface FrameRequestCallback { + (time: number): void; +} + +interface PopStateEvent extends Event { + state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} +declare var PopStateEvent: { + prototype: PopStateEvent; + new(): PopStateEvent; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + style: CSSStyleDeclaration; +} +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSStream { + type: string; + msDetachStream(): any; + msClose(): void; +} +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface IDBFactory { + open(name: string, version?: number): IDBOpenDBRequest; + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; +} +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface MSPointerEvent extends MouseEvent { + width: number; + rotation: number; + pressure: number; + pointerType: any; + isPrimary: boolean; + tiltY: number; + height: number; + intermediatePoints: any; + currentPoint: any; + tiltX: number; + hwTimestamp: number; + pointerId: number; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + MSPOINTER_TYPE_PEN: number; + MSPOINTER_TYPE_MOUSE: number; + MSPOINTER_TYPE_TOUCH: number; +} +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(): MSPointerEvent; + MSPOINTER_TYPE_PEN: number; + MSPOINTER_TYPE_MOUSE: number; + MSPOINTER_TYPE_TOUCH: number; +} + +interface MSManipulationEvent extends UIEvent { + lastState: number; + currentState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + MS_MANIPULATION_STATE_STOPPED: number; + MS_MANIPULATION_STATE_ACTIVE: number; + MS_MANIPULATION_STATE_INERTIA: number; + MS_MANIPULATION_STATE_SELECTING: number; + MS_MANIPULATION_STATE_COMMITTED: number; + MS_MANIPULATION_STATE_PRESELECT: number; + MS_MANIPULATION_STATE_DRAGGING: number; + MS_MANIPULATION_STATE_CANCELLED: number; +} +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + MS_MANIPULATION_STATE_STOPPED: number; + MS_MANIPULATION_STATE_ACTIVE: number; + MS_MANIPULATION_STATE_INERTIA: number; + MS_MANIPULATION_STATE_SELECTING: number; + MS_MANIPULATION_STATE_COMMITTED: number; + MS_MANIPULATION_STATE_PRESELECT: number; + MS_MANIPULATION_STATE_DRAGGING: number; + MS_MANIPULATION_STATE_CANCELLED: number; +} + +interface FormData { + append(name: any, value: any, blobName?: string): void; +} +declare var FormData: { + prototype: FormData; + new(): FormData; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollection; +} +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface SVGFEImageElement extends SVGElement, SVGLangSpace, SVGFilterPrimitiveStandardAttributes, SVGURIReference, SVGExternalResourcesRequired { + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; +} +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface AbstractWorker extends EventTarget { + onerror: (ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + operator: SVGAnimatedEnumeration; + in2: SVGAnimatedString; + k2: SVGAnimatedNumber; + k1: SVGAnimatedNumber; + k3: SVGAnimatedNumber; + in1: SVGAnimatedString; + k4: SVGAnimatedNumber; + SVG_FECOMPOSITE_OPERATOR_OUT: number; + SVG_FECOMPOSITE_OPERATOR_OVER: number; + SVG_FECOMPOSITE_OPERATOR_XOR: number; + SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + SVG_FECOMPOSITE_OPERATOR_IN: number; + SVG_FECOMPOSITE_OPERATOR_ATOP: number; +} +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + SVG_FECOMPOSITE_OPERATOR_OUT: number; + SVG_FECOMPOSITE_OPERATOR_OVER: number; + SVG_FECOMPOSITE_OPERATOR_XOR: number; + SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + SVG_FECOMPOSITE_OPERATOR_IN: number; + SVG_FECOMPOSITE_OPERATOR_ATOP: number; +} + +interface ValidityState { + customError: boolean; + valueMissing: boolean; + stepMismatch: boolean; + rangeUnderflow: boolean; + rangeOverflow: boolean; + typeMismatch: boolean; + patternMismatch: boolean; + tooLong: boolean; + valid: boolean; +} +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface HTMLTrackElement extends HTMLElement { + kind: string; + src: string; + srclang: string; + track: TextTrack; + label: string; + default: boolean; + readyState: number; + ERROR: number; + LOADING: number; + LOADED: number; + NONE: number; +} +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + ERROR: number; + LOADING: number; + LOADED: number; + NONE: number; +} + +interface MSApp { + createFileFromStorageFile(storageFile: any): File; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + terminateApp(exceptionObject: any): void; + createDataPackage(object: any): any; + execUnsafeLocalFunction(unsafeFunction: MSUnsafeFunctionCallback): any; + getHtmlPrintDocumentSource(htmlDoc: any): any; + addPublicLocalApplicationUri(uri: string): void; + createDataPackageFromSelection(): any; + getViewOpener(): MSAppView; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + createNewView(uri: string): MSAppView; + getCurrentPriority(): string; + NORMAL: string; + HIGH: string; + IDLE: string; + CURRENT: string; +} +declare var MSApp: MSApp; + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; +} +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + kernelUnitLengthY: SVGAnimatedNumber; + surfaceScale: SVGAnimatedNumber; + in1: SVGAnimatedString; + kernelUnitLengthX: SVGAnimatedNumber; + diffuseConstant: SVGAnimatedNumber; +} +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface MSCSSMatrix { + m24: number; + m34: number; + a: number; + d: number; + m32: number; + m41: number; + m11: number; + f: number; + e: number; + m23: number; + m14: number; + m33: number; + m22: number; + m21: number; + c: number; + m12: number; + b: number; + m42: number; + m31: number; + m43: number; + m13: number; + m44: number; + multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; + skewY(angle: number): MSCSSMatrix; + setMatrixValue(value: string): void; + inverse(): MSCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; + toString(): string; + rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; + translate(x: number, y: number, z?: number): MSCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; + skewX(angle: number): MSCSSMatrix; +} +declare var MSCSSMatrix: { + prototype: MSCSSMatrix; + new(text?: string): MSCSSMatrix; +} + +interface Worker extends AbstractWorker { + onmessage: (ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} + +interface MSGraphicsTrust { + status: string; + constrictionActive: boolean; +} +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface SubtleCrypto { + unwrapKey(wrappedKey: ArrayBufferView, keyAlgorithm: any, keyEncryptionKey: Key, extractable?: boolean, keyUsages?: string[]): KeyOperation; + encrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; + importKey(format: string, keyData: ArrayBufferView, algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + wrapKey(key: Key, keyEncryptionKey: Key, keyWrappingAlgorithm: any): KeyOperation; + verify(algorithm: any, key: Key, signature: ArrayBufferView, buffer?: ArrayBufferView): CryptoOperation; + deriveKey(algorithm: any, baseKey: Key, derivedKeyType: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + digest(algorithm: any, buffer?: ArrayBufferView): CryptoOperation; + exportKey(format: string, key: Key): KeyOperation; + generateKey(algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + sign(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; + decrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; +} +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface Crypto extends RandomSource { + subtle: SubtleCrypto; +} +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface VideoPlaybackQuality { + totalFrameDelay: number; + creationTime: number; + totalVideoFrames: number; + droppedVideoFrames: number; +} +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface GlobalEventHandlers { + onpointerenter: (ev: PointerEvent) => any; + onpointerout: (ev: PointerEvent) => any; + onpointerdown: (ev: PointerEvent) => any; + onpointerup: (ev: PointerEvent) => any; + onpointercancel: (ev: PointerEvent) => any; + onpointerover: (ev: PointerEvent) => any; + onpointermove: (ev: PointerEvent) => any; + onpointerleave: (ev: PointerEvent) => any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface Key { + algorithm: Algorithm; + type: string; + extractable: boolean; + keyUsage: string[]; +} +declare var Key: { + prototype: Key; + new(): Key; +} + +interface DeviceAcceleration { + y: number; + x: number; + z: number; +} +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface HTMLAllCollection extends HTMLCollection { + namedItem(name: string): Element; + // [name: string]: Element; +} +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface AesGcmEncryptResult { + ciphertext: ArrayBuffer; + tag: ArrayBuffer; +} +declare var AesGcmEncryptResult: { + prototype: AesGcmEncryptResult; + new(): AesGcmEncryptResult; +} + +interface NavigationCompletedEvent extends NavigationEvent { + webErrorStatus: number; + isSuccess: boolean; +} +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface MutationRecord { + oldValue: string; + previousSibling: Node; + addedNodes: NodeList; + attributeName: string; + removedNodes: NodeList; + target: Node; + nextSibling: Node; + attributeNamespace: string; + type: string; +} +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface MimeTypeArray { + length: number; + item(index: number): Plugin; + [index: number]: Plugin; + namedItem(type: string): Plugin; + // [type: string]: Plugin; +} +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface KeyOperation extends EventTarget { + oncomplete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + result: any; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var KeyOperation: { + prototype: KeyOperation; + new(): KeyOperation; +} + +interface DOMStringMap { +} +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DeviceOrientationEvent extends Event { + gamma: number; + alpha: number; + absolute: boolean; + beta: number; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; +} +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(): DeviceOrientationEvent; +} + +interface MSMediaKeys { + keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; +} + +interface MSMediaKeyMessageEvent extends Event { + destinationURL: string; + message: Uint8Array; +} +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSHTMLWebViewElement extends HTMLElement { + documentTitle: string; + width: number; + src: string; + canGoForward: boolean; + height: number; + canGoBack: boolean; + navigateWithHttpRequestMessage(requestMessage: any): void; + goBack(): void; + navigate(uri: string): void; + stop(): void; + navigateToString(contents: string): void; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + refresh(): void; + goForward(): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; +} +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface NavigationEvent extends Event { + uri: string; +} +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SourceBuffer extends EventTarget { + updating: boolean; + appendWindowStart: number; + appendWindowEnd: number; + buffered: TimeRanges; + timestampOffset: number; + audioTracks: AudioTrackList; + appendBuffer(data: ArrayBuffer): void; + remove(start: number, end: number): void; + abort(): void; + appendStream(stream: MSStream, maxSize?: number): void; +} +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface MSInputMethodContext extends EventTarget { + oncandidatewindowshow: (ev: any) => any; + target: HTMLElement; + compositionStartOffset: number; + oncandidatewindowhide: (ev: any) => any; + oncandidatewindowupdate: (ev: any) => any; + compositionEndOffset: number; + getCompositionAlternatives(): string[]; + getCandidateWindowClientRect(): ClientRect; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: "candidatewindowshow", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "candidatewindowhide", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "candidatewindowupdate", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface DeviceRotationRate { + gamma: number; + alpha: number; + beta: number; +} +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface PluginArray { + length: number; + refresh(reload?: boolean): void; + item(index: number): Plugin; + [index: number]: Plugin; + namedItem(name: string): Plugin; + // [name: string]: Plugin; +} +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface MSMediaKeyError { + systemCode: number; + code: number; + MS_MEDIA_KEYERR_SERVICE: number; + MS_MEDIA_KEYERR_HARDWARECHANGE: number; + MS_MEDIA_KEYERR_OUTPUT: number; + MS_MEDIA_KEYERR_DOMAIN: number; + MS_MEDIA_KEYERR_UNKNOWN: number; + MS_MEDIA_KEYERR_CLIENT: number; +} +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + MS_MEDIA_KEYERR_SERVICE: number; + MS_MEDIA_KEYERR_HARDWARECHANGE: number; + MS_MEDIA_KEYERR_OUTPUT: number; + MS_MEDIA_KEYERR_DOMAIN: number; + MS_MEDIA_KEYERR_UNKNOWN: number; + MS_MEDIA_KEYERR_CLIENT: number; +} + +interface Plugin { + length: number; + filename: string; + version: string; + name: string; + description: string; + item(index: number): MimeType; + [index: number]: MimeType; + namedItem(type: string): MimeType; + // [type: string]: MimeType; +} +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface MediaSource extends EventTarget { + sourceBuffers: SourceBufferList; + duration: number; + readyState: string; + activeSourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: string): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface SourceBufferList extends EventTarget { + length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface XMLDocument extends Document { +} +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface DeviceMotionEvent extends Event { + rotationRate: DeviceRotationRate; + acceleration: DeviceAcceleration; + interval: number; + accelerationIncludingGravity: DeviceAcceleration; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; +} +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(): DeviceMotionEvent; +} + +interface MimeType { + enabledPlugin: Plugin; + suffixes: string; + type: string; + description: string; +} +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface PointerEvent extends MouseEvent { + width: number; + rotation: number; + pressure: number; + pointerType: any; + isPrimary: boolean; + tiltY: number; + height: number; + intermediatePoints: any; + currentPoint: any; + tiltX: number; + hwTimestamp: number; + pointerId: number; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; +} +declare var PointerEvent: { + prototype: PointerEvent; + new(): PointerEvent; +} + +interface MSDocumentExtensions { + captureEvents(): void; + releaseEvents(): void; +} + +interface MutationObserver { + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; + disconnect(): void; +} +declare var MutationObserver: { + prototype: MutationObserver; + new (callback: (arr: MutationRecord[], observer: MutationObserver)=>any): MutationObserver; +} + +interface MSWebViewAsyncOperation extends EventTarget { + target: MSHTMLWebViewElement; + oncomplete: (ev: Event) => any; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + readyState: number; + type: number; + result: any; + start(): void; + ERROR: number; + TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + TYPE_INVOKE_SCRIPT: number; + COMPLETED: number; + TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + STARTED: number; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + ERROR: number; + TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + TYPE_INVOKE_SCRIPT: number; + COMPLETED: number; + TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + STARTED: number; +} + +interface ScriptNotifyEvent extends Event { + value: string; + callingUri: string; +} +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + redirectStart: number; + domainLookupEnd: number; + responseStart: number; + domComplete: number; + domainLookupStart: number; + loadEventStart: number; + unloadEventEnd: number; + fetchStart: number; + requestStart: number; + domInteractive: number; + navigationStart: number; + connectEnd: number; + loadEventEnd: number; + connectStart: number; + responseEnd: number; + domLoading: number; + redirectEnd: number; + redirectCount: number; + unloadEventStart: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + type: string; +} +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface MSMediaKeyNeededEvent extends Event { + initData: Uint8Array; +} +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface LongRunningScriptDetectedEvent extends Event { + stopPageScriptExecution: boolean; + executionTime: number; +} +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSAppView { + viewId: number; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; +} +declare var MSAppView: { + prototype: MSAppView; + new(): MSAppView; +} + +interface PerfWidgetExternal { + maxCpuSpeed: number; + independentRenderingEnabled: boolean; + irDisablingContentString: string; + irStatusAvailable: boolean; + performanceCounter: number; + averagePaintTime: number; + activeNetworkRequestCount: number; + paintRequestsPerSecond: number; + extraInformationEnabled: boolean; + performanceCounterFrequency: number; + averageFrameTime: number; + repositionWindow(x: number, y: number): void; + getRecentMemoryUsage(last: number): any; + getMemoryUsage(): number; + resizeWindow(width: number, height: number): void; + getProcessCpuUsage(): number; + removeEventListener(eventType: string, callback: (ev: any) => any): void; + getRecentCpuUsage(last: number): any; + addEventListener(eventType: string, callback: (ev: any) => any): void; + getRecentFrames(last: number): any; + getRecentPaintRequests(last: number): any; +} +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface PageTransitionEvent extends Event { + persisted: boolean; +} +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} + +interface HTMLDocument extends Document { +} +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface KeyPair { + privateKey: Key; + publicKey: Key; +} +declare var KeyPair: { + prototype: KeyPair; + new(): KeyPair; +} + +interface MSMediaKeySession extends EventTarget { + sessionId: string; + error: MSMediaKeyError; + keySystem: string; + close(): void; + update(key: Uint8Array): void; +} +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEvent { + referrer: string; +} +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface CryptoOperation extends EventTarget { + algorithm: Algorithm; + oncomplete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: UIEvent) => any; + key: Key; + result: any; + abort(): void; + finish(): void; + process(buffer: ArrayBufferView): void; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var CryptoOperation: { + prototype: CryptoOperation; + new(): CryptoOperation; +} + +interface WebGLTexture extends WebGLObject { +} +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface OES_texture_float { +} +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface WebGLContextEvent extends Event { + statusMessage: string; +} +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(): WebGLContextEvent; +} + +interface WebGLRenderbuffer extends WebGLObject { +} +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLUniformLocation { +} +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebGLActiveInfo { + name: string; + type: number; + size: number; +} +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WEBGL_compressed_texture_s3tc { + COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WebGLRenderingContext { + drawingBufferWidth: number; + drawingBufferHeight: number; + canvas: HTMLCanvasElement; + getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; + bindTexture(target: number, texture: WebGLTexture): void; + bufferData(target: number, data: ArrayBufferView, usage: number): void; + bufferData(target: number, data: ArrayBuffer, usage: number): void; + bufferData(target: number, size: number, usage: number): void; + depthMask(flag: boolean): void; + getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; + vertexAttrib3fv(indx: number, values: number[]): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; + linkProgram(program: WebGLProgram): void; + getSupportedExtensions(): string[]; + bufferSubData(target: number, offset: number, data: ArrayBuffer): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + polygonOffset(factor: number, units: number): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + createTexture(): WebGLTexture; + hint(target: number, mode: number): void; + getVertexAttrib(index: number, pname: number): any; + enableVertexAttribArray(index: number): void; + depthRange(zNear: number, zFar: number): void; + cullFace(mode: number): void; + createFramebuffer(): WebGLFramebuffer; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + getExtension(name: string): any; + createProgram(): WebGLProgram; + deleteShader(shader: WebGLShader): void; + getAttachedShaders(program: WebGLProgram): WebGLShader[]; + enable(cap: number): void; + blendEquation(mode: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void; + createBuffer(): WebGLBuffer; + deleteTexture(texture: WebGLTexture): void; + useProgram(program: WebGLProgram): void; + vertexAttrib2fv(indx: number, values: number[]): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; + checkFramebufferStatus(target: number): number; + frontFace(mode: number): void; + getBufferParameter(target: number, pname: number): any; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + getVertexAttribOffset(index: number, pname: number): number; + disableVertexAttribArray(index: number): void; + blendFunc(sfactor: number, dfactor: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + isFramebuffer(framebuffer: WebGLFramebuffer): boolean; + uniform3iv(location: WebGLUniformLocation, v: number[]): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + lineWidth(width: number): void; + getShaderInfoLog(shader: WebGLShader): string; + getTexParameter(target: number, pname: number): any; + getParameter(pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; + getContextAttributes(): WebGLContextAttributes; + vertexAttrib1f(indx: number, x: number): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + isContextLost(): boolean; + uniform1iv(location: WebGLUniformLocation, v: number[]): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + getRenderbufferParameter(target: number, pname: number): any; + uniform2fv(location: WebGLUniformLocation, v: number[]): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + isTexture(texture: WebGLTexture): boolean; + getError(): number; + shaderSource(shader: WebGLShader, source: string): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; + stencilMask(mask: number): void; + bindBuffer(target: number, buffer: WebGLBuffer): void; + getAttribLocation(program: WebGLProgram, name: string): number; + uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + clear(mask: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + scissor(x: number, y: number, width: number, height: number): void; + uniform2i(location: WebGLUniformLocation, x: number, y: number): void; + getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; + getShaderSource(shader: WebGLShader): string; + generateMipmap(target: number): void; + bindAttribLocation(program: WebGLProgram, index: number, name: string): void; + uniform1fv(location: WebGLUniformLocation, v: number[]): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2iv(location: WebGLUniformLocation, v: number[]): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + uniform4fv(location: WebGLUniformLocation, v: number[]): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + vertexAttrib1fv(indx: number, values: number[]): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; + flush(): void; + uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + deleteProgram(program: WebGLProgram): void; + isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; + uniform1i(location: WebGLUniformLocation, x: number): void; + getProgramParameter(program: WebGLProgram, pname: number): any; + getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; + stencilFunc(func: number, ref: number, mask: number): void; + pixelStorei(pname: number, param: number): void; + disable(cap: number): void; + vertexAttrib4fv(indx: number, values: number[]): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; + createRenderbuffer(): WebGLRenderbuffer; + isBuffer(buffer: WebGLBuffer): boolean; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + sampleCoverage(value: number, invert: boolean): void; + depthFunc(func: number): void; + texParameterf(target: number, pname: number, param: number): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + drawArrays(mode: number, first: number, count: number): void; + texParameteri(target: number, pname: number, param: number): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + getShaderParameter(shader: WebGLShader, pname: number): any; + clearDepth(depth: number): void; + activeTexture(texture: number): void; + viewport(x: number, y: number, width: number, height: number): void; + detachShader(program: WebGLProgram, shader: WebGLShader): void; + uniform1f(location: WebGLUniformLocation, x: number): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + deleteBuffer(buffer: WebGLBuffer): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + uniform3fv(location: WebGLUniformLocation, v: number[]): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + stencilMaskSeparate(face: number, mask: number): void; + attachShader(program: WebGLProgram, shader: WebGLShader): void; + compileShader(shader: WebGLShader): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + isShader(shader: WebGLShader): boolean; + clearStencil(s: number): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; + finish(): void; + uniform2f(location: WebGLUniformLocation, x: number, y: number): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; + getProgramInfoLog(program: WebGLProgram): string; + validateProgram(program: WebGLProgram): void; + isEnabled(cap: number): boolean; + vertexAttrib2f(indx: number, x: number, y: number): void; + isProgram(program: WebGLProgram): boolean; + createShader(type: number): WebGLShader; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; + uniform4iv(location: WebGLUniformLocation, v: number[]): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; + DEPTH_FUNC: number; + DEPTH_COMPONENT16: number; + REPLACE: number; + REPEAT: number; + VERTEX_ATTRIB_ARRAY_ENABLED: number; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + STENCIL_BUFFER_BIT: number; + RENDERER: number; + STENCIL_BACK_REF: number; + TEXTURE26: number; + RGB565: number; + DITHER: number; + CONSTANT_COLOR: number; + GENERATE_MIPMAP_HINT: number; + POINTS: number; + DECR: number; + INT_VEC3: number; + TEXTURE28: number; + ONE_MINUS_CONSTANT_ALPHA: number; + BACK: number; + RENDERBUFFER_STENCIL_SIZE: number; + UNPACK_FLIP_Y_WEBGL: number; + BLEND: number; + TEXTURE9: number; + ARRAY_BUFFER_BINDING: number; + MAX_VIEWPORT_DIMS: number; + INVALID_FRAMEBUFFER_OPERATION: number; + TEXTURE: number; + TEXTURE0: number; + TEXTURE31: number; + TEXTURE24: number; + HIGH_INT: number; + RENDERBUFFER_BINDING: number; + BLEND_COLOR: number; + FASTEST: number; + STENCIL_WRITEMASK: number; + ALIASED_POINT_SIZE_RANGE: number; + TEXTURE12: number; + DST_ALPHA: number; + BLEND_EQUATION_RGB: number; + FRAMEBUFFER_COMPLETE: number; + NEAREST_MIPMAP_NEAREST: number; + VERTEX_ATTRIB_ARRAY_SIZE: number; + TEXTURE3: number; + DEPTH_WRITEMASK: number; + CONTEXT_LOST_WEBGL: number; + INVALID_VALUE: number; + TEXTURE_MAG_FILTER: number; + ONE_MINUS_CONSTANT_COLOR: number; + ONE_MINUS_SRC_ALPHA: number; + TEXTURE_CUBE_MAP_POSITIVE_Z: number; + NOTEQUAL: number; + ALPHA: number; + DEPTH_STENCIL: number; + MAX_VERTEX_UNIFORM_VECTORS: number; + DEPTH_COMPONENT: number; + RENDERBUFFER_RED_SIZE: number; + TEXTURE20: number; + RED_BITS: number; + RENDERBUFFER_BLUE_SIZE: number; + SCISSOR_BOX: number; + VENDOR: number; + FRONT_AND_BACK: number; + CONSTANT_ALPHA: number; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + NEAREST: number; + CULL_FACE: number; + ALIASED_LINE_WIDTH_RANGE: number; + TEXTURE19: number; + FRONT: number; + DEPTH_CLEAR_VALUE: number; + GREEN_BITS: number; + TEXTURE29: number; + TEXTURE23: number; + MAX_RENDERBUFFER_SIZE: number; + STENCIL_ATTACHMENT: number; + TEXTURE27: number; + BOOL_VEC2: number; + OUT_OF_MEMORY: number; + MIRRORED_REPEAT: number; + POLYGON_OFFSET_UNITS: number; + TEXTURE_MIN_FILTER: number; + STENCIL_BACK_PASS_DEPTH_PASS: number; + LINE_LOOP: number; + FLOAT_MAT3: number; + TEXTURE14: number; + LINEAR: number; + RGB5_A1: number; + ONE_MINUS_SRC_COLOR: number; + SAMPLE_COVERAGE_INVERT: number; + DONT_CARE: number; + FRAMEBUFFER_BINDING: number; + RENDERBUFFER_ALPHA_SIZE: number; + STENCIL_REF: number; + ZERO: number; + DECR_WRAP: number; + SAMPLE_COVERAGE: number; + STENCIL_BACK_FUNC: number; + TEXTURE30: number; + VIEWPORT: number; + STENCIL_BITS: number; + FLOAT: number; + COLOR_WRITEMASK: number; + SAMPLE_COVERAGE_VALUE: number; + TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + STENCIL_BACK_FAIL: number; + FLOAT_MAT4: number; + UNSIGNED_SHORT_4_4_4_4: number; + TEXTURE6: number; + RENDERBUFFER_WIDTH: number; + RGBA4: number; + ALWAYS: number; + BLEND_EQUATION_ALPHA: number; + COLOR_BUFFER_BIT: number; + TEXTURE_CUBE_MAP: number; + DEPTH_BUFFER_BIT: number; + STENCIL_CLEAR_VALUE: number; + BLEND_EQUATION: number; + RENDERBUFFER_GREEN_SIZE: number; + NEAREST_MIPMAP_LINEAR: number; + VERTEX_ATTRIB_ARRAY_TYPE: number; + INCR_WRAP: number; + ONE_MINUS_DST_COLOR: number; + HIGH_FLOAT: number; + BYTE: number; + FRONT_FACE: number; + SAMPLE_ALPHA_TO_COVERAGE: number; + CCW: number; + TEXTURE13: number; + MAX_VERTEX_ATTRIBS: number; + MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_WRAP_T: number; + UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + FLOAT_VEC2: number; + LUMINANCE: number; + GREATER: number; + INT_VEC2: number; + VALIDATE_STATUS: number; + FRAMEBUFFER: number; + FRAMEBUFFER_UNSUPPORTED: number; + TEXTURE5: number; + FUNC_SUBTRACT: number; + BLEND_DST_ALPHA: number; + SAMPLER_CUBE: number; + ONE_MINUS_DST_ALPHA: number; + LESS: number; + TEXTURE_CUBE_MAP_POSITIVE_X: number; + BLUE_BITS: number; + DEPTH_TEST: number; + VERTEX_ATTRIB_ARRAY_STRIDE: number; + DELETE_STATUS: number; + TEXTURE18: number; + POLYGON_OFFSET_FACTOR: number; + UNSIGNED_INT: number; + TEXTURE_2D: number; + DST_COLOR: number; + FLOAT_MAT2: number; + COMPRESSED_TEXTURE_FORMATS: number; + MAX_FRAGMENT_UNIFORM_VECTORS: number; + DEPTH_STENCIL_ATTACHMENT: number; + LUMINANCE_ALPHA: number; + CW: number; + VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + LINEAR_MIPMAP_LINEAR: number; + BUFFER_SIZE: number; + SAMPLE_BUFFERS: number; + TEXTURE15: number; + ACTIVE_TEXTURE: number; + VERTEX_SHADER: number; + TEXTURE22: number; + VERTEX_ATTRIB_ARRAY_POINTER: number; + INCR: number; + COMPILE_STATUS: number; + MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + TEXTURE7: number; + UNSIGNED_SHORT_5_5_5_1: number; + DEPTH_BITS: number; + RGBA: number; + TRIANGLE_STRIP: number; + COLOR_CLEAR_VALUE: number; + BROWSER_DEFAULT_WEBGL: number; + INVALID_ENUM: number; + SCISSOR_TEST: number; + LINE_STRIP: number; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + STENCIL_FUNC: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + RENDERBUFFER_HEIGHT: number; + TEXTURE8: number; + TRIANGLES: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + STENCIL_BACK_VALUE_MASK: number; + TEXTURE25: number; + RENDERBUFFER: number; + LEQUAL: number; + TEXTURE1: number; + STENCIL_INDEX8: number; + FUNC_ADD: number; + STENCIL_FAIL: number; + BLEND_SRC_ALPHA: number; + BOOL: number; + ALPHA_BITS: number; + LOW_INT: number; + TEXTURE10: number; + SRC_COLOR: number; + MAX_VARYING_VECTORS: number; + BLEND_DST_RGB: number; + TEXTURE_BINDING_CUBE_MAP: number; + STENCIL_INDEX: number; + TEXTURE_BINDING_2D: number; + MEDIUM_INT: number; + SHADER_TYPE: number; + POLYGON_OFFSET_FILL: number; + DYNAMIC_DRAW: number; + TEXTURE4: number; + STENCIL_BACK_PASS_DEPTH_FAIL: number; + STREAM_DRAW: number; + MAX_CUBE_MAP_TEXTURE_SIZE: number; + TEXTURE17: number; + TRIANGLE_FAN: number; + UNPACK_ALIGNMENT: number; + CURRENT_PROGRAM: number; + LINES: number; + INVALID_OPERATION: number; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + LINEAR_MIPMAP_NEAREST: number; + CLAMP_TO_EDGE: number; + RENDERBUFFER_DEPTH_SIZE: number; + TEXTURE_WRAP_S: number; + ELEMENT_ARRAY_BUFFER: number; + UNSIGNED_SHORT_5_6_5: number; + ACTIVE_UNIFORMS: number; + FLOAT_VEC3: number; + NO_ERROR: number; + ATTACHED_SHADERS: number; + DEPTH_ATTACHMENT: number; + TEXTURE11: number; + STENCIL_TEST: number; + ONE: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + STATIC_DRAW: number; + GEQUAL: number; + BOOL_VEC4: number; + COLOR_ATTACHMENT0: number; + PACK_ALIGNMENT: number; + MAX_TEXTURE_SIZE: number; + STENCIL_PASS_DEPTH_FAIL: number; + CULL_FACE_MODE: number; + TEXTURE16: number; + STENCIL_BACK_WRITEMASK: number; + SRC_ALPHA: number; + UNSIGNED_SHORT: number; + TEXTURE21: number; + FUNC_REVERSE_SUBTRACT: number; + SHADING_LANGUAGE_VERSION: number; + EQUAL: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + BOOL_VEC3: number; + SAMPLER_2D: number; + TEXTURE_CUBE_MAP_NEGATIVE_X: number; + MAX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_CUBE_MAP_POSITIVE_Y: number; + RENDERBUFFER_INTERNAL_FORMAT: number; + STENCIL_VALUE_MASK: number; + ELEMENT_ARRAY_BUFFER_BINDING: number; + ARRAY_BUFFER: number; + DEPTH_RANGE: number; + NICEST: number; + ACTIVE_ATTRIBUTES: number; + NEVER: number; + FLOAT_VEC4: number; + CURRENT_VERTEX_ATTRIB: number; + STENCIL_PASS_DEPTH_PASS: number; + INVERT: number; + LINK_STATUS: number; + RGB: number; + INT_VEC4: number; + TEXTURE2: number; + UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + MEDIUM_FLOAT: number; + SRC_ALPHA_SATURATE: number; + BUFFER_USAGE: number; + SHORT: number; + NONE: number; + UNSIGNED_BYTE: number; + INT: number; + SUBPIXEL_BITS: number; + KEEP: number; + SAMPLES: number; + FRAGMENT_SHADER: number; + LINE_WIDTH: number; + BLEND_SRC_RGB: number; + LOW_FLOAT: number; + VERSION: number; +} +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + DEPTH_FUNC: number; + DEPTH_COMPONENT16: number; + REPLACE: number; + REPEAT: number; + VERTEX_ATTRIB_ARRAY_ENABLED: number; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + STENCIL_BUFFER_BIT: number; + RENDERER: number; + STENCIL_BACK_REF: number; + TEXTURE26: number; + RGB565: number; + DITHER: number; + CONSTANT_COLOR: number; + GENERATE_MIPMAP_HINT: number; + POINTS: number; + DECR: number; + INT_VEC3: number; + TEXTURE28: number; + ONE_MINUS_CONSTANT_ALPHA: number; + BACK: number; + RENDERBUFFER_STENCIL_SIZE: number; + UNPACK_FLIP_Y_WEBGL: number; + BLEND: number; + TEXTURE9: number; + ARRAY_BUFFER_BINDING: number; + MAX_VIEWPORT_DIMS: number; + INVALID_FRAMEBUFFER_OPERATION: number; + TEXTURE: number; + TEXTURE0: number; + TEXTURE31: number; + TEXTURE24: number; + HIGH_INT: number; + RENDERBUFFER_BINDING: number; + BLEND_COLOR: number; + FASTEST: number; + STENCIL_WRITEMASK: number; + ALIASED_POINT_SIZE_RANGE: number; + TEXTURE12: number; + DST_ALPHA: number; + BLEND_EQUATION_RGB: number; + FRAMEBUFFER_COMPLETE: number; + NEAREST_MIPMAP_NEAREST: number; + VERTEX_ATTRIB_ARRAY_SIZE: number; + TEXTURE3: number; + DEPTH_WRITEMASK: number; + CONTEXT_LOST_WEBGL: number; + INVALID_VALUE: number; + TEXTURE_MAG_FILTER: number; + ONE_MINUS_CONSTANT_COLOR: number; + ONE_MINUS_SRC_ALPHA: number; + TEXTURE_CUBE_MAP_POSITIVE_Z: number; + NOTEQUAL: number; + ALPHA: number; + DEPTH_STENCIL: number; + MAX_VERTEX_UNIFORM_VECTORS: number; + DEPTH_COMPONENT: number; + RENDERBUFFER_RED_SIZE: number; + TEXTURE20: number; + RED_BITS: number; + RENDERBUFFER_BLUE_SIZE: number; + SCISSOR_BOX: number; + VENDOR: number; + FRONT_AND_BACK: number; + CONSTANT_ALPHA: number; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + NEAREST: number; + CULL_FACE: number; + ALIASED_LINE_WIDTH_RANGE: number; + TEXTURE19: number; + FRONT: number; + DEPTH_CLEAR_VALUE: number; + GREEN_BITS: number; + TEXTURE29: number; + TEXTURE23: number; + MAX_RENDERBUFFER_SIZE: number; + STENCIL_ATTACHMENT: number; + TEXTURE27: number; + BOOL_VEC2: number; + OUT_OF_MEMORY: number; + MIRRORED_REPEAT: number; + POLYGON_OFFSET_UNITS: number; + TEXTURE_MIN_FILTER: number; + STENCIL_BACK_PASS_DEPTH_PASS: number; + LINE_LOOP: number; + FLOAT_MAT3: number; + TEXTURE14: number; + LINEAR: number; + RGB5_A1: number; + ONE_MINUS_SRC_COLOR: number; + SAMPLE_COVERAGE_INVERT: number; + DONT_CARE: number; + FRAMEBUFFER_BINDING: number; + RENDERBUFFER_ALPHA_SIZE: number; + STENCIL_REF: number; + ZERO: number; + DECR_WRAP: number; + SAMPLE_COVERAGE: number; + STENCIL_BACK_FUNC: number; + TEXTURE30: number; + VIEWPORT: number; + STENCIL_BITS: number; + FLOAT: number; + COLOR_WRITEMASK: number; + SAMPLE_COVERAGE_VALUE: number; + TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + STENCIL_BACK_FAIL: number; + FLOAT_MAT4: number; + UNSIGNED_SHORT_4_4_4_4: number; + TEXTURE6: number; + RENDERBUFFER_WIDTH: number; + RGBA4: number; + ALWAYS: number; + BLEND_EQUATION_ALPHA: number; + COLOR_BUFFER_BIT: number; + TEXTURE_CUBE_MAP: number; + DEPTH_BUFFER_BIT: number; + STENCIL_CLEAR_VALUE: number; + BLEND_EQUATION: number; + RENDERBUFFER_GREEN_SIZE: number; + NEAREST_MIPMAP_LINEAR: number; + VERTEX_ATTRIB_ARRAY_TYPE: number; + INCR_WRAP: number; + ONE_MINUS_DST_COLOR: number; + HIGH_FLOAT: number; + BYTE: number; + FRONT_FACE: number; + SAMPLE_ALPHA_TO_COVERAGE: number; + CCW: number; + TEXTURE13: number; + MAX_VERTEX_ATTRIBS: number; + MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_WRAP_T: number; + UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + FLOAT_VEC2: number; + LUMINANCE: number; + GREATER: number; + INT_VEC2: number; + VALIDATE_STATUS: number; + FRAMEBUFFER: number; + FRAMEBUFFER_UNSUPPORTED: number; + TEXTURE5: number; + FUNC_SUBTRACT: number; + BLEND_DST_ALPHA: number; + SAMPLER_CUBE: number; + ONE_MINUS_DST_ALPHA: number; + LESS: number; + TEXTURE_CUBE_MAP_POSITIVE_X: number; + BLUE_BITS: number; + DEPTH_TEST: number; + VERTEX_ATTRIB_ARRAY_STRIDE: number; + DELETE_STATUS: number; + TEXTURE18: number; + POLYGON_OFFSET_FACTOR: number; + UNSIGNED_INT: number; + TEXTURE_2D: number; + DST_COLOR: number; + FLOAT_MAT2: number; + COMPRESSED_TEXTURE_FORMATS: number; + MAX_FRAGMENT_UNIFORM_VECTORS: number; + DEPTH_STENCIL_ATTACHMENT: number; + LUMINANCE_ALPHA: number; + CW: number; + VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + LINEAR_MIPMAP_LINEAR: number; + BUFFER_SIZE: number; + SAMPLE_BUFFERS: number; + TEXTURE15: number; + ACTIVE_TEXTURE: number; + VERTEX_SHADER: number; + TEXTURE22: number; + VERTEX_ATTRIB_ARRAY_POINTER: number; + INCR: number; + COMPILE_STATUS: number; + MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + TEXTURE7: number; + UNSIGNED_SHORT_5_5_5_1: number; + DEPTH_BITS: number; + RGBA: number; + TRIANGLE_STRIP: number; + COLOR_CLEAR_VALUE: number; + BROWSER_DEFAULT_WEBGL: number; + INVALID_ENUM: number; + SCISSOR_TEST: number; + LINE_STRIP: number; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + STENCIL_FUNC: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + RENDERBUFFER_HEIGHT: number; + TEXTURE8: number; + TRIANGLES: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + STENCIL_BACK_VALUE_MASK: number; + TEXTURE25: number; + RENDERBUFFER: number; + LEQUAL: number; + TEXTURE1: number; + STENCIL_INDEX8: number; + FUNC_ADD: number; + STENCIL_FAIL: number; + BLEND_SRC_ALPHA: number; + BOOL: number; + ALPHA_BITS: number; + LOW_INT: number; + TEXTURE10: number; + SRC_COLOR: number; + MAX_VARYING_VECTORS: number; + BLEND_DST_RGB: number; + TEXTURE_BINDING_CUBE_MAP: number; + STENCIL_INDEX: number; + TEXTURE_BINDING_2D: number; + MEDIUM_INT: number; + SHADER_TYPE: number; + POLYGON_OFFSET_FILL: number; + DYNAMIC_DRAW: number; + TEXTURE4: number; + STENCIL_BACK_PASS_DEPTH_FAIL: number; + STREAM_DRAW: number; + MAX_CUBE_MAP_TEXTURE_SIZE: number; + TEXTURE17: number; + TRIANGLE_FAN: number; + UNPACK_ALIGNMENT: number; + CURRENT_PROGRAM: number; + LINES: number; + INVALID_OPERATION: number; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + LINEAR_MIPMAP_NEAREST: number; + CLAMP_TO_EDGE: number; + RENDERBUFFER_DEPTH_SIZE: number; + TEXTURE_WRAP_S: number; + ELEMENT_ARRAY_BUFFER: number; + UNSIGNED_SHORT_5_6_5: number; + ACTIVE_UNIFORMS: number; + FLOAT_VEC3: number; + NO_ERROR: number; + ATTACHED_SHADERS: number; + DEPTH_ATTACHMENT: number; + TEXTURE11: number; + STENCIL_TEST: number; + ONE: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + STATIC_DRAW: number; + GEQUAL: number; + BOOL_VEC4: number; + COLOR_ATTACHMENT0: number; + PACK_ALIGNMENT: number; + MAX_TEXTURE_SIZE: number; + STENCIL_PASS_DEPTH_FAIL: number; + CULL_FACE_MODE: number; + TEXTURE16: number; + STENCIL_BACK_WRITEMASK: number; + SRC_ALPHA: number; + UNSIGNED_SHORT: number; + TEXTURE21: number; + FUNC_REVERSE_SUBTRACT: number; + SHADING_LANGUAGE_VERSION: number; + EQUAL: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + BOOL_VEC3: number; + SAMPLER_2D: number; + TEXTURE_CUBE_MAP_NEGATIVE_X: number; + MAX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_CUBE_MAP_POSITIVE_Y: number; + RENDERBUFFER_INTERNAL_FORMAT: number; + STENCIL_VALUE_MASK: number; + ELEMENT_ARRAY_BUFFER_BINDING: number; + ARRAY_BUFFER: number; + DEPTH_RANGE: number; + NICEST: number; + ACTIVE_ATTRIBUTES: number; + NEVER: number; + FLOAT_VEC4: number; + CURRENT_VERTEX_ATTRIB: number; + STENCIL_PASS_DEPTH_PASS: number; + INVERT: number; + LINK_STATUS: number; + RGB: number; + INT_VEC4: number; + TEXTURE2: number; + UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + MEDIUM_FLOAT: number; + SRC_ALPHA_SATURATE: number; + BUFFER_USAGE: number; + SHORT: number; + NONE: number; + UNSIGNED_BYTE: number; + INT: number; + SUBPIXEL_BITS: number; + KEEP: number; + SAMPLES: number; + FRAGMENT_SHADER: number; + LINE_WIDTH: number; + BLEND_SRC_RGB: number; + LOW_FLOAT: number; + VERSION: number; +} + +interface WebGLProgram extends WebGLObject { +} +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface OES_standard_derivatives { + FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface WebGLFramebuffer extends WebGLObject { +} +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLShader extends WebGLObject { +} +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface OES_texture_float_linear { +} +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface WebGLObject { +} +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLBuffer extends WebGLObject { +} +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLShaderPrecisionFormat { + rangeMin: number; + rangeMax: number; + precision: number; +} +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface EXT_texture_filter_anisotropic { + TEXTURE_MAX_ANISOTROPY_EXT: number; + MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; +} +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + TEXTURE_MAX_ANISOTROPY_EXT: number; + MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var Option: { new(text?: string, value?: string, defaultSelected?: boolean, selected?:boolean): HTMLOptionElement; }; +declare var Image: { new(width?: number, height?: number): HTMLImageElement; }; +declare var Audio: { new(src?: string): HTMLAudioElement; }; + +declare var ondragend: (ev: DragEvent) => any; +declare var onkeydown: (ev: KeyboardEvent) => any; +declare var ondragover: (ev: DragEvent) => any; +declare var onkeyup: (ev: KeyboardEvent) => any; +declare var onreset: (ev: Event) => any; +declare var onmouseup: (ev: MouseEvent) => any; +declare var ondragstart: (ev: DragEvent) => any; +declare var ondrag: (ev: DragEvent) => any; +declare var screenX: number; +declare var onmouseover: (ev: MouseEvent) => any; +declare var ondragleave: (ev: DragEvent) => any; +declare var history: History; +declare var pageXOffset: number; +declare var name: string; +declare var onafterprint: (ev: Event) => any; +declare var onpause: (ev: Event) => any; +declare var onbeforeprint: (ev: Event) => any; +declare var top: Window; +declare var onmousedown: (ev: MouseEvent) => any; +declare var onseeked: (ev: Event) => any; +declare var opener: Window; +declare var onclick: (ev: MouseEvent) => any; +declare var innerHeight: number; +declare var onwaiting: (ev: Event) => any; +declare var ononline: (ev: Event) => any; +declare var ondurationchange: (ev: Event) => any; +declare var frames: Window; +declare var onblur: (ev: FocusEvent) => any; +declare var onemptied: (ev: Event) => any; +declare var onseeking: (ev: Event) => any; +declare var oncanplay: (ev: Event) => any; +declare var outerWidth: number; +declare var onstalled: (ev: Event) => any; +declare var onmousemove: (ev: MouseEvent) => any; +declare var innerWidth: number; +declare var onoffline: (ev: Event) => any; +declare var length: number; +declare var screen: Screen; +declare var onbeforeunload: (ev: BeforeUnloadEvent) => any; +declare var onratechange: (ev: Event) => any; +declare var onstorage: (ev: StorageEvent) => any; +declare var onloadstart: (ev: Event) => any; +declare var ondragenter: (ev: DragEvent) => any; +declare var onsubmit: (ev: Event) => any; +declare var self: Window; +declare var document: Document; +declare var onprogress: (ev: ProgressEvent) => any; +declare var ondblclick: (ev: MouseEvent) => any; +declare var pageYOffset: number; +declare var oncontextmenu: (ev: MouseEvent) => any; +declare var onchange: (ev: Event) => any; +declare var onloadedmetadata: (ev: Event) => any; +declare var onplay: (ev: Event) => any; +declare var onerror: ErrorEventHandler; +declare var onplaying: (ev: Event) => any; +declare var parent: Window; +declare var location: Location; +declare var oncanplaythrough: (ev: Event) => any; +declare var onabort: (ev: UIEvent) => any; +declare var onreadystatechange: (ev: Event) => any; +declare var outerHeight: number; +declare var onkeypress: (ev: KeyboardEvent) => any; +declare var frameElement: Element; +declare var onloadeddata: (ev: Event) => any; +declare var onsuspend: (ev: Event) => any; +declare var window: Window; +declare var onfocus: (ev: FocusEvent) => any; +declare var onmessage: (ev: MessageEvent) => any; +declare var ontimeupdate: (ev: Event) => any; +declare var onresize: (ev: UIEvent) => any; +declare var onselect: (ev: UIEvent) => any; +declare var navigator: Navigator; +declare var styleMedia: StyleMedia; +declare var ondrop: (ev: DragEvent) => any; +declare var onmouseout: (ev: MouseEvent) => any; +declare var onended: (ev: Event) => any; +declare var onhashchange: (ev: Event) => any; +declare var onunload: (ev: Event) => any; +declare var onscroll: (ev: UIEvent) => any; +declare var screenY: number; +declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onload: (ev: Event) => any; +declare var onvolumechange: (ev: Event) => any; +declare var oninput: (ev: Event) => any; +declare var performance: Performance; +declare var onmspointerdown: (ev: any) => any; +declare var animationStartTime: number; +declare var onmsgesturedoubletap: (ev: any) => any; +declare var onmspointerhover: (ev: any) => any; +declare var onmsgesturehold: (ev: any) => any; +declare var onmspointermove: (ev: any) => any; +declare var onmsgesturechange: (ev: any) => any; +declare var onmsgesturestart: (ev: any) => any; +declare var onmspointercancel: (ev: any) => any; +declare var onmsgestureend: (ev: any) => any; +declare var onmsgesturetap: (ev: any) => any; +declare var onmspointerout: (ev: any) => any; +declare var msAnimationStartTime: number; +declare var applicationCache: ApplicationCache; +declare var onmsinertiastart: (ev: any) => any; +declare var onmspointerover: (ev: any) => any; +declare var onpopstate: (ev: PopStateEvent) => any; +declare var onmspointerup: (ev: any) => any; +declare var onpageshow: (ev: PageTransitionEvent) => any; +declare var ondevicemotion: (ev: DeviceMotionEvent) => any; +declare var devicePixelRatio: number; +declare var msCrypto: Crypto; +declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; +declare var doNotTrack: string; +declare var onmspointerenter: (ev: any) => any; +declare var onpagehide: (ev: PageTransitionEvent) => any; +declare var onmspointerleave: (ev: any) => any; +declare function alert(message?: any): void; +declare function scroll(x?: number, y?: number): void; +declare function focus(): void; +declare function scrollTo(x?: number, y?: number): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string; +declare function toString(): string; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function scrollBy(x?: number, y?: number): void; +declare function confirm(message?: string): boolean; +declare function close(): void; +declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function showModalDialog(url?: string, argument?: any, options?: any): any; +declare function blur(): void; +declare function getSelection(): Selection; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function msCancelRequestAnimationFrame(handle: number): void; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function cancelAnimationFrame(handle: number): void; +declare function msIsStaticHTML(html: string): boolean; +declare function msMatchMedia(mediaQuery: string): MediaQueryList; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare function dispatchEvent(evt: Event): boolean; +declare function attachEvent(event: string, listener: EventListener): boolean; +declare function detachEvent(event: string, listener: EventListener): void; +declare var localStorage: Storage; +declare var status: string; +declare var onmouseleave: (ev: MouseEvent) => any; +declare var screenLeft: number; +declare var offscreenBuffering: any; +declare var maxConnectionsPerServer: number; +declare var onmouseenter: (ev: MouseEvent) => any; +declare var clipboardData: DataTransfer; +declare var defaultStatus: string; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var onhelp: (ev: Event) => any; +declare var external: External; +declare var event: MSEventObj; +declare var onfocusout: (ev: FocusEvent) => any; +declare var screenTop: number; +declare var onfocusin: (ev: FocusEvent) => any; +declare function showModelessDialog(url?: string, argument?: any, options?: any): Window; +declare function navigate(url: string): void; +declare function resizeBy(x?: number, y?: number): void; +declare function item(index: any): any; +declare function resizeTo(x?: number, y?: number): void; +declare function createPopup(arguments?: any): MSPopupWindow; +declare function toStaticHTML(html: string): string; +declare function execScript(code: string, language?: string): any; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function moveTo(x?: number, y?: number): void; +declare function moveBy(x?: number, y?: number): void; +declare function showHelp(url: string, helpArg?: any, features?: string): void; +declare function captureEvents(): void; +declare function releaseEvents(): void; +declare var sessionStorage: Storage; +declare function clearTimeout(handle: number): void; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearInterval(handle: number): void; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function msSetImmediate(expression: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function msClearImmediate(handle: number): void; +declare function setImmediate(expression: any, ...args: any[]): number; +declare function btoa(rawString: string): string; +declare function atob(encodedString: string): string; +declare var msIndexedDB: IDBFactory; +declare var indexedDB: IDBFactory; +declare var console: Console; +declare var onpointerenter: (ev: PointerEvent) => any; +declare var onpointerout: (ev: PointerEvent) => any; +declare var onpointerdown: (ev: PointerEvent) => any; +declare var onpointerup: (ev: PointerEvent) => any; +declare var onpointercancel: (ev: PointerEvent) => any; +declare var onpointerover: (ev: PointerEvent) => any; +declare var onpointermove: (ev: PointerEvent) => any; +declare var onpointerleave: (ev: PointerEvent) => any; +declare function addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; diff --git a/lib/typescript-src/support/typescript/bin/lib.es6.d.ts b/lib/typescript-src/support/typescript/bin/lib.es6.d.ts new file mode 100644 index 0000000..2434079 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/lib.es6.d.ts @@ -0,0 +1,17195 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare var NaN: number; +declare var Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties?: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: any): any; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: any): any; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: any): any; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare var Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(thisArg: any, ...argArray: any[]): any; + + prototype: any; + length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + prototype: Function; +} + +declare var Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A function that returns the replacement text. + */ + replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replaceValue A function that returns the replacement text. + */ + replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + +interface Boolean { +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + prototype: Boolean; +} + +declare var Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends Array { + raw: string[]; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + E: number; + /** The natural logarithm of 10. */ + LN10: number; + /** The natural logarithm of 2. */ + LN2: number; + /** The base-2 logarithm of e. */ + LOG2E: number; + /** The base-10 logarithm of e. */ + LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + SQRT1_2: number; + /** The square root of 2. */ + SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point (y,x). + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare var Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */ + source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): RegExp; +} + +interface RegExpConstructor { + new (pattern: string, flags?: string): RegExp; + (pattern: string, flags?: string): RegExp; + prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare var RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + prototype: Error; +} + +declare var Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + prototype: EvalError; +} + +declare var EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + prototype: RangeError; +} + +declare var RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + prototype: ReferenceError; +} + +declare var ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + prototype: SyntaxError; +} + +declare var SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + prototype: TypeError; +} + +declare var TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + prototype: URIError; +} + +declare var URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + */ + stringify(value: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + */ + stringify(value: any, replacer: (key: string, value: any) => any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + */ + stringify(value: any, replacer: any[]): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: any[], space: any): string; +} +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): boolean; + prototype: Array; +} + +declare var Array: ArrayConstructor; +declare type PropertyKey = string | number | Symbol; + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + // [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): Symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): Symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: Symbol): string; + + // Well-known Symbols + + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + hasInstance: Symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + isConcatSpreadable: Symbol; + + /** + * A Boolean value that if true indicates that an object may be used as a regular expression. + */ + isRegExp: Symbol; + + /** + * A method that returns the default iterator for an object.Called by the semantics of the + * for-of statement. + */ + iterator: Symbol; + + /** + * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive + * abstract operation. + */ + toPrimitive: Symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built- in method Object.prototype.toString. + */ + toStringTag: Symbol; + + /** + * An Object whose own property names are property names that are excluded from the with + * environment bindings of the associated objects. + */ + unscopables: Symbol; +} +declare var Symbol: SymbolConstructor; + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): Symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface Function { + /** + * Returns a new function object that is identical to the argument object in all ways except + * for its identity and the value of its HomeObject internal slot. + */ + toMethod(newHome: Object): Function; + + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + name: string; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + +interface Array { + /** Iterator */ + // [Symbol.iterator] (): Iterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface String { + /** Iterator */ + // [Symbol.iterator] (): Iterator; + + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + contains(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + //[Symbol.iterator](): Iterator; + next(): IteratorResult; +} + +interface Iterable { + //[Symbol.iterator](): Iterator; +} + +interface GeneratorFunction extends Function { + +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + +interface Generator extends Iterator { + next(value?: any): IteratorResult; + throw (exception: any): IteratorResult; + return (value: T): IteratorResult; + // [Symbol.toStringTag]: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; + + // [Symbol.toStringTag]: string; +} + +interface RegExp { + // [Symbol.isRegExp]: boolean; + + /** + * Matches a string with a regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + match(string: string): string[]; + + /** + * Replaces text in a string, using a regular expression. + * @param searchValue A String object or string literal that represents the regular expression + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of rgExp in stringObj. + */ + replace(string: string, replaceValue: string): string; + + search(string: string): number; + + /** + * Returns an Array object into which substrings of the result of converting string to a String + * have been stored. The substrings are determined by searching from left to right for matches + * of the this value regular expression; these occurrences are not part of any substring in the + * returned array, but serve to divide up the String value. + * + * If the regular expression that contains capturing parentheses, then each time separator is + * matched the results (including any undefined results) of the capturing parentheses are spliced. + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than limit elements. + */ + split(string: string, limit?: number): string[]; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + unicode: boolean; +} + +interface Map { + clear(): void; + delete(key: K): boolean; + entries(): Iterator<[K, V]>; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + keys(): Iterator; + set(key: K, value?: V): Map; + size: number; + values(): Iterator; + // [Symbol.iterator]():Iterator<[K,V]>; + // [Symbol.toStringTag]: string; +} + +interface MapConstructor { + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + // [Symbol.toStringTag]: string; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): Iterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): Iterator; + size: number; + values(): Iterator; + // [Symbol.iterator]():Iterator; + // [Symbol.toStringTag]: string; +} + +interface SetConstructor { + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + // [Symbol.toStringTag]: string; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + +interface JSON { + // [Symbol.toStringTag]: string; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; + + // [Symbol.toStringTag]: string; +} + +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian: boolean): void; + + // [Symbol.toStringTag]: string; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int8Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int8Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int8Array; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: Int8Array): Int8Array; + new (array: number[]): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} +declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: Uint8Array): Uint8Array; + new (array: number[]): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} +declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: Uint8ClampedArray): Uint8ClampedArray; + new (array: number[]): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int16Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int16Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int16Array; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: Int16Array): Int16Array; + new (array: number[]): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} +declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint16Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint16Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint16Array; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: Uint16Array): Uint16Array; + new (array: number[]): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} +declare var Uint16Array: Uint16ArrayConstructor; + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int32Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int32Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int32Array; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: Int32Array): Int32Array; + new (array: number[]): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint32Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint32Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint32Array; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: Uint32Array): Uint32Array; + new (array: number[]): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float32Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float32Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float32Array; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: Float32Array): Float32Array; + new (array: number[]): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} +declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float64Array; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): Iterator<[number, number]>; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float64Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns an list of keys in the array + */ + keys(): Iterator; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float64Array, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float64Array; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** + * Returns an list of values in the array + */ + values(): Iterator; + + [index: number]: number; + // [Symbol.iterator] (): Iterator; +} + +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: Float64Array): Float64Array; + new (array: number[]): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare var Float64Array: Float64ArrayConstructor; + +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handeler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; + +declare var Reflect: { + apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + construct(target: Function, argumentsList: ArrayLike): any; + defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + deleteProperty(target: any, propertyKey: PropertyKey): boolean; + enumerate(target: any): Iterator; + get(target: any, propertyKey: PropertyKey, receiver?: any): any; + getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + getPrototypeOf(target: any): any; + has(target: any, propertyKey: string): boolean; + has(target: any, propertyKey: Symbol): boolean; + isExtensible(target: any): boolean; + ownKeys(target: any): Array; + preventExtensions(target: any): boolean; + set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; + setPrototypeOf(target: any, proto: any): boolean; +}; + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | Promise, onrejected?: (reason: any) => TResult | Promise): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | Promise): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param init A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + + (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | Promise)[]): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of values. + * @returns A new Promise. + */ + all(values: Promise[]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: (T | Promise)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | Promise): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +}///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumintegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): Collator; + new (locale?: string, options?: NumberFormatOptions): Collator; + (locales?: string[], options?: NumberFormatOptions): Collator; + (locale?: string, options?: NumberFormatOptions): Collator; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12: boolean; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date: number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): Collator; + new (locale?: string, options?: DateTimeFormatOptions): Collator; + (locales?: string[], options?: DateTimeFormatOptions): Collator; + (locale?: string, options?: DateTimeFormatOptions): Collator; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface AlgorithmParameters { +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface Algorithm { + name?: string; + params?: AlgorithmParameters; +} + +interface MouseEventInit { + bubbles?: boolean; + cancelable?: boolean; + view?: Window; + detail?: number; + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface WebGLContextAttributes { + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLElement extends Element, ElementCSSInlineStyle, MSEventAttachmentTarget, MSNodeExtensions { + hidden: any; + readyState: any; + onmouseleave: (ev: MouseEvent) => any; + onbeforecut: (ev: DragEvent) => any; + onkeydown: (ev: KeyboardEvent) => any; + onmove: (ev: MSEventObj) => any; + onkeyup: (ev: KeyboardEvent) => any; + onreset: (ev: Event) => any; + onhelp: (ev: Event) => any; + ondragleave: (ev: DragEvent) => any; + className: string; + onfocusin: (ev: FocusEvent) => any; + onseeked: (ev: Event) => any; + recordNumber: any; + title: string; + parentTextEdit: Element; + outerHTML: string; + ondurationchange: (ev: Event) => any; + offsetHeight: number; + all: HTMLCollection; + onblur: (ev: FocusEvent) => any; + dir: string; + onemptied: (ev: Event) => any; + onseeking: (ev: Event) => any; + oncanplay: (ev: Event) => any; + ondeactivate: (ev: UIEvent) => any; + ondatasetchanged: (ev: MSEventObj) => any; + onrowsdelete: (ev: MSEventObj) => any; + sourceIndex: number; + onloadstart: (ev: Event) => any; + onlosecapture: (ev: MSEventObj) => any; + ondragenter: (ev: DragEvent) => any; + oncontrolselect: (ev: MSEventObj) => any; + onsubmit: (ev: Event) => any; + behaviorUrns: MSBehaviorUrnsCollection; + scopeName: string; + onchange: (ev: Event) => any; + id: string; + onlayoutcomplete: (ev: MSEventObj) => any; + uniqueID: string; + onbeforeactivate: (ev: UIEvent) => any; + oncanplaythrough: (ev: Event) => any; + onbeforeupdate: (ev: MSEventObj) => any; + onfilterchange: (ev: MSEventObj) => any; + offsetParent: Element; + ondatasetcomplete: (ev: MSEventObj) => any; + onsuspend: (ev: Event) => any; + onmouseenter: (ev: MouseEvent) => any; + innerText: string; + onerrorupdate: (ev: MSEventObj) => any; + onmouseout: (ev: MouseEvent) => any; + parentElement: HTMLElement; + onmousewheel: (ev: MouseWheelEvent) => any; + onvolumechange: (ev: Event) => any; + oncellchange: (ev: MSEventObj) => any; + onrowexit: (ev: MSEventObj) => any; + onrowsinserted: (ev: MSEventObj) => any; + onpropertychange: (ev: MSEventObj) => any; + filters: any; + children: HTMLCollection; + ondragend: (ev: DragEvent) => any; + onbeforepaste: (ev: DragEvent) => any; + ondragover: (ev: DragEvent) => any; + offsetTop: number; + onmouseup: (ev: MouseEvent) => any; + ondragstart: (ev: DragEvent) => any; + onbeforecopy: (ev: DragEvent) => any; + ondrag: (ev: DragEvent) => any; + innerHTML: string; + onmouseover: (ev: MouseEvent) => any; + lang: string; + uniqueNumber: number; + onpause: (ev: Event) => any; + tagUrn: string; + onmousedown: (ev: MouseEvent) => any; + onclick: (ev: MouseEvent) => any; + onwaiting: (ev: Event) => any; + onresizestart: (ev: MSEventObj) => any; + offsetLeft: number; + isTextEdit: boolean; + isDisabled: boolean; + onpaste: (ev: DragEvent) => any; + canHaveHTML: boolean; + onmoveend: (ev: MSEventObj) => any; + language: string; + onstalled: (ev: Event) => any; + onmousemove: (ev: MouseEvent) => any; + style: MSStyleCSSProperties; + isContentEditable: boolean; + onbeforeeditfocus: (ev: MSEventObj) => any; + onratechange: (ev: Event) => any; + contentEditable: string; + tabIndex: number; + document: Document; + onprogress: (ev: ProgressEvent) => any; + ondblclick: (ev: MouseEvent) => any; + oncontextmenu: (ev: MouseEvent) => any; + onloadedmetadata: (ev: Event) => any; + onafterupdate: (ev: MSEventObj) => any; + onerror: (ev: ErrorEvent) => any; + onplay: (ev: Event) => any; + onresizeend: (ev: MSEventObj) => any; + onplaying: (ev: Event) => any; + isMultiLine: boolean; + onfocusout: (ev: FocusEvent) => any; + onabort: (ev: UIEvent) => any; + ondataavailable: (ev: MSEventObj) => any; + hideFocus: boolean; + onreadystatechange: (ev: Event) => any; + onkeypress: (ev: KeyboardEvent) => any; + onloadeddata: (ev: Event) => any; + onbeforedeactivate: (ev: UIEvent) => any; + outerText: string; + disabled: boolean; + onactivate: (ev: UIEvent) => any; + accessKey: string; + onmovestart: (ev: MSEventObj) => any; + onselectstart: (ev: Event) => any; + onfocus: (ev: FocusEvent) => any; + ontimeupdate: (ev: Event) => any; + onresize: (ev: UIEvent) => any; + oncut: (ev: DragEvent) => any; + onselect: (ev: UIEvent) => any; + ondrop: (ev: DragEvent) => any; + offsetWidth: number; + oncopy: (ev: DragEvent) => any; + onended: (ev: Event) => any; + onscroll: (ev: UIEvent) => any; + onrowenter: (ev: MSEventObj) => any; + onload: (ev: Event) => any; + canHaveChildren: boolean; + oninput: (ev: Event) => any; + onmscontentzoom: (ev: MSEventObj) => any; + oncuechange: (ev: Event) => any; + spellcheck: boolean; + classList: DOMTokenList; + onmsmanipulationstatechanged: (ev: any) => any; + draggable: boolean; + dataset: DOMStringMap; + dragDrop(): boolean; + scrollIntoView(top?: boolean): void; + addFilter(filter: any): void; + setCapture(containerCapture?: boolean): void; + focus(): void; + getAdjacentText(where: string): string; + insertAdjacentText(where: string, text: string): void; + getElementsByClassName(classNames: string): NodeList; + setActive(): void; + removeFilter(filter: any): void; + blur(): void; + clearAttributes(): void; + releaseCapture(): void; + createControlRange(): ControlRangeCollection; + removeBehavior(cookie: number): boolean; + contains(child: HTMLElement): boolean; + click(): void; + insertAdjacentElement(position: string, insertedElement: Element): Element; + mergeAttributes(source: HTMLElement, preserveIdentity?: boolean): void; + replaceAdjacentText(where: string, newText: string): string; + applyElement(apply: Element, where?: string): Element; + addBehavior(bstrUrl: string, factory?: any): number; + insertAdjacentHTML(where: string, html: string): void; + msGetInputContext(): MSInputMethodContext; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface Document extends Node, NodeSelector, MSEventAttachmentTarget, DocumentEvent, MSResourceMetadata, MSNodeExtensions, MSDocumentExtensions, GlobalEventHandlers { + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Retrieves the collection of user agents and versions declared in the X-UA-Compatible + */ + compatible: MSCompatibleInfoCollection; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (ev: KeyboardEvent) => any; + /** + * Gets the implementation object of the current document. + */ + implementation: DOMImplementation; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (ev: Event) => any; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollection; + /** + * Fires when the user presses the F1 key while the browser is the active window. + * @param ev The event. + */ + onhelp: (ev: Event) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (ev: DragEvent) => any; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Fires for an element just prior to setting focus on that element. + * @param ev The focus event + */ + onfocusin: (ev: FocusEvent) => any; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (ev: Event) => any; + security: string; + /** + * Contains the title of the document. + */ + title: string; + /** + * Retrieves a collection of namespace objects. + */ + namespaces: MSNamespaceInfoCollection; + /** + * Gets the default character set from the current regional language settings. + */ + defaultCharset: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollection; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + styleSheets: StyleSheetList; + /** + * Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window. + */ + frames: Window; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (ev: Event) => any; + /** + * Returns a reference to the collection of elements contained by the object. + */ + all: HTMLCollection; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollection; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (ev: FocusEvent) => any; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (ev: Event) => any; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (ev: Event) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (ev: UIEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (ev: Event) => any; + /** + * Fires when the data set exposed by a data source object changes. + * @param ev The event. + */ + ondatasetchanged: (ev: MSEventObj) => any; + /** + * Fires when rows are about to be deleted from the recordset. + * @param ev The event + */ + onrowsdelete: (ev: MSEventObj) => any; + Script: MSScriptHost; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (ev: Event) => any; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + URLUnencoded: string; + defaultView: Window; + /** + * Fires when the user is about to make a control selection of the object. + * @param ev The event. + */ + oncontrolselect: (ev: MSEventObj) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (ev: DragEvent) => any; + onsubmit: (ev: Event) => any; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + inputEncoding: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + activeElement: Element; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (ev: Event) => any; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollection; + /** + * Retrieves an autogenerated, unique identifier for the object. + */ + uniqueID: string; + /** + * Sets or gets the URL for the current document. + */ + URL: string; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (ev: UIEvent) => any; + head: HTMLHeadElement; + cookie: string; + xmlEncoding: string; + oncanplaythrough: (ev: Event) => any; + /** + * Retrieves the document compatibility mode of the document. + */ + documentMode: number; + characterSet: string; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollection; + onbeforeupdate: (ev: MSEventObj) => any; + /** + * Fires to indicate that all data is available from the data source object. + * @param ev The event. + */ + ondatasetcomplete: (ev: MSEventObj) => any; + plugins: HTMLCollection; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (ev: Event) => any; + /** + * Gets the root svg element in the document hierarchy. + */ + rootElement: SVGSVGElement; + /** + * Retrieves a value that indicates the current state of the object. + */ + readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + referrer: string; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Fires on a databound object when an error occurs while updating the associated data in the data source object. + * @param ev The event. + */ + onerrorupdate: (ev: MSEventObj) => any; + /** + * Gets a reference to the container object of the window. + */ + parentWindow: Window; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (ev: MouseEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (ev: MSSiteModeEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (ev: MouseWheelEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (ev: Event) => any; + /** + * Fires when data changes in the data provider. + * @param ev The event. + */ + oncellchange: (ev: MSEventObj) => any; + /** + * Fires just before the data source control changes the current row in the object. + * @param ev The event. + */ + onrowexit: (ev: MSEventObj) => any; + /** + * Fires just after new rows are inserted in the current recordset. + * @param ev The event. + */ + onrowsinserted: (ev: MSEventObj) => any; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string; + msCapsLockWarningOff: boolean; + /** + * Fires when a property changes on the object. + * @param ev The event. + */ + onpropertychange: (ev: MSEventObj) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (ev: DragEvent) => any; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + doctype: DocumentType; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (ev: DragEvent) => any; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (ev: DragEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (ev: MouseEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (ev: DragEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (ev: MouseEvent) => any; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (ev: MouseEvent) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (ev: MouseEvent) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (ev: Event) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollection; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + xmlStandalone: boolean; + /** + * Represents the active selection, which is a highlighted block of text or other elements in the document that a user or a script can carry out some action on. + */ + selection: MSSelection; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (ev: Event) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (ev: MouseEvent) => any; + /** + * Fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected. + * @param ev The event. + */ + onbeforeeditfocus: (ev: MSEventObj) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (ev: ProgressEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (ev: MouseEvent) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (ev: Event) => any; + media: string; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (ev: ErrorEvent) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (ev: Event) => any; + onafterupdate: (ev: MSEventObj) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (ev: Event) => any; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollection; + /** + * Contains information about the current URL. + */ + location: Location; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (ev: UIEvent) => any; + /** + * Fires for the current element with focus immediately after moving focus to another element. + * @param ev The event. + */ + onfocusout: (ev: FocusEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; + /** + * Fires when a local DOM Storage area is written to disk. + * @param ev The event. + */ + onstoragecommit: (ev: StorageEvent) => any; + /** + * Fires periodically as data arrives from data source objects that asynchronously transmit their data. + * @param ev The event. + */ + ondataavailable: (ev: MSEventObj) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (ev: Event) => any; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + lastModified: string; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (ev: KeyboardEvent) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (ev: Event) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (ev: UIEvent) => any; + onselectstart: (ev: Event) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (ev: FocusEvent) => any; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (ev: UIEvent) => any; + ondrop: (ev: DragEvent) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (ev: Event) => any; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + compatMode: string; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (ev: UIEvent) => any; + /** + * Fires to indicate that the current row has changed in the data source and new data values are available on the object. + * @param ev The event. + */ + onrowenter: (ev: MSEventObj) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (ev: Event) => any; + oninput: (ev: Event) => any; + onmspointerdown: (ev: any) => any; + msHidden: boolean; + msVisibilityState: string; + onmsgesturedoubletap: (ev: any) => any; + visibilityState: string; + onmsmanipulationstatechanged: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmscontentzoom: (ev: MSEventObj) => any; + onmspointermove: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + onmsinertiastart: (ev: any) => any; + msCSSOMElementFloatMetrics: boolean; + onmspointerover: (ev: any) => any; + hidden: boolean; + onmspointerup: (ev: any) => any; + msFullscreenEnabled: boolean; + onmsfullscreenerror: (ev: any) => any; + onmspointerenter: (ev: any) => any; + msFullscreenElement: Element; + onmsfullscreenchange: (ev: any) => any; + onmspointerleave: (ev: any) => any; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + adoptNode(source: Node): Node; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + createCDATASection(data: string): CDATASection; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: "a"): HTMLAnchorElement; + createElement(tagName: "abbr"): HTMLPhraseElement; + createElement(tagName: "acronym"): HTMLPhraseElement; + createElement(tagName: "address"): HTMLBlockElement; + createElement(tagName: "applet"): HTMLAppletElement; + createElement(tagName: "area"): HTMLAreaElement; + createElement(tagName: "article"): HTMLElement; + createElement(tagName: "aside"): HTMLElement; + createElement(tagName: "audio"): HTMLAudioElement; + createElement(tagName: "b"): HTMLPhraseElement; + createElement(tagName: "base"): HTMLBaseElement; + createElement(tagName: "basefont"): HTMLBaseFontElement; + createElement(tagName: "bdo"): HTMLPhraseElement; + createElement(tagName: "bgsound"): HTMLBGSoundElement; + createElement(tagName: "big"): HTMLPhraseElement; + createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "body"): HTMLBodyElement; + createElement(tagName: "br"): HTMLBRElement; + createElement(tagName: "button"): HTMLButtonElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: "caption"): HTMLTableCaptionElement; + createElement(tagName: "center"): HTMLBlockElement; + createElement(tagName: "cite"): HTMLPhraseElement; + createElement(tagName: "code"): HTMLPhraseElement; + createElement(tagName: "col"): HTMLTableColElement; + createElement(tagName: "colgroup"): HTMLTableColElement; + createElement(tagName: "datalist"): HTMLDataListElement; + createElement(tagName: "dd"): HTMLDDElement; + createElement(tagName: "del"): HTMLModElement; + createElement(tagName: "dfn"): HTMLPhraseElement; + createElement(tagName: "dir"): HTMLDirectoryElement; + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "dl"): HTMLDListElement; + createElement(tagName: "dt"): HTMLDTElement; + createElement(tagName: "em"): HTMLPhraseElement; + createElement(tagName: "embed"): HTMLEmbedElement; + createElement(tagName: "fieldset"): HTMLFieldSetElement; + createElement(tagName: "figcaption"): HTMLElement; + createElement(tagName: "figure"): HTMLElement; + createElement(tagName: "font"): HTMLFontElement; + createElement(tagName: "footer"): HTMLElement; + createElement(tagName: "form"): HTMLFormElement; + createElement(tagName: "frame"): HTMLFrameElement; + createElement(tagName: "frameset"): HTMLFrameSetElement; + createElement(tagName: "h1"): HTMLHeadingElement; + createElement(tagName: "h2"): HTMLHeadingElement; + createElement(tagName: "h3"): HTMLHeadingElement; + createElement(tagName: "h4"): HTMLHeadingElement; + createElement(tagName: "h5"): HTMLHeadingElement; + createElement(tagName: "h6"): HTMLHeadingElement; + createElement(tagName: "head"): HTMLHeadElement; + createElement(tagName: "header"): HTMLElement; + createElement(tagName: "hgroup"): HTMLElement; + createElement(tagName: "hr"): HTMLHRElement; + createElement(tagName: "html"): HTMLHtmlElement; + createElement(tagName: "i"): HTMLPhraseElement; + createElement(tagName: "iframe"): HTMLIFrameElement; + createElement(tagName: "img"): HTMLImageElement; + createElement(tagName: "input"): HTMLInputElement; + createElement(tagName: "ins"): HTMLModElement; + createElement(tagName: "isindex"): HTMLIsIndexElement; + createElement(tagName: "kbd"): HTMLPhraseElement; + createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "label"): HTMLLabelElement; + createElement(tagName: "legend"): HTMLLegendElement; + createElement(tagName: "li"): HTMLLIElement; + createElement(tagName: "link"): HTMLLinkElement; + createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "map"): HTMLMapElement; + createElement(tagName: "mark"): HTMLElement; + createElement(tagName: "marquee"): HTMLMarqueeElement; + createElement(tagName: "menu"): HTMLMenuElement; + createElement(tagName: "meta"): HTMLMetaElement; + createElement(tagName: "nav"): HTMLElement; + createElement(tagName: "nextid"): HTMLNextIdElement; + createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "noframes"): HTMLElement; + createElement(tagName: "noscript"): HTMLElement; + createElement(tagName: "object"): HTMLObjectElement; + createElement(tagName: "ol"): HTMLOListElement; + createElement(tagName: "optgroup"): HTMLOptGroupElement; + createElement(tagName: "option"): HTMLOptionElement; + createElement(tagName: "p"): HTMLParagraphElement; + createElement(tagName: "param"): HTMLParamElement; + createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "pre"): HTMLPreElement; + createElement(tagName: "progress"): HTMLProgressElement; + createElement(tagName: "q"): HTMLQuoteElement; + createElement(tagName: "rt"): HTMLPhraseElement; + createElement(tagName: "ruby"): HTMLPhraseElement; + createElement(tagName: "s"): HTMLPhraseElement; + createElement(tagName: "samp"): HTMLPhraseElement; + createElement(tagName: "script"): HTMLScriptElement; + createElement(tagName: "section"): HTMLElement; + createElement(tagName: "select"): HTMLSelectElement; + createElement(tagName: "small"): HTMLPhraseElement; + createElement(tagName: "SOURCE"): HTMLSourceElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "strike"): HTMLPhraseElement; + createElement(tagName: "strong"): HTMLPhraseElement; + createElement(tagName: "style"): HTMLStyleElement; + createElement(tagName: "sub"): HTMLPhraseElement; + createElement(tagName: "sup"): HTMLPhraseElement; + createElement(tagName: "table"): HTMLTableElement; + createElement(tagName: "tbody"): HTMLTableSectionElement; + createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "textarea"): HTMLTextAreaElement; + createElement(tagName: "tfoot"): HTMLTableSectionElement; + createElement(tagName: "th"): HTMLTableHeaderCellElement; + createElement(tagName: "thead"): HTMLTableSectionElement; + createElement(tagName: "title"): HTMLTitleElement; + createElement(tagName: "tr"): HTMLTableRowElement; + createElement(tagName: "track"): HTMLTrackElement; + createElement(tagName: "tt"): HTMLPhraseElement; + createElement(tagName: "u"): HTMLPhraseElement; + createElement(tagName: "ul"): HTMLUListElement; + createElement(tagName: "var"): HTMLPhraseElement; + createElement(tagName: "video"): HTMLVideoElement; + createElement(tagName: "wbr"): HTMLElement; + createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; + createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: string): HTMLElement; + /** + * Removes mouse capture from the object in the current document. + */ + releaseCapture(): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): void; + createElementNS(namespaceURI: string, qualifiedName: string): Element; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): any; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): TreeWalker; + createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + getElementsByClassName(classNames: string): NodeList; + importNode(importedNode: Node, deep: boolean): Node; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Fires a specified event on the object. + * @param eventName Specifies the name of the event to fire. + * @param eventObj Object that specifies the event object from which to obtain event object properties. + */ + fireEvent(eventName: string, eventObj?: any): boolean; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "bgsound"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "SOURCE"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeList; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates a style sheet for the document. + * @param href Specifies how to add the style sheet to the document. If a file name is specified for the URL, the style information is added as a link object. If the URL contains style information, it is added to the style object. + * @param index Specifies the index that indicates where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style sheet at the end of the collection. + */ + createStyleSheet(href?: string, index?: number): CSSStyleSheet; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeList; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow: number, filter: NodeFilter, entityReferenceExpansion: boolean): NodeIterator; + /** + * Generates an event object to pass event context information when you use the fireEvent method. + * @param eventObj An object that specifies an existing event object on which to base the new object. + */ + createEventObject(eventObj?: any): MSEventObj; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + msElementsFromPoint(x: number, y: number): NodeList; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + clear(): void; + msExitFullscreen(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storagecommit", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msfullscreenerror", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msfullscreenchange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Document: { + prototype: Document; + new(): Document; +} + +interface Console { + info(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; + error(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + profile(reportName?: string): void; + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + clear(): void; + dir(value?: any, ...optionalParams: any[]): void; + profileEnd(): void; + count(countTitle?: string): void; + groupEnd(): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(): void; + group(groupTitle?: string): void; + dirxml(value: any): void; + debug(message?: string, ...optionalParams: any[]): void; + groupCollapsed(groupTitle?: string): void; + select(element: Element): void; +} +declare var Console: { + prototype: Console; + new(): Console; +} + +interface MSEventObj extends Event { + nextPage: string; + keyCode: number; + toElement: Element; + returnValue: any; + dataFld: string; + y: number; + dataTransfer: DataTransfer; + propertyName: string; + url: string; + offsetX: number; + recordset: any; + screenX: number; + buttonID: number; + wheelDelta: number; + reason: number; + origin: string; + data: string; + srcFilter: any; + boundElements: HTMLCollection; + cancelBubble: boolean; + altLeft: boolean; + behaviorCookie: number; + bookmarks: BookmarkCollection; + type: string; + repeat: boolean; + srcElement: Element; + source: Window; + fromElement: Element; + offsetY: number; + x: number; + behaviorPart: number; + qualifier: string; + altKey: boolean; + ctrlKey: boolean; + clientY: number; + shiftKey: boolean; + shiftLeft: boolean; + contentOverflow: boolean; + screenY: number; + ctrlLeft: boolean; + button: number; + srcUrn: string; + clientX: number; + actionURL: string; + getAttribute(strAttributeName: string, lFlags?: number): any; + setAttribute(strAttributeName: string, AttributeValue: any, lFlags?: number): void; + removeAttribute(strAttributeName: string, lFlags?: number): boolean; +} +declare var MSEventObj: { + prototype: MSEventObj; + new(): MSEventObj; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: string, ...args: any[]): any; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. + */ + toDataURL(type?: string, ...args: any[]): string; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; +} +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface Window extends EventTarget, MSEventAttachmentTarget, WindowLocalStorage, MSWindowExtensions, WindowSessionStorage, WindowTimers, WindowBase64, IDBEnvironment, WindowConsole, GlobalEventHandlers { + ondragend: (ev: DragEvent) => any; + onkeydown: (ev: KeyboardEvent) => any; + ondragover: (ev: DragEvent) => any; + onkeyup: (ev: KeyboardEvent) => any; + onreset: (ev: Event) => any; + onmouseup: (ev: MouseEvent) => any; + ondragstart: (ev: DragEvent) => any; + ondrag: (ev: DragEvent) => any; + screenX: number; + onmouseover: (ev: MouseEvent) => any; + ondragleave: (ev: DragEvent) => any; + history: History; + pageXOffset: number; + name: string; + onafterprint: (ev: Event) => any; + onpause: (ev: Event) => any; + onbeforeprint: (ev: Event) => any; + top: Window; + onmousedown: (ev: MouseEvent) => any; + onseeked: (ev: Event) => any; + opener: Window; + onclick: (ev: MouseEvent) => any; + innerHeight: number; + onwaiting: (ev: Event) => any; + ononline: (ev: Event) => any; + ondurationchange: (ev: Event) => any; + frames: Window; + onblur: (ev: FocusEvent) => any; + onemptied: (ev: Event) => any; + onseeking: (ev: Event) => any; + oncanplay: (ev: Event) => any; + outerWidth: number; + onstalled: (ev: Event) => any; + onmousemove: (ev: MouseEvent) => any; + innerWidth: number; + onoffline: (ev: Event) => any; + length: number; + screen: Screen; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + onratechange: (ev: Event) => any; + onstorage: (ev: StorageEvent) => any; + onloadstart: (ev: Event) => any; + ondragenter: (ev: DragEvent) => any; + onsubmit: (ev: Event) => any; + self: Window; + document: Document; + onprogress: (ev: ProgressEvent) => any; + ondblclick: (ev: MouseEvent) => any; + pageYOffset: number; + oncontextmenu: (ev: MouseEvent) => any; + onchange: (ev: Event) => any; + onloadedmetadata: (ev: Event) => any; + onplay: (ev: Event) => any; + onerror: ErrorEventHandler; + onplaying: (ev: Event) => any; + parent: Window; + location: Location; + oncanplaythrough: (ev: Event) => any; + onabort: (ev: UIEvent) => any; + onreadystatechange: (ev: Event) => any; + outerHeight: number; + onkeypress: (ev: KeyboardEvent) => any; + frameElement: Element; + onloadeddata: (ev: Event) => any; + onsuspend: (ev: Event) => any; + window: Window; + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + ontimeupdate: (ev: Event) => any; + onresize: (ev: UIEvent) => any; + onselect: (ev: UIEvent) => any; + navigator: Navigator; + styleMedia: StyleMedia; + ondrop: (ev: DragEvent) => any; + onmouseout: (ev: MouseEvent) => any; + onended: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onunload: (ev: Event) => any; + onscroll: (ev: UIEvent) => any; + screenY: number; + onmousewheel: (ev: MouseWheelEvent) => any; + onload: (ev: Event) => any; + onvolumechange: (ev: Event) => any; + oninput: (ev: Event) => any; + performance: Performance; + onmspointerdown: (ev: any) => any; + animationStartTime: number; + onmsgesturedoubletap: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmspointermove: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + msAnimationStartTime: number; + applicationCache: ApplicationCache; + onmsinertiastart: (ev: any) => any; + onmspointerover: (ev: any) => any; + onpopstate: (ev: PopStateEvent) => any; + onmspointerup: (ev: any) => any; + onpageshow: (ev: PageTransitionEvent) => any; + ondevicemotion: (ev: DeviceMotionEvent) => any; + devicePixelRatio: number; + msCrypto: Crypto; + ondeviceorientation: (ev: DeviceOrientationEvent) => any; + doNotTrack: string; + onmspointerenter: (ev: any) => any; + onpagehide: (ev: PageTransitionEvent) => any; + onmspointerleave: (ev: any) => any; + alert(message?: any): void; + scroll(x?: number, y?: number): void; + focus(): void; + scrollTo(x?: number, y?: number): void; + print(): void; + prompt(message?: string, _default?: string): string; + toString(): string; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + scrollBy(x?: number, y?: number): void; + confirm(message?: string): boolean; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; + showModalDialog(url?: string, argument?: any, options?: any): any; + blur(): void; + getSelection(): Selection; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + msCancelRequestAnimationFrame(handle: number): void; + matchMedia(mediaQuery: string): MediaQueryList; + cancelAnimationFrame(handle: number): void; + msIsStaticHTML(html: string): boolean; + msMatchMedia(mediaQuery: string): MediaQueryList; + requestAnimationFrame(callback: FrameRequestCallback): number; + msRequestAnimationFrame(callback: FrameRequestCallback): number; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Window: { + prototype: Window; + new(): Window; +} + +interface HTMLCollection extends MSHTMLCollectionExtensions { + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Retrieves an object from various collections. + */ + item(nameOrIndex?: any, optionalIndex?: any): Element; + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element; + // [name: string]: Element; + [index: number]: Element; +} +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface Blob { + type: string; + size: number; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; + msClose(): void; +} +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface NavigatorID { + appVersion: string; + appName: string; + userAgent: string; + platform: string; + product: string; + vendor: string; +} + +interface HTMLTableElement extends HTMLElement, MSDataBindingTableExtensions, MSDataBindingExtensions, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollection; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollection; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Retrieves a collection of all cells in the table row or in the entire table. + */ + cells: HTMLCollection; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLElement; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLElement; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLElement; + /** + * Moves a table row to a new position. + * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. + * @param indexTo Number that specifies where the row is moved within the rows collection. + */ + moveRow(indexFrom?: number, indexTo?: number): any; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLElement; +} +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface TreeWalker { + whatToShow: number; + filter: NodeFilter; + root: Node; + currentNode: Node; + expandEntityReferences: boolean; + previousSibling(): Node; + lastChild(): Node; + nextSibling(): Node; + nextNode(): Node; + parentNode(): Node; + firstChild(): Node; + previousNode(): Node; +} +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + y: number; + y1: number; + x: number; + x1: number; +} +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface Performance { + navigation: PerformanceNavigation; + timing: PerformanceTiming; + getEntriesByType(entryType: string): any; + toJSON(): any; + getMeasures(measureName?: string): any; + clearMarks(markName?: string): void; + getMarks(markName?: string): any; + clearResourceTimings(): void; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + getEntriesByName(name: string, entryType?: string): any; + getEntries(): any; + clearMeasures(measureName?: string): void; + setResourceTimingBufferSize(maxSize: number): void; + now(): number; +} +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface MSDataBindingTableExtensions { + dataPageSize: number; + nextPage(): void; + firstPage(): void; + refresh(): void; + previousPage(): void; + lastPage(): void; +} + +interface CompositionEvent extends UIEvent { + data: string; + locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} +declare var CompositionEvent: { + prototype: CompositionEvent; + new(): CompositionEvent; +} + +interface WindowTimers extends WindowTimersExtension { + clearTimeout(handle: number): void; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; + clearInterval(handle: number): void; + setInterval(handler: any, timeout?: any, ...args: any[]): number; +} + +interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { + orientType: SVGAnimatedEnumeration; + markerUnits: SVGAnimatedEnumeration; + markerWidth: SVGAnimatedLength; + markerHeight: SVGAnimatedLength; + orientAngle: SVGAnimatedAngle; + refY: SVGAnimatedLength; + refX: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + SVG_MARKER_ORIENT_UNKNOWN: number; + SVG_MARKER_ORIENT_ANGLE: number; + SVG_MARKERUNITS_UNKNOWN: number; + SVG_MARKERUNITS_STROKEWIDTH: number; + SVG_MARKER_ORIENT_AUTO: number; + SVG_MARKERUNITS_USERSPACEONUSE: number; +} +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + SVG_MARKER_ORIENT_UNKNOWN: number; + SVG_MARKER_ORIENT_ANGLE: number; + SVG_MARKERUNITS_UNKNOWN: number; + SVG_MARKERUNITS_STROKEWIDTH: number; + SVG_MARKER_ORIENT_AUTO: number; + SVG_MARKERUNITS_USERSPACEONUSE: number; +} + +interface CSSStyleDeclaration { + backgroundAttachment: string; + visibility: string; + textAlignLast: string; + borderRightStyle: string; + counterIncrement: string; + orphans: string; + cssText: string; + borderStyle: string; + pointerEvents: string; + borderTopColor: string; + markerEnd: string; + textIndent: string; + listStyleImage: string; + cursor: string; + listStylePosition: string; + wordWrap: string; + borderTopStyle: string; + alignmentBaseline: string; + opacity: string; + direction: string; + strokeMiterlimit: string; + maxWidth: string; + color: string; + clip: string; + borderRightWidth: string; + verticalAlign: string; + overflow: string; + mask: string; + borderLeftStyle: string; + emptyCells: string; + stopOpacity: string; + paddingRight: string; + parentRule: CSSRule; + background: string; + boxSizing: string; + textJustify: string; + height: string; + paddingTop: string; + length: number; + right: string; + baselineShift: string; + borderLeft: string; + widows: string; + lineHeight: string; + left: string; + textUnderlinePosition: string; + glyphOrientationHorizontal: string; + display: string; + textAnchor: string; + cssFloat: string; + strokeDasharray: string; + rubyAlign: string; + fontSizeAdjust: string; + borderLeftColor: string; + backgroundImage: string; + listStyleType: string; + strokeWidth: string; + textOverflow: string; + fillRule: string; + borderBottomColor: string; + zIndex: string; + position: string; + listStyle: string; + msTransformOrigin: string; + dominantBaseline: string; + overflowY: string; + fill: string; + captionSide: string; + borderCollapse: string; + boxShadow: string; + quotes: string; + tableLayout: string; + unicodeBidi: string; + borderBottomWidth: string; + backgroundSize: string; + textDecoration: string; + strokeDashoffset: string; + fontSize: string; + border: string; + pageBreakBefore: string; + borderTopRightRadius: string; + msTransform: string; + borderBottomLeftRadius: string; + textTransform: string; + rubyPosition: string; + strokeLinejoin: string; + clipPath: string; + borderRightColor: string; + fontFamily: string; + clear: string; + content: string; + backgroundClip: string; + marginBottom: string; + counterReset: string; + outlineWidth: string; + marginRight: string; + paddingLeft: string; + borderBottom: string; + wordBreak: string; + marginTop: string; + top: string; + fontWeight: string; + borderRight: string; + width: string; + kerning: string; + pageBreakAfter: string; + borderBottomStyle: string; + fontStretch: string; + padding: string; + strokeOpacity: string; + markerStart: string; + bottom: string; + borderLeftWidth: string; + clipRule: string; + backgroundPosition: string; + backgroundColor: string; + pageBreakInside: string; + backgroundOrigin: string; + strokeLinecap: string; + borderTopWidth: string; + outlineStyle: string; + borderTop: string; + outlineColor: string; + paddingBottom: string; + marginLeft: string; + font: string; + outline: string; + wordSpacing: string; + maxHeight: string; + fillOpacity: string; + letterSpacing: string; + borderSpacing: string; + backgroundRepeat: string; + borderRadius: string; + borderWidth: string; + borderBottomRightRadius: string; + whiteSpace: string; + fontStyle: string; + minWidth: string; + stopColor: string; + borderTopLeftRadius: string; + borderColor: string; + marker: string; + glyphOrientationVertical: string; + markerMid: string; + fontVariant: string; + minHeight: string; + stroke: string; + rubyOverhang: string; + overflowX: string; + textAlign: string; + margin: string; + animationFillMode: string; + floodColor: string; + animationIterationCount: string; + textShadow: string; + backfaceVisibility: string; + msAnimationIterationCount: string; + animationDelay: string; + animationTimingFunction: string; + columnWidth: any; + msScrollSnapX: string; + columnRuleColor: any; + columnRuleWidth: any; + transitionDelay: string; + transition: string; + msFlowFrom: string; + msScrollSnapType: string; + msContentZoomSnapType: string; + msGridColumns: string; + msAnimationName: string; + msGridRowAlign: string; + msContentZoomChaining: string; + msGridColumn: any; + msHyphenateLimitZone: any; + msScrollRails: string; + msAnimationDelay: string; + enableBackground: string; + msWrapThrough: string; + columnRuleStyle: string; + msAnimation: string; + msFlexFlow: string; + msScrollSnapY: string; + msHyphenateLimitLines: any; + msTouchAction: string; + msScrollLimit: string; + animation: string; + transform: string; + filter: string; + colorInterpolationFilters: string; + transitionTimingFunction: string; + msBackfaceVisibility: string; + animationPlayState: string; + transformOrigin: string; + msScrollLimitYMin: any; + msFontFeatureSettings: string; + msContentZoomLimitMin: any; + columnGap: any; + transitionProperty: string; + msAnimationDuration: string; + msAnimationFillMode: string; + msFlexDirection: string; + msTransitionDuration: string; + fontFeatureSettings: string; + breakBefore: string; + msFlexWrap: string; + perspective: string; + msFlowInto: string; + msTransformStyle: string; + msScrollTranslation: string; + msTransitionProperty: string; + msUserSelect: string; + msOverflowStyle: string; + msScrollSnapPointsY: string; + animationDirection: string; + animationDuration: string; + msFlex: string; + msTransitionTimingFunction: string; + animationName: string; + columnRule: string; + msGridColumnSpan: any; + msFlexNegative: string; + columnFill: string; + msGridRow: any; + msFlexOrder: string; + msFlexItemAlign: string; + msFlexPositive: string; + msContentZoomLimitMax: any; + msScrollLimitYMax: any; + msGridColumnAlign: string; + perspectiveOrigin: string; + lightingColor: string; + columns: string; + msScrollChaining: string; + msHyphenateLimitChars: string; + msTouchSelect: string; + floodOpacity: string; + msAnimationDirection: string; + msAnimationPlayState: string; + columnSpan: string; + msContentZooming: string; + msPerspective: string; + msFlexPack: string; + msScrollSnapPointsX: string; + msContentZoomSnapPoints: string; + msGridRowSpan: any; + msContentZoomSnap: string; + msScrollLimitXMin: any; + breakInside: string; + msHighContrastAdjust: string; + msFlexLinePack: string; + msGridRows: string; + transitionDuration: string; + msHyphens: string; + breakAfter: string; + msTransition: string; + msPerspectiveOrigin: string; + msContentZoomLimit: string; + msScrollLimitXMax: any; + msFlexAlign: string; + msWrapMargin: any; + columnCount: any; + msAnimationTimingFunction: string; + msTransitionDelay: string; + transformStyle: string; + msWrapFlow: string; + msFlexPreferredSize: string; + alignItems: string; + borderImageSource: string; + flexBasis: string; + borderImageWidth: string; + borderImageRepeat: string; + order: string; + flex: string; + alignContent: string; + msImeAlign: string; + flexShrink: string; + flexGrow: string; + borderImageSlice: string; + flexWrap: string; + borderImageOutset: string; + flexDirection: string; + touchAction: string; + flexFlow: string; + borderImage: string; + justifyContent: string; + alignSelf: string; + msTextCombineHorizontal: string; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + removeProperty(propertyName: string): string; + item(index: number): string; + [index: number]: string; + setProperty(propertyName: string, value: string, priority?: string): void; +} +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface MSStyleCSSProperties extends MSCSSProperties { + pixelWidth: number; + posHeight: number; + posLeft: number; + pixelTop: number; + pixelBottom: number; + textDecorationNone: boolean; + pixelLeft: number; + posTop: number; + posBottom: number; + textDecorationOverline: boolean; + posWidth: number; + textDecorationLineThrough: boolean; + pixelHeight: number; + textDecorationBlink: boolean; + posRight: number; + pixelRight: number; + textDecorationUnderline: boolean; +} +declare var MSStyleCSSProperties: { + prototype: MSStyleCSSProperties; + new(): MSStyleCSSProperties; +} + +interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, MSNavigatorExtensions, NavigatorGeolocation, MSNavigatorDoNotTrack, NavigatorStorageUtils, MSFileSaver { + msMaxTouchPoints: number; + msPointerEnabled: boolean; + msManipulationViewsEnabled: boolean; + pointerEnabled: boolean; + maxTouchPoints: number; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; +} +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + y: number; + x2: number; + x: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGZoomEvent extends UIEvent { + zoomRectScreen: SVGRect; + previousScale: number; + newScale: number; + previousTranslate: SVGPoint; + newTranslate: SVGPoint; +} +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface NodeSelector { + querySelectorAll(selectors: string): NodeList; + querySelector(selectors: string): Element; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { +} +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; +} +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface ClientRect { + left: number; + width: number; + right: number; + top: number; + bottom: number; + height: number; +} +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface PositionErrorCallback { + (error: PositionError): void; +} + +interface DOMImplementation { + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; + hasFeature(feature: string, version?: string): boolean; + createHTMLDocument(title: string): Document; +} +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface SVGUnitTypes { + SVG_UNIT_TYPE_UNKNOWN: number; + SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface Element extends Node, NodeSelector, ElementTraversal, GlobalEventHandlers { + scrollTop: number; + clientLeft: number; + scrollLeft: number; + tagName: string; + clientWidth: number; + scrollWidth: number; + clientHeight: number; + clientTop: number; + scrollHeight: number; + msRegionOverflow: string; + onmspointerdown: (ev: any) => any; + onmsgotpointercapture: (ev: any) => any; + onmsgesturedoubletap: (ev: any) => any; + onmspointerhover: (ev: any) => any; + onmsgesturehold: (ev: any) => any; + onmspointermove: (ev: any) => any; + onmsgesturechange: (ev: any) => any; + onmsgesturestart: (ev: any) => any; + onmspointercancel: (ev: any) => any; + onmsgestureend: (ev: any) => any; + onmsgesturetap: (ev: any) => any; + onmspointerout: (ev: any) => any; + onmsinertiastart: (ev: any) => any; + onmslostpointercapture: (ev: any) => any; + onmspointerover: (ev: any) => any; + msContentZoomFactor: number; + onmspointerup: (ev: any) => any; + onlostpointercapture: (ev: PointerEvent) => any; + onmspointerenter: (ev: any) => any; + ongotpointercapture: (ev: PointerEvent) => any; + onmspointerleave: (ev: any) => any; + getAttribute(name?: string): string; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + getBoundingClientRect(): ClientRect; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + msMatchesSelector(selectors: string): boolean; + hasAttribute(name: string): boolean; + removeAttribute(name?: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + getAttributeNode(name: string): Attr; + fireEvent(eventName: string, eventObj?: any): boolean; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "bgsound"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "SOURCE"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeList; + getClientRects(): ClientRectList; + setAttributeNode(newAttr: Attr): Attr; + removeAttributeNode(oldAttr: Attr): Attr; + setAttribute(name?: string, value?: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + msGetRegionContent(): MSRangeCollection; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + setPointerCapture(pointerId: number): void; + msGetUntransformedBounds(): ClientRect; + releasePointerCapture(pointerId: number): void; + msRequestFullscreen(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Element: { + prototype: Element; + new(): Element; +} + +interface HTMLNextIdElement extends HTMLElement { + n: string; +} +declare var HTMLNextIdElement: { + prototype: HTMLNextIdElement; + new(): HTMLNextIdElement; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y1: SVGAnimatedLength; + x2: SVGAnimatedLength; + x1: SVGAnimatedLength; + y2: SVGAnimatedLength; +} +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface HTMLParagraphElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; +} +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLAreasCollection extends HTMLCollection { + /** + * Removes an element from the collection. + */ + remove(index?: number): void; + /** + * Adds an element to the areas, controlRange, or options collection. + */ + add(element: HTMLElement, before?: any): void; +} +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { +} +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface Node extends EventTarget { + nodeType: number; + previousSibling: Node; + localName: string; + namespaceURI: string; + textContent: string; + parentNode: Node; + nextSibling: Node; + nodeValue: string; + lastChild: Node; + childNodes: NodeList; + nodeName: string; + ownerDocument: Document; + attributes: NamedNodeMap; + firstChild: Node; + prefix: string; + removeChild(oldChild: Node): Node; + appendChild(newChild: Node): Node; + isSupported(feature: string, version: string): boolean; + isEqualNode(arg: Node): boolean; + lookupPrefix(namespaceURI: string): string; + isDefaultNamespace(namespaceURI: string): boolean; + compareDocumentPosition(other: Node): number; + normalize(): void; + isSameNode(other: Node): boolean; + hasAttributes(): boolean; + lookupNamespaceURI(prefix: string): string; + cloneNode(deep?: boolean): Node; + hasChildNodes(): boolean; + replaceChild(newChild: Node, oldChild: Node): Node; + insertBefore(newChild: Node, refChild?: Node): Node; + ENTITY_REFERENCE_NODE: number; + ATTRIBUTE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + TEXT_NODE: number; + ELEMENT_NODE: number; + COMMENT_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + DOCUMENT_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + CDATA_SECTION_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_PRECEDING: number; +} +declare var Node: { + prototype: Node; + new(): Node; + ENTITY_REFERENCE_NODE: number; + ATTRIBUTE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + TEXT_NODE: number; + ELEMENT_NODE: number; + COMMENT_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + DOCUMENT_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + CDATA_SECTION_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_PRECEDING: number; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface DOML2DeprecatedListSpaceReduction { + compact: boolean; +} + +interface MSScriptHost { +} +declare var MSScriptHost: { + prototype: MSScriptHost; + new(): MSScriptHost; +} + +interface SVGClipPathElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + clipPathUnits: SVGAnimatedEnumeration; +} +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface MouseEvent extends UIEvent { + toElement: Element; + layerY: number; + fromElement: Element; + which: number; + pageX: number; + offsetY: number; + x: number; + y: number; + metaKey: boolean; + altKey: boolean; + ctrlKey: boolean; + offsetX: number; + screenX: number; + clientY: number; + shiftKey: boolean; + layerX: number; + screenY: number; + relatedTarget: EventTarget; + button: number; + pageY: number; + buttons: number; + clientX: number; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; + getModifierState(keyArg: string): boolean; +} +declare var MouseEvent: { + prototype: MouseEvent; + new(): MouseEvent; +} + +interface RangeException { + code: number; + message: string; + name: string; + toString(): string; + INVALID_NODE_TYPE_ERR: number; + BAD_BOUNDARYPOINTS_ERR: number; +} +declare var RangeException: { + prototype: RangeException; + new(): RangeException; + INVALID_NODE_TYPE_ERR: number; + BAD_BOUNDARYPOINTS_ERR: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + y: SVGAnimatedLengthList; + rotate: SVGAnimatedNumberList; + dy: SVGAnimatedLengthList; + x: SVGAnimatedLengthList; + dx: SVGAnimatedLengthList; +} +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface HTMLAppletElement extends HTMLElement, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { + width: number; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + object: string; + form: HTMLFormElement; + code: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the class identifier for the object. + */ + classid: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + contentDocument: Document; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + BaseHref: string; +} +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface TextMetrics { + width: number; +} +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface DocumentEvent { + createEvent(eventInterface: "AnimationEvent"): AnimationEvent; + createEvent(eventInterface: "CloseEvent"): CloseEvent; + createEvent(eventInterface: "CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; + createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface: "DragEvent"): DragEvent; + createEvent(eventInterface: "ErrorEvent"): ErrorEvent; + createEvent(eventInterface: "Event"): Event; + createEvent(eventInterface: "Events"): Event; + createEvent(eventInterface: "FocusEvent"): FocusEvent; + createEvent(eventInterface: "HTMLEvents"): Event; + createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface: "LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface: "MessageEvent"): MessageEvent; + createEvent(eventInterface: "MouseEvent"): MouseEvent; + createEvent(eventInterface: "MouseEvents"): MouseEvent; + createEvent(eventInterface: "MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface: "MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface: "MutationEvent"): MutationEvent; + createEvent(eventInterface: "MutationEvents"): MutationEvent; + createEvent(eventInterface: "NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface: "NavigationEvent"): NavigationEvent; + createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface: "PointerEvent"): MSPointerEvent; + createEvent(eventInterface: "PopStateEvent"): PopStateEvent; + createEvent(eventInterface: "ProgressEvent"): ProgressEvent; + createEvent(eventInterface: "StorageEvent"): StorageEvent; + createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface: "TextEvent"): TextEvent; + createEvent(eventInterface: "TrackEvent"): TrackEvent; + createEvent(eventInterface: "TransitionEvent"): TransitionEvent; + createEvent(eventInterface: "UIEvent"): UIEvent; + createEvent(eventInterface: "UIEvents"): UIEvent; + createEvent(eventInterface: "UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface: "WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface HTMLOListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { + /** + * The starting number. + */ + start: number; +} +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGAnimatedString { + animVal: string; + baseVal: string; +} +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface CDATASection extends Text { +} +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface StyleMedia { + type: string; + matchMedium(mediaquery: string): boolean; +} +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface HTMLSelectElement extends HTMLElement, MSHTMLCollectionExtensions, MSDataBindingExtensions { + options: HTMLSelectElement; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: any): void; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + [name: string]: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface TextRange { + boundingLeft: number; + htmlText: string; + offsetLeft: number; + boundingWidth: number; + boundingHeight: number; + boundingTop: number; + text: string; + offsetTop: number; + moveToPoint(x: number, y: number): void; + queryCommandValue(cmdID: string): any; + getBookmark(): string; + move(unit: string, count?: number): number; + queryCommandIndeterm(cmdID: string): boolean; + scrollIntoView(fStart?: boolean): void; + findText(string: string, count?: number, flags?: number): boolean; + execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; + getBoundingClientRect(): ClientRect; + moveToBookmark(bookmark: string): boolean; + isEqual(range: TextRange): boolean; + duplicate(): TextRange; + collapse(start?: boolean): void; + queryCommandText(cmdID: string): string; + select(): void; + pasteHTML(html: string): void; + inRange(range: TextRange): boolean; + moveEnd(unit: string, count?: number): number; + getClientRects(): ClientRectList; + moveStart(unit: string, count?: number): number; + parentElement(): Element; + queryCommandState(cmdID: string): boolean; + compareEndPoints(how: string, sourceRange: TextRange): number; + execCommandShowHelp(cmdID: string): boolean; + moveToElementText(element: Element): void; + expand(Unit: string): boolean; + queryCommandSupported(cmdID: string): boolean; + setEndPoint(how: string, SourceRange: TextRange): void; + queryCommandEnabled(cmdID: string): boolean; +} +declare var TextRange: { + prototype: TextRange; + new(): TextRange; +} + +interface SVGTests { + requiredFeatures: SVGStringList; + requiredExtensions: SVGStringList; + systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface HTMLBlockElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLBlockElement: { + prototype: HTMLBlockElement; + new(): HTMLBlockElement; +} + +interface CSSStyleSheet extends StyleSheet { + owningElement: Element; + imports: StyleSheetList; + isAlternate: boolean; + rules: MSCSSRuleList; + isPrefAlternate: boolean; + readOnly: boolean; + cssText: string; + ownerRule: CSSRule; + href: string; + cssRules: CSSRuleList; + id: string; + pages: StyleSheetPageList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + insertRule(rule: string, index?: number): number; + removeRule(lIndex: number): void; + deleteRule(index?: number): void; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + removeImport(lIndex: number): void; +} +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface MSSelection { + type: string; + typeDetail: string; + createRange(): TextRange; + clear(): void; + createRangeCollection(): TextRangeCollection; + empty(): void; +} +declare var MSSelection: { + prototype: MSSelection; + new(): MSSelection; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; +} +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface SVGPatternElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired, SVGURIReference { + patternUnits: SVGAnimatedEnumeration; + y: SVGAnimatedLength; + width: SVGAnimatedLength; + x: SVGAnimatedLength; + patternContentUnits: SVGAnimatedEnumeration; + patternTransform: SVGAnimatedTransformList; + height: SVGAnimatedLength; +} +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGAnimatedAngle { + animVal: SVGAngle; + baseVal: SVGAngle; +} +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface Selection { + isCollapsed: boolean; + anchorNode: Node; + focusNode: Node; + anchorOffset: number; + focusOffset: number; + rangeCount: number; + addRange(range: Range): void; + collapseToEnd(): void; + toString(): string; + selectAllChildren(parentNode: Node): void; + getRangeAt(index: number): Range; + collapse(parentNode: Node, offset: number): void; + removeAllRanges(): void; + collapseToStart(): void; + deleteFromDocument(): void; + removeRange(range: Range): void; +} +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { + type: string; +} +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface HTMLDDElement extends HTMLElement { + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDDElement: { + prototype: HTMLDDElement; + new(): HTMLDDElement; +} + +interface MSDataBindingRecordSetReadonlyExtensions { + recordset: any; + namedRecordset(dataMember: string, hierarchy?: any): any; +} + +interface CSSStyleRule extends CSSRule { + selectorText: string; + style: MSStyleCSSProperties; + readOnly: boolean; +} +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface NodeIterator { + whatToShow: number; + filter: NodeFilter; + root: Node; + expandEntityReferences: boolean; + nextNode(): Node; + detach(): void; + previousNode(): Node; +} +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox, SVGExternalResourcesRequired { + viewTarget: SVGStringList; +} +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; +} +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface SVGLocatable { + farthestViewportElement: SVGElement; + nearestViewportElement: SVGElement; + getBBox(): SVGRect; + getTransformToElement(element: SVGElement): SVGMatrix; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; +} +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { +} +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface ControlRangeCollection { + length: number; + queryCommandValue(cmdID: string): any; + remove(index: number): void; + add(item: Element): void; + queryCommandIndeterm(cmdID: string): boolean; + scrollIntoView(varargStart?: any): void; + item(index: number): Element; + [index: number]: Element; + execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; + addElement(item: Element): void; + queryCommandState(cmdID: string): boolean; + queryCommandSupported(cmdID: string): boolean; + queryCommandEnabled(cmdID: string): boolean; + queryCommandText(cmdID: string): string; + select(): void; +} +declare var ControlRangeCollection: { + prototype: ControlRangeCollection; + new(): ControlRangeCollection; +} + +interface MSNamespaceInfo extends MSEventAttachmentTarget { + urn: string; + onreadystatechange: (ev: Event) => any; + name: string; + readyState: string; + doImport(implementationUrl: string): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSNamespaceInfo: { + prototype: MSNamespaceInfo; + new(): MSNamespaceInfo; +} + +interface WindowSessionStorage { + sessionStorage: Storage; +} + +interface SVGAnimatedTransformList { + animVal: SVGTransformList; + baseVal: SVGTransformList; +} +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; +} +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLOptionElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + index: number; + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; +} +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; + create(): HTMLOptionElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + areas: HTMLAreasCollection; +} +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMenuElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { + type: string; +} +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface MouseWheelEvent extends MouseEvent { + wheelDelta: number; + initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; +} +declare var MouseWheelEvent: { + prototype: MouseWheelEvent; + new(): MouseWheelEvent; +} + +interface SVGFitToViewBox { + viewBox: SVGAnimatedRect; + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; +} + +interface SVGPointList { + numberOfItems: number; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; + getItem(index: number): SVGPoint; + clear(): void; + appendItem(newItem: SVGPoint): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + removeItem(index: number): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; +} +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGAnimatedLengthList { + animVal: SVGLengthList; + baseVal: SVGLengthList; +} +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedPreserveAspectRatio { + animVal: SVGPreserveAspectRatio; + baseVal: SVGPreserveAspectRatio; +} +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface MSSiteModeEvent extends Event { + buttonID: number; + actionURL: string; +} +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface DOML2DeprecatedTextFlowControl { + clear: string; +} + +interface StyleSheetPageList { + length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface MSCSSProperties extends CSSStyleDeclaration { + scrollbarShadowColor: string; + scrollbarHighlightColor: string; + layoutGridChar: string; + layoutGridType: string; + textAutospace: string; + textKashidaSpace: string; + writingMode: string; + scrollbarFaceColor: string; + backgroundPositionY: string; + lineBreak: string; + imeMode: string; + msBlockProgression: string; + layoutGridLine: string; + scrollbarBaseColor: string; + layoutGrid: string; + layoutFlow: string; + textKashida: string; + filter: string; + zoom: string; + scrollbarArrowColor: string; + behavior: string; + backgroundPositionX: string; + accelerator: string; + layoutGridMode: string; + textJustifyTrim: string; + scrollbar3dLightColor: string; + msInterpolationMode: string; + scrollbarTrackColor: string; + scrollbarDarkShadowColor: string; + styleFloat: string; + getAttribute(attributeName: string, flags?: number): any; + setAttribute(attributeName: string, AttributeValue: any, flags?: number): void; + removeAttribute(attributeName: string, flags?: number): boolean; +} +declare var MSCSSProperties: { + prototype: MSCSSProperties; + new(): MSCSSProperties; +} + +interface SVGExternalResourcesRequired { + externalResourcesRequired: SVGAnimatedBoolean; +} + +interface HTMLImageElement extends HTMLElement, MSImageResourceExtensions, MSDataBindingExtensions, MSResourceMetadata { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * The original height of the image resource before sizing. + */ + naturalHeight: number; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * The original width of the image resource before sizing. + */ + naturalWidth: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + /** + * Contains the hypertext reference (HREF) of the URL. + */ + href: string; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + complete: boolean; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + crossOrigin: string; + msPlayToPreferredSourceUri: string; +} +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; + create(): HTMLImageElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface EventTarget { + removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; +} + +interface SVGAngle { + valueAsString: string; + valueInSpecifiedUnits: number; + value: number; + unitType: number; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + SVG_ANGLETYPE_RAD: number; + SVG_ANGLETYPE_UNKNOWN: number; + SVG_ANGLETYPE_UNSPECIFIED: number; + SVG_ANGLETYPE_DEG: number; + SVG_ANGLETYPE_GRAD: number; +} +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + SVG_ANGLETYPE_RAD: number; + SVG_ANGLETYPE_UNKNOWN: number; + SVG_ANGLETYPE_UNSPECIFIED: number; + SVG_ANGLETYPE_DEG: number; + SVG_ANGLETYPE_GRAD: number; +} + +interface HTMLButtonElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + status: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; + msKeySystem: string; +} +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface KeyboardEvent extends UIEvent { + location: number; + keyCode: number; + shiftKey: boolean; + which: number; + locale: string; + key: string; + altKey: boolean; + metaKey: boolean; + char: string; + ctrlKey: boolean; + repeat: boolean; + charCode: number; + getModifierState(keyArg: string): boolean; + initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; + DOM_KEY_LOCATION_RIGHT: number; + DOM_KEY_LOCATION_STANDARD: number; + DOM_KEY_LOCATION_LEFT: number; + DOM_KEY_LOCATION_NUMPAD: number; + DOM_KEY_LOCATION_JOYSTICK: number; + DOM_KEY_LOCATION_MOBILE: number; +} +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(): KeyboardEvent; + DOM_KEY_LOCATION_RIGHT: number; + DOM_KEY_LOCATION_STANDARD: number; + DOM_KEY_LOCATION_LEFT: number; + DOM_KEY_LOCATION_NUMPAD: number; + DOM_KEY_LOCATION_JOYSTICK: number; + DOM_KEY_LOCATION_MOBILE: number; +} + +interface MessageEvent extends Event { + source: Window; + origin: string; + data: any; + ports: any; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} +declare var MessageEvent: { + prototype: MessageEvent; + new(): MessageEvent; +} + +interface SVGElement extends Element { + onmouseover: (ev: MouseEvent) => any; + viewportElement: SVGElement; + onmousemove: (ev: MouseEvent) => any; + onmouseout: (ev: MouseEvent) => any; + ondblclick: (ev: MouseEvent) => any; + onfocusout: (ev: FocusEvent) => any; + onfocusin: (ev: FocusEvent) => any; + xmlbase: string; + onmousedown: (ev: MouseEvent) => any; + onload: (ev: Event) => any; + onmouseup: (ev: MouseEvent) => any; + onclick: (ev: MouseEvent) => any; + ownerSVGElement: SVGSVGElement; + id: string; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface HTMLScriptElement extends HTMLElement { + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + async: boolean; +} +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { + /** + * Retrieves the position of the object in the rows collection for the table. + */ + rowIndex: number; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollection; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Retrieves the position of the object in the collection. + */ + sectionRowIndex: number; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLElement; +} +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface CanvasRenderingContext2D { + miterLimit: number; + font: string; + globalCompositeOperation: string; + msFillRule: string; + lineCap: string; + msImageSmoothingEnabled: boolean; + lineDashOffset: number; + shadowColor: string; + lineJoin: string; + shadowOffsetX: number; + lineWidth: number; + canvas: HTMLCanvasElement; + strokeStyle: any; + globalAlpha: number; + shadowOffsetY: number; + fillStyle: any; + shadowBlur: number; + textAlign: string; + textBaseline: string; + restore(): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + save(): void; + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + measureText(text: string): TextMetrics; + isPointInPath(x: number, y: number, fillRule?: string): boolean; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + rotate(angle: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + translate(x: number, y: number): void; + scale(x: number, y: number): void; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + lineTo(x: number, y: number): void; + getLineDash(): number[]; + fill(fillRule?: string): void; + createImageData(imageDataOrSw: any, sh?: number): ImageData; + createPattern(image: HTMLElement, repetition: string): CanvasPattern; + closePath(): void; + rect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: string): void; + clearRect(x: number, y: number, w: number, h: number): void; + moveTo(x: number, y: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + fillRect(x: number, y: number, w: number, h: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + drawImage(image: HTMLElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(): void; + strokeRect(x: number, y: number, w: number, h: number): void; + setLineDash(segments: number[]): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + beginPath(): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; +} +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface MSCSSRuleList { + length: number; + item(index?: number): CSSStyleRule; + [index: number]: CSSStyleRule; +} +declare var MSCSSRuleList: { + prototype: MSCSSRuleList; + new(): MSCSSRuleList; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + y: number; + sweepFlag: boolean; + r2: number; + x: number; + angle: number; + r1: number; + largeArcFlag: boolean; +} +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGTransformList { + numberOfItems: number; + getItem(index: number): SVGTransform; + consolidate(): SVGTransform; + clear(): void; + appendItem(newItem: SVGTransform): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + removeItem(index: number): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; +} +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; +} +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Retrieves the object of the specified. + */ + contentWindow: Window; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Raised when the object has been completely received from the server. + */ + onload: (ev: Event) => any; + /** + * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. + */ + security: any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface SVGAnimatedLength { + animVal: SVGLength; + baseVal: SVGLength; +} +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedPoints { + points: SVGPointList; + animatedPoints: SVGPointList; +} + +interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface CSSMediaRule extends CSSRule { + media: MediaList; + cssRules: CSSRuleList; + insertRule(rule: string, index?: number): number; + deleteRule(index?: number): void; +} +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface WindowModal { + dialogArguments: any; + returnValue: any; +} + +interface XMLHttpRequest extends EventTarget { + responseBody: any; + status: number; + readyState: number; + responseText: string; + responseXML: any; + ontimeout: (ev: Event) => any; + statusText: string; + onreadystatechange: (ev: Event) => any; + timeout: number; + onload: (ev: Event) => any; + response: any; + withCredentials: boolean; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: UIEvent) => any; + responseType: string; + onloadend: (ev: ProgressEvent) => any; + upload: XMLHttpRequestEventTarget; + onerror: (ev: ErrorEvent) => any; + onloadstart: (ev: Event) => any; + msCaching: string; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + send(data?: any): void; + abort(): void; + getAllResponseHeaders(): string; + setRequestHeader(header: string, value: string): void; + getResponseHeader(header: string): string; + msCachingEnabled(): boolean; + overrideMimeType(mime: string): void; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + create(): XMLHttpRequest; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; +} +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLDListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction { +} +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface MSDataBindingExtensions { + dataSrc: string; + dataFormatAs: string; + dataFld: string; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + ry: SVGAnimatedLength; + cx: SVGAnimatedLength; + rx: SVGAnimatedLength; + cy: SVGAnimatedLength; +} +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + target: SVGAnimatedString; +} +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGStylable { + className: SVGAnimatedString; + style: CSSStyleDeclaration; +} + +interface SVGTransformable extends SVGLocatable { + transform: SVGAnimatedTransformList; +} + +interface HTMLFrameSetElement extends HTMLElement { + ononline: (ev: Event) => any; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Fires when the object loses the input focus. + */ + onblur: (ev: FocusEvent) => any; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Fires when the object receives focus. + */ + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + onerror: (ev: ErrorEvent) => any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + onresize: (ev: UIEvent) => any; + name: string; + onafterprint: (ev: Event) => any; + onbeforeprint: (ev: Event) => any; + onoffline: (ev: Event) => any; + border: string; + onunload: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onload: (ev: Event) => any; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + onstorage: (ev: StorageEvent) => any; + onpageshow: (ev: PageTransitionEvent) => any; + onpagehide: (ev: PageTransitionEvent) => any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface Screen extends EventTarget { + width: number; + deviceXDPI: number; + fontSmoothingEnabled: boolean; + bufferDepth: number; + logicalXDPI: number; + systemXDPI: number; + availHeight: number; + height: number; + logicalYDPI: number; + systemYDPI: number; + updateInterval: number; + colorDepth: number; + availWidth: number; + deviceYDPI: number; + pixelDepth: number; + msOrientation: string; + onmsorientationchange: (ev: any) => any; + msLockOrientation(orientation: string): boolean; + msLockOrientation(orientations: string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: "msorientationchange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface Coordinates { + altitudeAccuracy: number; + longitude: number; + latitude: number; + speed: number; + heading: number; + altitude: number; + accuracy: number; +} +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface NavigatorGeolocation { + geolocation: Geolocation; +} + +interface NavigatorContentUtils { +} + +interface EventListener { + (evt: Event): void; +} + +interface SVGLangSpace { + xmllang: string; + xmlspace: string; +} + +interface DataTransfer { + effectAllowed: string; + dropEffect: string; + types: DOMStringList; + files: FileList; + clearData(format?: string): boolean; + setData(format: string, data: string): boolean; + getData(format: string): string; +} +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface FocusEvent extends UIEvent { + relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} +declare var FocusEvent: { + prototype: FocusEvent; + new(): FocusEvent; +} + +interface Range { + startOffset: number; + collapsed: boolean; + endOffset: number; + startContainer: Node; + endContainer: Node; + commonAncestorContainer: Node; + setStart(refNode: Node, offset: number): void; + setEndBefore(refNode: Node): void; + setStartBefore(refNode: Node): void; + selectNode(refNode: Node): void; + detach(): void; + getBoundingClientRect(): ClientRect; + toString(): string; + compareBoundaryPoints(how: number, sourceRange: Range): number; + insertNode(newNode: Node): void; + collapse(toStart: boolean): void; + selectNodeContents(refNode: Node): void; + cloneContents(): DocumentFragment; + setEnd(refNode: Node, offset: number): void; + cloneRange(): Range; + getClientRects(): ClientRectList; + surroundContents(newParent: Node): void; + deleteContents(): void; + setStartAfter(refNode: Node): void; + extractContents(): DocumentFragment; + setEndAfter(refNode: Node): void; + createContextualFragment(fragment: string): DocumentFragment; + END_TO_END: number; + START_TO_START: number; + START_TO_END: number; + END_TO_START: number; +} +declare var Range: { + prototype: Range; + new(): Range; + END_TO_END: number; + START_TO_START: number; + START_TO_END: number; + END_TO_START: number; +} + +interface SVGPoint { + y: number; + x: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface MSPluginsCollection { + length: number; + refresh(reload?: boolean): void; +} +declare var MSPluginsCollection: { + prototype: MSPluginsCollection; + new(): MSPluginsCollection; +} + +interface SVGAnimatedNumberList { + animVal: SVGNumberList; + baseVal: SVGNumberList; +} +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGSVGElement extends SVGElement, SVGStylable, SVGZoomAndPan, DocumentEvent, SVGLangSpace, SVGLocatable, SVGTests, SVGFitToViewBox, SVGExternalResourcesRequired { + width: SVGAnimatedLength; + x: SVGAnimatedLength; + contentStyleType: string; + onzoom: (ev: any) => any; + y: SVGAnimatedLength; + viewport: SVGRect; + onerror: (ev: ErrorEvent) => any; + pixelUnitToMillimeterY: number; + onresize: (ev: UIEvent) => any; + screenPixelToMillimeterY: number; + height: SVGAnimatedLength; + onabort: (ev: UIEvent) => any; + contentScriptType: string; + pixelUnitToMillimeterX: number; + currentTranslate: SVGPoint; + onunload: (ev: Event) => any; + currentScale: number; + onscroll: (ev: UIEvent) => any; + screenPixelToMillimeterX: number; + setCurrentTime(seconds: number): void; + createSVGLength(): SVGLength; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + unpauseAnimations(): void; + createSVGRect(): SVGRect; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + unsuspendRedrawAll(): void; + pauseAnimations(): void; + suspendRedraw(maxWaitMilliseconds: number): number; + deselectAll(): void; + createSVGAngle(): SVGAngle; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; + createSVGTransform(): SVGTransform; + unsuspendRedraw(suspendHandleID: number): void; + forceRedraw(): void; + getCurrentTime(): number; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + createSVGMatrix(): SVGMatrix; + createSVGPoint(): SVGPoint; + createSVGNumber(): SVGNumber; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getElementById(elementId: string): Element; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "zoom", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface HTMLLabelElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface MSResourceMetadata { + protocol: string; + fileSize: string; + fileUpdatedDate: string; + nameProp: string; + fileCreatedDate: string; + fileModifiedDate: string; + mimeType: string; +} + +interface HTMLLegendElement extends HTMLElement, MSDataBindingExtensions { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLDirectoryElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { +} +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface SVGAnimatedInteger { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { +} +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { +} +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface HTMLLIElement extends HTMLElement, DOML2DeprecatedListNumberingAndBulletStyle { + /** + * Sets or retrieves the value of a list item. + */ + value: number; +} +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface MSStorageExtensions { + remainingSpace: number; +} + +interface SVGStyleElement extends SVGElement, SVGLangSpace { + media: string; + type: string; + title: string; +} +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface MSCurrentStyleCSSProperties extends MSCSSProperties { + blockDirection: string; + clipBottom: string; + clipLeft: string; + clipRight: string; + clipTop: string; + hasLayout: string; +} +declare var MSCurrentStyleCSSProperties: { + prototype: MSCurrentStyleCSSProperties; + new(): MSCurrentStyleCSSProperties; +} + +interface MSHTMLCollectionExtensions { + urns(urn: any): any; + tags(tagName: any): any; +} + +interface Storage extends MSStorageExtensions { + length: number; + getItem(key: string): any; + [key: string]: any; + setItem(key: string, data: string): void; + clear(): void; + removeItem(key: string): void; + key(index: number): string; + [index: number]: string; +} +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Retrieves the object of the specified. + */ + contentWindow: Window; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. + */ + security: any; + /** + * Raised when the object has been completely received from the server. + */ + onload: (ev: Event) => any; + sandbox: DOMSettableTokenList; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface TextRangeCollection { + length: number; + item(index: number): TextRange; + [index: number]: TextRange; +} +declare var TextRangeCollection: { + prototype: TextRangeCollection; + new(): TextRangeCollection; +} + +interface HTMLBodyElement extends HTMLElement, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + scroll: string; + ononline: (ev: Event) => any; + onblur: (ev: FocusEvent) => any; + noWrap: boolean; + onfocus: (ev: FocusEvent) => any; + onmessage: (ev: MessageEvent) => any; + text: any; + onerror: (ev: ErrorEvent) => any; + bgProperties: string; + onresize: (ev: UIEvent) => any; + link: any; + aLink: any; + bottomMargin: any; + topMargin: any; + onafterprint: (ev: Event) => any; + vLink: any; + onbeforeprint: (ev: Event) => any; + onoffline: (ev: Event) => any; + onunload: (ev: Event) => any; + onhashchange: (ev: Event) => any; + onload: (ev: Event) => any; + rightMargin: any; + onbeforeunload: (ev: BeforeUnloadEvent) => any; + leftMargin: any; + onstorage: (ev: StorageEvent) => any; + onpopstate: (ev: PopStateEvent) => any; + onpageshow: (ev: PageTransitionEvent) => any; + onpagehide: (ev: PageTransitionEvent) => any; + createTextRange(): TextRange; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface DocumentType extends Node { + name: string; + notations: NamedNodeMap; + systemId: string; + internalSubset: string; + entities: NamedNodeMap; + publicId: string; +} +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + cx: SVGAnimatedLength; + r: SVGAnimatedLength; + cy: SVGAnimatedLength; + fx: SVGAnimatedLength; + fy: SVGAnimatedLength; +} +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface MutationEvent extends Event { + newValue: string; + attrChange: number; + attrName: string; + prevValue: string; + relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + MODIFICATION: number; + REMOVAL: number; + ADDITION: number; +} +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + MODIFICATION: number; + REMOVAL: number; + ADDITION: number; +} + +interface DragEvent extends MouseEvent { + dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollection; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Moves a table row to a new position. + * @param indexFrom Number that specifies the index in the rows collection of the table row that is moved. + * @param indexTo Number that specifies where the row is moved within the rows collection. + */ + moveRow(indexFrom?: number, indexTo?: number): any; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLElement; +} +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface DOML2DeprecatedListNumberingAndBulletStyle { + type: string; +} + +interface HTMLInputElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + status: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + indeterminate: boolean; + readOnly: boolean; + size: number; + loop: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Sets or retrieves the URL of the virtual reality modeling language (VRML) world to be displayed in the window. + */ + vrml: string; + /** + * Sets or retrieves a lower resolution image to display. + */ + lowsrc: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + dynsrc: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + /** + * Retrieves whether the object is fully loaded. + */ + complete: boolean; + start: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a FileList object on a file type input object. + */ + files: FileList; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + list: HTMLElement; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLAnchorElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + Methods: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + protocolLong: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + nameProp: string; + urn: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + type: string; + mimeType: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; +} +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGAnimatedNumber { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface PerformanceTiming { + redirectStart: number; + domainLookupEnd: number; + responseStart: number; + domComplete: number; + domainLookupStart: number; + loadEventStart: number; + msFirstPaint: number; + unloadEventEnd: number; + fetchStart: number; + requestStart: number; + domInteractive: number; + navigationStart: number; + connectEnd: number; + loadEventEnd: number; + connectStart: number; + responseEnd: number; + domLoading: number; + redirectEnd: number; + unloadEventStart: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + toJSON(): any; +} +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface HTMLPreElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; + /** + * Indicates a citation by rendering text in italic type. + */ + cite: string; +} +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface EventException { + code: number; + message: string; + name: string; + toString(): string; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} +declare var EventException: { + prototype: EventException; + new(): EventException; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} + +interface MSNavigatorDoNotTrack { + msDoNotTrack: string; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; +} + +interface NavigatorOnLine { + onLine: boolean; +} + +interface WindowLocalStorage { + localStorage: Storage; +} + +interface SVGMetadataElement extends SVGElement { +} +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + y: number; + sweepFlag: boolean; + r2: number; + x: number; + angle: number; + r1: number; + largeArcFlag: boolean; +} +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGStringList { + numberOfItems: number; + replaceItem(newItem: string, index: number): string; + getItem(index: number): string; + clear(): void; + appendItem(newItem: string): string; + initialize(newItem: string): string; + removeItem(index: number): string; + insertItemBefore(newItem: string, index: number): string; +} +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface XDomainRequest { + timeout: number; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onprogress: (ev: ProgressEvent) => any; + ontimeout: (ev: Event) => any; + responseText: string; + contentType: string; + open(method: string, url: string): void; + abort(): void; + send(data?: any): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XDomainRequest: { + prototype: XDomainRequest; + new(): XDomainRequest; + create(): XDomainRequest; +} + +interface DOML2DeprecatedBackgroundColorStyle { + bgColor: any; +} + +interface ElementTraversal { + childElementCount: number; + previousElementSibling: Element; + lastElementChild: Element; + nextElementSibling: Element; + firstElementChild: Element; +} + +interface SVGLength { + valueAsString: string; + valueInSpecifiedUnits: number; + value: number; + unitType: number; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + SVG_LENGTHTYPE_NUMBER: number; + SVG_LENGTHTYPE_CM: number; + SVG_LENGTHTYPE_PC: number; + SVG_LENGTHTYPE_PERCENTAGE: number; + SVG_LENGTHTYPE_MM: number; + SVG_LENGTHTYPE_PT: number; + SVG_LENGTHTYPE_IN: number; + SVG_LENGTHTYPE_EMS: number; + SVG_LENGTHTYPE_PX: number; + SVG_LENGTHTYPE_UNKNOWN: number; + SVG_LENGTHTYPE_EXS: number; +} +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + SVG_LENGTHTYPE_NUMBER: number; + SVG_LENGTHTYPE_CM: number; + SVG_LENGTHTYPE_PC: number; + SVG_LENGTHTYPE_PERCENTAGE: number; + SVG_LENGTHTYPE_MM: number; + SVG_LENGTHTYPE_PT: number; + SVG_LENGTHTYPE_IN: number; + SVG_LENGTHTYPE_EMS: number; + SVG_LENGTHTYPE_PX: number; + SVG_LENGTHTYPE_UNKNOWN: number; + SVG_LENGTHTYPE_EXS: number; +} + +interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface HTMLPhraseElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLPhraseElement: { + prototype: HTMLPhraseElement; + new(): HTMLPhraseElement; +} + +interface NavigatorStorageUtils { +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + y: number; + y1: number; + x2: number; + x: number; + x1: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGTextContentElement extends SVGElement, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + textLength: SVGAnimatedLength; + lengthAdjust: SVGAnimatedEnumeration; + getCharNumAtPosition(point: SVGPoint): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getComputedTextLength(): number; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getEndPositionOfChar(charnum: number): SVGPoint; + LENGTHADJUST_SPACING: number; + LENGTHADJUST_SPACINGANDGLYPHS: number; + LENGTHADJUST_UNKNOWN: number; +} +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + LENGTHADJUST_SPACING: number; + LENGTHADJUST_SPACINGANDGLYPHS: number; + LENGTHADJUST_UNKNOWN: number; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface Location { + hash: string; + protocol: string; + search: string; + href: string; + hostname: string; + port: string; + pathname: string; + host: string; + reload(flag?: boolean): void; + replace(url: string): void; + assign(url: string): void; + toString(): string; +} +declare var Location: { + prototype: Location; + new(): Location; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; +} +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; +} +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface PerformanceEntry { + name: string; + startTime: number; + duration: number; + entryType: string; +} +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface SVGTransform { + type: number; + angle: number; + matrix: SVGMatrix; + setTranslate(tx: number, ty: number): void; + setScale(sx: number, sy: number): void; + setMatrix(matrix: SVGMatrix): void; + setSkewY(angle: number): void; + setRotate(angle: number, cx: number, cy: number): void; + setSkewX(angle: number): void; + SVG_TRANSFORM_SKEWX: number; + SVG_TRANSFORM_UNKNOWN: number; + SVG_TRANSFORM_SCALE: number; + SVG_TRANSFORM_TRANSLATE: number; + SVG_TRANSFORM_MATRIX: number; + SVG_TRANSFORM_ROTATE: number; + SVG_TRANSFORM_SKEWY: number; +} +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + SVG_TRANSFORM_SKEWX: number; + SVG_TRANSFORM_UNKNOWN: number; + SVG_TRANSFORM_SCALE: number; + SVG_TRANSFORM_TRANSLATE: number; + SVG_TRANSFORM_MATRIX: number; + SVG_TRANSFORM_ROTATE: number; + SVG_TRANSFORM_SKEWY: number; +} + +interface UIEvent extends Event { + detail: number; + view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} +declare var UIEvent: { + prototype: UIEvent; + new(): UIEvent; +} + +interface SVGURIReference { + href: SVGAnimatedString; +} + +interface SVGPathSeg { + pathSegType: number; + pathSegTypeAsLetter: string; + PATHSEG_MOVETO_REL: number; + PATHSEG_LINETO_VERTICAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + PATHSEG_CURVETO_QUADRATIC_REL: number; + PATHSEG_CURVETO_CUBIC_ABS: number; + PATHSEG_LINETO_HORIZONTAL_ABS: number; + PATHSEG_CURVETO_QUADRATIC_ABS: number; + PATHSEG_LINETO_ABS: number; + PATHSEG_CLOSEPATH: number; + PATHSEG_LINETO_HORIZONTAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + PATHSEG_LINETO_REL: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + PATHSEG_ARC_REL: number; + PATHSEG_CURVETO_CUBIC_REL: number; + PATHSEG_UNKNOWN: number; + PATHSEG_LINETO_VERTICAL_ABS: number; + PATHSEG_ARC_ABS: number; + PATHSEG_MOVETO_ABS: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; +} +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + PATHSEG_MOVETO_REL: number; + PATHSEG_LINETO_VERTICAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + PATHSEG_CURVETO_QUADRATIC_REL: number; + PATHSEG_CURVETO_CUBIC_ABS: number; + PATHSEG_LINETO_HORIZONTAL_ABS: number; + PATHSEG_CURVETO_QUADRATIC_ABS: number; + PATHSEG_LINETO_ABS: number; + PATHSEG_CLOSEPATH: number; + PATHSEG_LINETO_HORIZONTAL_REL: number; + PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + PATHSEG_LINETO_REL: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + PATHSEG_ARC_REL: number; + PATHSEG_CURVETO_CUBIC_REL: number; + PATHSEG_UNKNOWN: number; + PATHSEG_LINETO_VERTICAL_ABS: number; + PATHSEG_ARC_ABS: number; + PATHSEG_MOVETO_ABS: number; + PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; +} + +interface WheelEvent extends MouseEvent { + deltaZ: number; + deltaX: number; + deltaMode: number; + deltaY: number; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + getCurrentPoint(element: Element): void; + DOM_DELTA_PIXEL: number; + DOM_DELTA_LINE: number; + DOM_DELTA_PAGE: number; +} +declare var WheelEvent: { + prototype: WheelEvent; + new(): WheelEvent; + DOM_DELTA_PIXEL: number; + DOM_DELTA_LINE: number; + DOM_DELTA_PAGE: number; +} + +interface MSEventAttachmentTarget { + attachEvent(event: string, listener: EventListener): boolean; + detachEvent(event: string, listener: EventListener): void; +} + +interface SVGNumber { + value: number; +} +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGPathElement extends SVGElement, SVGStylable, SVGAnimatedPathData, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + getTotalLength(): number; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; +} +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface MSCompatibleInfo { + version: string; + userAgent: string; +} +declare var MSCompatibleInfo: { + prototype: MSCompatibleInfo; + new(): MSCompatibleInfo; +} + +interface Text extends CharacterData, MSNodeExtensions { + wholeText: string; + splitText(offset: number): Text; + replaceWholeText(content: string): Text; +} +declare var Text: { + prototype: Text; + new(): Text; +} + +interface SVGAnimatedRect { + animVal: SVGRect; + baseVal: SVGRect; +} +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface CSSNamespaceRule extends CSSRule { + namespaceURI: string; + prefix: string; +} +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface SVGPathSegList { + numberOfItems: number; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; + getItem(index: number): SVGPathSeg; + clear(): void; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; +} +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface HTMLUnknownElement extends HTMLElement, MSDataBindingRecordSetReadonlyExtensions { +} +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLAudioElement extends HTMLMediaElement { +} +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface MSImageResourceExtensions { + dynsrc: string; + vrml: string; + lowsrc: string; + start: string; + loop: number; +} + +interface PositionError { + code: number; + message: string; + toString(): string; + POSITION_UNAVAILABLE: number; + PERMISSION_DENIED: number; + TIMEOUT: number; +} +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + POSITION_UNAVAILABLE: number; + PERMISSION_DENIED: number; + TIMEOUT: number; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + cellIndex: number; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorLight: any; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the color for one of the two colors used to draw the 3-D border of the object. + */ + borderColorDark: any; +} +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface SVGElementInstance extends EventTarget { + previousSibling: SVGElementInstance; + parentNode: SVGElementInstance; + lastChild: SVGElementInstance; + nextSibling: SVGElementInstance; + childNodes: SVGElementInstanceList; + correspondingUseElement: SVGUseElement; + correspondingElement: SVGElement; + firstChild: SVGElementInstance; +} +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface MSNamespaceInfoCollection { + length: number; + add(namespace?: string, urn?: string, implementationUrl?: any): any; + item(index: any): any; + // [index: any]: any; +} +declare var MSNamespaceInfoCollection: { + prototype: MSNamespaceInfoCollection; + new(): MSNamespaceInfoCollection; +} + +interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + cx: SVGAnimatedLength; + r: SVGAnimatedLength; + cy: SVGAnimatedLength; +} +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface StyleSheetList { + length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface CSSImportRule extends CSSRule { + styleSheet: CSSStyleSheet; + href: string; + media: MediaList; +} +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CustomEvent extends Event { + detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} +declare var CustomEvent: { + prototype: CustomEvent; + new(): CustomEvent; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; +} +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLTextAreaElement extends HTMLElement, MSDataBindingExtensions { + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Retrieves the type of control. + */ + type: string; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Creates a TextRange object for the element. + */ + createTextRange(): TextRange; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface DOML2DeprecatedMarginStyle { + vspace: number; + hspace: number; +} + +interface MSWindowModeless { + dialogTop: any; + dialogLeft: any; + dialogWidth: any; + dialogHeight: any; + menuArguments: any; +} + +interface DOML2DeprecatedAlignmentStyle { + align: string; +} + +interface HTMLMarqueeElement extends HTMLElement, MSDataBindingExtensions, DOML2DeprecatedBackgroundColorStyle { + width: string; + onbounce: (ev: Event) => any; + vspace: number; + trueSpeed: boolean; + scrollAmount: number; + scrollDelay: number; + behavior: string; + height: string; + loop: number; + direction: string; + hspace: number; + onstart: (ev: Event) => any; + onfinish: (ev: Event) => any; + stop(): void; + start(): void; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "start", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface SVGRect { + y: number; + width: number; + x: number; + height: number; +} +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface MSNodeExtensions { + swapNode(otherNode: Node): Node; + removeNode(deep?: boolean): Node; + replaceNode(replacement: Node): Node; +} + +interface History { + length: number; + state: any; + back(distance?: any): void; + forward(distance?: any): void; + go(delta?: any): void; + replaceState(statedata: any, title: string, url?: string): void; + pushState(statedata: any, title: string, url?: string): void; +} +declare var History: { + prototype: History; + new(): History; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + y: number; + y1: number; + x2: number; + x: number; + x1: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + y: number; + y1: number; + x: number; + x1: number; +} +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface TimeRanges { + length: number; + start(index: number): number; + end(index: number): number; +} +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface CSSRule { + cssText: string; + parentStyleSheet: CSSStyleSheet; + parentRule: CSSRule; + type: number; + IMPORT_RULE: number; + MEDIA_RULE: number; + STYLE_RULE: number; + NAMESPACE_RULE: number; + PAGE_RULE: number; + UNKNOWN_RULE: number; + FONT_FACE_RULE: number; + CHARSET_RULE: number; + KEYFRAMES_RULE: number; + KEYFRAME_RULE: number; + VIEWPORT_RULE: number; +} +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + IMPORT_RULE: number; + MEDIA_RULE: number; + STYLE_RULE: number; + NAMESPACE_RULE: number; + PAGE_RULE: number; + UNKNOWN_RULE: number; + FONT_FACE_RULE: number; + CHARSET_RULE: number; + KEYFRAMES_RULE: number; + KEYFRAME_RULE: number; + VIEWPORT_RULE: number; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface SVGMatrix { + e: number; + c: number; + a: number; + b: number; + d: number; + f: number; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + flipY(): SVGMatrix; + skewY(angle: number): SVGMatrix; + inverse(): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + rotate(angle: number): SVGMatrix; + flipX(): SVGMatrix; + translate(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + skewX(angle: number): SVGMatrix; +} +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface MSPopupWindow { + document: Document; + isOpen: boolean; + show(x: number, y: number, w: number, h: number, element?: any): void; + hide(): void; +} +declare var MSPopupWindow: { + prototype: MSPopupWindow; + new(): MSPopupWindow; +} + +interface BeforeUnloadEvent extends Event { + returnValue: string; +} +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired, SVGURIReference { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + animatedInstanceRoot: SVGElementInstance; + instanceRoot: SVGElementInstance; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface Event { + timeStamp: number; + defaultPrevented: boolean; + isTrusted: boolean; + currentTarget: EventTarget; + cancelBubble: boolean; + target: EventTarget; + eventPhase: number; + cancelable: boolean; + type: string; + srcElement: Element; + bubbles: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + stopPropagation(): void; + stopImmediatePropagation(): void; + preventDefault(): void; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} +declare var Event: { + prototype: Event; + new(): Event; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} + +interface ImageData { + width: number; + data: number[]; + height: number; +} +declare var ImageData: { + prototype: ImageData; + new(): ImageData; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the width of the object. + */ + width: any; + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; +} +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface SVGException { + code: number; + message: string; + name: string; + toString(): string; + SVG_MATRIX_NOT_INVERTABLE: number; + SVG_WRONG_TYPE_ERR: number; + SVG_INVALID_VALUE_ERR: number; +} +declare var SVGException: { + prototype: SVGException; + new(): SVGException; + SVG_MATRIX_NOT_INVERTABLE: number; + SVG_WRONG_TYPE_ERR: number; + SVG_INVALID_VALUE_ERR: number; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + y1: SVGAnimatedLength; + x2: SVGAnimatedLength; + x1: SVGAnimatedLength; + y2: SVGAnimatedLength; +} +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; +} + +interface SVGAnimatedEnumeration { + animVal: number; + baseVal: number; +} +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface HTMLUListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle { +} +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + ry: SVGAnimatedLength; + rx: SVGAnimatedLength; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface ErrorEventHandler { + (event: Event, source: string, fileno: number, columnNumber: number): void; +} + +interface HTMLDivElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface DOML2DeprecatedBorderStyle { + border: string; +} + +interface NamedNodeMap { + length: number; + removeNamedItemNS(namespaceURI: string, localName: string): Attr; + item(index: number): Attr; + [index: number]: Attr; + removeNamedItem(name: string): Attr; + getNamedItem(name: string): Attr; + // [name: string]: Attr; + setNamedItem(arg: Attr): Attr; + getNamedItemNS(namespaceURI: string, localName: string): Attr; + setNamedItemNS(arg: Attr): Attr; +} +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface MediaList { + length: number; + mediaText: string; + deleteMedium(oldMedium: string): void; + appendMedium(newMedium: string): void; + item(index: number): string; + [index: number]: string; + toString(): string; +} +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + y: number; + x2: number; + x: number; + y2: number; +} +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGLengthList { + numberOfItems: number; + replaceItem(newItem: SVGLength, index: number): SVGLength; + getItem(index: number): SVGLength; + clear(): void; + appendItem(newItem: SVGLength): SVGLength; + initialize(newItem: SVGLength): SVGLength; + removeItem(index: number): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; +} +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface ProcessingInstruction extends Node { + target: string; + data: string; +} +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface MSWindowExtensions { + status: string; + onmouseleave: (ev: MouseEvent) => any; + screenLeft: number; + offscreenBuffering: any; + maxConnectionsPerServer: number; + onmouseenter: (ev: MouseEvent) => any; + clipboardData: DataTransfer; + defaultStatus: string; + clientInformation: Navigator; + closed: boolean; + onhelp: (ev: Event) => any; + external: External; + event: MSEventObj; + onfocusout: (ev: FocusEvent) => any; + screenTop: number; + onfocusin: (ev: FocusEvent) => any; + showModelessDialog(url?: string, argument?: any, options?: any): Window; + navigate(url: string): void; + resizeBy(x?: number, y?: number): void; + item(index: any): any; + resizeTo(x?: number, y?: number): void; + createPopup(arguments?: any): MSPopupWindow; + toStaticHTML(html: string): string; + execScript(code: string, language?: string): any; + msWriteProfilerMark(profilerMarkName: string): void; + moveTo(x?: number, y?: number): void; + moveBy(x?: number, y?: number): void; + showHelp(url: string, helpArg?: any, features?: string): void; + captureEvents(): void; + releaseEvents(): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface MSBehaviorUrnsCollection { + length: number; + item(index: number): string; +} +declare var MSBehaviorUrnsCollection: { + prototype: MSBehaviorUrnsCollection; + new(): MSBehaviorUrnsCollection; +} + +interface CSSFontFaceRule extends CSSRule { + style: CSSStyleDeclaration; +} +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface DOML2DeprecatedBackgroundStyle { + background: string; +} + +interface TextEvent extends UIEvent { + inputMethod: number; + data: string; + locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + DOM_INPUT_METHOD_KEYBOARD: number; + DOM_INPUT_METHOD_DROP: number; + DOM_INPUT_METHOD_IME: number; + DOM_INPUT_METHOD_SCRIPT: number; + DOM_INPUT_METHOD_VOICE: number; + DOM_INPUT_METHOD_UNKNOWN: number; + DOM_INPUT_METHOD_PASTE: number; + DOM_INPUT_METHOD_HANDWRITING: number; + DOM_INPUT_METHOD_OPTION: number; + DOM_INPUT_METHOD_MULTIMODAL: number; +} +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + DOM_INPUT_METHOD_KEYBOARD: number; + DOM_INPUT_METHOD_DROP: number; + DOM_INPUT_METHOD_IME: number; + DOM_INPUT_METHOD_SCRIPT: number; + DOM_INPUT_METHOD_VOICE: number; + DOM_INPUT_METHOD_UNKNOWN: number; + DOM_INPUT_METHOD_PASTE: number; + DOM_INPUT_METHOD_HANDWRITING: number; + DOM_INPUT_METHOD_OPTION: number; + DOM_INPUT_METHOD_MULTIMODAL: number; +} + +interface DocumentFragment extends Node, NodeSelector, MSEventAttachmentTarget, MSNodeExtensions { +} +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGAnimatedPathData { + pathSegList: SVGPathSegList; +} + +interface Position { + timestamp: Date; + coords: Coordinates; +} +declare var Position: { + prototype: Position; + new(): Position; +} + +interface BookmarkCollection { + length: number; + item(index: number): any; + [index: number]: any; +} +declare var BookmarkCollection: { + prototype: BookmarkCollection; + new(): BookmarkCollection; +} + +interface PerformanceMark extends PerformanceEntry { +} +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface CSSPageRule extends CSSRule { + pseudoClass: string; + selectorText: string; + selector: string; + style: CSSStyleDeclaration; +} +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; +} +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface MSNavigatorExtensions { + userLanguage: string; + plugins: MSPluginsCollection; + cookieEnabled: boolean; + appCodeName: string; + cpuClass: string; + appMinorVersion: string; + connectionSpeed: number; + browserLanguage: string; + mimeTypes: MSMimeTypesCollection; + systemLanguage: string; + language: string; + javaEnabled(): boolean; + taintEnabled(): boolean; +} + +interface HTMLSpanElement extends HTMLElement, MSDataBindingExtensions { +} +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; +} +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement, DOML2DeprecatedTextFlowControl { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; +} +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLFormElement extends HTMLElement, MSHTMLCollectionExtensions { + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + elements: HTMLCollection; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + [name: string]: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; +} +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface SVGZoomAndPan { + zoomAndPan: number; + SVG_ZOOMANDPAN_MAGNIFY: number; + SVG_ZOOMANDPAN_UNKNOWN: number; + SVG_ZOOMANDPAN_DISABLE: number; +} +declare var SVGZoomAndPan: SVGZoomAndPan; + +interface HTMLMediaElement extends HTMLElement { + /** + * Gets the earliest possible position, in seconds, that the playback can begin. + */ + initialTime: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + played: TimeRanges; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + currentSrc: string; + readyState: any; + /** + * The autobuffer element is not supported by Internet Explorer 9. Use the preload element instead. + */ + autobuffer: boolean; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + /** + * Gets information about whether the playback has ended or not. + */ + ended: boolean; + /** + * Gets a collection of buffered time ranges. + */ + buffered: TimeRanges; + /** + * Returns an object representing the current error state of the audio or video element. + */ + error: MediaError; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + seekable: TimeRanges; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + duration: number; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Gets a flag that specifies whether playback is paused. + */ + paused: boolean; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + seeking: boolean; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + /** + * Gets the current network activity for the element. + */ + networkState: number; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + textTracks: TextTrackList; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + audioTracks: AudioTrackList; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + msKeys: MSMediaKeys; + msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + /** + * Fires immediately after the client loads the object. + */ + load(): void; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + HAVE_METADATA: number; + HAVE_CURRENT_DATA: number; + HAVE_NOTHING: number; + NETWORK_NO_SOURCE: number; + HAVE_ENOUGH_DATA: number; + NETWORK_EMPTY: number; + NETWORK_LOADING: number; + NETWORK_IDLE: number; + HAVE_FUTURE_DATA: number; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + HAVE_METADATA: number; + HAVE_CURRENT_DATA: number; + HAVE_NOTHING: number; + NETWORK_NO_SOURCE: number; + HAVE_ENOUGH_DATA: number; + NETWORK_EMPTY: number; + NETWORK_LOADING: number; + NETWORK_IDLE: number; + HAVE_FUTURE_DATA: number; +} + +interface ElementCSSInlineStyle { + runtimeStyle: MSStyleCSSProperties; + currentStyle: MSCurrentStyleCSSProperties; + doScroll(component?: any): void; + componentFromPoint(x: number, y: number): string; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface MSMimeTypesCollection { + length: number; +} +declare var MSMimeTypesCollection: { + prototype: MSMimeTypesCollection; + new(): MSMimeTypesCollection; +} + +interface StyleSheet { + disabled: boolean; + ownerNode: Node; + parentStyleSheet: StyleSheet; + href: string; + media: MediaList; + type: string; + title: string; +} +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + startOffset: SVGAnimatedLength; + method: SVGAnimatedEnumeration; + spacing: SVGAnimatedEnumeration; + TEXTPATH_SPACINGTYPE_EXACT: number; + TEXTPATH_METHODTYPE_STRETCH: number; + TEXTPATH_SPACINGTYPE_AUTO: number; + TEXTPATH_SPACINGTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_ALIGN: number; +} +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + TEXTPATH_SPACINGTYPE_EXACT: number; + TEXTPATH_METHODTYPE_STRETCH: number; + TEXTPATH_SPACINGTYPE_AUTO: number; + TEXTPATH_SPACINGTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_UNKNOWN: number; + TEXTPATH_METHODTYPE_ALIGN: number; +} + +interface HTMLDTElement extends HTMLElement { + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} +declare var HTMLDTElement: { + prototype: HTMLDTElement; + new(): HTMLDTElement; +} + +interface NodeList { + length: number; + item(index: number): Node; + [index: number]: Node; +} +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface PerformanceMeasure extends PerformanceEntry { +} +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGExternalResourcesRequired, SVGURIReference { + spreadMethod: SVGAnimatedEnumeration; + gradientTransform: SVGAnimatedTransformList; + gradientUnits: SVGAnimatedEnumeration; + SVG_SPREADMETHOD_REFLECT: number; + SVG_SPREADMETHOD_PAD: number; + SVG_SPREADMETHOD_UNKNOWN: number; + SVG_SPREADMETHOD_REPEAT: number; +} +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + SVG_SPREADMETHOD_REFLECT: number; + SVG_SPREADMETHOD_PAD: number; + SVG_SPREADMETHOD_UNKNOWN: number; + SVG_SPREADMETHOD_REPEAT: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; + SHOW_ENTITY_REFERENCE: number; + SHOW_NOTATION: number; + SHOW_ENTITY: number; + SHOW_DOCUMENT: number; + SHOW_PROCESSING_INSTRUCTION: number; + FILTER_REJECT: number; + SHOW_CDATA_SECTION: number; + FILTER_ACCEPT: number; + SHOW_ALL: number; + SHOW_DOCUMENT_TYPE: number; + SHOW_TEXT: number; + SHOW_ELEMENT: number; + SHOW_COMMENT: number; + FILTER_SKIP: number; + SHOW_ATTRIBUTE: number; + SHOW_DOCUMENT_FRAGMENT: number; +} +declare var NodeFilter: NodeFilter; + +interface SVGNumberList { + numberOfItems: number; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; + getItem(index: number): SVGNumber; + clear(): void; + appendItem(newItem: SVGNumber): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + removeItem(index: number): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; +} +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface MediaError { + code: number; + msExtendedCode: number; + MEDIA_ERR_ABORTED: number; + MEDIA_ERR_NETWORK: number; + MEDIA_ERR_SRC_NOT_SUPPORTED: number; + MEDIA_ERR_DECODE: number; + MS_MEDIA_ERR_ENCRYPTED: number; +} +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + MEDIA_ERR_ABORTED: number; + MEDIA_ERR_NETWORK: number; + MEDIA_ERR_SRC_NOT_SUPPORTED: number; + MEDIA_ERR_DECODE: number; + MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLBGSoundElement extends HTMLElement { + /** + * Sets or gets the value indicating how the volume of the background sound is divided between the left speaker and the right speaker. + */ + balance: any; + /** + * Sets or gets the volume setting for the sound. + */ + volume: any; + /** + * Sets or gets the URL of a sound to play. + */ + src: string; + /** + * Sets or retrieves the number of times a sound or video clip will loop when activated. + */ + loop: number; +} +declare var HTMLBGSoundElement: { + prototype: HTMLBGSoundElement; + new(): HTMLBGSoundElement; +} + +interface Comment extends CharacterData { + text: string; +} +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + redirectStart: number; + redirectEnd: number; + domainLookupEnd: number; + responseStart: number; + domainLookupStart: number; + fetchStart: number; + requestStart: number; + connectEnd: number; + connectStart: number; + initiatorType: string; + responseEnd: number; +} +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface CanvasPattern { +} +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the width of the object. + */ + width: number; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; +} +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle, MSDataBindingExtensions, MSDataBindingRecordSetExtensions { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the contained object. + */ + object: any; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the class identifier for the object. + */ + classid: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Retrieves the document object of the page or frame. + */ + contentDocument: Document; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + declare: boolean; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + BaseHref: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + willValidate: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + readyState: number; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Retrieves the palette used for the embedded document. + */ + palette: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + hidden: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + pluginspage: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + readyState: string; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + msPlayToSource: any; +} +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface StorageEvent extends Event { + oldValue: any; + newValue: any; + url: string; + storageArea: Storage; + key: string; + initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; +} +declare var StorageEvent: { + prototype: StorageEvent; + new(): StorageEvent; +} + +interface CharacterData extends Node { + length: number; + data: string; + deleteData(offset: number, count: number): void; + replaceData(offset: number, count: number, arg: string): void; + appendData(arg: string): void; + insertData(offset: number, arg: string): void; + substringData(offset: number, count: number): string; +} +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface HTMLOptGroupElement extends HTMLElement, MSDataBindingExtensions { + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + index: number; + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; +} +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLIsIndexElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + prompt: string; +} +declare var HTMLIsIndexElement: { + prototype: HTMLIsIndexElement; + new(): HTMLIsIndexElement; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + y: number; + x: number; +} +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface DOMException { + code: number; + message: string; + name: string; + toString(): string; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} + +interface SVGAnimatedBoolean { + animVal: boolean; + baseVal: boolean; +} +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface MSCompatibleInfoCollection { + length: number; + item(index: number): MSCompatibleInfo; +} +declare var MSCompatibleInfoCollection: { + prototype: MSCompatibleInfoCollection; + new(): MSCompatibleInfoCollection; +} + +interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { +} +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + SVG_PRESERVEASPECTRATIO_NONE: number; + SVG_PRESERVEASPECTRATIO_XMINYMID: number; + SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + SVG_MEETORSLICE_UNKNOWN: number; + SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + SVG_MEETORSLICE_MEET: number; + SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + SVG_MEETORSLICE_SLICE: number; + SVG_PRESERVEASPECTRATIO_UNKNOWN: number; +} +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + SVG_PRESERVEASPECTRATIO_NONE: number; + SVG_PRESERVEASPECTRATIO_XMINYMID: number; + SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + SVG_MEETORSLICE_UNKNOWN: number; + SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + SVG_MEETORSLICE_MEET: number; + SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + SVG_MEETORSLICE_SLICE: number; + SVG_PRESERVEASPECTRATIO_UNKNOWN: number; +} + +interface Attr extends Node { + expando: boolean; + specified: boolean; + ownerElement: Element; + value: string; + name: string; +} +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface PerformanceNavigation { + redirectCount: number; + type: number; + toJSON(): any; + TYPE_RELOAD: number; + TYPE_RESERVED: number; + TYPE_BACK_FORWARD: number; + TYPE_NAVIGATE: number; +} +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + TYPE_RELOAD: number; + TYPE_RESERVED: number; + TYPE_BACK_FORWARD: number; + TYPE_NAVIGATE: number; +} + +interface SVGStopElement extends SVGElement, SVGStylable { + offset: SVGAnimatedNumber; +} +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface PositionCallback { + (position: Position): void; +} + +interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox, SVGExternalResourcesRequired { +} +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGElementInstanceList { + length: number; + item(index: number): SVGElementInstance; +} +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface CSSRuleList { + length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface MSDataBindingRecordSetExtensions { + recordset: any; + namedRecordset(dataMember: string, hierarchy?: any): any; +} + +interface LinkStyle { + styleSheet: StyleSheet; + sheet: StyleSheet; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the width of the video element. + */ + width: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + videoWidth: number; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + videoHeight: number; + /** + * Gets or sets the height of the video element. + */ + height: number; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + msIsStereo3D: boolean; + msStereo3DPackingMode: string; + onMSVideoOptimalLayoutChanged: (ev: any) => any; + onMSVideoFrameStepCompleted: (ev: any) => any; + msStereo3DRenderMode: string; + msIsLayoutOptimalForPlayback: boolean; + msHorizontalMirror: boolean; + onMSVideoFormatChanged: (ev: any) => any; + msZoom: boolean; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + msFrameStep(forward: boolean): void; + getVideoPlaybackQuality(): VideoPlaybackQuality; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgotpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mslostpointercapture", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "move", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "datasetchanged", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsdelete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "losecapture", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "controlselect", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "layoutcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "filterchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "datasetcomplete", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "errorupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cellchange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowexit", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "rowsinserted", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "propertychange", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "moveend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeeditfocus", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "afterupdate", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resizeend", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dataavailable", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "movestart", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "rowenter", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mscontentzoom", listener: (ev: MSEventObj) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "msmanipulationstatechanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFrameStepCompleted", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFormatChanged", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface ClientRectList { + length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface SVGMaskElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + maskUnits: SVGAnimatedEnumeration; + maskContentUnits: SVGAnimatedEnumeration; + x: SVGAnimatedLength; + height: SVGAnimatedLength; +} +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface External { +} +declare var External: { + prototype: External; + new(): External; +} + +interface MSGestureEvent extends UIEvent { + offsetY: number; + translationY: number; + velocityExpansion: number; + velocityY: number; + velocityAngular: number; + translationX: number; + velocityX: number; + hwTimestamp: number; + offsetX: number; + screenX: number; + rotation: number; + expansion: number; + clientY: number; + screenY: number; + scale: number; + gestureObject: any; + clientX: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + MSGESTURE_FLAG_BEGIN: number; + MSGESTURE_FLAG_END: number; + MSGESTURE_FLAG_CANCEL: number; + MSGESTURE_FLAG_INERTIA: number; + MSGESTURE_FLAG_NONE: number; +} +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + MSGESTURE_FLAG_BEGIN: number; + MSGESTURE_FLAG_END: number; + MSGESTURE_FLAG_CANCEL: number; + MSGESTURE_FLAG_INERTIA: number; + MSGESTURE_FLAG_NONE: number; +} + +interface ErrorEvent extends Event { + colno: number; + filename: string; + error: any; + lineno: number; + message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + filterResX: SVGAnimatedInteger; + filterUnits: SVGAnimatedEnumeration; + primitiveUnits: SVGAnimatedEnumeration; + x: SVGAnimatedLength; + height: SVGAnimatedLength; + filterResY: SVGAnimatedInteger; + setFilterRes(filterResX: number, filterResY: number): void; +} +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface TrackEvent extends Event { + track: any; +} +declare var TrackEvent: { + prototype: TrackEvent; + new(): TrackEvent; +} + +interface SVGFEMergeNodeElement extends SVGElement { + in1: SVGAnimatedString; +} +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { +} +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface TextTrackCue extends EventTarget { + onenter: (ev: Event) => any; + track: TextTrack; + endTime: number; + text: string; + pauseOnExit: boolean; + id: string; + startTime: number; + onexit: (ev: Event) => any; + getCueAsHTML(): DocumentFragment; + addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface MSStreamReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; +} +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface DOMTokenList { + length: number; + contains(token: string): boolean; + remove(token: string): void; + toggle(token: string): boolean; + add(token: string): void; + item(index: number): string; + [index: number]: string; + toString(): string; +} +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; +} +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in2: SVGAnimatedString; + mode: SVGAnimatedEnumeration; + in1: SVGAnimatedString; + SVG_FEBLEND_MODE_DARKEN: number; + SVG_FEBLEND_MODE_UNKNOWN: number; + SVG_FEBLEND_MODE_MULTIPLY: number; + SVG_FEBLEND_MODE_NORMAL: number; + SVG_FEBLEND_MODE_SCREEN: number; + SVG_FEBLEND_MODE_LIGHTEN: number; +} +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + SVG_FEBLEND_MODE_DARKEN: number; + SVG_FEBLEND_MODE_UNKNOWN: number; + SVG_FEBLEND_MODE_MULTIPLY: number; + SVG_FEBLEND_MODE_NORMAL: number; + SVG_FEBLEND_MODE_SCREEN: number; + SVG_FEBLEND_MODE_LIGHTEN: number; +} + +interface MessageChannel { + port2: MessagePort; + port1: MessagePort; +} +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { +} +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface TransitionEvent extends Event { + propertyName: string; + elapsedTime: number; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} +declare var TransitionEvent: { + prototype: TransitionEvent; + new(): TransitionEvent; +} + +interface MediaQueryList { + matches: boolean; + media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface DOMError { + name: string; + toString(): string; +} +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface CloseEvent extends Event { + wasClean: boolean; + reason: string; + code: number; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface WebSocket extends EventTarget { + protocol: string; + readyState: number; + bufferedAmount: number; + onopen: (ev: Event) => any; + extensions: string; + onmessage: (ev: MessageEvent) => any; + onclose: (ev: CloseEvent) => any; + onerror: (ev: ErrorEvent) => any; + binaryType: string; + url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; + addEventListener(type: "open", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string): WebSocket; + new(url: string, protocols?: string[]): WebSocket; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; +} + +interface SVGFEPointLightElement extends SVGElement { + y: SVGAnimatedNumber; + x: SVGAnimatedNumber; + z: SVGAnimatedNumber; +} +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface ProgressEvent extends Event { + loaded: number; + lengthComputable: boolean; + total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} +declare var ProgressEvent: { + prototype: ProgressEvent; + new(): ProgressEvent; +} + +interface IDBObjectStore { + indexNames: DOMStringList; + name: string; + transaction: IDBTransaction; + keyPath: string; + count(key?: any): IDBRequest; + add(value: any, key?: any): IDBRequest; + clear(): IDBRequest; + createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + put(value: any, key?: any): IDBRequest; + openCursor(range?: any, direction?: string): IDBRequest; + deleteIndex(indexName: string): void; + index(name: string): IDBIndex; + get(key: any): IDBRequest; + delete(key: any): IDBRequest; +} +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + stdDeviationX: SVGAnimatedNumber; + in1: SVGAnimatedString; + stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; +} +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { + y: SVGAnimatedLength; + width: SVGAnimatedLength; + x: SVGAnimatedLength; + height: SVGAnimatedLength; + result: SVGAnimatedString; +} + +interface IDBVersionChangeEvent extends Event { + newVersion: number; + oldVersion: number; +} +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IDBIndex { + unique: boolean; + name: string; + keyPath: string; + objectStore: IDBObjectStore; + count(key?: any): IDBRequest; + getKey(key: any): IDBRequest; + openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + get(key: any): IDBRequest; + openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; +} +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface FileList { + length: number; + item(index: number): File; + [index: number]: File; +} +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface IDBCursor { + source: any; + direction: string; + key: any; + primaryKey: any; + advance(count: number): void; + delete(): IDBRequest; + continue(key?: any): void; + update(value: any): IDBRequest; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + kernelUnitLengthY: SVGAnimatedNumber; + surfaceScale: SVGAnimatedNumber; + specularExponent: SVGAnimatedNumber; + in1: SVGAnimatedString; + kernelUnitLengthX: SVGAnimatedNumber; + specularConstant: SVGAnimatedNumber; +} +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface File extends Blob { + lastModifiedDate: any; + name: string; +} +declare var File: { + prototype: File; + new(): File; +} + +interface URL { + revokeObjectURL(url: string): void; + createObjectURL(object: any, options?: ObjectURLOptions): string; +} +declare var URL: URL; + +interface IDBCursorWithValue extends IDBCursor { + value: any; +} +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface XMLHttpRequestEventTarget extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + ontimeout: (ev: Event) => any; + onabort: (ev: UIEvent) => any; + onloadstart: (ev: Event) => any; + onloadend: (ev: ProgressEvent) => any; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequestEventTarget: { + prototype: XMLHttpRequestEventTarget; + new(): XMLHttpRequestEventTarget; +} + +interface IDBEnvironment { + msIndexedDB: IDBFactory; + indexedDB: IDBFactory; +} + +interface AudioTrackList extends EventTarget { + length: number; + onchange: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + onremovetrack: (ev: any /*PluginArray*/) => any; + getTrackById(id: string): AudioTrack; + item(index: number): AudioTrack; + [index: number]: AudioTrack; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: any /*PluginArray*/) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface MSBaseReader extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + readyState: number; + onabort: (ev: UIEvent) => any; + onloadend: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onloadstart: (ev: Event) => any; + result: any; + abort(): void; + LOADING: number; + EMPTY: number; + DONE: number; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + operator: SVGAnimatedEnumeration; + radiusX: SVGAnimatedNumber; + radiusY: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + SVG_MORPHOLOGY_OPERATOR_ERODE: number; + SVG_MORPHOLOGY_OPERATOR_DILATE: number; +} +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + SVG_MORPHOLOGY_OPERATOR_ERODE: number; + SVG_MORPHOLOGY_OPERATOR_DILATE: number; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface WindowTimersExtension { + msSetImmediate(expression: any, ...args: any[]): number; + clearImmediate(handle: number): void; + msClearImmediate(handle: number): void; + setImmediate(expression: any, ...args: any[]): number; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in2: SVGAnimatedString; + xChannelSelector: SVGAnimatedEnumeration; + yChannelSelector: SVGAnimatedEnumeration; + scale: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_CHANNEL_B: number; + SVG_CHANNEL_R: number; + SVG_CHANNEL_G: number; + SVG_CHANNEL_UNKNOWN: number; + SVG_CHANNEL_A: number; +} +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + SVG_CHANNEL_B: number; + SVG_CHANNEL_R: number; + SVG_CHANNEL_G: number; + SVG_CHANNEL_UNKNOWN: number; + SVG_CHANNEL_A: number; +} + +interface AnimationEvent extends Event { + animationName: string; + elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} +declare var AnimationEvent: { + prototype: AnimationEvent; + new(): AnimationEvent; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + tableValues: SVGAnimatedNumberList; + slope: SVGAnimatedNumber; + type: SVGAnimatedEnumeration; + exponent: SVGAnimatedNumber; + amplitude: SVGAnimatedNumber; + intercept: SVGAnimatedNumber; + offset: SVGAnimatedNumber; + SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; +} +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; +} + +interface MSRangeCollection { + length: number; + item(index: number): Range; + [index: number]: Range; +} +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface SVGFEDistantLightElement extends SVGElement { + azimuth: SVGAnimatedNumber; + elevation: SVGAnimatedNumber; +} +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface IDBKeyRange { + upper: any; + upperOpen: boolean; + lower: any; + lowerOpen: boolean; +} +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + lowerBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(bound: any, open?: boolean): IDBKeyRange; +} + +interface WindowConsole { + console: Console; +} + +interface IDBTransaction extends EventTarget { + oncomplete: (ev: Event) => any; + db: IDBDatabase; + mode: string; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: UIEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; +} + +interface AudioTrack { + kind: string; + language: string; + id: string; + label: string; + enabled: boolean; + sourceBuffer: SourceBuffer; +} +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + orderY: SVGAnimatedInteger; + kernelUnitLengthY: SVGAnimatedNumber; + orderX: SVGAnimatedInteger; + preserveAlpha: SVGAnimatedBoolean; + kernelMatrix: SVGAnimatedNumberList; + edgeMode: SVGAnimatedEnumeration; + kernelUnitLengthX: SVGAnimatedNumber; + bias: SVGAnimatedNumber; + targetX: SVGAnimatedInteger; + targetY: SVGAnimatedInteger; + divisor: SVGAnimatedNumber; + in1: SVGAnimatedString; + SVG_EDGEMODE_WRAP: number; + SVG_EDGEMODE_DUPLICATE: number; + SVG_EDGEMODE_UNKNOWN: number; + SVG_EDGEMODE_NONE: number; +} +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + SVG_EDGEMODE_WRAP: number; + SVG_EDGEMODE_DUPLICATE: number; + SVG_EDGEMODE_UNKNOWN: number; + SVG_EDGEMODE_NONE: number; +} + +interface TextTrackCueList { + length: number; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; + getCueById(id: string): TextTrackCue; +} +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface CSSKeyframesRule extends CSSRule { + name: string; + cssRules: CSSRuleList; + findRule(rule: string): CSSKeyframeRule; + deleteRule(rule: string): void; + appendRule(rule: string): void; +} +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + baseFrequencyX: SVGAnimatedNumber; + numOctaves: SVGAnimatedInteger; + type: SVGAnimatedEnumeration; + baseFrequencyY: SVGAnimatedNumber; + stitchTiles: SVGAnimatedEnumeration; + seed: SVGAnimatedNumber; + SVG_STITCHTYPE_UNKNOWN: number; + SVG_STITCHTYPE_NOSTITCH: number; + SVG_TURBULENCE_TYPE_UNKNOWN: number; + SVG_TURBULENCE_TYPE_TURBULENCE: number; + SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + SVG_STITCHTYPE_STITCH: number; +} +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + SVG_STITCHTYPE_UNKNOWN: number; + SVG_STITCHTYPE_NOSTITCH: number; + SVG_TURBULENCE_TYPE_UNKNOWN: number; + SVG_TURBULENCE_TYPE_TURBULENCE: number; + SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + SVG_STITCHTYPE_STITCH: number; +} + +interface TextTrackList extends EventTarget { + length: number; + onaddtrack: (ev: TrackEvent) => any; + item(index: number): TextTrack; + [index: number]: TextTrack; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { +} +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; + type: SVGAnimatedEnumeration; + values: SVGAnimatedNumberList; + SVG_FECOLORMATRIX_TYPE_SATURATE: number; + SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + SVG_FECOLORMATRIX_TYPE_MATRIX: number; + SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; +} +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + SVG_FECOLORMATRIX_TYPE_SATURATE: number; + SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + SVG_FECOLORMATRIX_TYPE_MATRIX: number; + SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; +} + +interface SVGFESpotLightElement extends SVGElement { + pointsAtY: SVGAnimatedNumber; + y: SVGAnimatedNumber; + limitingConeAngle: SVGAnimatedNumber; + specularExponent: SVGAnimatedNumber; + x: SVGAnimatedNumber; + pointsAtZ: SVGAnimatedNumber; + z: SVGAnimatedNumber; + pointsAtX: SVGAnimatedNumber; +} +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface WindowBase64 { + btoa(rawString: string): string; + atob(encodedString: string): string; +} + +interface IDBDatabase extends EventTarget { + version: string; + name: string; + objectStoreNames: DOMStringList; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: UIEvent) => any; + createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + close(): void; + transaction(storeNames: any, mode?: string): IDBTransaction; + deleteObjectStore(name: string): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface DOMStringList { + length: number; + contains(str: string): boolean; + item(index: number): string; + [index: number]: string; +} +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface IDBOpenDBRequest extends IDBRequest { + onupgradeneeded: (ev: IDBVersionChangeEvent) => any; + onblocked: (ev: Event) => any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blocked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + position: number; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + form: HTMLFormElement; +} +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface MSLaunchUriCallback { + (): void; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + dy: SVGAnimatedNumber; + in1: SVGAnimatedString; + dx: SVGAnimatedNumber; +} +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface MSUnsafeFunctionCallback { + (): any; +} + +interface TextTrack extends EventTarget { + language: string; + mode: any; + readyState: number; + activeCues: TextTrackCueList; + cues: TextTrackCueList; + oncuechange: (ev: Event) => any; + kind: string; + onload: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + label: string; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + ERROR: number; + SHOWING: number; + LOADING: number; + LOADED: number; + NONE: number; + HIDDEN: number; + DISABLED: number; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + ERROR: number; + SHOWING: number; + LOADING: number; + LOADED: number; + NONE: number; + HIDDEN: number; + DISABLED: number; +} + +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} + +interface IDBRequest extends EventTarget { + source: any; + onsuccess: (ev: Event) => any; + error: DOMError; + transaction: IDBTransaction; + onerror: (ev: ErrorEvent) => any; + readyState: string; + result: any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface MessagePort extends EventTarget { + onmessage: (ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface FileReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; +} +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface ApplicationCache extends EventTarget { + status: number; + ondownloading: (ev: Event) => any; + onprogress: (ev: ProgressEvent) => any; + onupdateready: (ev: Event) => any; + oncached: (ev: Event) => any; + onobsolete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + onchecking: (ev: Event) => any; + onnoupdate: (ev: Event) => any; + swapCache(): void; + abort(): void; + update(): void; + CHECKING: number; + UNCACHED: number; + UPDATEREADY: number; + DOWNLOADING: number; + IDLE: number; + OBSOLETE: number; + addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "updateready", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "obsolete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "noupdate", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + CHECKING: number; + UNCACHED: number; + UPDATEREADY: number; + DOWNLOADING: number; + IDLE: number; + OBSOLETE: number; +} + +interface FrameRequestCallback { + (time: number): void; +} + +interface PopStateEvent extends Event { + state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} +declare var PopStateEvent: { + prototype: PopStateEvent; + new(): PopStateEvent; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + style: CSSStyleDeclaration; +} +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSStream { + type: string; + msDetachStream(): any; + msClose(): void; +} +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface IDBFactory { + open(name: string, version?: number): IDBOpenDBRequest; + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; +} +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface MSPointerEvent extends MouseEvent { + width: number; + rotation: number; + pressure: number; + pointerType: any; + isPrimary: boolean; + tiltY: number; + height: number; + intermediatePoints: any; + currentPoint: any; + tiltX: number; + hwTimestamp: number; + pointerId: number; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + MSPOINTER_TYPE_PEN: number; + MSPOINTER_TYPE_MOUSE: number; + MSPOINTER_TYPE_TOUCH: number; +} +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(): MSPointerEvent; + MSPOINTER_TYPE_PEN: number; + MSPOINTER_TYPE_MOUSE: number; + MSPOINTER_TYPE_TOUCH: number; +} + +interface MSManipulationEvent extends UIEvent { + lastState: number; + currentState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + MS_MANIPULATION_STATE_STOPPED: number; + MS_MANIPULATION_STATE_ACTIVE: number; + MS_MANIPULATION_STATE_INERTIA: number; + MS_MANIPULATION_STATE_SELECTING: number; + MS_MANIPULATION_STATE_COMMITTED: number; + MS_MANIPULATION_STATE_PRESELECT: number; + MS_MANIPULATION_STATE_DRAGGING: number; + MS_MANIPULATION_STATE_CANCELLED: number; +} +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + MS_MANIPULATION_STATE_STOPPED: number; + MS_MANIPULATION_STATE_ACTIVE: number; + MS_MANIPULATION_STATE_INERTIA: number; + MS_MANIPULATION_STATE_SELECTING: number; + MS_MANIPULATION_STATE_COMMITTED: number; + MS_MANIPULATION_STATE_PRESELECT: number; + MS_MANIPULATION_STATE_DRAGGING: number; + MS_MANIPULATION_STATE_CANCELLED: number; +} + +interface FormData { + append(name: any, value: any, blobName?: string): void; +} +declare var FormData: { + prototype: FormData; + new(): FormData; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollection; +} +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface SVGFEImageElement extends SVGElement, SVGLangSpace, SVGFilterPrimitiveStandardAttributes, SVGURIReference, SVGExternalResourcesRequired { + preserveAspectRatio: SVGAnimatedPreserveAspectRatio; +} +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface AbstractWorker extends EventTarget { + onerror: (ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + operator: SVGAnimatedEnumeration; + in2: SVGAnimatedString; + k2: SVGAnimatedNumber; + k1: SVGAnimatedNumber; + k3: SVGAnimatedNumber; + in1: SVGAnimatedString; + k4: SVGAnimatedNumber; + SVG_FECOMPOSITE_OPERATOR_OUT: number; + SVG_FECOMPOSITE_OPERATOR_OVER: number; + SVG_FECOMPOSITE_OPERATOR_XOR: number; + SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + SVG_FECOMPOSITE_OPERATOR_IN: number; + SVG_FECOMPOSITE_OPERATOR_ATOP: number; +} +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + SVG_FECOMPOSITE_OPERATOR_OUT: number; + SVG_FECOMPOSITE_OPERATOR_OVER: number; + SVG_FECOMPOSITE_OPERATOR_XOR: number; + SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + SVG_FECOMPOSITE_OPERATOR_IN: number; + SVG_FECOMPOSITE_OPERATOR_ATOP: number; +} + +interface ValidityState { + customError: boolean; + valueMissing: boolean; + stepMismatch: boolean; + rangeUnderflow: boolean; + rangeOverflow: boolean; + typeMismatch: boolean; + patternMismatch: boolean; + tooLong: boolean; + valid: boolean; +} +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface HTMLTrackElement extends HTMLElement { + kind: string; + src: string; + srclang: string; + track: TextTrack; + label: string; + default: boolean; + readyState: number; + ERROR: number; + LOADING: number; + LOADED: number; + NONE: number; +} +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + ERROR: number; + LOADING: number; + LOADED: number; + NONE: number; +} + +interface MSApp { + createFileFromStorageFile(storageFile: any): File; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + terminateApp(exceptionObject: any): void; + createDataPackage(object: any): any; + execUnsafeLocalFunction(unsafeFunction: MSUnsafeFunctionCallback): any; + getHtmlPrintDocumentSource(htmlDoc: any): any; + addPublicLocalApplicationUri(uri: string): void; + createDataPackageFromSelection(): any; + getViewOpener(): MSAppView; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + createNewView(uri: string): MSAppView; + getCurrentPriority(): string; + NORMAL: string; + HIGH: string; + IDLE: string; + CURRENT: string; +} +declare var MSApp: MSApp; + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + in1: SVGAnimatedString; +} +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + kernelUnitLengthY: SVGAnimatedNumber; + surfaceScale: SVGAnimatedNumber; + in1: SVGAnimatedString; + kernelUnitLengthX: SVGAnimatedNumber; + diffuseConstant: SVGAnimatedNumber; +} +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface MSCSSMatrix { + m24: number; + m34: number; + a: number; + d: number; + m32: number; + m41: number; + m11: number; + f: number; + e: number; + m23: number; + m14: number; + m33: number; + m22: number; + m21: number; + c: number; + m12: number; + b: number; + m42: number; + m31: number; + m43: number; + m13: number; + m44: number; + multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; + skewY(angle: number): MSCSSMatrix; + setMatrixValue(value: string): void; + inverse(): MSCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; + toString(): string; + rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; + translate(x: number, y: number, z?: number): MSCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; + skewX(angle: number): MSCSSMatrix; +} +declare var MSCSSMatrix: { + prototype: MSCSSMatrix; + new(text?: string): MSCSSMatrix; +} + +interface Worker extends AbstractWorker { + onmessage: (ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} + +interface MSGraphicsTrust { + status: string; + constrictionActive: boolean; +} +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface SubtleCrypto { + unwrapKey(wrappedKey: ArrayBufferView, keyAlgorithm: any, keyEncryptionKey: Key, extractable?: boolean, keyUsages?: string[]): KeyOperation; + encrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; + importKey(format: string, keyData: ArrayBufferView, algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + wrapKey(key: Key, keyEncryptionKey: Key, keyWrappingAlgorithm: any): KeyOperation; + verify(algorithm: any, key: Key, signature: ArrayBufferView, buffer?: ArrayBufferView): CryptoOperation; + deriveKey(algorithm: any, baseKey: Key, derivedKeyType: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + digest(algorithm: any, buffer?: ArrayBufferView): CryptoOperation; + exportKey(format: string, key: Key): KeyOperation; + generateKey(algorithm: any, extractable?: boolean, keyUsages?: string[]): KeyOperation; + sign(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; + decrypt(algorithm: any, key: Key, buffer?: ArrayBufferView): CryptoOperation; +} +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface Crypto extends RandomSource { + subtle: SubtleCrypto; +} +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface VideoPlaybackQuality { + totalFrameDelay: number; + creationTime: number; + totalVideoFrames: number; + droppedVideoFrames: number; +} +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface GlobalEventHandlers { + onpointerenter: (ev: PointerEvent) => any; + onpointerout: (ev: PointerEvent) => any; + onpointerdown: (ev: PointerEvent) => any; + onpointerup: (ev: PointerEvent) => any; + onpointercancel: (ev: PointerEvent) => any; + onpointerover: (ev: PointerEvent) => any; + onpointermove: (ev: PointerEvent) => any; + onpointerleave: (ev: PointerEvent) => any; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface Key { + algorithm: Algorithm; + type: string; + extractable: boolean; + keyUsage: string[]; +} +declare var Key: { + prototype: Key; + new(): Key; +} + +interface DeviceAcceleration { + y: number; + x: number; + z: number; +} +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface HTMLAllCollection extends HTMLCollection { + namedItem(name: string): Element; + // [name: string]: Element; +} +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface AesGcmEncryptResult { + ciphertext: ArrayBuffer; + tag: ArrayBuffer; +} +declare var AesGcmEncryptResult: { + prototype: AesGcmEncryptResult; + new(): AesGcmEncryptResult; +} + +interface NavigationCompletedEvent extends NavigationEvent { + webErrorStatus: number; + isSuccess: boolean; +} +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface MutationRecord { + oldValue: string; + previousSibling: Node; + addedNodes: NodeList; + attributeName: string; + removedNodes: NodeList; + target: Node; + nextSibling: Node; + attributeNamespace: string; + type: string; +} +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface MimeTypeArray { + length: number; + item(index: number): Plugin; + [index: number]: Plugin; + namedItem(type: string): Plugin; + // [type: string]: Plugin; +} +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface KeyOperation extends EventTarget { + oncomplete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + result: any; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var KeyOperation: { + prototype: KeyOperation; + new(): KeyOperation; +} + +interface DOMStringMap { +} +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DeviceOrientationEvent extends Event { + gamma: number; + alpha: number; + absolute: boolean; + beta: number; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; +} +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(): DeviceOrientationEvent; +} + +interface MSMediaKeys { + keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; +} + +interface MSMediaKeyMessageEvent extends Event { + destinationURL: string; + message: Uint8Array; +} +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSHTMLWebViewElement extends HTMLElement { + documentTitle: string; + width: number; + src: string; + canGoForward: boolean; + height: number; + canGoBack: boolean; + navigateWithHttpRequestMessage(requestMessage: any): void; + goBack(): void; + navigate(uri: string): void; + stop(): void; + navigateToString(contents: string): void; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + refresh(): void; + goForward(): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; +} +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface NavigationEvent extends Event { + uri: string; +} +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SourceBuffer extends EventTarget { + updating: boolean; + appendWindowStart: number; + appendWindowEnd: number; + buffered: TimeRanges; + timestampOffset: number; + audioTracks: AudioTrackList; + appendBuffer(data: ArrayBuffer): void; + remove(start: number, end: number): void; + abort(): void; + appendStream(stream: MSStream, maxSize?: number): void; +} +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface MSInputMethodContext extends EventTarget { + oncandidatewindowshow: (ev: any) => any; + target: HTMLElement; + compositionStartOffset: number; + oncandidatewindowhide: (ev: any) => any; + oncandidatewindowupdate: (ev: any) => any; + compositionEndOffset: number; + getCompositionAlternatives(): string[]; + getCandidateWindowClientRect(): ClientRect; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: "candidatewindowshow", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "candidatewindowhide", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "candidatewindowupdate", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface DeviceRotationRate { + gamma: number; + alpha: number; + beta: number; +} +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface PluginArray { + length: number; + refresh(reload?: boolean): void; + item(index: number): Plugin; + [index: number]: Plugin; + namedItem(name: string): Plugin; + // [name: string]: Plugin; +} +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface MSMediaKeyError { + systemCode: number; + code: number; + MS_MEDIA_KEYERR_SERVICE: number; + MS_MEDIA_KEYERR_HARDWARECHANGE: number; + MS_MEDIA_KEYERR_OUTPUT: number; + MS_MEDIA_KEYERR_DOMAIN: number; + MS_MEDIA_KEYERR_UNKNOWN: number; + MS_MEDIA_KEYERR_CLIENT: number; +} +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + MS_MEDIA_KEYERR_SERVICE: number; + MS_MEDIA_KEYERR_HARDWARECHANGE: number; + MS_MEDIA_KEYERR_OUTPUT: number; + MS_MEDIA_KEYERR_DOMAIN: number; + MS_MEDIA_KEYERR_UNKNOWN: number; + MS_MEDIA_KEYERR_CLIENT: number; +} + +interface Plugin { + length: number; + filename: string; + version: string; + name: string; + description: string; + item(index: number): MimeType; + [index: number]: MimeType; + namedItem(type: string): MimeType; + // [type: string]: MimeType; +} +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface MediaSource extends EventTarget { + sourceBuffers: SourceBufferList; + duration: number; + readyState: string; + activeSourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: string): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface SourceBufferList extends EventTarget { + length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface XMLDocument extends Document { +} +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface DeviceMotionEvent extends Event { + rotationRate: DeviceRotationRate; + acceleration: DeviceAcceleration; + interval: number; + accelerationIncludingGravity: DeviceAcceleration; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; +} +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(): DeviceMotionEvent; +} + +interface MimeType { + enabledPlugin: Plugin; + suffixes: string; + type: string; + description: string; +} +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface PointerEvent extends MouseEvent { + width: number; + rotation: number; + pressure: number; + pointerType: any; + isPrimary: boolean; + tiltY: number; + height: number; + intermediatePoints: any; + currentPoint: any; + tiltX: number; + hwTimestamp: number; + pointerId: number; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; +} +declare var PointerEvent: { + prototype: PointerEvent; + new(): PointerEvent; +} + +interface MSDocumentExtensions { + captureEvents(): void; + releaseEvents(): void; +} + +interface MutationObserver { + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; + disconnect(): void; +} +declare var MutationObserver: { + prototype: MutationObserver; + new (callback: (arr: MutationRecord[], observer: MutationObserver)=>any): MutationObserver; +} + +interface MSWebViewAsyncOperation extends EventTarget { + target: MSHTMLWebViewElement; + oncomplete: (ev: Event) => any; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + readyState: number; + type: number; + result: any; + start(): void; + ERROR: number; + TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + TYPE_INVOKE_SCRIPT: number; + COMPLETED: number; + TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + STARTED: number; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + ERROR: number; + TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + TYPE_INVOKE_SCRIPT: number; + COMPLETED: number; + TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + STARTED: number; +} + +interface ScriptNotifyEvent extends Event { + value: string; + callingUri: string; +} +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + redirectStart: number; + domainLookupEnd: number; + responseStart: number; + domComplete: number; + domainLookupStart: number; + loadEventStart: number; + unloadEventEnd: number; + fetchStart: number; + requestStart: number; + domInteractive: number; + navigationStart: number; + connectEnd: number; + loadEventEnd: number; + connectStart: number; + responseEnd: number; + domLoading: number; + redirectEnd: number; + redirectCount: number; + unloadEventStart: number; + domContentLoadedEventStart: number; + domContentLoadedEventEnd: number; + type: string; +} +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface MSMediaKeyNeededEvent extends Event { + initData: Uint8Array; +} +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface LongRunningScriptDetectedEvent extends Event { + stopPageScriptExecution: boolean; + executionTime: number; +} +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSAppView { + viewId: number; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; +} +declare var MSAppView: { + prototype: MSAppView; + new(): MSAppView; +} + +interface PerfWidgetExternal { + maxCpuSpeed: number; + independentRenderingEnabled: boolean; + irDisablingContentString: string; + irStatusAvailable: boolean; + performanceCounter: number; + averagePaintTime: number; + activeNetworkRequestCount: number; + paintRequestsPerSecond: number; + extraInformationEnabled: boolean; + performanceCounterFrequency: number; + averageFrameTime: number; + repositionWindow(x: number, y: number): void; + getRecentMemoryUsage(last: number): any; + getMemoryUsage(): number; + resizeWindow(width: number, height: number): void; + getProcessCpuUsage(): number; + removeEventListener(eventType: string, callback: (ev: any) => any): void; + getRecentCpuUsage(last: number): any; + addEventListener(eventType: string, callback: (ev: any) => any): void; + getRecentFrames(last: number): any; + getRecentPaintRequests(last: number): any; +} +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface PageTransitionEvent extends Event { + persisted: boolean; +} +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} + +interface HTMLDocument extends Document { +} +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface KeyPair { + privateKey: Key; + publicKey: Key; +} +declare var KeyPair: { + prototype: KeyPair; + new(): KeyPair; +} + +interface MSMediaKeySession extends EventTarget { + sessionId: string; + error: MSMediaKeyError; + keySystem: string; + close(): void; + update(key: Uint8Array): void; +} +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEvent { + referrer: string; +} +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface CryptoOperation extends EventTarget { + algorithm: Algorithm; + oncomplete: (ev: Event) => any; + onerror: (ev: ErrorEvent) => any; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: UIEvent) => any; + key: Key; + result: any; + abort(): void; + finish(): void; + process(buffer: ArrayBufferView): void; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var CryptoOperation: { + prototype: CryptoOperation; + new(): CryptoOperation; +} + +interface WebGLTexture extends WebGLObject { +} +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface OES_texture_float { +} +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface WebGLContextEvent extends Event { + statusMessage: string; +} +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(): WebGLContextEvent; +} + +interface WebGLRenderbuffer extends WebGLObject { +} +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLUniformLocation { +} +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebGLActiveInfo { + name: string; + type: number; + size: number; +} +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WEBGL_compressed_texture_s3tc { + COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WebGLRenderingContext { + drawingBufferWidth: number; + drawingBufferHeight: number; + canvas: HTMLCanvasElement; + getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; + bindTexture(target: number, texture: WebGLTexture): void; + bufferData(target: number, data: ArrayBufferView, usage: number): void; + bufferData(target: number, data: ArrayBuffer, usage: number): void; + bufferData(target: number, size: number, usage: number): void; + depthMask(flag: boolean): void; + getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; + vertexAttrib3fv(indx: number, values: number[]): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; + linkProgram(program: WebGLProgram): void; + getSupportedExtensions(): string[]; + bufferSubData(target: number, offset: number, data: ArrayBuffer): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + polygonOffset(factor: number, units: number): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + createTexture(): WebGLTexture; + hint(target: number, mode: number): void; + getVertexAttrib(index: number, pname: number): any; + enableVertexAttribArray(index: number): void; + depthRange(zNear: number, zFar: number): void; + cullFace(mode: number): void; + createFramebuffer(): WebGLFramebuffer; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + getExtension(name: string): any; + createProgram(): WebGLProgram; + deleteShader(shader: WebGLShader): void; + getAttachedShaders(program: WebGLProgram): WebGLShader[]; + enable(cap: number): void; + blendEquation(mode: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void; + createBuffer(): WebGLBuffer; + deleteTexture(texture: WebGLTexture): void; + useProgram(program: WebGLProgram): void; + vertexAttrib2fv(indx: number, values: number[]): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; + checkFramebufferStatus(target: number): number; + frontFace(mode: number): void; + getBufferParameter(target: number, pname: number): any; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + getVertexAttribOffset(index: number, pname: number): number; + disableVertexAttribArray(index: number): void; + blendFunc(sfactor: number, dfactor: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + isFramebuffer(framebuffer: WebGLFramebuffer): boolean; + uniform3iv(location: WebGLUniformLocation, v: number[]): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + lineWidth(width: number): void; + getShaderInfoLog(shader: WebGLShader): string; + getTexParameter(target: number, pname: number): any; + getParameter(pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; + getContextAttributes(): WebGLContextAttributes; + vertexAttrib1f(indx: number, x: number): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + isContextLost(): boolean; + uniform1iv(location: WebGLUniformLocation, v: number[]): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + getRenderbufferParameter(target: number, pname: number): any; + uniform2fv(location: WebGLUniformLocation, v: number[]): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + isTexture(texture: WebGLTexture): boolean; + getError(): number; + shaderSource(shader: WebGLShader, source: string): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; + stencilMask(mask: number): void; + bindBuffer(target: number, buffer: WebGLBuffer): void; + getAttribLocation(program: WebGLProgram, name: string): number; + uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + clear(mask: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; + scissor(x: number, y: number, width: number, height: number): void; + uniform2i(location: WebGLUniformLocation, x: number, y: number): void; + getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; + getShaderSource(shader: WebGLShader): string; + generateMipmap(target: number): void; + bindAttribLocation(program: WebGLProgram, index: number, name: string): void; + uniform1fv(location: WebGLUniformLocation, v: number[]): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2iv(location: WebGLUniformLocation, v: number[]): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + uniform4fv(location: WebGLUniformLocation, v: number[]): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + vertexAttrib1fv(indx: number, values: number[]): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; + flush(): void; + uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + deleteProgram(program: WebGLProgram): void; + isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; + uniform1i(location: WebGLUniformLocation, x: number): void; + getProgramParameter(program: WebGLProgram, pname: number): any; + getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; + stencilFunc(func: number, ref: number, mask: number): void; + pixelStorei(pname: number, param: number): void; + disable(cap: number): void; + vertexAttrib4fv(indx: number, values: number[]): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; + createRenderbuffer(): WebGLRenderbuffer; + isBuffer(buffer: WebGLBuffer): boolean; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + sampleCoverage(value: number, invert: boolean): void; + depthFunc(func: number): void; + texParameterf(target: number, pname: number, param: number): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + drawArrays(mode: number, first: number, count: number): void; + texParameteri(target: number, pname: number, param: number): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + getShaderParameter(shader: WebGLShader, pname: number): any; + clearDepth(depth: number): void; + activeTexture(texture: number): void; + viewport(x: number, y: number, width: number, height: number): void; + detachShader(program: WebGLProgram, shader: WebGLShader): void; + uniform1f(location: WebGLUniformLocation, x: number): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + deleteBuffer(buffer: WebGLBuffer): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + uniform3fv(location: WebGLUniformLocation, v: number[]): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + stencilMaskSeparate(face: number, mask: number): void; + attachShader(program: WebGLProgram, shader: WebGLShader): void; + compileShader(shader: WebGLShader): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + isShader(shader: WebGLShader): boolean; + clearStencil(s: number): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; + finish(): void; + uniform2f(location: WebGLUniformLocation, x: number, y: number): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; + getProgramInfoLog(program: WebGLProgram): string; + validateProgram(program: WebGLProgram): void; + isEnabled(cap: number): boolean; + vertexAttrib2f(indx: number, x: number, y: number): void; + isProgram(program: WebGLProgram): boolean; + createShader(type: number): WebGLShader; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; + uniform4iv(location: WebGLUniformLocation, v: number[]): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; + DEPTH_FUNC: number; + DEPTH_COMPONENT16: number; + REPLACE: number; + REPEAT: number; + VERTEX_ATTRIB_ARRAY_ENABLED: number; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + STENCIL_BUFFER_BIT: number; + RENDERER: number; + STENCIL_BACK_REF: number; + TEXTURE26: number; + RGB565: number; + DITHER: number; + CONSTANT_COLOR: number; + GENERATE_MIPMAP_HINT: number; + POINTS: number; + DECR: number; + INT_VEC3: number; + TEXTURE28: number; + ONE_MINUS_CONSTANT_ALPHA: number; + BACK: number; + RENDERBUFFER_STENCIL_SIZE: number; + UNPACK_FLIP_Y_WEBGL: number; + BLEND: number; + TEXTURE9: number; + ARRAY_BUFFER_BINDING: number; + MAX_VIEWPORT_DIMS: number; + INVALID_FRAMEBUFFER_OPERATION: number; + TEXTURE: number; + TEXTURE0: number; + TEXTURE31: number; + TEXTURE24: number; + HIGH_INT: number; + RENDERBUFFER_BINDING: number; + BLEND_COLOR: number; + FASTEST: number; + STENCIL_WRITEMASK: number; + ALIASED_POINT_SIZE_RANGE: number; + TEXTURE12: number; + DST_ALPHA: number; + BLEND_EQUATION_RGB: number; + FRAMEBUFFER_COMPLETE: number; + NEAREST_MIPMAP_NEAREST: number; + VERTEX_ATTRIB_ARRAY_SIZE: number; + TEXTURE3: number; + DEPTH_WRITEMASK: number; + CONTEXT_LOST_WEBGL: number; + INVALID_VALUE: number; + TEXTURE_MAG_FILTER: number; + ONE_MINUS_CONSTANT_COLOR: number; + ONE_MINUS_SRC_ALPHA: number; + TEXTURE_CUBE_MAP_POSITIVE_Z: number; + NOTEQUAL: number; + ALPHA: number; + DEPTH_STENCIL: number; + MAX_VERTEX_UNIFORM_VECTORS: number; + DEPTH_COMPONENT: number; + RENDERBUFFER_RED_SIZE: number; + TEXTURE20: number; + RED_BITS: number; + RENDERBUFFER_BLUE_SIZE: number; + SCISSOR_BOX: number; + VENDOR: number; + FRONT_AND_BACK: number; + CONSTANT_ALPHA: number; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + NEAREST: number; + CULL_FACE: number; + ALIASED_LINE_WIDTH_RANGE: number; + TEXTURE19: number; + FRONT: number; + DEPTH_CLEAR_VALUE: number; + GREEN_BITS: number; + TEXTURE29: number; + TEXTURE23: number; + MAX_RENDERBUFFER_SIZE: number; + STENCIL_ATTACHMENT: number; + TEXTURE27: number; + BOOL_VEC2: number; + OUT_OF_MEMORY: number; + MIRRORED_REPEAT: number; + POLYGON_OFFSET_UNITS: number; + TEXTURE_MIN_FILTER: number; + STENCIL_BACK_PASS_DEPTH_PASS: number; + LINE_LOOP: number; + FLOAT_MAT3: number; + TEXTURE14: number; + LINEAR: number; + RGB5_A1: number; + ONE_MINUS_SRC_COLOR: number; + SAMPLE_COVERAGE_INVERT: number; + DONT_CARE: number; + FRAMEBUFFER_BINDING: number; + RENDERBUFFER_ALPHA_SIZE: number; + STENCIL_REF: number; + ZERO: number; + DECR_WRAP: number; + SAMPLE_COVERAGE: number; + STENCIL_BACK_FUNC: number; + TEXTURE30: number; + VIEWPORT: number; + STENCIL_BITS: number; + FLOAT: number; + COLOR_WRITEMASK: number; + SAMPLE_COVERAGE_VALUE: number; + TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + STENCIL_BACK_FAIL: number; + FLOAT_MAT4: number; + UNSIGNED_SHORT_4_4_4_4: number; + TEXTURE6: number; + RENDERBUFFER_WIDTH: number; + RGBA4: number; + ALWAYS: number; + BLEND_EQUATION_ALPHA: number; + COLOR_BUFFER_BIT: number; + TEXTURE_CUBE_MAP: number; + DEPTH_BUFFER_BIT: number; + STENCIL_CLEAR_VALUE: number; + BLEND_EQUATION: number; + RENDERBUFFER_GREEN_SIZE: number; + NEAREST_MIPMAP_LINEAR: number; + VERTEX_ATTRIB_ARRAY_TYPE: number; + INCR_WRAP: number; + ONE_MINUS_DST_COLOR: number; + HIGH_FLOAT: number; + BYTE: number; + FRONT_FACE: number; + SAMPLE_ALPHA_TO_COVERAGE: number; + CCW: number; + TEXTURE13: number; + MAX_VERTEX_ATTRIBS: number; + MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_WRAP_T: number; + UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + FLOAT_VEC2: number; + LUMINANCE: number; + GREATER: number; + INT_VEC2: number; + VALIDATE_STATUS: number; + FRAMEBUFFER: number; + FRAMEBUFFER_UNSUPPORTED: number; + TEXTURE5: number; + FUNC_SUBTRACT: number; + BLEND_DST_ALPHA: number; + SAMPLER_CUBE: number; + ONE_MINUS_DST_ALPHA: number; + LESS: number; + TEXTURE_CUBE_MAP_POSITIVE_X: number; + BLUE_BITS: number; + DEPTH_TEST: number; + VERTEX_ATTRIB_ARRAY_STRIDE: number; + DELETE_STATUS: number; + TEXTURE18: number; + POLYGON_OFFSET_FACTOR: number; + UNSIGNED_INT: number; + TEXTURE_2D: number; + DST_COLOR: number; + FLOAT_MAT2: number; + COMPRESSED_TEXTURE_FORMATS: number; + MAX_FRAGMENT_UNIFORM_VECTORS: number; + DEPTH_STENCIL_ATTACHMENT: number; + LUMINANCE_ALPHA: number; + CW: number; + VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + LINEAR_MIPMAP_LINEAR: number; + BUFFER_SIZE: number; + SAMPLE_BUFFERS: number; + TEXTURE15: number; + ACTIVE_TEXTURE: number; + VERTEX_SHADER: number; + TEXTURE22: number; + VERTEX_ATTRIB_ARRAY_POINTER: number; + INCR: number; + COMPILE_STATUS: number; + MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + TEXTURE7: number; + UNSIGNED_SHORT_5_5_5_1: number; + DEPTH_BITS: number; + RGBA: number; + TRIANGLE_STRIP: number; + COLOR_CLEAR_VALUE: number; + BROWSER_DEFAULT_WEBGL: number; + INVALID_ENUM: number; + SCISSOR_TEST: number; + LINE_STRIP: number; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + STENCIL_FUNC: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + RENDERBUFFER_HEIGHT: number; + TEXTURE8: number; + TRIANGLES: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + STENCIL_BACK_VALUE_MASK: number; + TEXTURE25: number; + RENDERBUFFER: number; + LEQUAL: number; + TEXTURE1: number; + STENCIL_INDEX8: number; + FUNC_ADD: number; + STENCIL_FAIL: number; + BLEND_SRC_ALPHA: number; + BOOL: number; + ALPHA_BITS: number; + LOW_INT: number; + TEXTURE10: number; + SRC_COLOR: number; + MAX_VARYING_VECTORS: number; + BLEND_DST_RGB: number; + TEXTURE_BINDING_CUBE_MAP: number; + STENCIL_INDEX: number; + TEXTURE_BINDING_2D: number; + MEDIUM_INT: number; + SHADER_TYPE: number; + POLYGON_OFFSET_FILL: number; + DYNAMIC_DRAW: number; + TEXTURE4: number; + STENCIL_BACK_PASS_DEPTH_FAIL: number; + STREAM_DRAW: number; + MAX_CUBE_MAP_TEXTURE_SIZE: number; + TEXTURE17: number; + TRIANGLE_FAN: number; + UNPACK_ALIGNMENT: number; + CURRENT_PROGRAM: number; + LINES: number; + INVALID_OPERATION: number; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + LINEAR_MIPMAP_NEAREST: number; + CLAMP_TO_EDGE: number; + RENDERBUFFER_DEPTH_SIZE: number; + TEXTURE_WRAP_S: number; + ELEMENT_ARRAY_BUFFER: number; + UNSIGNED_SHORT_5_6_5: number; + ACTIVE_UNIFORMS: number; + FLOAT_VEC3: number; + NO_ERROR: number; + ATTACHED_SHADERS: number; + DEPTH_ATTACHMENT: number; + TEXTURE11: number; + STENCIL_TEST: number; + ONE: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + STATIC_DRAW: number; + GEQUAL: number; + BOOL_VEC4: number; + COLOR_ATTACHMENT0: number; + PACK_ALIGNMENT: number; + MAX_TEXTURE_SIZE: number; + STENCIL_PASS_DEPTH_FAIL: number; + CULL_FACE_MODE: number; + TEXTURE16: number; + STENCIL_BACK_WRITEMASK: number; + SRC_ALPHA: number; + UNSIGNED_SHORT: number; + TEXTURE21: number; + FUNC_REVERSE_SUBTRACT: number; + SHADING_LANGUAGE_VERSION: number; + EQUAL: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + BOOL_VEC3: number; + SAMPLER_2D: number; + TEXTURE_CUBE_MAP_NEGATIVE_X: number; + MAX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_CUBE_MAP_POSITIVE_Y: number; + RENDERBUFFER_INTERNAL_FORMAT: number; + STENCIL_VALUE_MASK: number; + ELEMENT_ARRAY_BUFFER_BINDING: number; + ARRAY_BUFFER: number; + DEPTH_RANGE: number; + NICEST: number; + ACTIVE_ATTRIBUTES: number; + NEVER: number; + FLOAT_VEC4: number; + CURRENT_VERTEX_ATTRIB: number; + STENCIL_PASS_DEPTH_PASS: number; + INVERT: number; + LINK_STATUS: number; + RGB: number; + INT_VEC4: number; + TEXTURE2: number; + UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + MEDIUM_FLOAT: number; + SRC_ALPHA_SATURATE: number; + BUFFER_USAGE: number; + SHORT: number; + NONE: number; + UNSIGNED_BYTE: number; + INT: number; + SUBPIXEL_BITS: number; + KEEP: number; + SAMPLES: number; + FRAGMENT_SHADER: number; + LINE_WIDTH: number; + BLEND_SRC_RGB: number; + LOW_FLOAT: number; + VERSION: number; +} +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + DEPTH_FUNC: number; + DEPTH_COMPONENT16: number; + REPLACE: number; + REPEAT: number; + VERTEX_ATTRIB_ARRAY_ENABLED: number; + FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + STENCIL_BUFFER_BIT: number; + RENDERER: number; + STENCIL_BACK_REF: number; + TEXTURE26: number; + RGB565: number; + DITHER: number; + CONSTANT_COLOR: number; + GENERATE_MIPMAP_HINT: number; + POINTS: number; + DECR: number; + INT_VEC3: number; + TEXTURE28: number; + ONE_MINUS_CONSTANT_ALPHA: number; + BACK: number; + RENDERBUFFER_STENCIL_SIZE: number; + UNPACK_FLIP_Y_WEBGL: number; + BLEND: number; + TEXTURE9: number; + ARRAY_BUFFER_BINDING: number; + MAX_VIEWPORT_DIMS: number; + INVALID_FRAMEBUFFER_OPERATION: number; + TEXTURE: number; + TEXTURE0: number; + TEXTURE31: number; + TEXTURE24: number; + HIGH_INT: number; + RENDERBUFFER_BINDING: number; + BLEND_COLOR: number; + FASTEST: number; + STENCIL_WRITEMASK: number; + ALIASED_POINT_SIZE_RANGE: number; + TEXTURE12: number; + DST_ALPHA: number; + BLEND_EQUATION_RGB: number; + FRAMEBUFFER_COMPLETE: number; + NEAREST_MIPMAP_NEAREST: number; + VERTEX_ATTRIB_ARRAY_SIZE: number; + TEXTURE3: number; + DEPTH_WRITEMASK: number; + CONTEXT_LOST_WEBGL: number; + INVALID_VALUE: number; + TEXTURE_MAG_FILTER: number; + ONE_MINUS_CONSTANT_COLOR: number; + ONE_MINUS_SRC_ALPHA: number; + TEXTURE_CUBE_MAP_POSITIVE_Z: number; + NOTEQUAL: number; + ALPHA: number; + DEPTH_STENCIL: number; + MAX_VERTEX_UNIFORM_VECTORS: number; + DEPTH_COMPONENT: number; + RENDERBUFFER_RED_SIZE: number; + TEXTURE20: number; + RED_BITS: number; + RENDERBUFFER_BLUE_SIZE: number; + SCISSOR_BOX: number; + VENDOR: number; + FRONT_AND_BACK: number; + CONSTANT_ALPHA: number; + VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + NEAREST: number; + CULL_FACE: number; + ALIASED_LINE_WIDTH_RANGE: number; + TEXTURE19: number; + FRONT: number; + DEPTH_CLEAR_VALUE: number; + GREEN_BITS: number; + TEXTURE29: number; + TEXTURE23: number; + MAX_RENDERBUFFER_SIZE: number; + STENCIL_ATTACHMENT: number; + TEXTURE27: number; + BOOL_VEC2: number; + OUT_OF_MEMORY: number; + MIRRORED_REPEAT: number; + POLYGON_OFFSET_UNITS: number; + TEXTURE_MIN_FILTER: number; + STENCIL_BACK_PASS_DEPTH_PASS: number; + LINE_LOOP: number; + FLOAT_MAT3: number; + TEXTURE14: number; + LINEAR: number; + RGB5_A1: number; + ONE_MINUS_SRC_COLOR: number; + SAMPLE_COVERAGE_INVERT: number; + DONT_CARE: number; + FRAMEBUFFER_BINDING: number; + RENDERBUFFER_ALPHA_SIZE: number; + STENCIL_REF: number; + ZERO: number; + DECR_WRAP: number; + SAMPLE_COVERAGE: number; + STENCIL_BACK_FUNC: number; + TEXTURE30: number; + VIEWPORT: number; + STENCIL_BITS: number; + FLOAT: number; + COLOR_WRITEMASK: number; + SAMPLE_COVERAGE_VALUE: number; + TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + STENCIL_BACK_FAIL: number; + FLOAT_MAT4: number; + UNSIGNED_SHORT_4_4_4_4: number; + TEXTURE6: number; + RENDERBUFFER_WIDTH: number; + RGBA4: number; + ALWAYS: number; + BLEND_EQUATION_ALPHA: number; + COLOR_BUFFER_BIT: number; + TEXTURE_CUBE_MAP: number; + DEPTH_BUFFER_BIT: number; + STENCIL_CLEAR_VALUE: number; + BLEND_EQUATION: number; + RENDERBUFFER_GREEN_SIZE: number; + NEAREST_MIPMAP_LINEAR: number; + VERTEX_ATTRIB_ARRAY_TYPE: number; + INCR_WRAP: number; + ONE_MINUS_DST_COLOR: number; + HIGH_FLOAT: number; + BYTE: number; + FRONT_FACE: number; + SAMPLE_ALPHA_TO_COVERAGE: number; + CCW: number; + TEXTURE13: number; + MAX_VERTEX_ATTRIBS: number; + MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_WRAP_T: number; + UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + FLOAT_VEC2: number; + LUMINANCE: number; + GREATER: number; + INT_VEC2: number; + VALIDATE_STATUS: number; + FRAMEBUFFER: number; + FRAMEBUFFER_UNSUPPORTED: number; + TEXTURE5: number; + FUNC_SUBTRACT: number; + BLEND_DST_ALPHA: number; + SAMPLER_CUBE: number; + ONE_MINUS_DST_ALPHA: number; + LESS: number; + TEXTURE_CUBE_MAP_POSITIVE_X: number; + BLUE_BITS: number; + DEPTH_TEST: number; + VERTEX_ATTRIB_ARRAY_STRIDE: number; + DELETE_STATUS: number; + TEXTURE18: number; + POLYGON_OFFSET_FACTOR: number; + UNSIGNED_INT: number; + TEXTURE_2D: number; + DST_COLOR: number; + FLOAT_MAT2: number; + COMPRESSED_TEXTURE_FORMATS: number; + MAX_FRAGMENT_UNIFORM_VECTORS: number; + DEPTH_STENCIL_ATTACHMENT: number; + LUMINANCE_ALPHA: number; + CW: number; + VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + LINEAR_MIPMAP_LINEAR: number; + BUFFER_SIZE: number; + SAMPLE_BUFFERS: number; + TEXTURE15: number; + ACTIVE_TEXTURE: number; + VERTEX_SHADER: number; + TEXTURE22: number; + VERTEX_ATTRIB_ARRAY_POINTER: number; + INCR: number; + COMPILE_STATUS: number; + MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + TEXTURE7: number; + UNSIGNED_SHORT_5_5_5_1: number; + DEPTH_BITS: number; + RGBA: number; + TRIANGLE_STRIP: number; + COLOR_CLEAR_VALUE: number; + BROWSER_DEFAULT_WEBGL: number; + INVALID_ENUM: number; + SCISSOR_TEST: number; + LINE_STRIP: number; + FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + STENCIL_FUNC: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + RENDERBUFFER_HEIGHT: number; + TEXTURE8: number; + TRIANGLES: number; + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + STENCIL_BACK_VALUE_MASK: number; + TEXTURE25: number; + RENDERBUFFER: number; + LEQUAL: number; + TEXTURE1: number; + STENCIL_INDEX8: number; + FUNC_ADD: number; + STENCIL_FAIL: number; + BLEND_SRC_ALPHA: number; + BOOL: number; + ALPHA_BITS: number; + LOW_INT: number; + TEXTURE10: number; + SRC_COLOR: number; + MAX_VARYING_VECTORS: number; + BLEND_DST_RGB: number; + TEXTURE_BINDING_CUBE_MAP: number; + STENCIL_INDEX: number; + TEXTURE_BINDING_2D: number; + MEDIUM_INT: number; + SHADER_TYPE: number; + POLYGON_OFFSET_FILL: number; + DYNAMIC_DRAW: number; + TEXTURE4: number; + STENCIL_BACK_PASS_DEPTH_FAIL: number; + STREAM_DRAW: number; + MAX_CUBE_MAP_TEXTURE_SIZE: number; + TEXTURE17: number; + TRIANGLE_FAN: number; + UNPACK_ALIGNMENT: number; + CURRENT_PROGRAM: number; + LINES: number; + INVALID_OPERATION: number; + FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + LINEAR_MIPMAP_NEAREST: number; + CLAMP_TO_EDGE: number; + RENDERBUFFER_DEPTH_SIZE: number; + TEXTURE_WRAP_S: number; + ELEMENT_ARRAY_BUFFER: number; + UNSIGNED_SHORT_5_6_5: number; + ACTIVE_UNIFORMS: number; + FLOAT_VEC3: number; + NO_ERROR: number; + ATTACHED_SHADERS: number; + DEPTH_ATTACHMENT: number; + TEXTURE11: number; + STENCIL_TEST: number; + ONE: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + STATIC_DRAW: number; + GEQUAL: number; + BOOL_VEC4: number; + COLOR_ATTACHMENT0: number; + PACK_ALIGNMENT: number; + MAX_TEXTURE_SIZE: number; + STENCIL_PASS_DEPTH_FAIL: number; + CULL_FACE_MODE: number; + TEXTURE16: number; + STENCIL_BACK_WRITEMASK: number; + SRC_ALPHA: number; + UNSIGNED_SHORT: number; + TEXTURE21: number; + FUNC_REVERSE_SUBTRACT: number; + SHADING_LANGUAGE_VERSION: number; + EQUAL: number; + FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + BOOL_VEC3: number; + SAMPLER_2D: number; + TEXTURE_CUBE_MAP_NEGATIVE_X: number; + MAX_TEXTURE_IMAGE_UNITS: number; + TEXTURE_CUBE_MAP_POSITIVE_Y: number; + RENDERBUFFER_INTERNAL_FORMAT: number; + STENCIL_VALUE_MASK: number; + ELEMENT_ARRAY_BUFFER_BINDING: number; + ARRAY_BUFFER: number; + DEPTH_RANGE: number; + NICEST: number; + ACTIVE_ATTRIBUTES: number; + NEVER: number; + FLOAT_VEC4: number; + CURRENT_VERTEX_ATTRIB: number; + STENCIL_PASS_DEPTH_PASS: number; + INVERT: number; + LINK_STATUS: number; + RGB: number; + INT_VEC4: number; + TEXTURE2: number; + UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + MEDIUM_FLOAT: number; + SRC_ALPHA_SATURATE: number; + BUFFER_USAGE: number; + SHORT: number; + NONE: number; + UNSIGNED_BYTE: number; + INT: number; + SUBPIXEL_BITS: number; + KEEP: number; + SAMPLES: number; + FRAGMENT_SHADER: number; + LINE_WIDTH: number; + BLEND_SRC_RGB: number; + LOW_FLOAT: number; + VERSION: number; +} + +interface WebGLProgram extends WebGLObject { +} +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface OES_standard_derivatives { + FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface WebGLFramebuffer extends WebGLObject { +} +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLShader extends WebGLObject { +} +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface OES_texture_float_linear { +} +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface WebGLObject { +} +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLBuffer extends WebGLObject { +} +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLShaderPrecisionFormat { + rangeMin: number; + rangeMax: number; + precision: number; +} +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface EXT_texture_filter_anisotropic { + TEXTURE_MAX_ANISOTROPY_EXT: number; + MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; +} +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + TEXTURE_MAX_ANISOTROPY_EXT: number; + MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var Option: { new(text?: string, value?: string, defaultSelected?: boolean, selected?:boolean): HTMLOptionElement; }; +declare var Image: { new(width?: number, height?: number): HTMLImageElement; }; +declare var Audio: { new(src?: string): HTMLAudioElement; }; + +declare var ondragend: (ev: DragEvent) => any; +declare var onkeydown: (ev: KeyboardEvent) => any; +declare var ondragover: (ev: DragEvent) => any; +declare var onkeyup: (ev: KeyboardEvent) => any; +declare var onreset: (ev: Event) => any; +declare var onmouseup: (ev: MouseEvent) => any; +declare var ondragstart: (ev: DragEvent) => any; +declare var ondrag: (ev: DragEvent) => any; +declare var screenX: number; +declare var onmouseover: (ev: MouseEvent) => any; +declare var ondragleave: (ev: DragEvent) => any; +declare var history: History; +declare var pageXOffset: number; +declare var name: string; +declare var onafterprint: (ev: Event) => any; +declare var onpause: (ev: Event) => any; +declare var onbeforeprint: (ev: Event) => any; +declare var top: Window; +declare var onmousedown: (ev: MouseEvent) => any; +declare var onseeked: (ev: Event) => any; +declare var opener: Window; +declare var onclick: (ev: MouseEvent) => any; +declare var innerHeight: number; +declare var onwaiting: (ev: Event) => any; +declare var ononline: (ev: Event) => any; +declare var ondurationchange: (ev: Event) => any; +declare var frames: Window; +declare var onblur: (ev: FocusEvent) => any; +declare var onemptied: (ev: Event) => any; +declare var onseeking: (ev: Event) => any; +declare var oncanplay: (ev: Event) => any; +declare var outerWidth: number; +declare var onstalled: (ev: Event) => any; +declare var onmousemove: (ev: MouseEvent) => any; +declare var innerWidth: number; +declare var onoffline: (ev: Event) => any; +declare var length: number; +declare var screen: Screen; +declare var onbeforeunload: (ev: BeforeUnloadEvent) => any; +declare var onratechange: (ev: Event) => any; +declare var onstorage: (ev: StorageEvent) => any; +declare var onloadstart: (ev: Event) => any; +declare var ondragenter: (ev: DragEvent) => any; +declare var onsubmit: (ev: Event) => any; +declare var self: Window; +declare var document: Document; +declare var onprogress: (ev: ProgressEvent) => any; +declare var ondblclick: (ev: MouseEvent) => any; +declare var pageYOffset: number; +declare var oncontextmenu: (ev: MouseEvent) => any; +declare var onchange: (ev: Event) => any; +declare var onloadedmetadata: (ev: Event) => any; +declare var onplay: (ev: Event) => any; +declare var onerror: ErrorEventHandler; +declare var onplaying: (ev: Event) => any; +declare var parent: Window; +declare var location: Location; +declare var oncanplaythrough: (ev: Event) => any; +declare var onabort: (ev: UIEvent) => any; +declare var onreadystatechange: (ev: Event) => any; +declare var outerHeight: number; +declare var onkeypress: (ev: KeyboardEvent) => any; +declare var frameElement: Element; +declare var onloadeddata: (ev: Event) => any; +declare var onsuspend: (ev: Event) => any; +declare var window: Window; +declare var onfocus: (ev: FocusEvent) => any; +declare var onmessage: (ev: MessageEvent) => any; +declare var ontimeupdate: (ev: Event) => any; +declare var onresize: (ev: UIEvent) => any; +declare var onselect: (ev: UIEvent) => any; +declare var navigator: Navigator; +declare var styleMedia: StyleMedia; +declare var ondrop: (ev: DragEvent) => any; +declare var onmouseout: (ev: MouseEvent) => any; +declare var onended: (ev: Event) => any; +declare var onhashchange: (ev: Event) => any; +declare var onunload: (ev: Event) => any; +declare var onscroll: (ev: UIEvent) => any; +declare var screenY: number; +declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onload: (ev: Event) => any; +declare var onvolumechange: (ev: Event) => any; +declare var oninput: (ev: Event) => any; +declare var performance: Performance; +declare var onmspointerdown: (ev: any) => any; +declare var animationStartTime: number; +declare var onmsgesturedoubletap: (ev: any) => any; +declare var onmspointerhover: (ev: any) => any; +declare var onmsgesturehold: (ev: any) => any; +declare var onmspointermove: (ev: any) => any; +declare var onmsgesturechange: (ev: any) => any; +declare var onmsgesturestart: (ev: any) => any; +declare var onmspointercancel: (ev: any) => any; +declare var onmsgestureend: (ev: any) => any; +declare var onmsgesturetap: (ev: any) => any; +declare var onmspointerout: (ev: any) => any; +declare var msAnimationStartTime: number; +declare var applicationCache: ApplicationCache; +declare var onmsinertiastart: (ev: any) => any; +declare var onmspointerover: (ev: any) => any; +declare var onpopstate: (ev: PopStateEvent) => any; +declare var onmspointerup: (ev: any) => any; +declare var onpageshow: (ev: PageTransitionEvent) => any; +declare var ondevicemotion: (ev: DeviceMotionEvent) => any; +declare var devicePixelRatio: number; +declare var msCrypto: Crypto; +declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; +declare var doNotTrack: string; +declare var onmspointerenter: (ev: any) => any; +declare var onpagehide: (ev: PageTransitionEvent) => any; +declare var onmspointerleave: (ev: any) => any; +declare function alert(message?: any): void; +declare function scroll(x?: number, y?: number): void; +declare function focus(): void; +declare function scrollTo(x?: number, y?: number): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string; +declare function toString(): string; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function scrollBy(x?: number, y?: number): void; +declare function confirm(message?: string): boolean; +declare function close(): void; +declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function showModalDialog(url?: string, argument?: any, options?: any): any; +declare function blur(): void; +declare function getSelection(): Selection; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function msCancelRequestAnimationFrame(handle: number): void; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function cancelAnimationFrame(handle: number): void; +declare function msIsStaticHTML(html: string): boolean; +declare function msMatchMedia(mediaQuery: string): MediaQueryList; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare function dispatchEvent(evt: Event): boolean; +declare function attachEvent(event: string, listener: EventListener): boolean; +declare function detachEvent(event: string, listener: EventListener): void; +declare var localStorage: Storage; +declare var status: string; +declare var onmouseleave: (ev: MouseEvent) => any; +declare var screenLeft: number; +declare var offscreenBuffering: any; +declare var maxConnectionsPerServer: number; +declare var onmouseenter: (ev: MouseEvent) => any; +declare var clipboardData: DataTransfer; +declare var defaultStatus: string; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var onhelp: (ev: Event) => any; +declare var external: External; +declare var event: MSEventObj; +declare var onfocusout: (ev: FocusEvent) => any; +declare var screenTop: number; +declare var onfocusin: (ev: FocusEvent) => any; +declare function showModelessDialog(url?: string, argument?: any, options?: any): Window; +declare function navigate(url: string): void; +declare function resizeBy(x?: number, y?: number): void; +declare function item(index: any): any; +declare function resizeTo(x?: number, y?: number): void; +declare function createPopup(arguments?: any): MSPopupWindow; +declare function toStaticHTML(html: string): string; +declare function execScript(code: string, language?: string): any; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function moveTo(x?: number, y?: number): void; +declare function moveBy(x?: number, y?: number): void; +declare function showHelp(url: string, helpArg?: any, features?: string): void; +declare function captureEvents(): void; +declare function releaseEvents(): void; +declare var sessionStorage: Storage; +declare function clearTimeout(handle: number): void; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearInterval(handle: number): void; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function msSetImmediate(expression: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function msClearImmediate(handle: number): void; +declare function setImmediate(expression: any, ...args: any[]): number; +declare function btoa(rawString: string): string; +declare function atob(encodedString: string): string; +declare var msIndexedDB: IDBFactory; +declare var indexedDB: IDBFactory; +declare var console: Console; +declare var onpointerenter: (ev: PointerEvent) => any; +declare var onpointerout: (ev: PointerEvent) => any; +declare var onpointerdown: (ev: PointerEvent) => any; +declare var onpointerup: (ev: PointerEvent) => any; +declare var onpointercancel: (ev: PointerEvent) => any; +declare var onpointerover: (ev: PointerEvent) => any; +declare var onpointermove: (ev: PointerEvent) => any; +declare var onpointerleave: (ev: PointerEvent) => any; +declare function addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "help", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "contextmenu", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "hashchange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerdown", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturedoubletap", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerhover", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturehold", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointermove", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturechange", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturestart", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointercancel", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgestureend", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msgesturetap", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerout", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "msinertiastart", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerover", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerup", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerenter", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mspointerleave", listener: (ev: any) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + +///////////////////////////// +/// WorkerGlobalScope APIs +///////////////////////////// +// These are only available in a Web Worker +declare function importScripts(...urls: string[]): void; + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + +declare var ActiveXObject: { new (s: string): any; }; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +declare var WScript: { + Echo(s: any): void; + StdErr: ITextWriter; + StdOut: ITextWriter; + Arguments: { length: number; Item(n: number): string; }; + ScriptFullName: string; + Quit(exitCode?: number): number; +} diff --git a/lib/typescript-src/support/typescript/bin/lib.scriptHost.d.ts b/lib/typescript-src/support/typescript/bin/lib.scriptHost.d.ts new file mode 100644 index 0000000..a38a2e9 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/lib.scriptHost.d.ts @@ -0,0 +1,38 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + +declare var ActiveXObject: { new (s: string): any; }; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +declare var WScript: { + Echo(s: any): void; + StdErr: ITextWriter; + StdOut: ITextWriter; + Arguments: { length: number; Item(n: number): string; }; + ScriptFullName: string; + Quit(exitCode?: number): number; +} diff --git a/lib/typescript-src/support/typescript/bin/lib.webworker.d.ts b/lib/typescript-src/support/typescript/bin/lib.webworker.d.ts new file mode 100644 index 0000000..705739f --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/lib.webworker.d.ts @@ -0,0 +1,1652 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// + +///////////////////////////// +/// IE10 ECMAScript Extensions +///////////////////////////// + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +declare var ArrayBuffer: { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; +} + +interface ArrayBufferView { + buffer: ArrayBuffer; + byteOffset: number; + byteLength: number; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Int8Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int8Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; +} +declare var Int8Array: { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: Int8Array): Int8Array; + new (array: number[]): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Uint8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; +} +declare var Uint8Array: { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: Uint8Array): Uint8Array; + new (array: number[]): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 16-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int16Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int16Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; +} +declare var Int16Array: { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: Int16Array): Int16Array; + new (array: number[]): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint16Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Uint16Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; +} +declare var Uint16Array: { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: Uint16Array): Uint16Array; + new (array: number[]): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 32-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Int32Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; +} +declare var Int32Array: { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: Int32Array): Int32Array; + new (array: number[]): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint32Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Int8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; +} +declare var Uint32Array: { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: Uint32Array): Uint32Array; + new (array: number[]): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Float32Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float32Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Float32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; +} +declare var Float32Array: { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: Float32Array): Float32Array; + new (array: number[]): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + BYTES_PER_ELEMENT: number; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised. + */ +interface Float64Array extends ArrayBufferView { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The length of the array. + */ + length: number; + [index: number]: number; + + /** + * Gets the element at the specified index. + * @param index The index at which to get the element of the array. + */ + get(index: number): number; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Float64Array, offset?: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: number[], offset?: number): void; + + /** + * Gets a new Float64Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; +} +declare var Float64Array: { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: Float64Array): Float64Array; + new (array: number[]): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + BYTES_PER_ELEMENT: number; +} + +/** + * You can use a DataView object to read and write the different kinds of binary data to any location in the ArrayBuffer. + */ +interface DataView extends ArrayBufferView { + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; +} +declare var DataView: { + prototype: DataView; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): DataView; +} + +///////////////////////////// +/// IE11 ECMAScript Extensions +///////////////////////////// + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value: V): Map; + size: number; +} +declare var Map: { + new (): Map; + prototype: Map; +} + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value: V): WeakMap; +} +declare var WeakMap: { + new (): WeakMap; + prototype: WeakMap; +} + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + size: number; +} +declare var Set: { + new (): Set; + prototype: Set; +} +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumintegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): Collator; + new (locale?: string, options?: NumberFormatOptions): Collator; + (locales?: string[], options?: NumberFormatOptions): Collator; + (locale?: string, options?: NumberFormatOptions): Collator; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12: boolean; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date: number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): Collator; + new (locale?: string, options?: DateTimeFormatOptions): Collator; + (locales?: string[], options?: DateTimeFormatOptions): Collator; + (locale?: string, options?: DateTimeFormatOptions): Collator; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} + +///////////////////////////// +/// IE Worker APIs +///////////////////////////// + + +interface Console { + info(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; + error(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + profile(reportName?: string): void; + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: any): boolean; + clear(): void; + dir(value?: any, ...optionalParams: any[]): void; + profileEnd(): void; + count(countTitle?: string): void; + groupEnd(): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(): void; + group(groupTitle?: string): void; + dirxml(value: any): void; + debug(message?: string, ...optionalParams: any[]): void; + groupCollapsed(groupTitle?: string): void; + select(element: any): void; +} +declare var Console: { + prototype: Console; + new(): Console; +} + +interface NavigatorID { + appVersion: string; + appName: string; + userAgent: string; + platform: string; + product: string; + vendor: string; +} + +interface EventTarget { + removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; +} + +interface MessageEvent extends Event { + source: any; + origin: string; + data: any; + ports: any; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; +} +declare var MessageEvent: { + prototype: MessageEvent; + new(): MessageEvent; +} + +interface XMLHttpRequest extends EventTarget { + responseBody: any; + status: number; + readyState: number; + responseText: string; + responseXML: any; + ontimeout: (ev: Event) => any; + statusText: string; + onreadystatechange: (ev: Event) => any; + timeout: number; + onload: (ev: Event) => any; + response: any; + withCredentials: boolean; + onprogress: (ev: ProgressEvent) => any; + onabort: (ev: any) => any; + responseType: string; + onloadend: (ev: ProgressEvent) => any; + upload: XMLHttpRequestEventTarget; + onerror: (ev: ErrorEvent) => any; + onloadstart: (ev: Event) => any; + msCaching: string; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + send(data?: any): void; + abort(): void; + getAllResponseHeaders(): string; + setRequestHeader(header: string, value: string): void; + getResponseHeader(header: string): string; + msCachingEnabled(): boolean; + overrideMimeType(mime: string): void; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + LOADING: number; + DONE: number; + UNSENT: number; + OPENED: number; + HEADERS_RECEIVED: number; + create(): XMLHttpRequest; +} + +interface EventListener { + (evt: Event): void; +} + +interface EventException { + code: number; + message: string; + name: string; + toString(): string; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} +declare var EventException: { + prototype: EventException; + new(): EventException; + DISPATCH_REQUEST_ERR: number; + UNSPECIFIED_EVENT_TYPE_ERR: number; +} + +interface NavigatorOnLine { + onLine: boolean; +} + +interface Event { + timeStamp: number; + defaultPrevented: boolean; + isTrusted: boolean; + currentTarget: EventTarget; + cancelBubble: boolean; + target: EventTarget; + eventPhase: number; + cancelable: boolean; + type: string; + srcElement: any; + bubbles: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + stopPropagation(): void; + stopImmediatePropagation(): void; + preventDefault(): void; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} +declare var Event: { + prototype: Event; + new(): Event; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; +} + +interface ImageData { + width: number; + data: number[]; + height: number; +} +declare var ImageData: { + prototype: ImageData; + new(): ImageData; +} + +interface DOMException { + code: number; + message: string; + name: string; + toString(): string; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + HIERARCHY_REQUEST_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_MODIFICATION_ERR: number; + NAMESPACE_ERR: number; + INVALID_CHARACTER_ERR: number; + TYPE_MISMATCH_ERR: number; + ABORT_ERR: number; + INVALID_STATE_ERR: number; + SECURITY_ERR: number; + NETWORK_ERR: number; + WRONG_DOCUMENT_ERR: number; + QUOTA_EXCEEDED_ERR: number; + INDEX_SIZE_ERR: number; + DOMSTRING_SIZE_ERR: number; + SYNTAX_ERR: number; + SERIALIZE_ERR: number; + VALIDATION_ERR: number; + NOT_FOUND_ERR: number; + URL_MISMATCH_ERR: number; + PARSE_ERR: number; + NO_DATA_ALLOWED_ERR: number; + NOT_SUPPORTED_ERR: number; + INVALID_ACCESS_ERR: number; + INUSE_ATTRIBUTE_ERR: number; + INVALID_NODE_TYPE_ERR: number; + DATA_CLONE_ERR: number; + TIMEOUT_ERR: number; +} + +interface ErrorEvent extends Event { + colno: number; + filename: string; + error: any; + lineno: number; + message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface MSStreamReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; +} +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MessageChannel { + port2: MessagePort; + port1: MessagePort; +} +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface DOMError { + name: string; + toString(): string; +} +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface CloseEvent extends Event { + wasClean: boolean; + reason: string; + code: number; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface WebSocket extends EventTarget { + protocol: string; + readyState: number; + bufferedAmount: number; + onopen: (ev: Event) => any; + extensions: string; + onmessage: (ev: MessageEvent) => any; + onclose: (ev: CloseEvent) => any; + onerror: (ev: ErrorEvent) => any; + binaryType: string; + url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; + addEventListener(type: "open", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string): WebSocket; + new(url: string, protocols?: string[]): WebSocket; + OPEN: number; + CLOSING: number; + CONNECTING: number; + CLOSED: number; +} + +interface ProgressEvent extends Event { + loaded: number; + lengthComputable: boolean; + total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} +declare var ProgressEvent: { + prototype: ProgressEvent; + new(): ProgressEvent; +} + +interface IDBObjectStore { + indexNames: DOMStringList; + name: string; + transaction: IDBTransaction; + keyPath: string; + count(key?: any): IDBRequest; + add(value: any, key?: any): IDBRequest; + clear(): IDBRequest; + createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + put(value: any, key?: any): IDBRequest; + openCursor(range?: any, direction?: string): IDBRequest; + deleteIndex(indexName: string): void; + index(name: string): IDBIndex; + get(key: any): IDBRequest; + delete(key: any): IDBRequest; +} +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBVersionChangeEvent extends Event { + newVersion: number; + oldVersion: number; +} +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IDBIndex { + unique: boolean; + name: string; + keyPath: string; + objectStore: IDBObjectStore; + count(key?: any): IDBRequest; + getKey(key: any): IDBRequest; + openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + get(key: any): IDBRequest; + openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; +} +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface FileList { + length: number; + item(index: number): File; + [index: number]: File; +} +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface IDBCursor { + source: any; + direction: string; + key: any; + primaryKey: any; + advance(count: number): void; + delete(): IDBRequest; + continue(key?: any): void; + update(value: any): IDBRequest; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + PREV: string; + PREV_NO_DUPLICATE: string; + NEXT: string; + NEXT_NO_DUPLICATE: string; +} + +interface File extends Blob { + lastModifiedDate: any; + name: string; +} +declare var File: { + prototype: File; + new(): File; +} + +interface IDBCursorWithValue extends IDBCursor { + value: any; +} +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface XMLHttpRequestEventTarget extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + ontimeout: (ev: Event) => any; + onabort: (ev: any) => any; + onloadstart: (ev: Event) => any; + onloadend: (ev: ProgressEvent) => any; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var XMLHttpRequestEventTarget: { + prototype: XMLHttpRequestEventTarget; + new(): XMLHttpRequestEventTarget; +} + +interface MSBaseReader extends EventTarget { + onprogress: (ev: ProgressEvent) => any; + readyState: number; + onabort: (ev: any) => any; + onloadend: (ev: ProgressEvent) => any; + onerror: (ev: ErrorEvent) => any; + onload: (ev: Event) => any; + onloadstart: (ev: Event) => any; + result: any; + abort(): void; + LOADING: number; + EMPTY: number; + DONE: number; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface IDBKeyRange { + upper: any; + upperOpen: boolean; + lower: any; + lowerOpen: boolean; +} +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + lowerBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(bound: any, open?: boolean): IDBKeyRange; +} + +interface WindowConsole { + console: Console; +} + +interface IDBTransaction extends EventTarget { + oncomplete: (ev: Event) => any; + db: IDBDatabase; + mode: string; + error: DOMError; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: any) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + READ_ONLY: string; + VERSION_CHANGE: string; + READ_WRITE: string; +} + +interface WindowBase64 { + btoa(rawString: string): string; + atob(encodedString: string): string; +} + +interface IDBDatabase extends EventTarget { + version: string; + name: string; + objectStoreNames: DOMStringList; + onerror: (ev: ErrorEvent) => any; + onabort: (ev: any) => any; + createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + close(): void; + transaction(storeNames: any, mode?: string): IDBTransaction; + deleteObjectStore(name: string): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: any) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface DOMStringList { + length: number; + contains(str: string): boolean; + item(index: number): string; + [index: number]: string; +} +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface IDBOpenDBRequest extends IDBRequest { + onupgradeneeded: (ev: IDBVersionChangeEvent) => any; + onblocked: (ev: Event) => any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blocked", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface MSUnsafeFunctionCallback { + (): any; +} + +interface IDBRequest extends EventTarget { + source: any; + onsuccess: (ev: Event) => any; + error: DOMError; + transaction: IDBTransaction; + onerror: (ev: ErrorEvent) => any; + readyState: string; + result: any; + addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface MessagePort extends EventTarget { + onmessage: (ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface FileReader extends MSBaseReader { + error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; +} +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface Blob { + type: string; + size: number; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; + msClose(): void; +} +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface MSStream { + type: string; + msDetachStream(): any; + msClose(): void; +} +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface IDBFactory { + open(name: string, version?: number): IDBOpenDBRequest; + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; +} +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface AbstractWorker extends EventTarget { + onerror: (ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} + +interface MSApp { + createFileFromStorageFile(storageFile: any): File; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + terminateApp(exceptionObject: any): void; + createDataPackage(object: any): any; + execUnsafeLocalFunction(unsafeFunction: MSUnsafeFunctionCallback): any; + getHtmlPrintDocumentSource(htmlDoc: any): any; + addPublicLocalApplicationUri(uri: string): void; + createDataPackageFromSelection(): any; + getViewOpener(): MSAppView; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + createNewView(uri: string): MSAppView; + getCurrentPriority(): string; + NORMAL: string; + HIGH: string; + IDLE: string; + CURRENT: string; +} +declare var MSApp: MSApp; + +interface Worker extends AbstractWorker { + onmessage: (ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +} +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} + +interface MSAppView { + viewId: number; + close(): void; + postMessage(message: any, targetOrigin: string, ports?: any): void; +} +declare var MSAppView: { + prototype: MSAppView; + new(): MSAppView; +} + +interface WorkerLocation { + hash: string; + protocol: string; + search: string; + href: string; + hostname: string; + port: string; + pathname: string; + host: string; + toString(): string; +} +declare var WorkerLocation: { + prototype: WorkerLocation; + new(): WorkerLocation; +} + +interface FileReaderSync { + readAsArrayBuffer(blob: Blob): any; + readAsDataURL(blob: Blob): string; + readAsText(blob: Blob, encoding?: string): string; +} +declare var FileReaderSync: { + prototype: FileReaderSync; + new(): FileReaderSync; +} + +interface WorkerGlobalScope extends EventTarget, DedicatedWorkerGlobalScope, WindowConsole, WorkerUtils { + location: WorkerLocation; + self: WorkerGlobalScope; + onerror: (ev: ErrorEvent) => any; + msWriteProfilerMark(profilerMarkName: string): void; + close(): void; + toString(): string; +} +declare var WorkerGlobalScope: { + prototype: WorkerGlobalScope; + new(): WorkerGlobalScope; +} + +interface DedicatedWorkerGlobalScope { + onmessage: (ev: MessageEvent) => any; + postMessage(data: any): void; +} + +interface WorkerNavigator extends NavigatorID, NavigatorOnLine { +} +declare var WorkerNavigator: { + prototype: WorkerNavigator; + new(): WorkerNavigator; +} + +interface WorkerUtils extends WindowBase64 { + navigator: WorkerNavigator; + msIndexedDB: IDBFactory; + indexedDB: IDBFactory; + clearImmediate(handle: number): void; + importScripts(...urls: string[]): void; + clearTimeout(handle: number): void; + setImmediate(handler: any, ...args: any[]): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; + clearInterval(handle: number): void; + setInterval(handler: any, timeout?: any, ...args: any[]): number; +} + + +declare var location: WorkerLocation; +declare var self: WorkerGlobalScope; +declare var onerror: (ev: ErrorEvent) => any; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function close(): void; +declare function toString(): string; +declare function removeEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; +declare function dispatchEvent(evt: Event): boolean; +declare var onmessage: (ev: MessageEvent) => any; +declare function postMessage(data: any): void; +declare var console: Console; +declare var navigator: WorkerNavigator; +declare var msIndexedDB: IDBFactory; +declare var indexedDB: IDBFactory; +declare function clearImmediate(handle: number): void; +declare function importScripts(...urls: string[]): void; +declare function clearTimeout(handle: number): void; +declare function setImmediate(handler: any, ...args: any[]): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearInterval(handle: number): void; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function btoa(rawString: string): string; +declare function atob(encodedString: string): string; diff --git a/lib/typescript-src/support/typescript/bin/resources/cs/cz/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/cs/cz/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/cs/cz/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/cs/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/cs/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/cs/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/cz/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/cz/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/cz/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/de/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/de/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/de/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/en/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/en/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/en/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/en/us/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/en/us/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/en/us/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/es/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/es/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/es/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/fr/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/fr/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/fr/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/it/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/it/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/it/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/ja/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/ja/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/ja/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/ja/jp/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/ja/jp/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/ja/jp/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/ko/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/ko/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/ko/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/ko/kr/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/ko/kr/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/ko/kr/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/pl/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/pl/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/pl/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/pt/br/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/pt/br/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/pt/br/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/pt/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/pt/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/pt/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/ru/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/ru/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/ru/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/tr/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/tr/diagnosticMessages.generated.json deleted file mode 100644 index 91d8040..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/tr/diagnosticMessages.generated.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE": "FILE", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "DIRECTORY": "DIRECTORY", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/zh/cn/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/zh/cn/diagnosticMessages.generated.json deleted file mode 100644 index e4988f2..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/zh/cn/diagnosticMessages.generated.json +++ /dev/null @@ -1,373 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Cannot compile external modules when emitting into single file.": "Cannot compile external modules when emitting into single file.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "Concatenate and emit output to single file | Redirect output structure to the directory": "Concatenate and emit output to single file | Redirect output structure to the directory", - "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", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE|DIRECTORY": "FILE|DIRECTORY", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/resources/zh/tw/diagnosticMessages.generated.json b/lib/typescript-src/support/typescript/bin/resources/zh/tw/diagnosticMessages.generated.json deleted file mode 100644 index e4988f2..0000000 --- a/lib/typescript-src/support/typescript/bin/resources/zh/tw/diagnosticMessages.generated.json +++ /dev/null @@ -1,373 +0,0 @@ -{ - "error TS{0}: {1}": "error TS{0}: {1}", - "warning TS{0}: {1}": "warning TS{0}: {1}", - "Unrecognized escape sequence.": "Unrecognized escape sequence.", - "Unexpected character {0}.": "Unexpected character {0}.", - "Missing close quote character.": "Missing close quote character.", - "Identifier expected.": "Identifier expected.", - "'{0}' keyword expected.": "'{0}' keyword expected.", - "'{0}' expected.": "'{0}' expected.", - "Identifier expected; '{0}' is a keyword.": "Identifier expected; '{0}' is a keyword.", - "Automatic semicolon insertion not allowed.": "Automatic semicolon insertion not allowed.", - "Unexpected token; '{0}' expected.": "Unexpected token; '{0}' expected.", - "Trailing separator not allowed.": "Trailing separator not allowed.", - "'*/' expected.": "'*/' expected.", - "'public' or 'private' modifier must precede 'static'.": "'public' or 'private' modifier must precede 'static'.", - "Unexpected token.": "Unexpected token.", - "Catch clause parameter cannot have a type annotation.": "Catch clause parameter cannot have a type annotation.", - "Rest parameter must be last in list.": "Rest parameter must be last in list.", - "Parameter cannot have question mark and initializer.": "Parameter cannot have question mark and initializer.", - "Required parameter cannot follow optional parameter.": "Required parameter cannot follow optional parameter.", - "Index signatures cannot have rest parameters.": "Index signatures cannot have rest parameters.", - "Index signature parameter cannot have accessibility modifiers.": "Index signature parameter cannot have accessibility modifiers.", - "Index signature parameter cannot have a question mark.": "Index signature parameter cannot have a question mark.", - "Index signature parameter cannot have an initializer.": "Index signature parameter cannot have an initializer.", - "Index signature must have a type annotation.": "Index signature must have a type annotation.", - "Index signature parameter must have a type annotation.": "Index signature parameter must have a type annotation.", - "Index signature parameter type must be 'string' or 'number'.": "Index signature parameter type must be 'string' or 'number'.", - "'extends' clause already seen.": "'extends' clause already seen.", - "'extends' clause must precede 'implements' clause.": "'extends' clause must precede 'implements' clause.", - "Classes can only extend a single class.": "Classes can only extend a single class.", - "'implements' clause already seen.": "'implements' clause already seen.", - "Accessibility modifier already seen.": "Accessibility modifier already seen.", - "'{0}' modifier must precede '{1}' modifier.": "'{0}' modifier must precede '{1}' modifier.", - "'{0}' modifier already seen.": "'{0}' modifier already seen.", - "'{0}' modifier cannot appear on a class element.": "'{0}' modifier cannot appear on a class element.", - "Interface declaration cannot have 'implements' clause.": "Interface declaration cannot have 'implements' clause.", - "'super' invocation cannot have type arguments.": "'super' invocation cannot have type arguments.", - "Only ambient modules can use quoted names.": "Only ambient modules can use quoted names.", - "Statements are not allowed in ambient contexts.": "Statements are not allowed in ambient contexts.", - "Implementations are not allowed in ambient contexts.": "Implementations are not allowed in ambient contexts.", - "'declare' modifier not allowed for code already in an ambient context.": "'declare' modifier not allowed for code already in an ambient context.", - "Initializers are not allowed in ambient contexts.": "Initializers are not allowed in ambient contexts.", - "Parameter property declarations can only be used in constructors.": "Parameter property declarations can only be used in constructors.", - "Function implementation expected.": "Function implementation expected.", - "Constructor implementation expected.": "Constructor implementation expected.", - "Function overload name must be '{0}'.": "Function overload name must be '{0}'.", - "'{0}' modifier cannot appear on a module element.": "'{0}' modifier cannot appear on a module element.", - "'declare' modifier cannot appear on an interface declaration.": "'declare' modifier cannot appear on an interface declaration.", - "'declare' modifier required for top level element.": "'declare' modifier required for top level element.", - "Rest parameter cannot be optional.": "Rest parameter cannot be optional.", - "Rest parameter cannot have an initializer.": "Rest parameter cannot have an initializer.", - "'set' accessor must have one and only one parameter.": "'set' accessor must have one and only one parameter.", - "'set' accessor parameter cannot have accessibility modifier.": "'set' accessor parameter cannot have accessibility modifier.", - "'set' accessor parameter cannot be optional.": "'set' accessor parameter cannot be optional.", - "'set' accessor parameter cannot have an initializer.": "'set' accessor parameter cannot have an initializer.", - "'set' accessor cannot have rest parameter.": "'set' accessor cannot have rest parameter.", - "'get' accessor cannot have parameters.": "'get' accessor cannot have parameters.", - "Modifiers cannot appear here.": "Modifiers cannot appear here.", - "Accessors are only available when targeting ECMAScript 5 and higher.": "Accessors are only available when targeting ECMAScript 5 and higher.", - "Class name cannot be '{0}'.": "Class name cannot be '{0}'.", - "Interface name cannot be '{0}'.": "Interface name cannot be '{0}'.", - "Enum name cannot be '{0}'.": "Enum name cannot be '{0}'.", - "Module name cannot be '{0}'.": "Module name cannot be '{0}'.", - "Enum member must have initializer.": "Enum member must have initializer.", - "Export assignment cannot be used in internal modules.": "Export assignment cannot be used in internal modules.", - "Export assignment not allowed in module with exported element.": "Export assignment not allowed in module with exported element.", - "Module cannot have multiple export assignments.": "Module cannot have multiple export assignments.", - "Ambient enum elements can only have integer literal initializers.": "Ambient enum elements can only have integer literal initializers.", - "module, class, interface, enum, import or statement": "module, class, interface, enum, import or statement", - "constructor, function, accessor or variable": "constructor, function, accessor or variable", - "statement": "statement", - "case or default clause": "case or default clause", - "identifier": "identifier", - "call, construct, index, property or function signature": "call, construct, index, property or function signature", - "expression": "expression", - "type name": "type name", - "property or accessor": "property or accessor", - "parameter": "parameter", - "type": "type", - "type parameter": "type parameter", - "'declare' modifier not allowed on import declaration.": "'declare' modifier not allowed on import declaration.", - "Function overload must be static": "Function overload must be static", - "Function overload must not be static": "Function overload must not be static", - "Duplicate identifier '{0}'.": "Duplicate identifier '{0}'.", - "The name '{0}' does not exist in the current scope.": "The name '{0}' does not exist in the current scope.", - "The name '{0}' does not refer to a value.": "The name '{0}' does not refer to a value.", - "'super' can only be used inside a class instance method.": "'super' can only be used inside a class instance method.", - "The left-hand side of an assignment expression must be a variable, property or indexer.": "The left-hand side of an assignment expression must be a variable, property or indexer.", - "Value of type '{0}' is not callable. Did you mean to include 'new'?": "Value of type '{0}' is not callable. Did you mean to include 'new'?", - "Value of type '{0}' is not callable.": "Value of type '{0}' is not callable.", - "Value of type '{0}' is not newable.": "Value of type '{0}' is not newable.", - "Value of type '{0}' is not indexable by type '{1}'.": "Value of type '{0}' is not indexable by type '{1}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - "Cannot convert '{0}' to '{1}'.": "Cannot convert '{0}' to '{1}'.", - "Cannot convert '{0}' to '{1}':{NL}{2}": "Cannot convert '{0}' to '{1}':{NL}{2}", - "Expected var, class, interface, or module.": "Expected var, class, interface, or module.", - "Operator '{0}' cannot be applied to type '{1}'.": "Operator '{0}' cannot be applied to type '{1}'.", - "Getter '{0}' already declared.": "Getter '{0}' already declared.", - "Setter '{0}' already declared.": "Setter '{0}' already declared.", - "Accessors cannot have type parameters.": "Accessors cannot have type parameters.", - "Exported class '{0}' extends private class '{1}'.": "Exported class '{0}' extends private class '{1}'.", - "Exported class '{0}' implements private interface '{1}'.": "Exported class '{0}' implements private interface '{1}'.", - "Exported interface '{0}' extends private interface '{1}'.": "Exported interface '{0}' extends private interface '{1}'.", - "Exported class '{0}' extends class from inaccessible module {1}.": "Exported class '{0}' extends class from inaccessible module {1}.", - "Exported class '{0}' implements interface from inaccessible module {1}.": "Exported class '{0}' implements interface from inaccessible module {1}.", - "Exported interface '{0}' extends interface from inaccessible module {1}.": "Exported interface '{0}' extends interface from inaccessible module {1}.", - "Public static property '{0}' of exported class has or is using private type '{1}'.": "Public static property '{0}' of exported class has or is using private type '{1}'.", - "Public property '{0}' of exported class has or is using private type '{1}'.": "Public property '{0}' of exported class has or is using private type '{1}'.", - "Property '{0}' of exported interface has or is using private type '{1}'.": "Property '{0}' of exported interface has or is using private type '{1}'.", - "Exported variable '{0}' has or is using private type '{1}'.": "Exported variable '{0}' has or is using private type '{1}'.", - "Public static property '{0}' of exported class is using inaccessible module {1}.": "Public static property '{0}' of exported class is using inaccessible module {1}.", - "Public property '{0}' of exported class is using inaccessible module {1}.": "Public property '{0}' of exported class is using inaccessible module {1}.", - "Property '{0}' of exported interface is using inaccessible module {1}.": "Property '{0}' of exported interface is using inaccessible module {1}.", - "Exported variable '{0}' is using inaccessible module {1}.": "Exported variable '{0}' is using inaccessible module {1}.", - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - "Parameter '{0}' of exported function has or is using private type '{1}'.": "Parameter '{0}' of exported function has or is using private type '{1}'.", - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - "Parameter '{0}' of exported function is using inaccessible module {1}.": "Parameter '{0}' of exported function is using inaccessible module {1}.", - "Return type of public static property getter from exported class has or is using private type '{0}'.": "Return type of public static property getter from exported class has or is using private type '{0}'.", - "Return type of public property getter from exported class has or is using private type '{0}'.": "Return type of public property getter from exported class has or is using private type '{0}'.", - "Return type of constructor signature from exported interface has or is using private type '{0}'.": "Return type of constructor signature from exported interface has or is using private type '{0}'.", - "Return type of call signature from exported interface has or is using private type '{0}'.": "Return type of call signature from exported interface has or is using private type '{0}'.", - "Return type of index signature from exported interface has or is using private type '{0}'.": "Return type of index signature from exported interface has or is using private type '{0}'.", - "Return type of public static method from exported class has or is using private type '{0}'.": "Return type of public static method from exported class has or is using private type '{0}'.", - "Return type of public method from exported class has or is using private type '{0}'.": "Return type of public method from exported class has or is using private type '{0}'.", - "Return type of method from exported interface has or is using private type '{0}'.": "Return type of method from exported interface has or is using private type '{0}'.", - "Return type of exported function has or is using private type '{0}'.": "Return type of exported function has or is using private type '{0}'.", - "Return type of public static property getter from exported class is using inaccessible module {0}.": "Return type of public static property getter from exported class is using inaccessible module {0}.", - "Return type of public property getter from exported class is using inaccessible module {0}.": "Return type of public property getter from exported class is using inaccessible module {0}.", - "Return type of constructor signature from exported interface is using inaccessible module {0}.": "Return type of constructor signature from exported interface is using inaccessible module {0}.", - "Return type of call signature from exported interface is using inaccessible module {0}.": "Return type of call signature from exported interface is using inaccessible module {0}.", - "Return type of index signature from exported interface is using inaccessible module {0}.": "Return type of index signature from exported interface is using inaccessible module {0}.", - "Return type of public static method from exported class is using inaccessible module {0}.": "Return type of public static method from exported class is using inaccessible module {0}.", - "Return type of public method from exported class is using inaccessible module {0}.": "Return type of public method from exported class is using inaccessible module {0}.", - "Return type of method from exported interface is using inaccessible module {0}.": "Return type of method from exported interface is using inaccessible module {0}.", - "Return type of exported function is using inaccessible module {0}.": "Return type of exported function is using inaccessible module {0}.", - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - "A parameter list must follow a generic type argument list. '(' expected.": "A parameter list must follow a generic type argument list. '(' expected.", - "Multiple constructor implementations are not allowed.": "Multiple constructor implementations are not allowed.", - "Unable to resolve external module '{0}'.": "Unable to resolve external module '{0}'.", - "Module cannot be aliased to a non-module type.": "Module cannot be aliased to a non-module type.", - "A class may only extend another class.": "A class may only extend another class.", - "A class may only implement another class or interface.": "A class may only implement another class or interface.", - "An interface may only extend another class or interface.": "An interface may only extend another class or interface.", - "An interface cannot implement another type.": "An interface cannot implement another type.", - "Unable to resolve type.": "Unable to resolve type.", - "Unable to resolve type of '{0}'.": "Unable to resolve type of '{0}'.", - "Unable to resolve type parameter constraint.": "Unable to resolve type parameter constraint.", - "Type parameter constraint cannot be a primitive type.": "Type parameter constraint cannot be a primitive type.", - "Supplied parameters do not match any signature of call target.": "Supplied parameters do not match any signature of call target.", - "Supplied parameters do not match any signature of call target:{NL}{0}": "Supplied parameters do not match any signature of call target:{NL}{0}", - "Invalid 'new' expression.": "Invalid 'new' expression.", - "Call signatures used in a 'new' expression must have a 'void' return type.": "Call signatures used in a 'new' expression must have a 'void' return type.", - "Could not select overload for 'new' expression.": "Could not select overload for 'new' expression.", - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - "Could not select overload for 'call' expression.": "Could not select overload for 'call' expression.", - "Cannot invoke an expression whose type lacks a call signature.": "Cannot invoke an expression whose type lacks a call signature.", - "Calls to 'super' are only valid inside a class.": "Calls to 'super' are only valid inside a class.", - "Generic type '{0}' requires {1} type argument(s).": "Generic type '{0}' requires {1} type argument(s).", - "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.": "Type of conditional expression cannot be determined. Best common type could not be found between '{0}' and '{1}'.", - "Type of array literal cannot be determined. Best common type could not be found for array elements.": "Type of array literal cannot be determined. Best common type could not be found for array elements.", - "Could not find enclosing symbol for dotted name '{0}'.": "Could not find enclosing symbol for dotted name '{0}'.", - "The property '{0}' does not exist on value of type '{1}'.": "The property '{0}' does not exist on value of type '{1}'.", - "Could not find symbol '{0}'.": "Could not find symbol '{0}'.", - "'get' and 'set' accessor must have the same type.": "'get' and 'set' accessor must have the same type.", - "'this' cannot be referenced in current location.": "'this' cannot be referenced in current location.", - "Static methods cannot reference class type parameters.": "Static methods cannot reference class type parameters.", - "Class '{0}' is recursively referenced as a base type of itself.": "Class '{0}' is recursively referenced as a base type of itself.", - "Interface '{0}' is recursively referenced as a base type of itself.": "Interface '{0}' is recursively referenced as a base type of itself.", - "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.": "'super' property access is permitted only in a constructor, instance member function, or instance member accessor of a derived class.", - "'super' cannot be referenced in non-derived classes.": "'super' cannot be referenced in non-derived classes.", - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - "Constructors for derived classes must contain a 'super' call.": "Constructors for derived classes must contain a 'super' call.", - "Super calls are not permitted outside constructors or in local functions inside constructors.": "Super calls are not permitted outside constructors or in local functions inside constructors.", - "'{0}.{1}' is inaccessible.": "'{0}.{1}' is inaccessible.", - "'this' cannot be referenced within module bodies.": "'this' cannot be referenced within module bodies.", - "Invalid '+' expression - types not known to support the addition operator.": "Invalid '+' expression - types not known to support the addition operator.", - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - "Variable declarations of a 'for' statement cannot use a type annotation.": "Variable declarations of a 'for' statement cannot use a type annotation.", - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'in' expression must be of types 'string' or 'any'.": "The left-hand side of an 'in' expression must be of types 'string' or 'any'.", - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.": "The right-hand side of an 'instanceof' expression must be of type 'any' or a subtype of the 'Function' interface type.", - "Setters cannot return a value.": "Setters cannot return a value.", - "Tried to query type of uninitialized module '{0}'.": "Tried to query type of uninitialized module '{0}'.", - "Tried to set variable type to uninitialized module type '{0}'.": "Tried to set variable type to uninitialized module type '{0}'.", - "Function '{0}' declared a non-void return type, but has no return expression.": "Function '{0}' declared a non-void return type, but has no return expression.", - "Getters must return a value.": "Getters must return a value.", - "Getter and setter accessors do not agree in visibility.": "Getter and setter accessors do not agree in visibility.", - "Invalid left-hand side of assignment expression.": "Invalid left-hand side of assignment expression.", - "Function declared a non-void return type, but has no return expression.": "Function declared a non-void return type, but has no return expression.", - "Cannot resolve return type reference.": "Cannot resolve return type reference.", - "Constructors cannot have a return type of 'void'.": "Constructors cannot have a return type of 'void'.", - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - "All symbols within a with block will be resolved to 'any'.": "All symbols within a with block will be resolved to 'any'.", - "Import declarations in an internal module cannot reference an external module.": "Import declarations in an internal module cannot reference an external module.", - "Class {0} declares interface {1} but does not implement it:{NL}{2}": "Class {0} declares interface {1} but does not implement it:{NL}{2}", - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - "The operand of an increment or decrement operator must be a variable, property or indexer.": "The operand of an increment or decrement operator must be a variable, property or indexer.", - "'this' cannot be referenced in static initializers in a class body.": "'this' cannot be referenced in static initializers in a class body.", - "Class '{0}' cannot extend class '{1}':{NL}{2}": "Class '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend class '{1}':{NL}{2}": "Interface '{0}' cannot extend class '{1}':{NL}{2}", - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - "Duplicate overload signature for '{0}'.": "Duplicate overload signature for '{0}'.", - "Duplicate constructor overload signature.": "Duplicate constructor overload signature.", - "Duplicate overload call signature.": "Duplicate overload call signature.", - "Duplicate overload construct signature.": "Duplicate overload construct signature.", - "Overload signature is not compatible with function definition.": "Overload signature is not compatible with function definition.", - "Overload signature is not compatible with function definition:{NL}{0}": "Overload signature is not compatible with function definition:{NL}{0}", - "Overload signatures must all be public or private.": "Overload signatures must all be public or private.", - "Overload signatures must all be exported or local.": "Overload signatures must all be exported or local.", - "Overload signatures must all be ambient or non-ambient.": "Overload signatures must all be ambient or non-ambient.", - "Overload signatures must all be optional or required.": "Overload signatures must all be optional or required.", - "Specialized overload signature is not subtype of any non-specialized signature.": "Specialized overload signature is not subtype of any non-specialized signature.", - "'this' cannot be referenced in constructor arguments.": "'this' cannot be referenced in constructor arguments.", - "Static member cannot be accessed off an instance variable.": "Static member cannot be accessed off an instance variable.", - "Instance member cannot be accessed off a class.": "Instance member cannot be accessed off a class.", - "Untyped function calls may not accept type arguments.": "Untyped function calls may not accept type arguments.", - "Non-generic functions may not accept type arguments.": "Non-generic functions may not accept type arguments.", - "A generic type may not reference itself with a wrapped form of its own type parameters.": "A generic type may not reference itself with a wrapped form of its own type parameters.", - "Rest parameters must be array types.": "Rest parameters must be array types.", - "Overload signature implementation cannot use specialized type.": "Overload signature implementation cannot use specialized type.", - "Export assignments may only be used at the top-level of external modules.": "Export assignments may only be used at the top-level of external modules.", - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules": "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules", - "Only public instance methods of the base class are accessible via the 'super' keyword.": "Only public instance methods of the base class are accessible via the 'super' keyword.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}'.", - "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}": "Numeric indexer type '{0}' must be a subtype of string indexer type '{1}':{NL}{2}", - "All numerically named properties must be subtypes of numeric indexer type '{0}'.": "All numerically named properties must be subtypes of numeric indexer type '{0}'.", - "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}": "All numerically named properties must be subtypes of numeric indexer type '{0}':{NL}{1}", - "All named properties must be subtypes of string indexer type '{0}'.": "All named properties must be subtypes of string indexer type '{0}'.", - "All named properties must be subtypes of string indexer type '{0}':{NL}{1}": "All named properties must be subtypes of string indexer type '{0}':{NL}{1}", - "Generic type references must include all type arguments.": "Generic type references must include all type arguments.", - "Default arguments are not allowed in an overload parameter.": "Default arguments are not allowed in an overload parameter.", - "Overloads cannot differ only by return type.": "Overloads cannot differ only by return type.", - "Function expression declared a non-void return type, but has no return expression.": "Function expression declared a non-void return type, but has no return expression.", - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - "Could not find symbol '{0}' in module '{1}'.": "Could not find symbol '{0}' in module '{1}'.", - "Unable to resolve module reference '{0}'.": "Unable to resolve module reference '{0}'.", - "Could not find module '{0}' in module '{1}'.": "Could not find module '{0}' in module '{1}'.", - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.": "Type reference '{0}' in extends clause doesn't reference constructor function for '{1}'.", - "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.": "Internal module reference '{0}' in import declaration doesn't reference module instance for '{1}'.", - "Type '{0}' is missing property '{1}' from type '{2}'.": "Type '{0}' is missing property '{1}' from type '{2}'.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - "Types '{0}' and '{1}' define property '{2}' as private.": "Types '{0}' and '{1}' define property '{2}' as private.", - "Call signatures of types '{0}' and '{1}' are incompatible.": "Call signatures of types '{0}' and '{1}' are incompatible.", - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a call signature, but type '{1}' lacks one.": "Type '{0}' requires a call signature, but type '{1}' lacks one.", - "Construct signatures of types '{0}' and '{1}' are incompatible.": "Construct signatures of types '{0}' and '{1}' are incompatible.", - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - "Index signatures of types '{0}' and '{1}' are incompatible.": "Index signatures of types '{0}' and '{1}' are incompatible.", - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - "Call signature expects {0} or fewer parameters.": "Call signature expects {0} or fewer parameters.", - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - "Type reference cannot refer to container '{0}'.": "Type reference cannot refer to container '{0}'.", - "Type reference must refer to type.": "Type reference must refer to type.", - "Enums with multiple declarations must provide an initializer for the first enum element.": "Enums with multiple declarations must provide an initializer for the first enum element.", - " (+ {0} overload(s))": " (+ {0} overload(s))", - "Current host does not support '{0}' option.": "Current host does not support '{0}' option.", - "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.": "ECMAScript target version '{0}' not supported. Using default '{1}' code generation.", - "Module code generation '{0}' not supported.": "Module code generation '{0}' not supported.", - "Could not find file: '{0}'.": "Could not find file: '{0}'.", - "A file cannot have a reference to itself.": "A file cannot have a reference to itself.", - "Cannot resolve referenced file: '{0}'.": "Cannot resolve referenced file: '{0}'.", - "Cannot find the common subdirectory path for the input files.": "Cannot find the common subdirectory path for the input files.", - "Cannot compile external modules when emitting into single file.": "Cannot compile external modules when emitting into single file.", - "Emit Error: {0}.": "Emit Error: {0}.", - "Cannot read file '{0}': {1}": "Cannot read file '{0}': {1}", - "Unsupported file encoding.": "Unsupported file encoding.", - "Locale must be of the form or -. For example '{0}' or '{1}'.": "Locale must be of the form or -. For example '{0}' or '{1}'.", - "Unsupported locale: '{0}'.": "Unsupported locale: '{0}'.", - "Execution Failed.{NL}": "Execution Failed.{NL}", - "Should not emit a type query": "Should not emit a type query", - "Should not emit a type reference": "Should not emit a type reference", - "Invalid call to 'up'": "Invalid call to 'up'", - "Invalid call to 'down'": "Invalid call to 'down'", - "Base64 value '{0}' finished with a continuation bit": "Base64 value '{0}' finished with a continuation bit", - "Key was already in table": "Key was already in table", - "Unknown option '{0}'": "Unknown option '{0}'", - "Expected {0} arguments to message, got {1} instead": "Expected {0} arguments to message, got {1} instead", - "Expected the message '{0}' to have {1} arguments, but it had {2}": "Expected the message '{0}' to have {1} arguments, but it had {2}", - "Invalid argument: {0}. {1}": "Invalid argument: {0}. {1}", - "Invalid argument: {0}.": "Invalid argument: {0}.", - "Argument out of range: {0}.": "Argument out of range: {0}.", - "Argument null: {0}.": "Argument null: {0}.", - "Operation not implemented properly by subclass.": "Operation not implemented properly by subclass.", - "Not yet implemented.": "Not yet implemented.", - "Invalid operation: {0}": "Invalid operation: {0}", - "Invalid operation.": "Invalid operation.", - "Could not delete file '{0}'": "Could not delete file '{0}'", - "Could not create directory '{0}'": "Could not create directory '{0}'", - "Error while executing file '{0}': ": "Error while executing file '{0}': ", - "Cannot compile external modules unless the '--module' flag is provided.": "Cannot compile external modules unless the '--module' flag is provided.", - "Option mapRoot cannot be specified without specifying sourcemap option.": "Option mapRoot cannot be specified without specifying sourcemap option.", - "Option sourceRoot cannot be specified without specifying sourcemap option.": "Option sourceRoot cannot be specified without specifying sourcemap option.", - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - "Concatenate and emit output to single file | Redirect output structure to the directory": "Concatenate and emit output to single file | Redirect output structure to the directory", - "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", - "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", - "file": "file", - "Examples:": "Examples:", - "Options:": "Options:", - "Insert command line options and files from a file.": "Insert command line options and files from a file.", - "Version {0}": "Version {0}", - "Use the '{0}' flag to see options": "Use the '{0}' flag to see options", - "{NL}Recompiling ({0}):": "{NL}Recompiling ({0}):", - "STRING": "STRING", - "KIND": "KIND", - "FILE|DIRECTORY": "FILE|DIRECTORY", - "VERSION": "VERSION", - "LOCATION": "LOCATION", - "This version of the Javascript runtime does not support the '{0}' function.": "This version of the Javascript runtime does not support the '{0}' function.", - "Looking up path for identifier token did not result in an identifer.": "Looking up path for identifier token did not result in an identifer.", - "Unknown rule": "Unknown rule", - "Invalid line number ({0})": "Invalid line number ({0})", - "Warn on expressions and declarations with an implied 'any' type.": "Warn on expressions and declarations with an implied 'any' type.", - "Variable '{0}' implicitly has an 'any' type.": "Variable '{0}' implicitly has an 'any' type.", - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - "Parameter '{0}' of function type implicitly has an 'any' type.": "Parameter '{0}' of function type implicitly has an 'any' type.", - "Member '{0}' of object type implicitly has an 'any' type.": "Member '{0}' of object type implicitly has an 'any' type.", - "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.": "\"New\" expression, which lacks a constructor signature, implicitly has an 'any' type.", - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - "Parameter '{0}' of lambda function implicitly has an 'any' type.": "Parameter '{0}' of lambda function implicitly has an 'any' type.", - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - "Array Literal implicitly has an 'any' type from widening.": "Array Literal implicitly has an 'any' type from widening." -} \ No newline at end of file diff --git a/lib/typescript-src/support/typescript/bin/tsc.js b/lib/typescript-src/support/typescript/bin/tsc.js index 5813312..9811150 100644 --- a/lib/typescript-src/support/typescript/bin/tsc.js +++ b/lib/typescript-src/support/typescript/bin/tsc.js @@ -13,62917 +13,18277 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var TypeScript; -(function (TypeScript) { - TypeScript.DiagnosticCode = { - error_TS_0_1: "error TS{0}: {1}", - warning_TS_0_1: "warning TS{0}: {1}", - Unrecognized_escape_sequence: "Unrecognized escape sequence.", - Unexpected_character_0: "Unexpected character {0}.", - Missing_close_quote_character: "Missing close quote character.", - Identifier_expected: "Identifier expected.", - _0_keyword_expected: "'{0}' keyword expected.", - _0_expected: "'{0}' expected.", - Identifier_expected_0_is_a_keyword: "Identifier expected; '{0}' is a keyword.", - Automatic_semicolon_insertion_not_allowed: "Automatic semicolon insertion not allowed.", - Unexpected_token_0_expected: "Unexpected token; '{0}' expected.", - Trailing_separator_not_allowed: "Trailing separator not allowed.", - AsteriskSlash_expected: "'*/' expected.", - public_or_private_modifier_must_precede_static: "'public' or 'private' modifier must precede 'static'.", - Unexpected_token: "Unexpected token.", - Catch_clause_parameter_cannot_have_a_type_annotation: "Catch clause parameter cannot have a type annotation.", - Rest_parameter_must_be_last_in_list: "Rest parameter must be last in list.", - Parameter_cannot_have_question_mark_and_initializer: "Parameter cannot have question mark and initializer.", - Required_parameter_cannot_follow_optional_parameter: "Required parameter cannot follow optional parameter.", - Index_signatures_cannot_have_rest_parameters: "Index signatures cannot have rest parameters.", - Index_signature_parameter_cannot_have_accessibility_modifiers: "Index signature parameter cannot have accessibility modifiers.", - Index_signature_parameter_cannot_have_a_question_mark: "Index signature parameter cannot have a question mark.", - Index_signature_parameter_cannot_have_an_initializer: "Index signature parameter cannot have an initializer.", - Index_signature_must_have_a_type_annotation: "Index signature must have a type annotation.", - Index_signature_parameter_must_have_a_type_annotation: "Index signature parameter must have a type annotation.", - Index_signature_parameter_type_must_be_string_or_number: "Index signature parameter type must be 'string' or 'number'.", - extends_clause_already_seen: "'extends' clause already seen.", - extends_clause_must_precede_implements_clause: "'extends' clause must precede 'implements' clause.", - Classes_can_only_extend_a_single_class: "Classes can only extend a single class.", - implements_clause_already_seen: "'implements' clause already seen.", - Accessibility_modifier_already_seen: "Accessibility modifier already seen.", - _0_modifier_must_precede_1_modifier: "'{0}' modifier must precede '{1}' modifier.", - _0_modifier_already_seen: "'{0}' modifier already seen.", - _0_modifier_cannot_appear_on_a_class_element: "'{0}' modifier cannot appear on a class element.", - Interface_declaration_cannot_have_implements_clause: "Interface declaration cannot have 'implements' clause.", - super_invocation_cannot_have_type_arguments: "'super' invocation cannot have type arguments.", - Only_ambient_modules_can_use_quoted_names: "Only ambient modules can use quoted names.", - Statements_are_not_allowed_in_ambient_contexts: "Statements are not allowed in ambient contexts.", - Implementations_are_not_allowed_in_ambient_contexts: "Implementations are not allowed in ambient contexts.", - declare_modifier_not_allowed_for_code_already_in_an_ambient_context: "'declare' modifier not allowed for code already in an ambient context.", - Initializers_are_not_allowed_in_ambient_contexts: "Initializers are not allowed in ambient contexts.", - Parameter_property_declarations_can_only_be_used_in_a_non_ambient_constructor_declaration: "Parameter property declarations can only be used in a non-ambient constructor declaration.", - Function_implementation_expected: "Function implementation expected.", - Constructor_implementation_expected: "Constructor implementation expected.", - Function_overload_name_must_be_0: "Function overload name must be '{0}'.", - _0_modifier_cannot_appear_on_a_module_element: "'{0}' modifier cannot appear on a module element.", - declare_modifier_cannot_appear_on_an_interface_declaration: "'declare' modifier cannot appear on an interface declaration.", - declare_modifier_required_for_top_level_element: "'declare' modifier required for top level element.", - Rest_parameter_cannot_be_optional: "Rest parameter cannot be optional.", - Rest_parameter_cannot_have_an_initializer: "Rest parameter cannot have an initializer.", - set_accessor_must_have_one_and_only_one_parameter: "'set' accessor must have one and only one parameter.", - set_accessor_parameter_cannot_be_optional: "'set' accessor parameter cannot be optional.", - set_accessor_parameter_cannot_have_an_initializer: "'set' accessor parameter cannot have an initializer.", - set_accessor_cannot_have_rest_parameter: "'set' accessor cannot have rest parameter.", - get_accessor_cannot_have_parameters: "'get' accessor cannot have parameters.", - Modifiers_cannot_appear_here: "Modifiers cannot appear here.", - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: "Accessors are only available when targeting ECMAScript 5 and higher.", - Class_name_cannot_be_0: "Class name cannot be '{0}'.", - Interface_name_cannot_be_0: "Interface name cannot be '{0}'.", - Enum_name_cannot_be_0: "Enum name cannot be '{0}'.", - Module_name_cannot_be_0: "Module name cannot be '{0}'.", - Enum_member_must_have_initializer: "Enum member must have initializer.", - Export_assignment_cannot_be_used_in_internal_modules: "Export assignment cannot be used in internal modules.", - Export_assignment_not_allowed_in_module_with_exported_element: "Export assignment not allowed in module with exported element.", - Module_cannot_have_multiple_export_assignments: "Module cannot have multiple export assignments.", - Ambient_enum_elements_can_only_have_integer_literal_initializers: "Ambient enum elements can only have integer literal initializers.", - module_class_interface_enum_import_or_statement: "module, class, interface, enum, import or statement", - constructor_function_accessor_or_variable: "constructor, function, accessor or variable", - statement: "statement", - case_or_default_clause: "case or default clause", - identifier: "identifier", - call_construct_index_property_or_function_signature: "call, construct, index, property or function signature", - expression: "expression", - type_name: "type name", - property_or_accessor: "property or accessor", - parameter: "parameter", - type: "type", - type_parameter: "type parameter", - declare_modifier_not_allowed_on_import_declaration: "'declare' modifier not allowed on import declaration.", - Function_overload_must_be_static: "Function overload must be static.", - Function_overload_must_not_be_static: "Function overload must not be static.", - Parameter_property_declarations_cannot_be_used_in_a_constructor_overload: "Parameter property declarations cannot be used in a constructor overload.", - Invalid_reference_directive_syntax: "Invalid 'reference' directive syntax.", - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: "Octal literals are not available when targeting ECMAScript 5 and higher.", - Accessors_are_not_allowed_in_ambient_contexts: "Accessors are not allowed in ambient contexts.", - _0_modifier_cannot_appear_on_a_constructor_declaration: "'{0}' modifier cannot appear on a constructor declaration.", - _0_modifier_cannot_appear_on_a_parameter: "'{0}' modifier cannot appear on a parameter.", - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: "Only a single variable declaration is allowed in a 'for...in' statement.", - Type_parameters_cannot_appear_on_a_constructor_declaration: "Type parameters cannot appear on a constructor declaration.", - Type_annotation_cannot_appear_on_a_constructor_declaration: "Type annotation cannot appear on a constructor declaration.", - Duplicate_identifier_0: "Duplicate identifier '{0}'.", - The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.", - The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.", - super_can_only_be_used_inside_a_class_instance_method: "'super' can only be used inside a class instance method.", - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_property_or_indexer: "The left-hand side of an assignment expression must be a variable, property or indexer.", - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: "Value of type '{0}' is not callable. Did you mean to include 'new'?", - Value_of_type_0_is_not_callable: "Value of type '{0}' is not callable.", - Value_of_type_0_is_not_newable: "Value of type '{0}' is not newable.", - Value_of_type_0_is_not_indexable_by_type_1: "Value of type '{0}' is not indexable by type '{1}'.", - Operator_0_cannot_be_applied_to_types_1_and_2: "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - Operator_0_cannot_be_applied_to_types_1_and_2_3: "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - Cannot_convert_0_to_1: "Cannot convert '{0}' to '{1}'.", - Cannot_convert_0_to_1_NL_2: "Cannot convert '{0}' to '{1}':{NL}{2}", - Expected_var_class_interface_or_module: "Expected var, class, interface, or module.", - Operator_0_cannot_be_applied_to_type_1: "Operator '{0}' cannot be applied to type '{1}'.", - Getter_0_already_declared: "Getter '{0}' already declared.", - Setter_0_already_declared: "Setter '{0}' already declared.", - Exported_class_0_extends_private_class_1: "Exported class '{0}' extends private class '{1}'.", - Exported_class_0_implements_private_interface_1: "Exported class '{0}' implements private interface '{1}'.", - Exported_interface_0_extends_private_interface_1: "Exported interface '{0}' extends private interface '{1}'.", - Exported_class_0_extends_class_from_inaccessible_module_1: "Exported class '{0}' extends class from inaccessible module {1}.", - Exported_class_0_implements_interface_from_inaccessible_module_1: "Exported class '{0}' implements interface from inaccessible module {1}.", - Exported_interface_0_extends_interface_from_inaccessible_module_1: "Exported interface '{0}' extends interface from inaccessible module {1}.", - Public_static_property_0_of_exported_class_has_or_is_using_private_type_1: "Public static property '{0}' of exported class has or is using private type '{1}'.", - Public_property_0_of_exported_class_has_or_is_using_private_type_1: "Public property '{0}' of exported class has or is using private type '{1}'.", - Property_0_of_exported_interface_has_or_is_using_private_type_1: "Property '{0}' of exported interface has or is using private type '{1}'.", - Exported_variable_0_has_or_is_using_private_type_1: "Exported variable '{0}' has or is using private type '{1}'.", - Public_static_property_0_of_exported_class_is_using_inaccessible_module_1: "Public static property '{0}' of exported class is using inaccessible module {1}.", - Public_property_0_of_exported_class_is_using_inaccessible_module_1: "Public property '{0}' of exported class is using inaccessible module {1}.", - Property_0_of_exported_interface_is_using_inaccessible_module_1: "Property '{0}' of exported interface is using inaccessible module {1}.", - Exported_variable_0_is_using_inaccessible_module_1: "Exported variable '{0}' is using inaccessible module {1}.", - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - Parameter_0_of_exported_function_has_or_is_using_private_type_1: "Parameter '{0}' of exported function has or is using private type '{1}'.", - Parameter_0_of_constructor_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - Parameter_0_of_public_static_property_setter_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - Parameter_0_of_public_property_setter_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - Parameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - Parameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - Parameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - Parameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - Parameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - Parameter_0_of_exported_function_is_using_inaccessible_module_1: "Parameter '{0}' of exported function is using inaccessible module {1}.", - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_type_0: "Return type of public static property getter from exported class has or is using private type '{0}'.", - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_type_0: "Return type of public property getter from exported class has or is using private type '{0}'.", - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of constructor signature from exported interface has or is using private type '{0}'.", - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of call signature from exported interface has or is using private type '{0}'.", - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of index signature from exported interface has or is using private type '{0}'.", - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_type_0: "Return type of public static method from exported class has or is using private type '{0}'.", - Return_type_of_public_method_from_exported_class_has_or_is_using_private_type_0: "Return type of public method from exported class has or is using private type '{0}'.", - Return_type_of_method_from_exported_interface_has_or_is_using_private_type_0: "Return type of method from exported interface has or is using private type '{0}'.", - Return_type_of_exported_function_has_or_is_using_private_type_0: "Return type of exported function has or is using private type '{0}'.", - Return_type_of_public_static_property_getter_from_exported_class_is_using_inaccessible_module_0: "Return type of public static property getter from exported class is using inaccessible module {0}.", - Return_type_of_public_property_getter_from_exported_class_is_using_inaccessible_module_0: "Return type of public property getter from exported class is using inaccessible module {0}.", - Return_type_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of constructor signature from exported interface is using inaccessible module {0}.", - Return_type_of_call_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of call signature from exported interface is using inaccessible module {0}.", - Return_type_of_index_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of index signature from exported interface is using inaccessible module {0}.", - Return_type_of_public_static_method_from_exported_class_is_using_inaccessible_module_0: "Return type of public static method from exported class is using inaccessible module {0}.", - Return_type_of_public_method_from_exported_class_is_using_inaccessible_module_0: "Return type of public method from exported class is using inaccessible module {0}.", - Return_type_of_method_from_exported_interface_is_using_inaccessible_module_0: "Return type of method from exported interface is using inaccessible module {0}.", - Return_type_of_exported_function_is_using_inaccessible_module_0: "Return type of exported function is using inaccessible module {0}.", - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - A_parameter_list_must_follow_a_generic_type_argument_list_expected: "A parameter list must follow a generic type argument list. '(' expected.", - Multiple_constructor_implementations_are_not_allowed: "Multiple constructor implementations are not allowed.", - Unable_to_resolve_external_module_0: "Unable to resolve external module '{0}'.", - Module_cannot_be_aliased_to_a_non_module_type: "Module cannot be aliased to a non-module type.", - A_class_may_only_extend_another_class: "A class may only extend another class.", - A_class_may_only_implement_another_class_or_interface: "A class may only implement another class or interface.", - An_interface_may_only_extend_another_class_or_interface: "An interface may only extend another class or interface.", - Unable_to_resolve_type: "Unable to resolve type.", - Unable_to_resolve_type_of_0: "Unable to resolve type of '{0}'.", - Unable_to_resolve_type_parameter_constraint: "Unable to resolve type parameter constraint.", - Type_parameter_constraint_cannot_be_a_primitive_type: "Type parameter constraint cannot be a primitive type.", - Supplied_parameters_do_not_match_any_signature_of_call_target: "Supplied parameters do not match any signature of call target.", - Supplied_parameters_do_not_match_any_signature_of_call_target_NL_0: "Supplied parameters do not match any signature of call target:{NL}{0}", - Invalid_new_expression: "Invalid 'new' expression.", - Call_signatures_used_in_a_new_expression_must_have_a_void_return_type: "Call signatures used in a 'new' expression must have a 'void' return type.", - Could_not_select_overload_for_new_expression: "Could not select overload for 'new' expression.", - Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2: "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - Could_not_select_overload_for_call_expression: "Could not select overload for 'call' expression.", - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: "Cannot invoke an expression whose type lacks a call signature.", - Calls_to_super_are_only_valid_inside_a_class: "Calls to 'super' are only valid inside a class.", - Generic_type_0_requires_1_type_argument_s: "Generic type '{0}' requires {1} type argument(s).", - Type_of_array_literal_cannot_be_determined_Best_common_type_could_not_be_found_for_array_elements: "Type of array literal cannot be determined. Best common type could not be found for array elements.", - Could_not_find_enclosing_symbol_for_dotted_name_0: "Could not find enclosing symbol for dotted name '{0}'.", - The_property_0_does_not_exist_on_value_of_type_1: "The property '{0}' does not exist on value of type '{1}'.", - Could_not_find_symbol_0: "Could not find symbol '{0}'.", - get_and_set_accessor_must_have_the_same_type: "'get' and 'set' accessor must have the same type.", - this_cannot_be_referenced_in_current_location: "'this' cannot be referenced in current location.", - Static_members_cannot_reference_class_type_parameters: "Static members cannot reference class type parameters.", - Class_0_is_recursively_referenced_as_a_base_type_of_itself: "Class '{0}' is recursively referenced as a base type of itself.", - Interface_0_is_recursively_referenced_as_a_base_type_of_itself: "Interface '{0}' is recursively referenced as a base type of itself.", - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.", - super_cannot_be_referenced_in_non_derived_classes: "'super' cannot be referenced in non-derived classes.", - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - Constructors_for_derived_classes_must_contain_a_super_call: "Constructors for derived classes must contain a 'super' call.", - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: "Super calls are not permitted outside constructors or in nested functions inside constructors.", - _0_1_is_inaccessible: "'{0}.{1}' is inaccessible.", - this_cannot_be_referenced_within_module_bodies: "'this' cannot be referenced within module bodies.", - Invalid_expression_types_not_known_to_support_the_addition_operator: "Invalid '+' expression - types not known to support the addition operator.", - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - The_type_of_a_unary_arithmetic_operation_operand_must_be_of_type_any_number_or_an_enum_type: "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - Variable_declarations_of_a_for_statement_cannot_use_a_type_annotation: "Variable declarations of a 'for' statement cannot use a type annotation.", - Variable_declarations_of_a_for_statement_must_be_of_types_string_or_any: "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.", - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.", - Setters_cannot_return_a_value: "Setters cannot return a value.", - Tried_to_query_type_of_uninitialized_module_0: "Tried to query type of uninitialized module '{0}'.", - Tried_to_set_variable_type_to_uninitialized_module_type_0: "Tried to set variable type to uninitialized module type '{0}'.", - Type_0_does_not_have_type_parameters: "Type '{0}' does not have type parameters.", - Getters_must_return_a_value: "Getters must return a value.", - Getter_and_setter_accessors_do_not_agree_in_visibility: "Getter and setter accessors do not agree in visibility.", - Invalid_left_hand_side_of_assignment_expression: "Invalid left-hand side of assignment expression.", - Function_declared_a_non_void_return_type_but_has_no_return_expression: "Function declared a non-void return type, but has no return expression.", - Cannot_resolve_return_type_reference: "Cannot resolve return type reference.", - Constructors_cannot_have_a_return_type_of_void: "Constructors cannot have a return type of 'void'.", - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - All_symbols_within_a_with_block_will_be_resolved_to_any: "All symbols within a with block will be resolved to 'any'.", - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: "Import declarations in an internal module cannot reference an external module.", - Class_0_declares_interface_1_but_does_not_implement_it_NL_2: "Class {0} declares interface {1} but does not implement it:{NL}{2}", - Class_0_declares_class_1_as_an_interface_but_does_not_implement_it_NL_2: "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: "The operand of an increment or decrement operator must be a variable, property or indexer.", - this_cannot_be_referenced_in_static_initializers_in_a_class_body: "'this' cannot be referenced in static initializers in a class body.", - Class_0_cannot_extend_class_1_NL_2: "Class '{0}' cannot extend class '{1}':{NL}{2}", - Interface_0_cannot_extend_class_1_NL_2: "Interface '{0}' cannot extend class '{1}':{NL}{2}", - Interface_0_cannot_extend_interface_1_NL_2: "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - Duplicate_overload_signature_for_0: "Duplicate overload signature for '{0}'.", - Duplicate_constructor_overload_signature: "Duplicate constructor overload signature.", - Duplicate_overload_call_signature: "Duplicate overload call signature.", - Duplicate_overload_construct_signature: "Duplicate overload construct signature.", - Overload_signature_is_not_compatible_with_function_definition: "Overload signature is not compatible with function definition.", - Overload_signature_is_not_compatible_with_function_definition_NL_0: "Overload signature is not compatible with function definition:{NL}{0}", - Overload_signatures_must_all_be_public_or_private: "Overload signatures must all be public or private.", - Overload_signatures_must_all_be_exported_or_not_exported: "Overload signatures must all be exported or not exported.", - Overload_signatures_must_all_be_ambient_or_non_ambient: "Overload signatures must all be ambient or non-ambient.", - Overload_signatures_must_all_be_optional_or_required: "Overload signatures must all be optional or required.", - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: "Specialized overload signature is not assignable to any non-specialized signature.", - this_cannot_be_referenced_in_constructor_arguments: "'this' cannot be referenced in constructor arguments.", - Instance_member_cannot_be_accessed_off_a_class: "Instance member cannot be accessed off a class.", - Untyped_function_calls_may_not_accept_type_arguments: "Untyped function calls may not accept type arguments.", - Non_generic_functions_may_not_accept_type_arguments: "Non-generic functions may not accept type arguments.", - A_generic_type_may_not_reference_itself_with_a_wrapped_form_of_its_own_type_parameters: "A generic type may not reference itself with a wrapped form of its own type parameters.", - Rest_parameters_must_be_array_types: "Rest parameters must be array types.", - Overload_signature_implementation_cannot_use_specialized_type: "Overload signature implementation cannot use specialized type.", - Export_assignments_may_only_be_used_at_the_top_level_of_external_modules: "Export assignments may only be used at the top-level of external modules.", - Export_assignments_may_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules: "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules.", - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: "Only public methods of the base class are accessible via the 'super' keyword.", - Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1: "Numeric indexer type '{0}' must be assignable to string indexer type '{1}'.", - Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1_NL_2: "Numeric indexer type '{0}' must be assignable to string indexer type '{1}':{NL}{2}", - All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0: "All numerically named properties must be assignable to numeric indexer type '{0}'.", - All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0_NL_1: "All numerically named properties must be assignable to numeric indexer type '{0}':{NL}{1}", - All_named_properties_must_be_assignable_to_string_indexer_type_0: "All named properties must be assignable to string indexer type '{0}'.", - All_named_properties_must_be_assignable_to_string_indexer_type_0_NL_1: "All named properties must be assignable to string indexer type '{0}':{NL}{1}", - Generic_type_references_must_include_all_type_arguments: "Generic type references must include all type arguments.", - Default_arguments_are_only_allowed_in_implementation: "Default arguments are only allowed in implementation.", - Overloads_cannot_differ_only_by_return_type: "Overloads cannot differ only by return type.", - Function_expression_declared_a_non_void_return_type_but_has_no_return_expression: "Function expression declared a non-void return type, but has no return expression.", - Import_declaration_referencing_identifier_from_internal_module_can_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules: "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - Could_not_find_symbol_0_in_module_1: "Could not find symbol '{0}' in module '{1}'.", - Unable_to_resolve_module_reference_0: "Unable to resolve module reference '{0}'.", - Could_not_find_module_0_in_module_1: "Could not find module '{0}' in module '{1}'.", - Exported_import_declaration_0_is_assigned_value_with_type_that_has_or_is_using_private_type_1: "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - Exported_import_declaration_0_is_assigned_value_with_type_that_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - Exported_import_declaration_0_is_assigned_type_that_has_or_is_using_private_type_1: "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - Exported_import_declaration_0_is_assigned_type_that_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - Exported_import_declaration_0_is_assigned_container_that_is_or_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_1: "Type name '{0}' in extends clause does not reference constructor function for '{1}'.", - Internal_module_reference_0_in_import_declaration_does_not_reference_module_instance_for_1: "Internal module reference '{0}' in import declaration does not reference module instance for '{1}'.", - Module_0_cannot_merge_with_previous_declaration_of_1_in_a_different_file_2: "Module '{0}' cannot merge with previous declaration of '{1}' in a different file '{2}'.", - Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':{NL}{3}", - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.", - Ambient_external_module_declaration_cannot_be_reopened: "Ambient external module declaration cannot be reopened.", - All_declarations_of_merged_declaration_0_must_be_exported_or_not_exported: "All declarations of merged declaration '{0}' must be exported or not exported.", - super_cannot_be_referenced_in_constructor_arguments: "'super' cannot be referenced in constructor arguments.", - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: "Return type of constructor signature must be assignable to the instance type of the class.", - Ambient_external_module_declaration_must_be_defined_in_global_context: "Ambient external module declaration must be defined in global context.", - Ambient_external_module_declaration_cannot_specify_relative_module_name: "Ambient external module declaration cannot specify relative module name.", - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.", - Could_not_find_the_best_common_type_of_types_of_all_return_statement_expressions: "Could not find the best common type of types of all return statement expressions.", - Import_declaration_cannot_refer_to_external_module_reference_when_noResolve_option_is_set: "Import declaration cannot refer to external module reference when --noResolve option is set.", - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.", - continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: "'continue' statement can only be used within an enclosing iteration statement.", - break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: "'break' statement can only be used within an enclosing iteration or switch statement.", - Jump_target_not_found: "Jump target not found.", - Jump_target_cannot_cross_function_boundary: "Jump target cannot cross function boundary.", - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.", - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.", - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: "Expression resolves to '_super' that compiler uses to capture base class reference.", - TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of public static method from exported class has or is using private type '{1}'.", - TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of public method from exported class has or is using private type '{1}'.", - TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of method from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_exported_function_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported function has or is using private type '{1}'.", - TypeParameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - TypeParameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of call signature from exported interface is using inaccessible module {1}", - TypeParameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of public static method from exported class is using inaccessible module {1}.", - TypeParameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of public method from exported class is using inaccessible module {1}.", - TypeParameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of method from exported interface is using inaccessible module {1}.", - TypeParameter_0_of_exported_function_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported function is using inaccessible module {1}.", - TypeParameter_0_of_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported class has or is using private type '{1}'.", - TypeParameter_0_of_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported interface has or is using private type '{1}'.", - TypeParameter_0_of_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported class is using inaccessible module {1}.", - TypeParameter_0_of_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported interface is using inaccessible module {1}.", - Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter.", - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", - Type_of_conditional_0_must_be_identical_to_1_or_2: "Type of conditional '{0}' must be identical to '{1}' or '{2}'.", - Type_of_conditional_0_must_be_identical_to_1_2_or_3: "Type of conditional '{0}' must be identical to '{1}', '{2}' or '{3}'.", - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.", - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list.", - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.", - Parameter_0_cannot_be_referenced_in_its_initializer: "Parameter '{0}' cannot be referenced in its initializer.", - Duplicate_string_index_signature: "Duplicate string index signature.", - Duplicate_number_index_signature: "Duplicate number index signature.", - All_declarations_of_an_interface_must_have_identical_type_parameters: "All declarations of an interface must have identical type parameters.", - Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.", - Type_0_is_missing_property_1_from_type_2: "Type '{0}' is missing property '{1}' from type '{2}'.", - Types_of_property_0_of_types_1_and_2_are_incompatible: "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - Types_of_property_0_of_types_1_and_2_are_incompatible_NL_3: "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - Property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2: "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - Property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2: "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - Types_0_and_1_define_property_2_as_private: "Types '{0}' and '{1}' define property '{2}' as private.", - Call_signatures_of_types_0_and_1_are_incompatible: "Call signatures of types '{0}' and '{1}' are incompatible.", - Call_signatures_of_types_0_and_1_are_incompatible_NL_2: "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Type_0_requires_a_call_signature_but_type_1_lacks_one: "Type '{0}' requires a call signature, but type '{1}' lacks one.", - Construct_signatures_of_types_0_and_1_are_incompatible: "Construct signatures of types '{0}' and '{1}' are incompatible.", - Construct_signatures_of_types_0_and_1_are_incompatible_NL_2: "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Type_0_requires_a_construct_signature_but_type_1_lacks_one: "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - Index_signatures_of_types_0_and_1_are_incompatible: "Index signatures of types '{0}' and '{1}' are incompatible.", - Index_signatures_of_types_0_and_1_are_incompatible_NL_2: "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Call_signature_expects_0_or_fewer_parameters: "Call signature expects {0} or fewer parameters.", - Could_not_apply_type_0_to_argument_1_which_is_of_type_2: "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - Types_of_static_property_0_of_class_1_and_class_2_are_incompatible: "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - Types_of_static_property_0_of_class_1_and_class_2_are_incompatible_NL_3: "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - Type_reference_cannot_refer_to_container_0: "Type reference cannot refer to container '{0}'.", - Type_reference_must_refer_to_type: "Type reference must refer to type.", - In_enums_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_the_first_enum_element: "In enums with multiple declarations only one declaration can omit an initializer for the first enum element.", - _0_overload_s: " (+ {0} overload(s))", - Variable_declaration_cannot_have_the_same_name_as_an_import_declaration: "Variable declaration cannot have the same name as an import declaration.", - Signature_expected_0_type_arguments_got_1_instead: "Signature expected {0} type arguments, got {1} instead.", - Property_0_defined_as_optional_in_type_1_but_is_required_in_type_2: "Property '{0}' defined as optional in type '{1}', but is required in type '{2}'.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_do_not_refer_to_same_named_type: "Types '{0}' and '{1}' originating in infinitely expanding type reference do not refer to same named type.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments: "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments_NL_2: "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments:{NL}{2}", - Named_properties_0_of_types_1_and_2_are_not_identical: "Named properties '{0}' of types '{1}' and '{2}' are not identical.", - Types_of_string_indexer_of_types_0_and_1_are_not_identical: "Types of string indexer of types '{0}' and '{1}' are not identical.", - Types_of_number_indexer_of_types_0_and_1_are_not_identical: "Types of number indexer of types '{0}' and '{1}' are not identical.", - Type_of_number_indexer_in_type_0_is_not_assignable_to_string_indexer_type_in_type_1_NL_2: "Type of number indexer in type '{0}' is not assignable to string indexer type in type '{1}'.{NL}{2}", - Type_of_property_0_in_type_1_is_not_assignable_to_string_indexer_type_in_type_2_NL_3: "Type of property '{0}' in type '{1}' is not assignable to string indexer type in type '{2}'.{NL}{3}", - Type_of_property_0_in_type_1_is_not_assignable_to_number_indexer_type_in_type_2_NL_3: "Type of property '{0}' in type '{1}' is not assignable to number indexer type in type '{2}'.{NL}{3}", - Static_property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2: "Static property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - Static_property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2: "Static property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - Types_0_and_1_define_static_property_2_as_private: "Types '{0}' and '{1}' define static property '{2}' as private.", - Current_host_does_not_support_0_option: "Current host does not support '{0}' option.", - ECMAScript_target_version_0_not_supported_Specify_a_valid_target_version_1_default_or_2: "ECMAScript target version '{0}' not supported. Specify a valid target version: '{1}' (default), or '{2}'", - Module_code_generation_0_not_supported: "Module code generation '{0}' not supported.", - Could_not_find_file_0: "Could not find file: '{0}'.", - A_file_cannot_have_a_reference_to_itself: "A file cannot have a reference to itself.", - Cannot_resolve_referenced_file_0: "Cannot resolve referenced file: '{0}'.", - Cannot_find_the_common_subdirectory_path_for_the_input_files: "Cannot find the common subdirectory path for the input files.", - Emit_Error_0: "Emit Error: {0}.", - Cannot_read_file_0_1: "Cannot read file '{0}': {1}", - Unsupported_file_encoding: "Unsupported file encoding.", - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: "Locale must be of the form or -. For example '{0}' or '{1}'.", - Unsupported_locale_0: "Unsupported locale: '{0}'.", - Execution_Failed_NL: "Execution Failed.{NL}", - Invalid_call_to_up: "Invalid call to 'up'", - Invalid_call_to_down: "Invalid call to 'down'", - Base64_value_0_finished_with_a_continuation_bit: "Base64 value '{0}' finished with a continuation bit.", - Unknown_option_0: "Unknown option '{0}'", - Expected_0_arguments_to_message_got_1_instead: "Expected {0} arguments to message, got {1} instead.", - Expected_the_message_0_to_have_1_arguments_but_it_had_2: "Expected the message '{0}' to have {1} arguments, but it had {2}", - Could_not_delete_file_0: "Could not delete file '{0}'", - Could_not_create_directory_0: "Could not create directory '{0}'", - Error_while_executing_file_0: "Error while executing file '{0}': ", - Cannot_compile_external_modules_unless_the_module_flag_is_provided: "Cannot compile external modules unless the '--module' flag is provided.", - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: "Option mapRoot cannot be specified without specifying sourcemap option.", - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: "Option sourceRoot cannot be specified without specifying sourcemap option.", - Options_mapRoot_and_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - 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", - Examples: "Examples:", - Options: "Options:", - Insert_command_line_options_and_files_from_a_file: "Insert command line options and files from a file.", - Version_0: "Version {0}", - Use_the_0_flag_to_see_options: "Use the '{0}' flag to see options.", - NL_Recompiling_0: "{NL}Recompiling ({0}):", - STRING: "STRING", - KIND: "KIND", - file2: "FILE", - VERSION: "VERSION", - 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.", - Invalid_line_number_0: "Invalid line number ({0})", - Warn_on_expressions_and_declarations_with_an_implied_any_type: "Warn on expressions and declarations with an implied 'any' type.", - Variable_0_implicitly_has_an_any_type: "Variable '{0}' implicitly has an 'any' type.", - Parameter_0_of_1_implicitly_has_an_any_type: "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - Parameter_0_of_function_type_implicitly_has_an_any_type: "Parameter '{0}' of function type implicitly has an 'any' type.", - Member_0_of_object_type_implicitly_has_an_any_type: "Member '{0}' of object type implicitly has an 'any' type.", - new_expression_which_lacks_a_constructor_signature_implicitly_has_an_any_type: "'new' expression, which lacks a constructor signature, implicitly has an 'any' type.", - _0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - Parameter_0_of_lambda_function_implicitly_has_an_any_type: "Parameter '{0}' of lambda function implicitly has an 'any' type.", - Constructor_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - Lambda_Function_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - Array_Literal_implicitly_has_an_any_type_from_widening: "Array Literal implicitly has an 'any' type from widening.", - _0_which_lacks_get_accessor_and_parameter_type_annotation_on_set_accessor_implicitly_has_an_any_type: "'{0}', which lacks 'get' accessor and parameter type annotation on 'set' accessor, implicitly has an 'any' type.", - Index_signature_of_object_type_implicitly_has_an_any_type: "Index signature of object type implicitly has an 'any' type.", - Object_literal_s_property_0_implicitly_has_an_any_type_from_widening: "Object literal's property '{0}' implicitly has an 'any' type from widening." - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ArrayUtilities = (function () { - function ArrayUtilities() { - } - ArrayUtilities.isArray = function (value) { - return Object.prototype.toString.apply(value, []) === '[object Array]'; - }; - - ArrayUtilities.sequenceEquals = function (array1, array2, equals) { - if (array1 === array2) { - return true; - } - - if (array1 === null || array2 === null) { - return false; - } - - if (array1.length !== array2.length) { - return false; - } - - for (var i = 0, n = array1.length; i < n; i++) { - if (!equals(array1[i], array2[i])) { - return false; +var ts; +(function (ts) { + (function (EmitReturnStatus) { + EmitReturnStatus[EmitReturnStatus["Succeeded"] = 0] = "Succeeded"; + EmitReturnStatus[EmitReturnStatus["AllOutputGenerationSkipped"] = 1] = "AllOutputGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["JSGeneratedWithSemanticErrors"] = 2] = "JSGeneratedWithSemanticErrors"; + EmitReturnStatus[EmitReturnStatus["DeclarationGenerationSkipped"] = 3] = "DeclarationGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["EmitErrorsEncountered"] = 4] = "EmitErrorsEncountered"; + EmitReturnStatus[EmitReturnStatus["CompilerOptionsErrors"] = 5] = "CompilerOptionsErrors"; + })(ts.EmitReturnStatus || (ts.EmitReturnStatus = {})); + var EmitReturnStatus = ts.EmitReturnStatus; + (function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; + })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var DiagnosticCategory = ts.DiagnosticCategory; +})(ts || (ts = {})); +var ts; +(function (ts) { + function forEach(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + var result = callback(array[i]); + if (result) { + return result; } } - - return true; - }; - - ArrayUtilities.contains = function (array, value) { - for (var i = 0; i < array.length; i++) { + } + return undefined; + } + ts.forEach = forEach; + function contains(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return true; } } - - return false; - }; - - ArrayUtilities.groupBy = function (array, func) { - var result = {}; - - for (var i = 0, n = array.length; i < n; i++) { - var v = array[i]; - var k = func(v); - - var list = result[k] || []; - list.push(v); - result[k] = list; - } - - return result; - }; - - ArrayUtilities.distinct = function (array, equalsFn) { - var result = []; - - for (var i = 0, n = array.length; i < n; i++) { - var current = array[i]; - for (var j = 0; j < result.length; j++) { - if (equalsFn(result[j], current)) { - break; - } - } - - if (j === result.length) { - result.push(current); + } + return false; + } + ts.contains = contains; + function indexOf(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; } } - - return result; - }; - - ArrayUtilities.min = function (array, func) { - var min = func(array[0]); - - for (var i = 1; i < array.length; i++) { - var next = func(array[i]); - if (next < min) { - min = next; + } + return -1; + } + ts.indexOf = indexOf; + function countWhere(array, predicate) { + var count = 0; + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (predicate(array[i])) { + count++; } } - - return min; - }; - - ArrayUtilities.max = function (array, func) { - var max = func(array[0]); - - for (var i = 1; i < array.length; i++) { - var next = func(array[i]); - if (next > max) { - max = next; + } + return count; + } + ts.countWhere = countWhere; + function filter(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (f(item)) { + result.push(item); } } - - return max; - }; - - ArrayUtilities.last = function (array) { - if (array.length === 0) { - throw TypeScript.Errors.argumentOutOfRange('array'); + } + return result; + } + ts.filter = filter; + function map(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + result.push(f(array[i])); } - - return array[array.length - 1]; - }; - - ArrayUtilities.lastOrDefault = function (array, predicate) { - for (var i = array.length - 1; i >= 0; i--) { - var v = array[i]; - if (predicate(v, i)) { - return v; - } + } + return result; + } + ts.map = map; + function concatenate(array1, array2) { + if (!array2 || !array2.length) + return array1; + if (!array1 || !array1.length) + return array2; + return array1.concat(array2); + } + ts.concatenate = concatenate; + function deduplicate(array) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) + result.push(item); } - - return null; - }; - - ArrayUtilities.firstOrDefault = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - var value = array[i]; - if (func(value, i)) { - return value; - } + } + return result; + } + ts.deduplicate = deduplicate; + function sum(array, prop) { + var result = 0; + for (var i = 0; i < array.length; i++) { + result += array[i][prop]; + } + return result; + } + ts.sum = sum; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; + function binarySearch(array, value) { + var low = 0; + var high = array.length - 1; + while (low <= high) { + var middle = low + ((high - low) >> 1); + var midValue = array[middle]; + if (midValue === value) { + return middle; } - - return null; - }; - - ArrayUtilities.first = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - var value = array[i]; - if (!func || func(value, i)) { - return value; - } + else if (midValue > value) { + high = middle - 1; } - - throw TypeScript.Errors.invalidOperation(); - }; - - ArrayUtilities.sum = function (array, func) { - var result = 0; - - for (var i = 0, n = array.length; i < n; i++) { - result += func(array[i]); + else { + low = middle + 1; } - - return result; - }; - - ArrayUtilities.select = function (values, func) { - var result = new Array(values.length); - - for (var i = 0; i < values.length; i++) { - result[i] = func(values[i]); + } + return ~low; + } + ts.binarySearch = binarySearch; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasProperty(map, key) { + return hasOwnProperty.call(map, key); + } + ts.hasProperty = hasProperty; + function getProperty(map, key) { + return hasOwnProperty.call(map, key) ? map[key] : undefined; + } + ts.getProperty = getProperty; + function isEmpty(map) { + for (var id in map) { + if (hasProperty(map, id)) { + return false; } - - return result; + } + return true; + } + ts.isEmpty = isEmpty; + function clone(object) { + var result = {}; + for (var id in object) { + result[id] = object[id]; + } + return result; + } + ts.clone = clone; + function forEachValue(map, callback) { + var result; + for (var id in map) { + if (result = callback(map[id])) + break; + } + return result; + } + ts.forEachValue = forEachValue; + function forEachKey(map, callback) { + var result; + for (var id in map) { + if (result = callback(id)) + break; + } + return result; + } + ts.forEachKey = forEachKey; + function lookUp(map, key) { + return hasProperty(map, key) ? map[key] : undefined; + } + ts.lookUp = lookUp; + function mapToArray(map) { + var result = []; + for (var id in map) { + result.push(map[id]); + } + return result; + } + ts.mapToArray = mapToArray; + function arrayToMap(array, makeKey) { + var result = {}; + forEach(array, function (value) { + result[makeKey(value)] = value; + }); + return result; + } + ts.arrayToMap = arrayToMap; + function formatStringFromArgs(text, args, baseIndex) { + baseIndex = baseIndex || 0; + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + } + ts.localizedDiagnosticMessages = undefined; + function getLocaleSpecificMessage(message) { + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + } + ts.getLocaleSpecificMessage = getLocaleSpecificMessage; + function createFileDiagnostic(file, start, length, message) { + Debug.assert(start >= 0, "start must be non-negative, is " + start); + Debug.assert(length >= 0, "length must be non-negative, is " + length); + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file: file, + start: start, + length: length, + messageText: text, + category: message.category, + code: message.code, + isEarly: message.isEarly }; - - ArrayUtilities.where = function (values, func) { - var result = new Array(); - - for (var i = 0; i < values.length; i++) { - if (func(values[i])) { - result.push(values[i]); - } - } - - return result; + } + ts.createFileDiagnostic = createFileDiagnostic; + function createCompilerDiagnostic(message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 1) { + text = formatStringFromArgs(text, arguments, 1); + } + return { + file: undefined, + start: undefined, + length: undefined, + messageText: text, + category: message.category, + code: message.code, + isEarly: message.isEarly }; - - ArrayUtilities.any = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - if (func(array[i])) { - return true; - } - } - - return false; + } + ts.createCompilerDiagnostic = createCompilerDiagnostic; + function chainDiagnosticMessages(details, message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return { + messageText: text, + category: message.category, + code: message.code, + next: details }; - - ArrayUtilities.all = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - if (!func(array[i])) { - return false; - } - } - - return true; + } + ts.chainDiagnosticMessages = chainDiagnosticMessages; + function concatenateDiagnosticMessageChains(headChain, tailChain) { + Debug.assert(!headChain.next); + headChain.next = tailChain; + return headChain; + } + ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; + function flattenDiagnosticChain(file, start, length, diagnosticChain, newLine) { + 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: file, + start: start, + length: length, + code: code, + category: category, + messageText: messageText }; - - ArrayUtilities.binarySearch = function (array, value) { - var low = 0; - var high = array.length - 1; - - while (low <= high) { - var middle = low + ((high - low) >> 1); - var midValue = array[middle]; - - if (midValue === value) { - return middle; - } else if (midValue > value) { - high = middle - 1; - } else { - low = middle + 1; + } + ts.flattenDiagnosticChain = flattenDiagnosticChain; + function compareValues(a, b) { + if (a === b) + return 0 /* EqualTo */; + if (a === undefined) + return -1 /* LessThan */; + if (b === undefined) + return 1 /* GreaterThan */; + return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + } + ts.compareValues = compareValues; + function getDiagnosticFilename(diagnostic) { + return diagnostic.file ? diagnostic.file.filename : undefined; + } + function compareDiagnostics(d1, d2) { + 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; + } + ts.compareDiagnostics = compareDiagnostics; + function deduplicateSortedDiagnostics(diagnostics) { + if (diagnostics.length < 2) { + return diagnostics; + } + var newDiagnostics = [diagnostics[0]]; + var previousDiagnostic = diagnostics[0]; + for (var i = 1; i < diagnostics.length; i++) { + var currentDiagnostic = diagnostics[i]; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0 /* EqualTo */; + if (!isDupe) { + newDiagnostics.push(currentDiagnostic); + previousDiagnostic = currentDiagnostic; + } + } + return newDiagnostics; + } + ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics; + function normalizeSlashes(path) { + return path.replace(/\\/g, "/"); + } + ts.normalizeSlashes = normalizeSlashes; + function getRootLength(path) { + if (path.charCodeAt(0) === 47 /* slash */) { + if (path.charCodeAt(1) !== 47 /* slash */) + return 1; + var p1 = path.indexOf("/", 2); + if (p1 < 0) + return 2; + var p2 = path.indexOf("/", p1 + 1); + if (p2 < 0) + return p1 + 1; + return p2 + 1; + } + if (path.charCodeAt(1) === 58 /* colon */) { + if (path.charCodeAt(2) === 47 /* slash */) + return 3; + return 2; + } + return 0; + } + ts.getRootLength = getRootLength; + ts.directorySeparator = "/"; + function getNormalizedParts(normalizedSlashedPath, rootLength) { + var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); + var normalized = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (part !== ".") { + if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { + normalized.pop(); + } + else { + normalized.push(part); } } - - return ~low; - }; - - ArrayUtilities.createArray = function (length, defaultValue) { - var result = new Array(length); - for (var i = 0; i < length; i++) { - result[i] = defaultValue; + } + return normalized; + } + function normalizePath(path) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + var normalized = getNormalizedParts(path, rootLength); + return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); + } + ts.normalizePath = normalizePath; + function getDirectoryPath(path) { + return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); + } + ts.getDirectoryPath = getDirectoryPath; + function isUrl(path) { + return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; + } + ts.isUrl = isUrl; + function isRootedDiskPath(path) { + return getRootLength(path) !== 0; + } + ts.isRootedDiskPath = isRootedDiskPath; + function normalizedPathComponents(path, rootLength) { + var normalizedParts = getNormalizedParts(path, rootLength); + return [path.substr(0, rootLength)].concat(normalizedParts); + } + function getNormalizedPathComponents(path, currentDirectory) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength == 0) { + path = combinePaths(normalizeSlashes(currentDirectory), path); + rootLength = getRootLength(path); + } + return normalizedPathComponents(path, rootLength); + } + ts.getNormalizedPathComponents = getNormalizedPathComponents; + function getNormalizedAbsolutePath(filename, currentDirectory) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(filename, currentDirectory)); + } + ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath; + function getNormalizedPathFromPathComponents(pathComponents) { + if (pathComponents && pathComponents.length) { + return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); + } + } + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; + function getNormalizedPathComponentsOfUrl(url) { + var urlLength = url.length; + var rootLength = url.indexOf("://") + "://".length; + while (rootLength < urlLength) { + if (url.charCodeAt(rootLength) === 47 /* slash */) { + rootLength++; + } + else { + break; } - - return result; - }; - - ArrayUtilities.grow = function (array, length, defaultValue) { - var count = length - array.length; - for (var i = 0; i < count; i++) { - array.push(defaultValue); + } + if (rootLength === urlLength) { + return [url]; + } + var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); + if (indexOfNextSlash !== -1) { + rootLength = indexOfNextSlash + 1; + return normalizedPathComponents(url, rootLength); + } + else { + return [url + ts.directorySeparator]; + } + } + function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { + if (isUrl(pathOrUrl)) { + return getNormalizedPathComponentsOfUrl(pathOrUrl); + } + else { + return getNormalizedPathComponents(pathOrUrl, currentDirectory); + } + } + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { + var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); + var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); + if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { + directoryComponents.length--; + } + for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { + break; } - }; - - ArrayUtilities.copy = function (sourceArray, sourceIndex, destinationArray, destinationIndex, length) { - for (var i = 0; i < length; i++) { - destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i]; + } + if (joinStartIndex) { + var relativePath = ""; + var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); + for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (directoryComponents[joinStartIndex] !== "") { + relativePath = relativePath + ".." + ts.directorySeparator; + } } - }; - - ArrayUtilities.indexOf = function (array, predicate) { - for (var i = 0, n = array.length; i < n; i++) { - if (predicate(array[i])) { - return i; + return relativePath + relativePathComponents.join(ts.directorySeparator); + } + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); + if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { + absolutePath = "file:///" + absolutePath; + } + return absolutePath; + } + ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; + function getBaseFilename(path) { + var i = path.lastIndexOf(ts.directorySeparator); + return i < 0 ? path : path.substring(i + 1); + } + ts.getBaseFilename = getBaseFilename; + function combinePaths(path1, path2) { + if (!(path1 && path1.length)) + return path2; + if (!(path2 && path2.length)) + return path1; + if (path2.charAt(0) === ts.directorySeparator) + return path2; + if (path1.charAt(path1.length - 1) === ts.directorySeparator) + return path1 + path2; + return path1 + ts.directorySeparator + path2; + } + ts.combinePaths = combinePaths; + function fileExtensionIs(path, extension) { + var pathLen = path.length; + var extLen = extension.length; + return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; + } + ts.fileExtensionIs = fileExtensionIs; + var supportedExtensions = [".d.ts", ".ts", ".js"]; + function removeFileExtension(path) { + for (var i = 0; i < supportedExtensions.length; i++) { + var ext = supportedExtensions[i]; + if (fileExtensionIs(path, ext)) { + return path.substr(0, path.length - ext.length); + } + } + return path; + } + ts.removeFileExtension = removeFileExtension; + var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\\\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\0": "\\0", + "\r": "\\r", + "\n": "\\n", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function escapeString(s) { + return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, function (c) { + return escapedCharsMap[c] || c; + }) : s; + } + ts.escapeString = escapeString; + function Symbol(flags, name) { + this.flags = flags; + this.name = name; + this.declarations = undefined; + } + function Type(checker, flags) { + this.flags = flags; + } + function Signature(checker) { + } + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + Node.prototype = { + kind: kind, + pos: 0, + end: 0, + flags: 0, + parent: undefined + }; + return Node; + }, + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } + }; + var Debug; + (function (Debug) { + var currentAssertionLevel = 0 /* None */; + function shouldAssert(level) { + return currentAssertionLevel >= level; + } + Debug.shouldAssert = shouldAssert; + function assert(expression, message, verboseDebugInfo) { + if (!expression) { + var verboseDebugString = ""; + if (verboseDebugInfo) { + verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); } + throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); } - - return -1; - }; - return ArrayUtilities; - })(); - TypeScript.ArrayUtilities = ArrayUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (BitVector) { - var pool = []; - var Constants; - (function (Constants) { - Constants[Constants["MaxBitsPerEncodedNumber"] = 30] = "MaxBitsPerEncodedNumber"; - Constants[Constants["BitsPerEncodedBiStateValue"] = 1] = "BitsPerEncodedBiStateValue"; - - Constants[Constants["BitsPerEncodedTriStateValue"] = 2] = "BitsPerEncodedTriStateValue"; - - Constants[Constants["BiStateEncodedTrue"] = 1] = "BiStateEncodedTrue"; - Constants[Constants["BiStateClearBitsMask"] = 1] = "BiStateClearBitsMask"; - - Constants[Constants["TriStateEncodedFalse"] = 1] = "TriStateEncodedFalse"; - Constants[Constants["TriStateEncodedTrue"] = 2] = "TriStateEncodedTrue"; - Constants[Constants["TriStateClearBitsMask"] = 3] = "TriStateClearBitsMask"; - })(Constants || (Constants = {})); - - var BitVectorImpl = (function () { - function BitVectorImpl(allowUndefinedValues) { - this.allowUndefinedValues = allowUndefinedValues; - this.isReleased = false; - this.bits = []; - } - BitVectorImpl.prototype.computeTriStateArrayIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 2 /* BitsPerEncodedTriStateValue */; - - return (index / encodedValuesPerNumber) >>> 0; - }; - - BitVectorImpl.prototype.computeBiStateArrayIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 1 /* BitsPerEncodedBiStateValue */; - - return (index / encodedValuesPerNumber) >>> 0; - }; - - BitVectorImpl.prototype.computeTriStateEncodedValueIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 2 /* BitsPerEncodedTriStateValue */; - - return (index % encodedValuesPerNumber) * 2 /* BitsPerEncodedTriStateValue */; - }; - - BitVectorImpl.prototype.computeBiStateEncodedValueIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 1 /* BitsPerEncodedBiStateValue */; - - return (index % encodedValuesPerNumber) * 1 /* BitsPerEncodedBiStateValue */; - }; - - BitVectorImpl.prototype.valueAt = function (index) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - if (this.allowUndefinedValues) { - var arrayIndex = this.computeTriStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - return undefined; + } + Debug.assert = assert; + function fail(message) { + Debug.assert(false, message); + } + Debug.fail = fail; + })(Debug = ts.Debug || (ts.Debug = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.sys = (function () { + function getWScriptSystem() { + var fso = new ActiveXObject("Scripting.FileSystemObject"); + var fileStream = new ActiveXObject("ADODB.Stream"); + fileStream.Type = 2; + var binaryStream = new ActiveXObject("ADODB.Stream"); + binaryStream.Type = 1; + var args = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + function readFile(fileName, encoding) { + if (!fso.FileExists(fileName)) { + return undefined; + } + fileStream.Open(); + try { + if (encoding) { + fileStream.Charset = encoding; + fileStream.LoadFromFile(fileName); } - - var bitIndex = this.computeTriStateEncodedValueIndex(index); - if (encoded & (2 /* TriStateEncodedTrue */ << bitIndex)) { - return true; - } else if (encoded & (1 /* TriStateEncodedFalse */ << bitIndex)) { - return false; - } else { - return undefined; + else { + fileStream.Charset = "x-ansi"; + fileStream.LoadFromFile(fileName); + var bom = fileStream.ReadText(2) || ""; + fileStream.Position = 0; + fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; } - } else { - var arrayIndex = this.computeBiStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - return false; + return fileStream.ReadText(); + } + catch (e) { + throw e; + } + finally { + fileStream.Close(); + } + } + function writeFile(fileName, data, writeByteOrderMark) { + fileStream.Open(); + binaryStream.Open(); + try { + fileStream.Charset = "utf-8"; + fileStream.WriteText(data); + if (writeByteOrderMark) { + fileStream.Position = 0; } - - var bitIndex = this.computeBiStateEncodedValueIndex(index); - if (encoded & (1 /* BiStateEncodedTrue */ << bitIndex)) { - return true; - } else { - return false; + else { + fileStream.Position = 3; } + fileStream.CopyTo(binaryStream); + binaryStream.SaveToFile(fileName, 2); } - }; - - BitVectorImpl.prototype.setValueAt = function (index, value) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - if (this.allowUndefinedValues) { - TypeScript.Debug.assert(value === true || value === false || value === undefined, "value must only be true, false or undefined."); - - var arrayIndex = this.computeTriStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - if (value === undefined) { - return; - } - - encoded = 0; - } - - var bitIndex = this.computeTriStateEncodedValueIndex(index); - - var clearMask = ~(3 /* TriStateClearBitsMask */ << bitIndex); - encoded = encoded & clearMask; - - if (value === true) { - encoded = encoded | (2 /* TriStateEncodedTrue */ << bitIndex); - } else if (value === false) { - encoded = encoded | (1 /* TriStateEncodedFalse */ << bitIndex); + finally { + binaryStream.Close(); + fileStream.Close(); + } + } + return { + args: args, + newLine: "\r\n", + useCaseSensitiveFileNames: false, + write: function (s) { + WScript.StdOut.Write(s); + }, + readFile: readFile, + writeFile: writeFile, + resolvePath: function (path) { + return fso.GetAbsolutePathName(path); + }, + fileExists: function (path) { + return fso.FileExists(path); + }, + directoryExists: function (path) { + return fso.FolderExists(path); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + fso.CreateFolder(directoryName); } - - this.bits[arrayIndex] = encoded; - } else { - TypeScript.Debug.assert(value === true || value === false, "value must only be true or false."); - - var arrayIndex = this.computeBiStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - if (value === false) { - return; - } - - encoded = 0; + }, + getExecutingFilePath: function () { + return WScript.ScriptFullName; + }, + getCurrentDirectory: function () { + return new ActiveXObject("WScript.Shell").CurrentDirectory; + }, + exit: function (exitCode) { + try { + WScript.Quit(exitCode); } - - var bitIndex = this.computeBiStateEncodedValueIndex(index); - - encoded = encoded & ~(1 /* BiStateClearBitsMask */ << bitIndex); - - if (value) { - encoded = encoded | (1 /* BiStateEncodedTrue */ << bitIndex); + catch (e) { } - - this.bits[arrayIndex] = encoded; } }; - - BitVectorImpl.prototype.release = function () { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - this.isReleased = true; - this.bits.length = 0; - pool.push(this); - }; - return BitVectorImpl; - })(); - - function getBitVector(allowUndefinedValues) { - if (pool.length === 0) { - return new BitVectorImpl(allowUndefinedValues); - } - - var vector = pool.pop(); - vector.isReleased = false; - vector.allowUndefinedValues = allowUndefinedValues; - - return vector; - } - BitVector.getBitVector = getBitVector; - })(TypeScript.BitVector || (TypeScript.BitVector = {})); - var BitVector = TypeScript.BitVector; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (BitMatrix) { - var pool = []; - - var BitMatrixImpl = (function () { - function BitMatrixImpl(allowUndefinedValues) { - this.allowUndefinedValues = allowUndefinedValues; - this.isReleased = false; - this.vectors = []; - } - BitMatrixImpl.prototype.valueAt = function (x, y) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - var vector = this.vectors[x]; - if (!vector) { - return this.allowUndefinedValues ? undefined : false; + } + function getNodeSystem() { + var _fs = require("fs"); + var _path = require("path"); + var _os = require('os'); + var platform = _os.platform(); + var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + function readFile(fileName, encoding) { + if (!_fs.existsSync(fileName)) { + return undefined; } - - return vector.valueAt(y); - }; - - BitMatrixImpl.prototype.setValueAt = function (x, y, value) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - var vector = this.vectors[x]; - if (!vector) { - if (value === undefined) { - return; + var buffer = _fs.readFileSync(fileName); + var len = buffer.length; + if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { + len &= ~1; + for (var i = 0; i < len; i += 2) { + var temp = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = temp; } - - vector = TypeScript.BitVector.getBitVector(this.allowUndefinedValues); - this.vectors[x] = vector; + return buffer.toString("utf16le", 2); } - - vector.setValueAt(y, value); - }; - - BitMatrixImpl.prototype.release = function () { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - this.isReleased = true; - - for (var name in this.vectors) { - if (this.vectors.hasOwnProperty(name)) { - var vector = this.vectors[name]; - vector.release(); - } + if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { + return buffer.toString("utf16le", 2); } - - this.vectors.length = 0; - pool.push(this); - }; - return BitMatrixImpl; - })(); - - function getBitMatrix(allowUndefinedValues) { - if (pool.length === 0) { - return new BitMatrixImpl(allowUndefinedValues); + if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + return buffer.toString("utf8", 3); + } + return buffer.toString("utf8"); } - - var matrix = pool.pop(); - matrix.isReleased = false; - matrix.allowUndefinedValues = allowUndefinedValues; - - return matrix; - } - BitMatrix.getBitMatrix = getBitMatrix; - })(TypeScript.BitMatrix || (TypeScript.BitMatrix = {})); - var BitMatrix = TypeScript.BitMatrix; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Constants) { - Constants[Constants["Max31BitInteger"] = 1073741823] = "Max31BitInteger"; - Constants[Constants["Min31BitInteger"] = -1073741824] = "Min31BitInteger"; - })(TypeScript.Constants || (TypeScript.Constants = {})); - var Constants = TypeScript.Constants; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (AssertionLevel) { - AssertionLevel[AssertionLevel["None"] = 0] = "None"; - AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; - AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; - AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; - })(TypeScript.AssertionLevel || (TypeScript.AssertionLevel = {})); - var AssertionLevel = TypeScript.AssertionLevel; - - var Debug = (function () { - function Debug() { - } - Debug.shouldAssert = function (level) { - return this.currentAssertionLevel >= level; - }; - - Debug.assert = function (expression, message, verboseDebugInfo) { - if (typeof message === "undefined") { message = ""; } - if (typeof verboseDebugInfo === "undefined") { verboseDebugInfo = null; } - if (!expression) { - var verboseDebugString = ""; - if (verboseDebugInfo) { - verboseDebugString = "\r\nVerbose Debug Information:" + verboseDebugInfo(); + function writeFile(fileName, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = '\uFEFF' + data; } - - throw new Error("Debug Failure. False expression: " + message + verboseDebugString); + _fs.writeFileSync(fileName, data, "utf8"); } - }; - - Debug.fail = function (message) { - Debug.assert(false, message); - }; - Debug.currentAssertionLevel = 0 /* None */; - return Debug; - })(); - TypeScript.Debug = Debug; -})(TypeScript || (TypeScript = {})); -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) { - TypeScript.LocalizedDiagnosticMessages = null; - - var Location = (function () { - function Location(fileName, lineMap, start, length) { - this._fileName = fileName; - this._lineMap = lineMap; - this._start = start; - this._length = length; - } - Location.prototype.fileName = function () { - return this._fileName; - }; - - Location.prototype.lineMap = function () { - return this._lineMap; - }; - - Location.prototype.line = function () { - return this._lineMap ? this._lineMap.getLineNumberFromPosition(this.start()) : 0; - }; - - Location.prototype.character = function () { - return this._lineMap ? this._lineMap.getLineAndCharacterFromPosition(this.start()).character() : 0; - }; - - Location.prototype.start = function () { - return this._start; - }; - - Location.prototype.length = function () { - return this._length; - }; - - Location.equals = function (location1, location2) { - return location1._fileName === location2._fileName && location1._start === location2._start && location1._length === location2._length; - }; - return Location; + return { + args: process.argv.slice(2), + newLine: _os.EOL, + useCaseSensitiveFileNames: useCaseSensitiveFileNames, + write: function (s) { + _fs.writeSync(1, s); + }, + readFile: readFile, + writeFile: writeFile, + watchFile: function (fileName, callback) { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } + }; + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); + } + ; + }, + resolvePath: function (path) { + return _path.resolve(path); + }, + fileExists: function (path) { + return _fs.existsSync(path); + }, + directoryExists: function (path) { + return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + _fs.mkdirSync(directoryName); + } + }, + getExecutingFilePath: function () { + return __filename; + }, + getCurrentDirectory: function () { + return process.cwd(); + }, + getMemoryUsage: function () { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + }, + exit: function (exitCode) { + process.exit(exitCode); + } + }; + } + if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + return getWScriptSystem(); + } + else if (typeof module !== "undefined" && module.exports) { + return getNodeSystem(); + } + else { + return undefined; + } })(); - TypeScript.Location = Location; - - var Diagnostic = (function (_super) { - __extends(Diagnostic, _super); - function Diagnostic(fileName, lineMap, start, length, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - _super.call(this, fileName, lineMap, start, length); - this._diagnosticKey = diagnosticKey; - this._arguments = (_arguments && _arguments.length > 0) ? _arguments : null; - this._additionalLocations = (additionalLocations && additionalLocations.length > 0) ? additionalLocations : null; - } - Diagnostic.prototype.toJSON = function (key) { - var result = {}; - result.start = this.start(); - result.length = this.length(); - - result.diagnosticCode = this._diagnosticKey; - - var _arguments = this.arguments(); - if (_arguments && _arguments.length > 0) { - result.arguments = _arguments; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* 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: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, + A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: 1 /* Error */, key: "A function implementation cannot be declared in an ambient context." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* 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: 1 /* 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: 1 /* Error */, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* 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: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* 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: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* 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: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, + A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: 1 /* Error */, key: "A constructor implementation cannot be declared in an ambient context." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1 /* Error */, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* 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: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1 /* Error */, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1 /* Error */, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1 /* Error */, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1 /* Error */, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1 /* Error */, key: "Computed property names are not allowed in enums." }, + Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Computed property names are not allowed in method overloads." }, + Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: 1 /* Error */, key: "Computed property names are not allowed in interfaces." }, + Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: 1 /* 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: 1 /* Error */, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1 /* Error */, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1 /* Error */, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1 /* Error */, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1 /* Error */, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1 /* Error */, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1 /* Error */, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1 /* Error */, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1 /* Error */, key: "Unexpected token. '{' expected." }, + 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." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, + Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: 1 /* Error */, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." }, + Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: 1 /* Error */, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1 /* Error */, key: "An AMD module cannot have multiple name assignments." }, + 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}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* 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: 1 /* 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: 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'." }, + 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'." }, + 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}'." }, + 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." }, + 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." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2 /* Message */, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + 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." }, + 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" }, + Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, + 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..." }, + KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, + FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, + VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, + LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* Error */, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + 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}." }, + Warn_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." }, + 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." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* 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: 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." }, + Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported." }, + Computed_property_names_are_not_currently_supported: { code: 9002, category: 1 /* Error */, key: "Computed property names are not currently supported." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var textToToken = { + "any": 109 /* AnyKeyword */, + "boolean": 110 /* BooleanKeyword */, + "break": 64 /* BreakKeyword */, + "case": 65 /* CaseKeyword */, + "catch": 66 /* CatchKeyword */, + "class": 67 /* ClassKeyword */, + "continue": 69 /* ContinueKeyword */, + "const": 68 /* ConstKeyword */, + "constructor": 111 /* ConstructorKeyword */, + "debugger": 70 /* DebuggerKeyword */, + "declare": 112 /* DeclareKeyword */, + "default": 71 /* DefaultKeyword */, + "delete": 72 /* DeleteKeyword */, + "do": 73 /* DoKeyword */, + "else": 74 /* ElseKeyword */, + "enum": 75 /* EnumKeyword */, + "export": 76 /* ExportKeyword */, + "extends": 77 /* ExtendsKeyword */, + "false": 78 /* FalseKeyword */, + "finally": 79 /* FinallyKeyword */, + "for": 80 /* ForKeyword */, + "function": 81 /* FunctionKeyword */, + "get": 113 /* GetKeyword */, + "if": 82 /* IfKeyword */, + "implements": 100 /* ImplementsKeyword */, + "import": 83 /* ImportKeyword */, + "in": 84 /* InKeyword */, + "instanceof": 85 /* InstanceOfKeyword */, + "interface": 101 /* InterfaceKeyword */, + "let": 102 /* LetKeyword */, + "module": 114 /* ModuleKeyword */, + "new": 86 /* NewKeyword */, + "null": 87 /* NullKeyword */, + "number": 116 /* NumberKeyword */, + "package": 103 /* PackageKeyword */, + "private": 104 /* PrivateKeyword */, + "protected": 105 /* ProtectedKeyword */, + "public": 106 /* PublicKeyword */, + "require": 115 /* RequireKeyword */, + "return": 88 /* ReturnKeyword */, + "set": 117 /* SetKeyword */, + "static": 107 /* StaticKeyword */, + "string": 118 /* StringKeyword */, + "super": 89 /* SuperKeyword */, + "switch": 90 /* SwitchKeyword */, + "this": 91 /* ThisKeyword */, + "throw": 92 /* ThrowKeyword */, + "true": 93 /* TrueKeyword */, + "try": 94 /* TryKeyword */, + "type": 119 /* TypeKeyword */, + "typeof": 95 /* TypeOfKeyword */, + "var": 96 /* VarKeyword */, + "void": 97 /* VoidKeyword */, + "while": 98 /* WhileKeyword */, + "with": 99 /* WithKeyword */, + "yield": 108 /* YieldKeyword */, + "{": 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 */ + }; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; } - - return result; - }; - - Diagnostic.prototype.diagnosticKey = function () { - return this._diagnosticKey; - }; - - Diagnostic.prototype.arguments = function () { - return this._arguments; - }; - - Diagnostic.prototype.text = function () { - return TypeScript.getLocalizedText(this._diagnosticKey, this._arguments); - }; - - Diagnostic.prototype.message = function () { - return TypeScript.getDiagnosticMessage(this._diagnosticKey, this._arguments); - }; - - Diagnostic.prototype.additionalLocations = function () { - return this._additionalLocations || []; - }; - - Diagnostic.equals = function (diagnostic1, diagnostic2) { - return Location.equals(diagnostic1, diagnostic2) && diagnostic1._diagnosticKey === diagnostic2._diagnosticKey && TypeScript.ArrayUtilities.sequenceEquals(diagnostic1._arguments, diagnostic2._arguments, function (v1, v2) { - return v1 === v2; - }); - }; - - Diagnostic.prototype.info = function () { - return getDiagnosticInfoFromKey(this.diagnosticKey()); - }; - return Diagnostic; - })(Location); - TypeScript.Diagnostic = Diagnostic; - - function newLine() { - return TypeScript.Environment ? TypeScript.Environment.newLine : "\r\n"; - } - TypeScript.newLine = newLine; - - function getLargestIndex(diagnostic) { - var largest = -1; - var regex = /\{(\d+)\}/g; - - var match; - while (match = regex.exec(diagnostic)) { - var val = parseInt(match[1]); - if (!isNaN(val) && val > largest) { - largest = val; + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; } } - - return largest; + return false; } - - function getDiagnosticInfoFromKey(diagnosticKey) { - var result = TypeScript.diagnosticInformationMap[diagnosticKey]; - TypeScript.Debug.assert(result); - return result; + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); } - - function getLocalizedText(diagnosticKey, args) { - if (TypeScript.LocalizedDiagnosticMessages) { - } - - var diagnosticMessageText = TypeScript.LocalizedDiagnosticMessages ? TypeScript.LocalizedDiagnosticMessages[diagnosticKey] : diagnosticKey; - TypeScript.Debug.assert(diagnosticMessageText !== undefined && diagnosticMessageText !== null); - - var actualCount = args ? args.length : 0; - - var expectedCount = 1 + getLargestIndex(diagnosticKey); - - if (expectedCount !== actualCount) { - throw new Error(getLocalizedText(TypeScript.DiagnosticCode.Expected_0_arguments_to_message_got_1_instead, [expectedCount, actualCount])); - } - - var valueCount = 1 + getLargestIndex(diagnosticMessageText); - if (valueCount !== expectedCount) { - throw new Error(getLocalizedText(TypeScript.DiagnosticCode.Expected_the_message_0_to_have_1_arguments_but_it_had_2, [diagnosticMessageText, expectedCount, valueCount])); - } - - diagnosticMessageText = diagnosticMessageText.replace(/{(\d+)}/g, function (match, num) { - return typeof args[num] !== 'undefined' ? args[num] : match; - }); - - diagnosticMessageText = diagnosticMessageText.replace(/{(NL)}/g, function (match) { - return TypeScript.newLine(); - }); - - return diagnosticMessageText; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); } - TypeScript.getLocalizedText = getLocalizedText; - - function getDiagnosticMessage(diagnosticKey, args) { - var diagnostic = getDiagnosticInfoFromKey(diagnosticKey); - var diagnosticMessageText = getLocalizedText(diagnosticKey, args); - - var message; - if (diagnostic.category === 1 /* Error */) { - message = getLocalizedText(TypeScript.DiagnosticCode.error_TS_0_1, [diagnostic.code, diagnosticMessageText]); - } else if (diagnostic.category === 0 /* Warning */) { - message = getLocalizedText(TypeScript.DiagnosticCode.warning_TS_0_1, [diagnostic.code, diagnosticMessageText]); - } else { - message = diagnosticMessageText; + function makeReverseMap(source) { + var result = []; + for (var name in source) { + if (source.hasOwnProperty(name)) { + result[source[name]] = name; + } } - - return message; + return result; } - TypeScript.getDiagnosticMessage = getDiagnosticMessage; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Errors = (function () { - function Errors() { - } - Errors.argument = function (argument, message) { - return new Error("Invalid argument: " + argument + ". " + message); - }; - - Errors.argumentOutOfRange = function (argument) { - return new Error("Argument out of range: " + argument); - }; - - Errors.argumentNull = function (argument) { - return new Error("Argument null: " + argument); - }; - - Errors.abstract = function () { - return new Error("Operation not implemented properly by subclass."); - }; - - Errors.notYetImplemented = function () { - return new Error("Not yet implemented."); - }; - - Errors.invalidOperation = function (message) { - return new Error("Invalid operation: " + message); - }; - return Errors; - })(); - TypeScript.Errors = Errors; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Hash = (function () { - function Hash() { - } - Hash.computeFnv1aCharArrayHashCode = function (text, start, len) { - var hashCode = Hash.FNV_BASE; - var end = start + len; - - for (var i = start; i < end; i++) { - hashCode = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(hashCode ^ text[i], Hash.FNV_PRIME); - } - - return hashCode; - }; - - Hash.computeSimple31BitCharArrayHashCode = function (key, start, len) { - var hash = 0; - - for (var i = 0; i < len; i++) { - var ch = key[start + i]; - - hash = ((((hash << 5) - hash) | 0) + ch) | 0; + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos++); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; } - - return hash & 0x7FFFFFFF; + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionFromLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line > 0); + return lineStarts[line - 1] + character - 1; + } + ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; + function getLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = (~lineNumber) - 1; + } + return { + line: lineNumber + 1, + character: position - lineStarts[lineNumber] + 1 }; - - Hash.computeSimple31BitStringHashCode = function (key) { - var hash = 0; - - var start = 0; - var len = key.length; - - for (var i = 0; i < len; i++) { - var ch = key.charCodeAt(start + i); - - hash = ((((hash << 5) - hash) | 0) + ch) | 0; - } - - return hash & 0x7FFFFFFF; - }; - - Hash.computeMurmur2StringHashCode = function (key, seed) { - var m = 0x5bd1e995; - var r = 24; - - var numberOfCharsLeft = key.length; - var h = Math.abs(seed ^ numberOfCharsLeft); - - var index = 0; - while (numberOfCharsLeft >= 2) { - var c1 = key.charCodeAt(index); - var c2 = key.charCodeAt(index + 1); - - var k = Math.abs(c1 | (c2 << 16)); - - k = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(k, m); - k ^= k >> r; - k = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(k, m); - - h = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(h, m); - h ^= k; - - index += 2; - numberOfCharsLeft -= 2; + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + function positionToLineAndCharacter(text, pos) { + var lineStarts = computeLineStarts(text); + return getLineAndCharacterOfPosition(lineStarts, pos); + } + ts.positionToLineAndCharacter = positionToLineAndCharacter; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; + } + ts.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; + } + function isOctalDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; + } + ts.isOctalDigit = isOctalDigit; + function skipTrivia(text, pos, stopAfterLineBreak) { + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (stopAfterLineBreak) + return pos; + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; } - - if (numberOfCharsLeft === 1) { - h ^= key.charCodeAt(index); - h = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(h, m); + return pos; + } + } + ts.skipTrivia = skipTrivia; + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + result[result.length - 1].hasTrailingNewLine = true; + } + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { + var startPos = pos; + pos += 2; + if (nextChar === 47 /* slash */) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) + result = []; + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + result[result.length - 1].hasTrailingNewLine = true; + } + pos++; + continue; + } + break; } - - h ^= h >> 13; - h = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(h, m); - h ^= h >> 15; - - return h; - }; - - Hash.getPrime = function (min) { - for (var i = 0; i < Hash.primes.length; i++) { - var num = Hash.primes[i]; - if (num >= min) { - return num; + return result; + } + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function createScanner(languageVersion, skipTrivia, text, onError) { + var pos; + var len; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var tokenIsUnterminated; + function error(message) { + if (onError) { + onError(message); + } + } + function isIdentifierStart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + function isIdentifierPart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46 /* dot */) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { + pos++; + if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanHexDigits(count, mustMatchCount) { + var digits = 0; + var value = 0; + while (digits < count || !mustMatchCount) { + var ch = text.charCodeAt(pos); + if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { + value = value * 16 + ch - 48 /* _0 */; + } + else if (ch >= 65 /* A */ && ch <= 70 /* F */) { + value = value * 16 + ch - 65 /* A */ + 10; + } + else if (ch >= 97 /* a */ && ch <= 102 /* f */) { + value = value * 16 + ch - 97 /* a */ + 10; + } + else { + break; } + pos++; + digits++; } - - throw TypeScript.Errors.notYetImplemented(); - }; - - Hash.expandPrime = function (oldSize) { - var num = oldSize << 1; - if (num > 2146435069 && 2146435069 > oldSize) { - return 2146435069; + if (digits < count) { + value = -1; } - return Hash.getPrime(num); - }; - - Hash.combine = function (value, currentHash) { - return (((currentHash << 5) + currentHash) + value) & 0x7FFFFFFF; - }; - Hash.FNV_BASE = 2166136261; - Hash.FNV_PRIME = 16777619; - - Hash.primes = [ - 3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, - 631, 761, 919, 1103, 1327, 1597, 1931, 2333, 2801, 3371, 4049, 4861, 5839, 7013, 8419, - 10103, 12143, 14591, 17519, 21023, 25229, 30293, 36353, 43627, 52361, 62851, 75431, - 90523, 108631, 130363, 156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, - 672827, 807403, 968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, - 4166287, 4999559, 5999471, 7199369]; - return Hash; - })(); - TypeScript.Hash = Hash; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Collections) { - Collections.DefaultHashTableCapacity = 1024; - - var HashTableEntry = (function () { - function HashTableEntry(Key, Value, HashCode, Next) { - this.Key = Key; - this.Value = Value; - this.HashCode = HashCode; - this.Next = Next; - } - return HashTableEntry; - })(); - - var HashTable = (function () { - function HashTable(capacity, hash) { - this.hash = hash; - this.count = 0; - var size = TypeScript.Hash.getPrime(capacity); - this.entries = TypeScript.ArrayUtilities.createArray(size, null); - } - HashTable.prototype.set = function (key, value) { - this.addOrSet(key, value, false); - }; - - HashTable.prototype.add = function (key, value) { - this.addOrSet(key, value, true); - }; - - HashTable.prototype.containsKey = function (key) { - var hashCode = this.computeHashCode(key); - var entry = this.findEntry(key, hashCode); - return entry !== null; - }; - - HashTable.prototype.get = function (key) { - var hashCode = this.computeHashCode(key); - var entry = this.findEntry(key, hashCode); - - return entry === null ? null : entry.Value; - }; - - HashTable.prototype.computeHashCode = function (key) { - var hashCode = this.hash === null ? key.hashCode : this.hash(key); - - hashCode = hashCode & 0x7FFFFFFF; - TypeScript.Debug.assert(hashCode >= 0); - - return hashCode; - }; - - HashTable.prototype.addOrSet = function (key, value, throwOnExistingEntry) { - var hashCode = this.computeHashCode(key); - - var entry = this.findEntry(key, hashCode); - if (entry !== null) { - if (throwOnExistingEntry) { - throw TypeScript.Errors.argument('key', "Key was already in table."); - } - - entry.Key = key; - entry.Value = value; - return; + return value; + } + function scanString() { + var quote = text.charCodeAt(pos++); + var result = ""; + var start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; } - - return this.addEntry(key, value, hashCode); - }; - - HashTable.prototype.findEntry = function (key, hashCode) { - for (var e = this.entries[hashCode % this.entries.length]; e !== null; e = e.Next) { - if (e.HashCode === hashCode && key === e.Key) { - return e; - } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; } - - return null; - }; - - HashTable.prototype.addEntry = function (key, value, hashCode) { - var index = hashCode % this.entries.length; - - var e = new HashTableEntry(key, value, hashCode, this.entries[index]); - - this.entries[index] = e; - - if (this.count >= (this.entries.length / 2)) { - this.grow(); + if (ch === 92 /* backslash */) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; } - - this.count++; - return e.Key; - }; - - HashTable.prototype.grow = function () { - var newSize = TypeScript.Hash.expandPrime(this.entries.length); - - var oldEntries = this.entries; - var newEntries = TypeScript.ArrayUtilities.createArray(newSize, null); - - this.entries = newEntries; - - for (var i = 0; i < oldEntries.length; i++) { - var e = oldEntries[i]; - - while (e !== null) { - var newIndex = e.HashCode % newSize; - var tmp = e.Next; - e.Next = newEntries[newIndex]; - newEntries[newIndex] = e; - e = tmp; + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96 /* backtick */) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; + break; + } + if (currChar === 92 /* backslash */) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13 /* carriageReturn */) { + contents += text.substring(start, pos); + if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos++; } + pos++; + contents += "\n"; + start = pos; + continue; } - }; - return HashTable; - })(); - Collections.HashTable = HashTable; - - function createHashTable(capacity, hash) { - if (typeof capacity === "undefined") { capacity = Collections.DefaultHashTableCapacity; } - if (typeof hash === "undefined") { hash = null; } - return new HashTable(capacity, hash); + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; } - Collections.createHashTable = createHashTable; - - var currentHashCode = 1; - function identityHashCode(value) { - if (value.__hash === undefined) { - value.__hash = currentHashCode; - currentHashCode++; + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48 /* _0 */: + return "\0"; + case 98 /* b */: + return "\b"; + case 116 /* t */: + return "\t"; + case 110 /* n */: + return "\n"; + case 118 /* v */: + return "\v"; + case 102 /* f */: + return "\f"; + case 114 /* r */: + return "\r"; + case 39 /* singleQuote */: + return "\'"; + case 34 /* doubleQuote */: + return "\""; + case 120 /* x */: + case 117 /* u */: + var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13 /* carriageReturn */: + if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + case 8232 /* lineSeparator */: + case 8233 /* paragraphSeparator */: + return ""; + default: + return String.fromCharCode(ch); } - - return value.__hash; } - Collections.identityHashCode = identityHashCode; - })(TypeScript.Collections || (TypeScript.Collections = {})); - var Collections = TypeScript.Collections; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - TypeScript.nodeMakeDirectoryTime = 0; - TypeScript.nodeCreateBufferTime = 0; - TypeScript.nodeWriteFileSyncTime = 0; - - (function (ByteOrderMark) { - ByteOrderMark[ByteOrderMark["None"] = 0] = "None"; - ByteOrderMark[ByteOrderMark["Utf8"] = 1] = "Utf8"; - ByteOrderMark[ByteOrderMark["Utf16BigEndian"] = 2] = "Utf16BigEndian"; - ByteOrderMark[ByteOrderMark["Utf16LittleEndian"] = 3] = "Utf16LittleEndian"; - })(TypeScript.ByteOrderMark || (TypeScript.ByteOrderMark = {})); - var ByteOrderMark = TypeScript.ByteOrderMark; - - var FileInformation = (function () { - function FileInformation(contents, byteOrderMark) { - this.contents = contents; - this.byteOrderMark = byteOrderMark; + function peekUnicodeEscape() { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { + var start = pos; + pos += 2; + var value = scanHexDigits(4, true); + pos = start; + return value; + } + return -1; } - return FileInformation; - })(); - TypeScript.FileInformation = FileInformation; - - TypeScript.Environment = (function () { - function getWindowsScriptHostEnvironment() { - try { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - } catch (e) { - return null; + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch)) { + pos++; + } + else if (ch === 92 /* backslash */) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } } - - var streamObjectPool = []; - - function getStreamObject() { - if (streamObjectPool.length > 0) { - return streamObjectPool.pop(); - } else { - return new ActiveXObject("ADODB.Stream"); + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; } } - - function releaseStreamObject(obj) { - streamObjectPool.push(obj); + return token = 63 /* Identifier */; + } + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48 /* _0 */; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; } - - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); + if (numberOfDigits === 0) { + return -1; } - - return { - newLine: "\r\n", - currentDirectory: function () { - return WScript.CreateObject("WScript.Shell").CurrentDirectory; - }, - supportsCodePage: function () { - return WScript.ReadFile; - }, - readFile: function (path, codepage) { - try { - if (codepage !== null && this.supportsCodePage()) { - try { - var contents = WScript.ReadFile(path, codepage); - return new FileInformation(contents, 0 /* None */); - } catch (e) { - } + return value; + } + function scan() { + startPos = pos; + precedingLineBreak = false; + tokenIsUnterminated = false; + while (true) { + tokenPos = pos; + if (pos >= len) { + return token = 1 /* EndOfFileToken */; + } + var ch = text.charCodeAt(pos); + switch (ch) { + case 10 /* lineFeed */: + case 13 /* carriageReturn */: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; } - - var streamObj = getStreamObject(); - streamObj.Open(); - streamObj.Type = 2; - - streamObj.Charset = 'x-ansi'; - - streamObj.LoadFromFile(path); - var bomChar = streamObj.ReadText(2); - - streamObj.Position = 0; - - var byteOrderMark = 0 /* None */; - - if (bomChar.charCodeAt(0) === 0xFE && bomChar.charCodeAt(1) === 0xFF) { - streamObj.Charset = 'unicode'; - byteOrderMark = 2 /* Utf16BigEndian */; - } else if (bomChar.charCodeAt(0) === 0xFF && bomChar.charCodeAt(1) === 0xFE) { - streamObj.Charset = 'unicode'; - byteOrderMark = 3 /* Utf16LittleEndian */; - } else if (bomChar.charCodeAt(0) === 0xEF && bomChar.charCodeAt(1) === 0xBB) { - streamObj.Charset = 'utf-8'; - byteOrderMark = 1 /* Utf8 */; - } else { - streamObj.Charset = 'utf-8'; + else { + if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos += 2; + } + else { + pos++; + } + return token = 4 /* NewLineTrivia */; } - - var contents = streamObj.ReadText(-1); - streamObj.Close(); - releaseStreamObject(streamObj); - return new FileInformation(contents, byteOrderMark); - } catch (err) { - var message; - if (err.number === -2147024809) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Unsupported_file_encoding, null); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Cannot_read_file_0_1, [path, err.message]); + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + if (skipTrivia) { + pos++; + continue; } - - throw new Error(message); - } - }, - writeFile: function (path, contents, writeByteOrderMark) { - var textStream = getStreamObject(); - textStream.Charset = 'utf-8'; - textStream.Open(); - textStream.WriteText(contents, 0); - - if (!writeByteOrderMark) { - textStream.Position = 3; - } else { - textStream.Position = 0; - } - - var fileStream = getStreamObject(); - fileStream.Type = 1; - fileStream.Open(); - - textStream.CopyTo(fileStream); - - fileStream.Flush(); - fileStream.SaveToFile(path, 2); - fileStream.Close(); - - textStream.Flush(); - textStream.Close(); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - deleteFile: function (path) { - if (fso.FileExists(path)) { - fso.DeleteFile(path, true); - } - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - listFiles: function (path, spec, options) { - options = options || {}; - function filesInFolder(folder, root) { - var paths = []; - var fc; - - if (options.recursive) { - fc = new Enumerator(folder.subfolders); - - for (; !fc.atEnd(); fc.moveNext()) { - paths = paths.concat(filesInFolder(fc.item(), root + "\\" + fc.item().Name)); + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; } + return token = 5 /* WhitespaceTrivia */; } - - fc = new Enumerator(folder.files); - - for (; !fc.atEnd(); fc.moveNext()) { - if (!spec || fc.item().Name.match(spec)) { - paths.push(root + "\\" + fc.item().Name); + case 33 /* exclamation */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; } - } - - return paths; - } - - var folder = fso.GetFolder(path); - var paths = []; - - return filesInFolder(folder, path); - }, - arguments: args, - standardOut: WScript.StdOut - }; - } - ; - - function getNodeEnvironment() { - var _fs = require('fs'); - var _path = require('path'); - var _module = require('module'); - var _os = require('os'); - - return { - newLine: _os.EOL, - currentDirectory: function () { - return process.cwd(); - }, - supportsCodePage: function () { - return false; - }, - readFile: function (file, codepage) { - if (codepage !== null) { - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.codepage_option_not_supported_on_current_platform, null)); - } - - var buffer = _fs.readFileSync(file); - switch (buffer[0]) { - case 0xFE: - if (buffer[1] === 0xFF) { - var i = 0; - while ((i + 1) < buffer.length) { - var temp = buffer[i]; - buffer[i] = buffer[i + 1]; - buffer[i + 1] = temp; - i += 2; + return pos += 2, token = 28 /* ExclamationEqualsToken */; + } + return pos++, token = 45 /* ExclamationToken */; + case 34 /* doubleQuote */: + case 39 /* singleQuote */: + tokenValue = scanString(); + return token = 7 /* StringLiteral */; + case 96 /* backtick */: + return token = scanTemplateAndSetTokenValue(); + case 37 /* percent */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 56 /* PercentEqualsToken */; + } + return pos++, token = 36 /* PercentToken */; + case 38 /* ampersand */: + if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { + return pos += 2, token = 47 /* AmpersandAmpersandToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 60 /* AmpersandEqualsToken */; + } + return pos++, token = 42 /* AmpersandToken */; + case 40 /* openParen */: + return pos++, token = 15 /* OpenParenToken */; + case 41 /* closeParen */: + return pos++, token = 16 /* CloseParenToken */; + case 42 /* asterisk */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 54 /* AsteriskEqualsToken */; + } + return pos++, token = 34 /* AsteriskToken */; + case 43 /* plus */: + if (text.charCodeAt(pos + 1) === 43 /* plus */) { + return pos += 2, token = 37 /* PlusPlusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 52 /* PlusEqualsToken */; + } + return pos++, token = 32 /* PlusToken */; + case 44 /* comma */: + return pos++, token = 22 /* CommaToken */; + case 45 /* minus */: + if (text.charCodeAt(pos + 1) === 45 /* minus */) { + return pos += 2, token = 38 /* MinusMinusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 53 /* MinusEqualsToken */; + } + return pos++, token = 33 /* MinusToken */; + case 46 /* dot */: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + } + if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { + return pos += 3, token = 20 /* DotDotDotToken */; + } + return pos++, token = 19 /* DotToken */; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; } - return new FileInformation(buffer.toString("ucs2", 2), 2 /* Utf16BigEndian */); + pos++; } - break; - case 0xFF: - if (buffer[1] === 0xFE) { - return new FileInformation(buffer.toString("ucs2", 2), 3 /* Utf16LittleEndian */); + if (skipTrivia) { + continue; } - break; - case 0xEF: - if (buffer[1] === 0xBB) { - return new FileInformation(buffer.toString("utf8", 3), 1 /* Utf8 */); + else { + return token = 2 /* SingleLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + var commentClosed = false; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3 /* MultiLineCommentTrivia */; } - } - - return new FileInformation(buffer.toString("utf8", 0), 0 /* None */); - }, - writeFile: function (path, contents, writeByteOrderMark) { - function mkdirRecursiveSync(path) { - var stats = _fs.statSync(path); - if (stats.isFile()) { - throw "\"" + path + "\" exists but isn't a directory."; - } else if (stats.isDirectory()) { - return; - } else { - mkdirRecursiveSync(_path.dirname(path)); - _fs.mkdirSync(path, 509); } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 55 /* SlashEqualsToken */; + } + return pos++, token = 35 /* SlashToken */; + case 48 /* _0 */: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { + pos += 2; + var value = scanHexDigits(1, false); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 6 /* NumericLiteral */; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; + } + tokenValue = "" + value; + return 6 /* NumericLiteral */; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return 6 /* NumericLiteral */; + } + if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return token = 6 /* NumericLiteral */; + } + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + case 56 /* _8 */: + case 57 /* _9 */: + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + case 58 /* colon */: + return pos++, token = 50 /* ColonToken */; + case 59 /* semicolon */: + return pos++, token = 21 /* SemicolonToken */; + case 60 /* lessThan */: + if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; + } + return pos += 2, token = 39 /* LessThanLessThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 25 /* LessThanEqualsToken */; + } + return pos++, token = 23 /* LessThanToken */; + case 61 /* equals */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; + } + return pos += 2, token = 27 /* EqualsEqualsToken */; + } + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + return pos += 2, token = 31 /* EqualsGreaterThanToken */; + } + return pos++, token = 51 /* EqualsToken */; + case 62 /* greaterThan */: + return pos++, token = 24 /* GreaterThanToken */; + case 63 /* question */: + return pos++, token = 49 /* QuestionToken */; + case 91 /* openBracket */: + return pos++, token = 17 /* OpenBracketToken */; + case 93 /* closeBracket */: + return pos++, token = 18 /* CloseBracketToken */; + case 94 /* caret */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 62 /* CaretEqualsToken */; + } + return pos++, token = 44 /* CaretToken */; + case 123 /* openBrace */: + return pos++, token = 13 /* OpenBraceToken */; + case 124 /* bar */: + if (text.charCodeAt(pos + 1) === 124 /* bar */) { + return pos += 2, token = 48 /* BarBarToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 61 /* BarEqualsToken */; + } + return pos++, token = 43 /* BarToken */; + case 125 /* closeBrace */: + return pos++, token = 14 /* CloseBraceToken */; + case 126 /* tilde */: + return pos++, token = 46 /* TildeToken */; + case 92 /* backslash */: + var ch = peekUnicodeEscape(); + if (ch >= 0 && isIdentifierStart(ch)) { + pos += 6; + tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + default: + if (isIdentifierStart(ch)) { + pos++; + while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92 /* backslash */) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + } + } + } + function reScanGreaterToken() { + if (token === 24 /* GreaterThanToken */) { + if (text.charCodeAt(pos) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + } + return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; } - var start = new Date().getTime(); - mkdirRecursiveSync(_path.dirname(path)); - TypeScript.nodeMakeDirectoryTime += new Date().getTime() - start; - - if (writeByteOrderMark) { - contents = '\uFEFF' + contents; + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; } - - var start = new Date().getTime(); - - var chunkLength = 4 * 1024; - var fileDescriptor = _fs.openSync(path, "w"); - try { - for (var index = 0; index < contents.length; index += chunkLength) { - var bufferStart = new Date().getTime(); - var buffer = new Buffer(contents.substr(index, chunkLength), "utf8"); - TypeScript.nodeCreateBufferTime += new Date().getTime() - bufferStart; - - _fs.writeSync(fileDescriptor, buffer, 0, buffer.length, null); - } - } finally { - _fs.closeSync(fileDescriptor); + return pos++, token = 40 /* GreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos) === 61 /* equals */) { + return pos++, token = 26 /* GreaterThanEqualsToken */; + } + } + return token; + } + function reScanSlashToken() { + if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= len) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; } - - TypeScript.nodeWriteFileSyncTime += new Date().getTime() - start; - }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - deleteFile: function (path) { - try { - _fs.unlinkSync(path); - } catch (e) { + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; } - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, - listFiles: function dir(path, spec, options) { - options = options || {}; - - function filesInFolder(folder) { - var paths = []; - - var files = _fs.readdirSync(folder); - for (var i = 0; i < files.length; i++) { - var stat = _fs.statSync(folder + "\\" + files[i]); - if (options.recursive && stat.isDirectory()) { - paths = paths.concat(filesInFolder(folder + "\\" + files[i])); - } else if (stat.isFile() && (!spec || files[i].match(spec))) { - paths.push(folder + "\\" + files[i]); - } - } - - return paths; + if (inEscape) { + inEscape = false; } - - return filesInFolder(path); - }, - arguments: process.argv.slice(2), - standardOut: { - Write: function (str) { - process.stdout.write(str); - }, - WriteLine: function (str) { - process.stdout.write(str + '\n'); - }, - Close: function () { + else if (ch === 47 /* slash */ && !inCharacterClass) { + p++; + break; + } + else if (ch === 91 /* openBracket */) { + inCharacterClass = true; } + else if (ch === 92 /* backslash */) { + inEscape = true; + } + else if (ch === 93 /* closeBracket */) { + inCharacterClass = false; + } + p++; + } + while (p < len && isIdentifierPart(text.charCodeAt(p))) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 8 /* RegularExpressionLiteral */; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryScan(callback) { + return speculationHelper(callback, false); + } + function setText(newText) { + text = newText || ""; + len = text.length; + setTextPos(0); + } + function setTextPos(textPos) { + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0 /* Unknown */; + precedingLineBreak = false; + } + setText(text); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 63 /* Identifier */ || token > 99 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 64 /* FirstReservedWord */ && token <= 99 /* LastReservedWord */; }, + isUnterminated: function () { return tokenIsUnterminated; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scan: scan, + setText: setText, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead + }; + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if (declaration.kind === kind) { + return declaration; + } + } + return undefined; + } + ts.getDeclarationOfKind = getDeclarationOfKind; + var stringWriters = []; + function getSingleLineStringWriter() { + if (stringWriters.length == 0) { + var str = ""; + var writeText = function (text) { return str += text; }; + return { + string: function () { return str; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeSymbol: writeText, + writeLine: function () { return str += " "; }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { return str = ""; }, + trackSymbol: function () { } }; } - ; - - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - return getWindowsScriptHostEnvironment(); - } else if (typeof module !== 'undefined' && module.exports) { - return getNodeEnvironment(); - } else { - return null; + return stringWriters.pop(); + } + ts.getSingleLineStringWriter = getSingleLineStringWriter; + function releaseStringWriter(writer) { + writer.clear(); + stringWriters.push(writer); + } + ts.releaseStringWriter = releaseStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts.getFullWidth = getFullWidth; + function hasFlag(val, flag) { + return (val & flag) !== 0; + } + ts.hasFlag = hasFlag; + function containsParseError(node) { + if (!hasFlag(node.parserContextFlags, 32 /* HasPropagatedChildContainsErrorFlag */)) { + var val = hasFlag(node.parserContextFlags, 16 /* ContainsError */) || ts.forEachChild(node, containsParseError); + if (val) { + node.parserContextFlags |= 16 /* ContainsError */; + } + node.parserContextFlags |= 32 /* HasPropagatedChildContainsErrorFlag */; } - })(); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (IntegerUtilities) { - function integerDivide(numerator, denominator) { - return (numerator / denominator) >> 0; - } - IntegerUtilities.integerDivide = integerDivide; - - function integerMultiplyLow32Bits(n1, n2) { - var n1Low16 = n1 & 0x0000ffff; - var n1High16 = n1 >>> 16; - - var n2Low16 = n2 & 0x0000ffff; - var n2High16 = n2 >>> 16; - - var resultLow32 = (((n1 & 0xffff0000) * n2) >>> 0) + (((n1 & 0x0000ffff) * n2) >>> 0) >>> 0; - return resultLow32; + return hasFlag(node.parserContextFlags, 16 /* ContainsError */); + } + ts.containsParseError = containsParseError; + function getSourceFileOfNode(node) { + while (node && node.kind !== 201 /* SourceFile */) { + node = node.parent; } - IntegerUtilities.integerMultiplyLow32Bits = integerMultiplyLow32Bits; - - function integerMultiplyHigh32Bits(n1, n2) { - var n1Low16 = n1 & 0x0000ffff; - var n1High16 = n1 >>> 16; - - var n2Low16 = n2 & 0x0000ffff; - var n2High16 = n2 >>> 16; - - var resultHigh32 = n1High16 * n2High16 + ((((n1Low16 * n2Low16) >>> 17) + n1Low16 * n2High16) >>> 15); - return resultHigh32; + return node; + } + ts.getSourceFileOfNode = getSourceFileOfNode; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = file.getLineAndCharacterFromPosition(node.pos); + return file.filename + "(" + loc.line + "," + loc.character + ")"; + } + ts.nodePosToString = nodePosToString; + function getStartPosOfNode(node) { + return node.pos; + } + ts.getStartPosOfNode = getStartPosOfNode; + function isMissingNode(node) { + return node.pos === node.end && node.kind !== 1 /* EndOfFileToken */; + } + ts.isMissingNode = isMissingNode; + function getTokenPosOfNode(node, sourceFile) { + if (isMissingNode(node)) { + return node.pos; } - IntegerUtilities.integerMultiplyHigh32Bits = integerMultiplyHigh32Bits; - - function isInteger(text) { - return /^[0-9]+$/.test(text); + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); + } + ts.getTokenPosOfNode = getTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node) { + if (isMissingNode(node)) { + return ""; } - IntegerUtilities.isInteger = isInteger; - - function isHexInteger(text) { - return /^0(x|X)[0-9a-fA-F]+$/.test(text); - } - IntegerUtilities.isHexInteger = isHexInteger; - })(TypeScript.IntegerUtilities || (TypeScript.IntegerUtilities = {})); - var IntegerUtilities = TypeScript.IntegerUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineMap = (function () { - function LineMap(_computeLineStarts, length) { - this._computeLineStarts = _computeLineStarts; - this.length = length; - this._lineStarts = null; - } - LineMap.prototype.toJSON = function (key) { - return { lineStarts: this.lineStarts(), length: this.length }; - }; - - LineMap.prototype.equals = function (other) { - return this.length === other.length && TypeScript.ArrayUtilities.sequenceEquals(this.lineStarts(), other.lineStarts(), function (v1, v2) { - return v1 === v2; - }); - }; - - LineMap.prototype.lineStarts = function () { - if (this._lineStarts === null) { - this._lineStarts = this._computeLineStarts(); - } - - return this._lineStarts; - }; - - LineMap.prototype.lineCount = function () { - return this.lineStarts().length; - }; - - LineMap.prototype.getPosition = function (line, character) { - return this.lineStarts()[line] + character; - }; - - LineMap.prototype.getLineNumberFromPosition = function (position) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); + var text = sourceFile.text; + return text.substring(ts.skipTrivia(text, node.pos), node.end); + } + ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function getTextOfNodeFromSourceText(sourceText, node) { + if (isMissingNode(node)) { + return ""; + } + return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + } + ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node) { + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node); + } + ts.getTextOfNode = getTextOfNode; + function escapeIdentifier(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier; + } + ts.escapeIdentifier = escapeIdentifier; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; + function declarationNameToString(name) { + return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts.declarationNameToString = declarationNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = getTokenPosOfNode(node, file); + var length = node.end - start; + return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeFromMessageChain(node, messageChain, newLine) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = ts.skipTrivia(file.text, node.pos); + var length = node.end - start; + return ts.flattenDiagnosticChain(file, start, length, messageChain, newLine); + } + ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function getErrorSpanForNode(node) { + var errorSpan; + switch (node.kind) { + case 183 /* VariableDeclaration */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 189 /* ModuleDeclaration */: + case 188 /* EnumDeclaration */: + case 200 /* EnumMember */: + errorSpan = node.name; + break; + } + return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node; + } + ts.getErrorSpanForNode = getErrorSpanForNode; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; + function isDeclarationFile(file) { + return (file.flags & 1024 /* DeclarationFile */) !== 0; + } + ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return node.kind === 188 /* EnumDeclaration */ && isConst(node); + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; + function isConst(node) { + return !!(node.flags & 4096 /* Const */); + } + ts.isConst = isConst; + function isLet(node) { + return !!(node.flags & 2048 /* Let */); + } + ts.isLet = isLet; + function isPrologueDirective(node) { + return node.kind === 166 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; + } + ts.isPrologueDirective = isPrologueDirective; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); + if (node.kind === 123 /* Parameter */ || node.kind === 122 /* TypeParameter */) { + return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); + } + else { + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + } + } + ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getJsDocComments(node, sourceFileOfNode) { + return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + function isJsDocComment(comment) { + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47 /* slash */; + } + } + ts.getJsDocComments = getJsDocComments; + ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 174 /* ReturnStatement */: + return visitor(node); + case 163 /* Block */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + return ts.forEachChild(node, traverse); } - - if (position === this.length) { - return this.lineCount() - 1; + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function isAnyFunction(node) { + if (node) { + switch (node.kind) { + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + return true; } - - var lineNumber = TypeScript.ArrayUtilities.binarySearch(this.lineStarts(), position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; + } + return false; + } + ts.isAnyFunction = isAnyFunction; + function isFunctionBlock(node) { + return node !== undefined && node.kind === 163 /* Block */ && isAnyFunction(node.parent); + } + ts.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node !== undefined && node.kind === 125 /* Method */ && node.parent.kind === 142 /* ObjectLiteralExpression */; + } + ts.isObjectLiteralMethod = isObjectLiteralMethod; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isAnyFunction(node)) { + return node; } - - return lineNumber; - }; - - LineMap.prototype.getLineStartPosition = function (lineNumber) { - return this.lineStarts()[lineNumber]; - }; - - LineMap.prototype.fillLineAndCharacterFromPosition = function (position, lineAndCharacter) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); + } + } + ts.getContainingFunction = getContainingFunction; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; } - - var lineNumber = this.getLineNumberFromPosition(position); - lineAndCharacter.line = lineNumber; - lineAndCharacter.character = position - this.lineStarts()[lineNumber]; - }; - - LineMap.prototype.getLineAndCharacterFromPosition = function (position) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); + switch (node.kind) { + case 151 /* ArrowFunction */: + if (!includeArrowFunctions) { + continue; + } + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 189 /* ModuleDeclaration */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 188 /* EnumDeclaration */: + case 201 /* SourceFile */: + return node; } - - var lineNumber = this.getLineNumberFromPosition(position); - - return new TypeScript.LineAndCharacter(lineNumber, position - this.lineStarts()[lineNumber]); - }; - LineMap.empty = new LineMap(function () { - return [0]; - }, 0); - return LineMap; - })(); - TypeScript.LineMap = LineMap; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineAndCharacter = (function () { - function LineAndCharacter(line, character) { - this._line = 0; - this._character = 0; - if (line < 0) { - throw TypeScript.Errors.argumentOutOfRange("line"); + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; } - - if (character < 0) { - throw TypeScript.Errors.argumentOutOfRange("character"); + switch (node.kind) { + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return node; } - - this._line = line; - this._character = character; } - LineAndCharacter.prototype.line = function () { - return this._line; - }; - - LineAndCharacter.prototype.character = function () { - return this._character; - }; - return LineAndCharacter; - })(); - TypeScript.LineAndCharacter = LineAndCharacter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var MathPrototype = (function () { - function MathPrototype() { - } - MathPrototype.max = function (a, b) { - return a >= b ? a : b; - }; - - MathPrototype.min = function (a, b) { - return a <= b ? a : b; - }; - return MathPrototype; - })(); - TypeScript.MathPrototype = MathPrototype; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Collections) { - Collections.DefaultStringTableCapacity = 256; - - var StringTableEntry = (function () { - function StringTableEntry(Text, HashCode, Next) { - this.Text = Text; - this.HashCode = HashCode; - this.Next = Next; - } - return StringTableEntry; - })(); - - var StringTable = (function () { - function StringTable(capacity) { - this.count = 0; - var size = TypeScript.Hash.getPrime(capacity); - this.entries = TypeScript.ArrayUtilities.createArray(size, null); - } - StringTable.prototype.addCharArray = function (key, start, len) { - var hashCode = TypeScript.Hash.computeSimple31BitCharArrayHashCode(key, start, len) & 0x7FFFFFFF; - - var entry = this.findCharArrayEntry(key, start, len, hashCode); - if (entry !== null) { - return entry.Text; - } - - var slice = key.slice(start, start + len); - return this.addEntry(TypeScript.StringUtilities.fromCharCodeArray(slice), hashCode); - }; - - StringTable.prototype.findCharArrayEntry = function (key, start, len, hashCode) { - for (var e = this.entries[hashCode % this.entries.length]; e !== null; e = e.Next) { - if (e.HashCode === hashCode && StringTable.textCharArrayEquals(e.Text, key, start, len)) { - return e; - } - } - - return null; - }; - - StringTable.prototype.addEntry = function (text, hashCode) { - var index = hashCode % this.entries.length; - - var e = new StringTableEntry(text, hashCode, this.entries[index]); - - this.entries[index] = e; - - if (this.count === this.entries.length) { - this.grow(); - } - - this.count++; - return e.Text; - }; - - StringTable.prototype.grow = function () { - var newSize = TypeScript.Hash.expandPrime(this.entries.length); - - var oldEntries = this.entries; - var newEntries = TypeScript.ArrayUtilities.createArray(newSize, null); - - this.entries = newEntries; - - for (var i = 0; i < oldEntries.length; i++) { - var e = oldEntries[i]; - while (e !== null) { - var newIndex = e.HashCode % newSize; - var tmp = e.Next; - e.Next = newEntries[newIndex]; - newEntries[newIndex] = e; - e = tmp; - } + } + ts.getSuperContainer = getSuperContainer; + function getInvokedExpression(node) { + if (node.kind === 147 /* TaggedTemplateExpression */) { + return node.tag; + } + return node.expression; + } + ts.getInvokedExpression = getInvokedExpression; + function isExpression(node) { + switch (node.kind) { + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + case 8 /* RegularExpressionLiteral */: + case 141 /* ArrayLiteralExpression */: + case 142 /* ObjectLiteralExpression */: + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 147 /* TaggedTemplateExpression */: + case 148 /* TypeAssertionExpression */: + case 149 /* ParenthesizedExpression */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 154 /* VoidExpression */: + case 152 /* DeleteExpression */: + case 153 /* TypeOfExpression */: + case 155 /* PrefixUnaryExpression */: + case 156 /* PostfixUnaryExpression */: + case 157 /* BinaryExpression */: + case 158 /* ConditionalExpression */: + case 159 /* TemplateExpression */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 161 /* OmittedExpression */: + return true; + case 120 /* QualifiedName */: + while (node.parent.kind === 120 /* QualifiedName */) { + node = node.parent; } - }; - - StringTable.textCharArrayEquals = function (text, array, start, length) { - if (text.length !== length) { - return false; + return node.parent.kind === 135 /* TypeQuery */; + case 63 /* Identifier */: + if (node.parent.kind === 135 /* TypeQuery */) { + return true; } - - var s = start; - for (var i = 0; i < length; i++) { - if (text.charCodeAt(i) !== array[s]) { - return false; - } - - s++; + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + var parent = node.parent; + switch (parent.kind) { + case 183 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: + case 200 /* EnumMember */: + case 198 /* PropertyAssignment */: + return parent.initializer === node; + case 166 /* ExpressionStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 174 /* ReturnStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 178 /* ThrowStatement */: + case 176 /* SwitchStatement */: + return parent.expression === node; + case 170 /* ForStatement */: + return parent.initializer === node || parent.condition === node || parent.iterator === node; + case 171 /* ForInStatement */: + return parent.variable === node || parent.expression === node; + case 148 /* TypeAssertionExpression */: + return node === parent.expression; + case 162 /* TemplateSpan */: + return node === parent.expression; + default: + if (isExpression(parent)) { + return true; + } } - - return true; - }; - return StringTable; - })(); - Collections.StringTable = StringTable; - - Collections.DefaultStringTable = new StringTable(Collections.DefaultStringTableCapacity); - })(TypeScript.Collections || (TypeScript.Collections = {})); - var Collections = TypeScript.Collections; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var StringUtilities = (function () { - function StringUtilities() { - } - StringUtilities.isString = function (value) { - return Object.prototype.toString.apply(value, []) === '[object String]'; - }; - - StringUtilities.fromCharCodeArray = function (array) { - return String.fromCharCode.apply(null, array); - }; - - StringUtilities.endsWith = function (string, value) { - return string.substring(string.length - value.length, string.length) === value; - }; - - StringUtilities.startsWith = function (string, value) { - return string.substr(0, value.length) === value; - }; - - StringUtilities.copyTo = function (source, sourceIndex, destination, destinationIndex, count) { - for (var i = 0; i < count; i++) { - destination[destinationIndex + i] = source.charCodeAt(sourceIndex + i); + } + return false; + } + ts.isExpression = isExpression; + function isExternalModuleImportDeclaration(node) { + return node.kind === 191 /* ImportDeclaration */ && node.moduleReference.kind === 193 /* ExternalModuleReference */; + } + ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; + function getExternalModuleImportDeclarationExpression(node) { + ts.Debug.assert(isExternalModuleImportDeclaration(node)); + return node.moduleReference.expression; + } + ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; + function isInternalModuleImportDeclaration(node) { + return node.kind === 191 /* ImportDeclaration */ && node.moduleReference.kind !== 193 /* ExternalModuleReference */; + } + ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; + function hasDotDotDotToken(node) { + return node && node.kind === 123 /* Parameter */ && node.dotDotDotToken !== undefined; + } + ts.hasDotDotDotToken = hasDotDotDotToken; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 123 /* Parameter */: + return node.questionToken !== undefined; + case 125 /* Method */: + return node.questionToken !== undefined; + case 199 /* ShorthandPropertyAssignment */: + case 198 /* PropertyAssignment */: + case 124 /* Property */: + return node.questionToken !== undefined; } - }; - - StringUtilities.repeat = function (value, count) { - return Array(count + 1).join(value); - }; - - StringUtilities.stringEquals = function (val1, val2) { - return val1 === val2; - }; - return StringUtilities; - })(); - TypeScript.StringUtilities = StringUtilities; -})(TypeScript || (TypeScript = {})); -var global = Function("return this").call(null); - -var TypeScript; -(function (TypeScript) { - var Clock; - (function (Clock) { - Clock.now; - Clock.resolution; - - if (typeof WScript !== "undefined" && typeof global['WScript'].InitializeProjection !== "undefined") { - global['WScript'].InitializeProjection(); - - Clock.now = function () { - return TestUtilities.QueryPerformanceCounter(); - }; - - Clock.resolution = TestUtilities.QueryPerformanceFrequency(); - } else { - Clock.now = function () { - return Date.now(); - }; - - Clock.resolution = 1000; } - })(Clock || (Clock = {})); - - var Timer = (function () { - function Timer() { - this.time = 0; + return false; + } + ts.hasQuestionToken = hasQuestionToken; + function hasRestParameters(s) { + return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined; + } + ts.hasRestParameters = hasRestParameters; + function isLiteralKind(kind) { + return 6 /* FirstLiteralToken */ <= kind && kind <= 9 /* LastLiteralToken */; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 7 /* StringLiteral */ || kind === 9 /* NoSubstitutionTemplateLiteral */; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return 9 /* FirstTemplateToken */ <= kind && kind <= 12 /* LastTemplateToken */; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isInAmbientContext(node) { + while (node) { + if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) + return true; + node = node.parent; } - Timer.prototype.start = function () { - this.time = 0; - this.startTime = Clock.now(); - }; - - Timer.prototype.end = function () { - this.time = (Clock.now() - this.startTime); + return false; + } + ts.isInAmbientContext = isInAmbientContext; + function isDeclaration(node) { + switch (node.kind) { + case 122 /* TypeParameter */: + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + case 200 /* EnumMember */: + case 125 /* Method */: + case 184 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 188 /* EnumDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + return true; + } + return false; + } + ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + case 182 /* DebuggerStatement */: + case 168 /* DoStatement */: + case 166 /* ExpressionStatement */: + case 165 /* EmptyStatement */: + case 171 /* ForInStatement */: + case 170 /* ForStatement */: + case 167 /* IfStatement */: + case 177 /* LabeledStatement */: + case 174 /* ReturnStatement */: + case 176 /* SwitchStatement */: + case 92 /* ThrowKeyword */: + case 179 /* TryStatement */: + case 164 /* VariableStatement */: + case 169 /* WhileStatement */: + case 175 /* WithStatement */: + case 192 /* ExportAssignment */: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; + function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { + if (name.kind !== 63 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { + return false; + } + var parent = name.parent; + if (isDeclaration(parent) || parent.kind === 150 /* FunctionExpression */) { + return parent.name === name; + } + if (parent.kind === 197 /* CatchClause */) { + return parent.name === name; + } + return false; + } + ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; + function getClassBaseTypeNode(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 77 /* ExtendsKeyword */); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; + } + ts.getClassBaseTypeNode = getClassBaseTypeNode; + function getClassImplementedTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 100 /* ImplementsKeyword */); + return heritageClause ? heritageClause.types : undefined; + } + ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 77 /* ExtendsKeyword */); + return heritageClause ? heritageClause.types : undefined; + } + ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var i = 0, n = clauses.length; i < n; i++) { + if (clauses[i].token === kind) { + return clauses[i]; + } + } + } + return undefined; + } + ts.getHeritageClause = getHeritageClause; + function tryResolveScriptReference(program, sourceFile, reference) { + if (!program.getCompilerOptions().noResolve) { + var referenceFileName = ts.isRootedDiskPath(reference.filename) ? reference.filename : ts.combinePaths(ts.getDirectoryPath(sourceFile.filename), reference.filename); + referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, program.getCompilerHost().getCurrentDirectory()); + return program.getSourceFile(referenceFileName); + } + } + ts.tryResolveScriptReference = tryResolveScriptReference; + function getAncestor(node, kind) { + switch (kind) { + case 185 /* ClassDeclaration */: + while (node) { + switch (node.kind) { + case 185 /* ClassDeclaration */: + return node; + case 188 /* EnumDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + return undefined; + } + ts.getAncestor = getAncestor; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.exec(comment)) { + if (isNoDefaultLibRegEx.exec(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + if (matchResult) { + var start = commentRange.pos; + var end = commentRange.end; + return { + fileReference: { + pos: start, + end: end, + filename: matchResult[3] + }, + isNoDefaultLib: false + }; + } + else { + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; + function isKeyword(token) { + return 64 /* FirstKeyword */ <= token && token <= 119 /* LastKeyword */; + } + ts.isKeyword = isKeyword; + function isTrivia(token) { + return 2 /* FirstTriviaToken */ <= token && token <= 5 /* LastTriviaToken */; + } + ts.isTrivia = isTrivia; + function isModifier(token) { + switch (token) { + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + case 76 /* ExportKeyword */: + case 112 /* DeclareKeyword */: + case 68 /* ConstKeyword */: + return true; + } + return false; + } + ts.isModifier = isModifier; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nodeConstructors = new Array(204 /* Count */); + function getNodeConstructor(kind) { + return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); + } + ts.getNodeConstructor = getNodeConstructor; + function createRootNode(kind, pos, end, flags) { + var node = new (getNodeConstructor(kind))(); + node.pos = pos; + node.end = end; + node.flags = flags; + return node; + } + function forEachChild(node, cbNode, cbNodes) { + function child(node) { + if (node) { + return cbNode(node); + } + } + function children(nodes) { + if (nodes) { + if (cbNodes) { + return cbNodes(nodes); + } + for (var i = 0, len = nodes.length; i < len; i++) { + var result = cbNode(nodes[i]); + if (result) { + return result; + } + } + return undefined; + } + } + if (!node) { + return; + } + switch (node.kind) { + case 120 /* QualifiedName */: + return child(node.left) || child(node.right); + case 122 /* TypeParameter */: + return child(node.name) || child(node.constraint); + case 123 /* Parameter */: + return children(node.modifiers) || child(node.dotDotDotToken) || child(node.name) || child(node.questionToken) || child(node.type) || child(node.initializer); + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + return children(node.modifiers) || child(node.name) || child(node.questionToken) || child(node.type) || child(node.initializer); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return children(node.modifiers) || children(node.typeParameters) || children(node.parameters) || child(node.type); + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + return children(node.modifiers) || child(node.name) || child(node.questionToken) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); + case 132 /* TypeReference */: + return child(node.typeName) || children(node.typeArguments); + case 135 /* TypeQuery */: + return child(node.exprName); + case 136 /* TypeLiteral */: + return children(node.members); + case 137 /* ArrayType */: + return child(node.elementType); + case 138 /* TupleType */: + return children(node.elementTypes); + case 139 /* UnionType */: + return children(node.types); + case 140 /* ParenthesizedType */: + return child(node.type); + case 141 /* ArrayLiteralExpression */: + return children(node.elements); + case 142 /* ObjectLiteralExpression */: + return children(node.properties); + case 143 /* PropertyAccessExpression */: + return child(node.expression) || child(node.name); + case 144 /* ElementAccessExpression */: + return child(node.expression) || child(node.argumentExpression); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return child(node.expression) || children(node.typeArguments) || children(node.arguments); + case 147 /* TaggedTemplateExpression */: + return child(node.tag) || child(node.template); + case 148 /* TypeAssertionExpression */: + return child(node.type) || child(node.expression); + case 149 /* ParenthesizedExpression */: + return child(node.expression); + case 152 /* DeleteExpression */: + return child(node.expression); + case 153 /* TypeOfExpression */: + return child(node.expression); + case 154 /* VoidExpression */: + return child(node.expression); + case 155 /* PrefixUnaryExpression */: + return child(node.operand); + case 156 /* PostfixUnaryExpression */: + return child(node.operand); + case 157 /* BinaryExpression */: + return child(node.left) || child(node.right); + case 158 /* ConditionalExpression */: + return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return children(node.statements); + case 201 /* SourceFile */: + return children(node.statements) || child(node.endOfFileToken); + case 164 /* VariableStatement */: + return children(node.modifiers) || children(node.declarations); + case 166 /* ExpressionStatement */: + return child(node.expression); + case 167 /* IfStatement */: + return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); + case 168 /* DoStatement */: + return child(node.statement) || child(node.expression); + case 169 /* WhileStatement */: + return child(node.expression) || child(node.statement); + case 170 /* ForStatement */: + return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); + case 171 /* ForInStatement */: + return children(node.declarations) || child(node.variable) || child(node.expression) || child(node.statement); + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + return child(node.label); + case 174 /* ReturnStatement */: + return child(node.expression); + case 175 /* WithStatement */: + return child(node.expression) || child(node.statement); + case 176 /* SwitchStatement */: + return child(node.expression) || children(node.clauses); + case 194 /* CaseClause */: + return child(node.expression) || children(node.statements); + case 195 /* DefaultClause */: + return children(node.statements); + case 177 /* LabeledStatement */: + return child(node.label) || child(node.statement); + case 178 /* ThrowStatement */: + return child(node.expression); + case 179 /* TryStatement */: + return child(node.tryBlock) || child(node.catchClause) || child(node.finallyBlock); + case 197 /* CatchClause */: + return child(node.name) || child(node.type) || child(node.block); + case 183 /* VariableDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.type) || child(node.initializer); + case 185 /* ClassDeclaration */: + return children(node.modifiers) || child(node.name) || children(node.typeParameters) || children(node.heritageClauses) || children(node.members); + case 186 /* InterfaceDeclaration */: + return children(node.modifiers) || child(node.name) || children(node.typeParameters) || children(node.heritageClauses) || children(node.members); + case 187 /* TypeAliasDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.type); + case 188 /* EnumDeclaration */: + return children(node.modifiers) || child(node.name) || children(node.members); + case 200 /* EnumMember */: + return child(node.name) || child(node.initializer); + case 189 /* ModuleDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.body); + case 191 /* ImportDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.moduleReference); + case 192 /* ExportAssignment */: + return children(node.modifiers) || child(node.exportName); + case 159 /* TemplateExpression */: + return child(node.head) || children(node.templateSpans); + case 162 /* TemplateSpan */: + return child(node.expression) || child(node.literal); + case 121 /* ComputedPropertyName */: + return child(node.expression); + case 196 /* HeritageClause */: + return children(node.types); + case 193 /* ExternalModuleReference */: + return child(node.expression); + } + } + ts.forEachChild = forEachChild; + function createCompilerHost(options) { + var currentDirectory; + var existingDirectories = {}; + function getCanonicalFileName(fileName) { + return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + } + var unsupportedFileEncodingErrorCode = -2147024809; + function getSourceFile(filename, languageVersion, onError) { + try { + var text = ts.sys.readFile(filename, options.charset); + } + catch (e) { + if (onError) { + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + } + text = ""; + } + return text !== undefined ? createSourceFile(filename, text, languageVersion, "0") : undefined; + } + function writeFile(fileName, data, writeByteOrderMark, onError) { + function directoryExists(directoryPath) { + if (ts.hasProperty(existingDirectories, directoryPath)) { + return true; + } + if (ts.sys.directoryExists(directoryPath)) { + existingDirectories[directoryPath] = true; + return true; + } + return false; + } + function ensureDirectoriesExist(directoryPath) { + if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + ts.sys.createDirectory(directoryPath); + } + } + try { + ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + catch (e) { + if (onError) { + onError(e.message); + } + } + } + return { + getSourceFile: getSourceFile, + getDefaultLibFilename: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), options.target === 2 /* ES6 */ ? "lib.es6.d.ts" : "lib.d.ts"); }, + writeFile: writeFile, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCanonicalFileName: getCanonicalFileName, + getNewLine: function () { return ts.sys.newLine; } }; - return Timer; - })(); - TypeScript.Timer = Timer; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (DiagnosticCategory) { - DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; - DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; - DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; - DiagnosticCategory[DiagnosticCategory["NoPrefix"] = 3] = "NoPrefix"; - })(TypeScript.DiagnosticCategory || (TypeScript.DiagnosticCategory = {})); - var DiagnosticCategory = TypeScript.DiagnosticCategory; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.diagnosticInformationMap = { - "error TS{0}: {1}": { - "code": 0, - "category": 3 /* NoPrefix */ - }, - "warning TS{0}: {1}": { - "code": 1, - "category": 3 /* NoPrefix */ - }, - "Unrecognized escape sequence.": { - "code": 1000, - "category": 1 /* Error */ - }, - "Unexpected character {0}.": { - "code": 1001, - "category": 1 /* Error */ - }, - "Missing close quote character.": { - "code": 1002, - "category": 1 /* Error */ - }, - "Identifier expected.": { - "code": 1003, - "category": 1 /* Error */ - }, - "'{0}' keyword expected.": { - "code": 1004, - "category": 1 /* Error */ - }, - "'{0}' expected.": { - "code": 1005, - "category": 1 /* Error */ - }, - "Identifier expected; '{0}' is a keyword.": { - "code": 1006, - "category": 1 /* Error */ - }, - "Automatic semicolon insertion not allowed.": { - "code": 1007, - "category": 1 /* Error */ - }, - "Unexpected token; '{0}' expected.": { - "code": 1008, - "category": 1 /* Error */ - }, - "Trailing separator not allowed.": { - "code": 1009, - "category": 1 /* Error */ - }, - "'*/' expected.": { - "code": 1010, - "category": 1 /* Error */ - }, - "'public' or 'private' modifier must precede 'static'.": { - "code": 1011, - "category": 1 /* Error */ - }, - "Unexpected token.": { - "code": 1012, - "category": 1 /* Error */ - }, - "Catch clause parameter cannot have a type annotation.": { - "code": 1013, - "category": 1 /* Error */ - }, - "Rest parameter must be last in list.": { - "code": 1014, - "category": 1 /* Error */ - }, - "Parameter cannot have question mark and initializer.": { - "code": 1015, - "category": 1 /* Error */ - }, - "Required parameter cannot follow optional parameter.": { - "code": 1016, - "category": 1 /* Error */ - }, - "Index signatures cannot have rest parameters.": { - "code": 1017, - "category": 1 /* Error */ - }, - "Index signature parameter cannot have accessibility modifiers.": { - "code": 1018, - "category": 1 /* Error */ - }, - "Index signature parameter cannot have a question mark.": { - "code": 1019, - "category": 1 /* Error */ - }, - "Index signature parameter cannot have an initializer.": { - "code": 1020, - "category": 1 /* Error */ - }, - "Index signature must have a type annotation.": { - "code": 1021, - "category": 1 /* Error */ - }, - "Index signature parameter must have a type annotation.": { - "code": 1022, - "category": 1 /* Error */ - }, - "Index signature parameter type must be 'string' or 'number'.": { - "code": 1023, - "category": 1 /* Error */ - }, - "'extends' clause already seen.": { - "code": 1024, - "category": 1 /* Error */ - }, - "'extends' clause must precede 'implements' clause.": { - "code": 1025, - "category": 1 /* Error */ - }, - "Classes can only extend a single class.": { - "code": 1026, - "category": 1 /* Error */ - }, - "'implements' clause already seen.": { - "code": 1027, - "category": 1 /* Error */ - }, - "Accessibility modifier already seen.": { - "code": 1028, - "category": 1 /* Error */ - }, - "'{0}' modifier must precede '{1}' modifier.": { - "code": 1029, - "category": 1 /* Error */ - }, - "'{0}' modifier already seen.": { - "code": 1030, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a class element.": { - "code": 1031, - "category": 1 /* Error */ - }, - "Interface declaration cannot have 'implements' clause.": { - "code": 1032, - "category": 1 /* Error */ - }, - "'super' invocation cannot have type arguments.": { - "code": 1034, - "category": 1 /* Error */ - }, - "Only ambient modules can use quoted names.": { - "code": 1035, - "category": 1 /* Error */ - }, - "Statements are not allowed in ambient contexts.": { - "code": 1036, - "category": 1 /* Error */ - }, - "Implementations are not allowed in ambient contexts.": { - "code": 1037, - "category": 1 /* Error */ - }, - "'declare' modifier not allowed for code already in an ambient context.": { - "code": 1038, - "category": 1 /* Error */ - }, - "Initializers are not allowed in ambient contexts.": { - "code": 1039, - "category": 1 /* Error */ - }, - "Parameter property declarations can only be used in a non-ambient constructor declaration.": { - "code": 1040, - "category": 1 /* Error */ - }, - "Function implementation expected.": { - "code": 1041, - "category": 1 /* Error */ - }, - "Constructor implementation expected.": { - "code": 1042, - "category": 1 /* Error */ - }, - "Function overload name must be '{0}'.": { - "code": 1043, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a module element.": { - "code": 1044, - "category": 1 /* Error */ - }, - "'declare' modifier cannot appear on an interface declaration.": { - "code": 1045, - "category": 1 /* Error */ - }, - "'declare' modifier required for top level element.": { - "code": 1046, - "category": 1 /* Error */ - }, - "Rest parameter cannot be optional.": { - "code": 1047, - "category": 1 /* Error */ - }, - "Rest parameter cannot have an initializer.": { - "code": 1048, - "category": 1 /* Error */ - }, - "'set' accessor must have one and only one parameter.": { - "code": 1049, - "category": 1 /* Error */ - }, - "'set' accessor parameter cannot be optional.": { - "code": 1051, - "category": 1 /* Error */ - }, - "'set' accessor parameter cannot have an initializer.": { - "code": 1052, - "category": 1 /* Error */ - }, - "'set' accessor cannot have rest parameter.": { - "code": 1053, - "category": 1 /* Error */ - }, - "'get' accessor cannot have parameters.": { - "code": 1054, - "category": 1 /* Error */ - }, - "Modifiers cannot appear here.": { - "code": 1055, - "category": 1 /* Error */ - }, - "Accessors are only available when targeting ECMAScript 5 and higher.": { - "code": 1056, - "category": 1 /* Error */ - }, - "Class name cannot be '{0}'.": { - "code": 1057, - "category": 1 /* Error */ - }, - "Interface name cannot be '{0}'.": { - "code": 1058, - "category": 1 /* Error */ - }, - "Enum name cannot be '{0}'.": { - "code": 1059, - "category": 1 /* Error */ - }, - "Module name cannot be '{0}'.": { - "code": 1060, - "category": 1 /* Error */ - }, - "Enum member must have initializer.": { - "code": 1061, - "category": 1 /* Error */ - }, - "Export assignment cannot be used in internal modules.": { - "code": 1063, - "category": 1 /* Error */ - }, - "Export assignment not allowed in module with exported element.": { - "code": 1064, - "category": 1 /* Error */ - }, - "Module cannot have multiple export assignments.": { - "code": 1065, - "category": 1 /* Error */ - }, - "Ambient enum elements can only have integer literal initializers.": { - "code": 1066, - "category": 1 /* Error */ - }, - "module, class, interface, enum, import or statement": { - "code": 1067, - "category": 3 /* NoPrefix */ - }, - "constructor, function, accessor or variable": { - "code": 1068, - "category": 3 /* NoPrefix */ - }, - "statement": { - "code": 1069, - "category": 3 /* NoPrefix */ - }, - "case or default clause": { - "code": 1070, - "category": 3 /* NoPrefix */ - }, - "identifier": { - "code": 1071, - "category": 3 /* NoPrefix */ - }, - "call, construct, index, property or function signature": { - "code": 1072, - "category": 3 /* NoPrefix */ - }, - "expression": { - "code": 1073, - "category": 3 /* NoPrefix */ - }, - "type name": { - "code": 1074, - "category": 3 /* NoPrefix */ - }, - "property or accessor": { - "code": 1075, - "category": 3 /* NoPrefix */ - }, - "parameter": { - "code": 1076, - "category": 3 /* NoPrefix */ - }, - "type": { - "code": 1077, - "category": 3 /* NoPrefix */ - }, - "type parameter": { - "code": 1078, - "category": 3 /* NoPrefix */ - }, - "'declare' modifier not allowed on import declaration.": { - "code": 1079, - "category": 1 /* Error */ - }, - "Function overload must be static.": { - "code": 1080, - "category": 1 /* Error */ - }, - "Function overload must not be static.": { - "code": 1081, - "category": 1 /* Error */ - }, - "Parameter property declarations cannot be used in a constructor overload.": { - "code": 1083, - "category": 1 /* Error */ - }, - "Invalid 'reference' directive syntax.": { - "code": 1084, - "category": 1 /* Error */ - }, - "Octal literals are not available when targeting ECMAScript 5 and higher.": { - "code": 1085, - "category": 1 /* Error */ - }, - "Accessors are not allowed in ambient contexts.": { - "code": 1086, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a constructor declaration.": { - "code": 1089, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a parameter.": { - "code": 1090, - "category": 1 /* Error */ - }, - "Only a single variable declaration is allowed in a 'for...in' statement.": { - "code": 1091, - "category": 1 /* Error */ - }, - "Type parameters cannot appear on a constructor declaration.": { - "code": 1091, - "category": 1 /* Error */ - }, - "Type annotation cannot appear on a constructor declaration.": { - "code": 1092, - "category": 1 /* Error */ - }, - "Duplicate identifier '{0}'.": { - "code": 2000, - "category": 1 /* Error */ - }, - "The name '{0}' does not exist in the current scope.": { - "code": 2001, - "category": 1 /* Error */ - }, - "The name '{0}' does not refer to a value.": { - "code": 2002, - "category": 1 /* Error */ - }, - "'super' can only be used inside a class instance method.": { - "code": 2003, - "category": 1 /* Error */ - }, - "The left-hand side of an assignment expression must be a variable, property or indexer.": { - "code": 2004, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not callable. Did you mean to include 'new'?": { - "code": 2161, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not callable.": { - "code": 2006, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not newable.": { - "code": 2007, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not indexable by type '{1}'.": { - "code": 2008, - "category": 1 /* Error */ - }, - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": { - "code": 2009, - "category": 1 /* Error */ - }, - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": { - "code": 2010, - "category": 1 /* Error */ - }, - "Cannot convert '{0}' to '{1}'.": { - "code": 2011, - "category": 1 /* Error */ - }, - "Cannot convert '{0}' to '{1}':{NL}{2}": { - "code": 2012, - "category": 1 /* Error */ - }, - "Expected var, class, interface, or module.": { - "code": 2013, - "category": 1 /* Error */ - }, - "Operator '{0}' cannot be applied to type '{1}'.": { - "code": 2014, - "category": 1 /* Error */ - }, - "Getter '{0}' already declared.": { - "code": 2015, - "category": 1 /* Error */ - }, - "Setter '{0}' already declared.": { - "code": 2016, - "category": 1 /* Error */ - }, - "Exported class '{0}' extends private class '{1}'.": { - "code": 2018, - "category": 1 /* Error */ - }, - "Exported class '{0}' implements private interface '{1}'.": { - "code": 2019, - "category": 1 /* Error */ - }, - "Exported interface '{0}' extends private interface '{1}'.": { - "code": 2020, - "category": 1 /* Error */ - }, - "Exported class '{0}' extends class from inaccessible module {1}.": { - "code": 2021, - "category": 1 /* Error */ - }, - "Exported class '{0}' implements interface from inaccessible module {1}.": { - "code": 2022, - "category": 1 /* Error */ - }, - "Exported interface '{0}' extends interface from inaccessible module {1}.": { - "code": 2023, - "category": 1 /* Error */ - }, - "Public static property '{0}' of exported class has or is using private type '{1}'.": { - "code": 2024, - "category": 1 /* Error */ - }, - "Public property '{0}' of exported class has or is using private type '{1}'.": { - "code": 2025, - "category": 1 /* Error */ - }, - "Property '{0}' of exported interface has or is using private type '{1}'.": { - "code": 2026, - "category": 1 /* Error */ - }, - "Exported variable '{0}' has or is using private type '{1}'.": { - "code": 2027, - "category": 1 /* Error */ - }, - "Public static property '{0}' of exported class is using inaccessible module {1}.": { - "code": 2028, - "category": 1 /* Error */ - }, - "Public property '{0}' of exported class is using inaccessible module {1}.": { - "code": 2029, - "category": 1 /* Error */ - }, - "Property '{0}' of exported interface is using inaccessible module {1}.": { - "code": 2030, - "category": 1 /* Error */ - }, - "Exported variable '{0}' is using inaccessible module {1}.": { - "code": 2031, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": { - "code": 2032, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": { - "code": 2033, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": { - "code": 2034, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": { - "code": 2035, - "category": 1 /* Error */ - }, - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": { - "code": 2036, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": { - "code": 2037, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": { - "code": 2038, - "category": 1 /* Error */ - }, - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": { - "code": 2039, - "category": 1 /* Error */ - }, - "Parameter '{0}' of exported function has or is using private type '{1}'.": { - "code": 2040, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": { - "code": 2041, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": { - "code": 2042, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": { - "code": 2043, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": { - "code": 2044, - "category": 1 /* Error */ - }, - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": { - "code": 2045, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": { - "code": 2046, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": { - "code": 2047, - "category": 1 /* Error */ - }, - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": { - "code": 2048, - "category": 1 /* Error */ - }, - "Parameter '{0}' of exported function is using inaccessible module {1}.": { - "code": 2049, - "category": 1 /* Error */ - }, - "Return type of public static property getter from exported class has or is using private type '{0}'.": { - "code": 2050, - "category": 1 /* Error */ - }, - "Return type of public property getter from exported class has or is using private type '{0}'.": { - "code": 2051, - "category": 1 /* Error */ - }, - "Return type of constructor signature from exported interface has or is using private type '{0}'.": { - "code": 2052, - "category": 1 /* Error */ - }, - "Return type of call signature from exported interface has or is using private type '{0}'.": { - "code": 2053, - "category": 1 /* Error */ - }, - "Return type of index signature from exported interface has or is using private type '{0}'.": { - "code": 2054, - "category": 1 /* Error */ - }, - "Return type of public static method from exported class has or is using private type '{0}'.": { - "code": 2055, - "category": 1 /* Error */ - }, - "Return type of public method from exported class has or is using private type '{0}'.": { - "code": 2056, - "category": 1 /* Error */ - }, - "Return type of method from exported interface has or is using private type '{0}'.": { - "code": 2057, - "category": 1 /* Error */ - }, - "Return type of exported function has or is using private type '{0}'.": { - "code": 2058, - "category": 1 /* Error */ - }, - "Return type of public static property getter from exported class is using inaccessible module {0}.": { - "code": 2059, - "category": 1 /* Error */ - }, - "Return type of public property getter from exported class is using inaccessible module {0}.": { - "code": 2060, - "category": 1 /* Error */ - }, - "Return type of constructor signature from exported interface is using inaccessible module {0}.": { - "code": 2061, - "category": 1 /* Error */ - }, - "Return type of call signature from exported interface is using inaccessible module {0}.": { - "code": 2062, - "category": 1 /* Error */ - }, - "Return type of index signature from exported interface is using inaccessible module {0}.": { - "code": 2063, - "category": 1 /* Error */ - }, - "Return type of public static method from exported class is using inaccessible module {0}.": { - "code": 2064, - "category": 1 /* Error */ - }, - "Return type of public method from exported class is using inaccessible module {0}.": { - "code": 2065, - "category": 1 /* Error */ - }, - "Return type of method from exported interface is using inaccessible module {0}.": { - "code": 2066, - "category": 1 /* Error */ - }, - "Return type of exported function is using inaccessible module {0}.": { - "code": 2067, - "category": 1 /* Error */ - }, - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": { - "code": 2068, - "category": 1 /* Error */ - }, - "A parameter list must follow a generic type argument list. '(' expected.": { - "code": 2069, - "category": 1 /* Error */ - }, - "Multiple constructor implementations are not allowed.": { - "code": 2070, - "category": 1 /* Error */ - }, - "Unable to resolve external module '{0}'.": { - "code": 2071, - "category": 1 /* Error */ - }, - "Module cannot be aliased to a non-module type.": { - "code": 2072, - "category": 1 /* Error */ - }, - "A class may only extend another class.": { - "code": 2073, - "category": 1 /* Error */ - }, - "A class may only implement another class or interface.": { - "code": 2074, - "category": 1 /* Error */ - }, - "An interface may only extend another class or interface.": { - "code": 2075, - "category": 1 /* Error */ - }, - "Unable to resolve type.": { - "code": 2077, - "category": 1 /* Error */ - }, - "Unable to resolve type of '{0}'.": { - "code": 2078, - "category": 1 /* Error */ - }, - "Unable to resolve type parameter constraint.": { - "code": 2079, - "category": 1 /* Error */ - }, - "Type parameter constraint cannot be a primitive type.": { - "code": 2080, - "category": 1 /* Error */ - }, - "Supplied parameters do not match any signature of call target.": { - "code": 2081, - "category": 1 /* Error */ - }, - "Supplied parameters do not match any signature of call target:{NL}{0}": { - "code": 2082, - "category": 1 /* Error */ - }, - "Invalid 'new' expression.": { - "code": 2083, - "category": 1 /* Error */ - }, - "Call signatures used in a 'new' expression must have a 'void' return type.": { - "code": 2084, - "category": 1 /* Error */ - }, - "Could not select overload for 'new' expression.": { - "code": 2085, - "category": 1 /* Error */ - }, - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": { - "code": 2086, - "category": 1 /* Error */ - }, - "Could not select overload for 'call' expression.": { - "code": 2087, - "category": 1 /* Error */ - }, - "Cannot invoke an expression whose type lacks a call signature.": { - "code": 2088, - "category": 1 /* Error */ - }, - "Calls to 'super' are only valid inside a class.": { - "code": 2089, - "category": 1 /* Error */ - }, - "Generic type '{0}' requires {1} type argument(s).": { - "code": 2090, - "category": 1 /* Error */ - }, - "Type of array literal cannot be determined. Best common type could not be found for array elements.": { - "code": 2092, - "category": 1 /* Error */ - }, - "Could not find enclosing symbol for dotted name '{0}'.": { - "code": 2093, - "category": 1 /* Error */ - }, - "The property '{0}' does not exist on value of type '{1}'.": { - "code": 2094, - "category": 1 /* Error */ - }, - "Could not find symbol '{0}'.": { - "code": 2095, - "category": 1 /* Error */ - }, - "'get' and 'set' accessor must have the same type.": { - "code": 2096, - "category": 1 /* Error */ - }, - "'this' cannot be referenced in current location.": { - "code": 2097, - "category": 1 /* Error */ - }, - "Static members cannot reference class type parameters.": { - "code": 2099, - "category": 1 /* Error */ - }, - "Class '{0}' is recursively referenced as a base type of itself.": { - "code": 2100, - "category": 1 /* Error */ - }, - "Interface '{0}' is recursively referenced as a base type of itself.": { - "code": 2101, - "category": 1 /* Error */ - }, - "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.": { - "code": 2102, - "category": 1 /* Error */ - }, - "'super' cannot be referenced in non-derived classes.": { - "code": 2103, - "category": 1 /* Error */ - }, - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": { - "code": 2104, - "category": 1 /* Error */ - }, - "Constructors for derived classes must contain a 'super' call.": { - "code": 2105, - "category": 1 /* Error */ - }, - "Super calls are not permitted outside constructors or in nested functions inside constructors.": { - "code": 2106, - "category": 1 /* Error */ - }, - "'{0}.{1}' is inaccessible.": { - "code": 2107, - "category": 1 /* Error */ - }, - "'this' cannot be referenced within module bodies.": { - "code": 2108, - "category": 1 /* Error */ - }, - "Invalid '+' expression - types not known to support the addition operator.": { - "code": 2111, - "category": 1 /* Error */ - }, - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": { - "code": 2112, - "category": 1 /* Error */ - }, - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": { - "code": 2113, - "category": 1 /* Error */ - }, - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": { - "code": 2114, - "category": 1 /* Error */ - }, - "Variable declarations of a 'for' statement cannot use a type annotation.": { - "code": 2115, - "category": 1 /* Error */ - }, - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": { - "code": 2116, - "category": 1 /* Error */ - }, - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": { - "code": 2117, - "category": 1 /* Error */ - }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { - "code": 2118, - "category": 1 /* Error */ - }, - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": { - "code": 2119, - "category": 1 /* Error */ - }, - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": { - "code": 2120, - "category": 1 /* Error */ - }, - "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.": { - "code": 2121, - "category": 1 /* Error */ - }, - "Setters cannot return a value.": { - "code": 2122, - "category": 1 /* Error */ - }, - "Tried to query type of uninitialized module '{0}'.": { - "code": 2123, - "category": 1 /* Error */ - }, - "Tried to set variable type to uninitialized module type '{0}'.": { - "code": 2124, - "category": 1 /* Error */ - }, - "Type '{0}' does not have type parameters.": { - "code": 2125, - "category": 1 /* Error */ - }, - "Getters must return a value.": { - "code": 2126, - "category": 1 /* Error */ - }, - "Getter and setter accessors do not agree in visibility.": { - "code": 2127, - "category": 1 /* Error */ - }, - "Invalid left-hand side of assignment expression.": { - "code": 2130, - "category": 1 /* Error */ - }, - "Function declared a non-void return type, but has no return expression.": { - "code": 2131, - "category": 1 /* Error */ - }, - "Cannot resolve return type reference.": { - "code": 2132, - "category": 1 /* Error */ - }, - "Constructors cannot have a return type of 'void'.": { - "code": 2133, - "category": 1 /* Error */ - }, - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": { - "code": 2134, - "category": 1 /* Error */ - }, - "All symbols within a with block will be resolved to 'any'.": { - "code": 2135, - "category": 1 /* Error */ - }, - "Import declarations in an internal module cannot reference an external module.": { - "code": 2136, - "category": 1 /* Error */ - }, - "Class {0} declares interface {1} but does not implement it:{NL}{2}": { - "code": 2137, - "category": 1 /* Error */ - }, - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": { - "code": 2138, - "category": 1 /* Error */ - }, - "The operand of an increment or decrement operator must be a variable, property or indexer.": { - "code": 2139, - "category": 1 /* Error */ - }, - "'this' cannot be referenced in static initializers in a class body.": { - "code": 2140, - "category": 1 /* Error */ - }, - "Class '{0}' cannot extend class '{1}':{NL}{2}": { - "code": 2141, - "category": 1 /* Error */ - }, - "Interface '{0}' cannot extend class '{1}':{NL}{2}": { - "code": 2142, - "category": 1 /* Error */ - }, - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": { - "code": 2143, - "category": 1 /* Error */ - }, - "Duplicate overload signature for '{0}'.": { - "code": 2144, - "category": 1 /* Error */ - }, - "Duplicate constructor overload signature.": { - "code": 2145, - "category": 1 /* Error */ - }, - "Duplicate overload call signature.": { - "code": 2146, - "category": 1 /* Error */ - }, - "Duplicate overload construct signature.": { - "code": 2147, - "category": 1 /* Error */ - }, - "Overload signature is not compatible with function definition.": { - "code": 2148, - "category": 1 /* Error */ - }, - "Overload signature is not compatible with function definition:{NL}{0}": { - "code": 2149, - "category": 1 /* Error */ - }, - "Overload signatures must all be public or private.": { - "code": 2150, - "category": 1 /* Error */ - }, - "Overload signatures must all be exported or not exported.": { - "code": 2151, - "category": 1 /* Error */ - }, - "Overload signatures must all be ambient or non-ambient.": { - "code": 2152, - "category": 1 /* Error */ - }, - "Overload signatures must all be optional or required.": { - "code": 2153, - "category": 1 /* Error */ - }, - "Specialized overload signature is not assignable to any non-specialized signature.": { - "code": 2154, - "category": 1 /* Error */ - }, - "'this' cannot be referenced in constructor arguments.": { - "code": 2155, - "category": 1 /* Error */ - }, - "Instance member cannot be accessed off a class.": { - "code": 2157, - "category": 1 /* Error */ - }, - "Untyped function calls may not accept type arguments.": { - "code": 2158, - "category": 1 /* Error */ - }, - "Non-generic functions may not accept type arguments.": { - "code": 2159, - "category": 1 /* Error */ - }, - "A generic type may not reference itself with a wrapped form of its own type parameters.": { - "code": 2160, - "category": 1 /* Error */ - }, - "Rest parameters must be array types.": { - "code": 2162, - "category": 1 /* Error */ - }, - "Overload signature implementation cannot use specialized type.": { - "code": 2163, - "category": 1 /* Error */ - }, - "Export assignments may only be used at the top-level of external modules.": { - "code": 2164, - "category": 1 /* Error */ - }, - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules.": { - "code": 2165, - "category": 1 /* Error */ - }, - "Only public methods of the base class are accessible via the 'super' keyword.": { - "code": 2166, - "category": 1 /* Error */ - }, - "Numeric indexer type '{0}' must be assignable to string indexer type '{1}'.": { - "code": 2167, - "category": 1 /* Error */ - }, - "Numeric indexer type '{0}' must be assignable to string indexer type '{1}':{NL}{2}": { - "code": 2168, - "category": 1 /* Error */ - }, - "All numerically named properties must be assignable to numeric indexer type '{0}'.": { - "code": 2169, - "category": 1 /* Error */ - }, - "All numerically named properties must be assignable to numeric indexer type '{0}':{NL}{1}": { - "code": 2170, - "category": 1 /* Error */ - }, - "All named properties must be assignable to string indexer type '{0}'.": { - "code": 2171, - "category": 1 /* Error */ - }, - "All named properties must be assignable to string indexer type '{0}':{NL}{1}": { - "code": 2172, - "category": 1 /* Error */ - }, - "Generic type references must include all type arguments.": { - "code": 2173, - "category": 1 /* Error */ - }, - "Default arguments are only allowed in implementation.": { - "code": 2174, - "category": 1 /* Error */ - }, - "Overloads cannot differ only by return type.": { - "code": 2175, - "category": 1 /* Error */ - }, - "Function expression declared a non-void return type, but has no return expression.": { - "code": 2176, - "category": 1 /* Error */ - }, - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": { - "code": 2177, - "category": 1 /* Error */ - }, - "Could not find symbol '{0}' in module '{1}'.": { - "code": 2178, - "category": 1 /* Error */ - }, - "Unable to resolve module reference '{0}'.": { - "code": 2179, - "category": 1 /* Error */ - }, - "Could not find module '{0}' in module '{1}'.": { - "code": 2180, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": { - "code": 2181, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": { - "code": 2182, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": { - "code": 2183, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": { - "code": 2184, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": { - "code": 2185, - "category": 1 /* Error */ - }, - "Type name '{0}' in extends clause does not reference constructor function for '{1}'.": { - "code": 2186, - "category": 1 /* Error */ - }, - "Internal module reference '{0}' in import declaration does not reference module instance for '{1}'.": { - "code": 2187, - "category": 1 /* Error */ - }, - "Module '{0}' cannot merge with previous declaration of '{1}' in a different file '{2}'.": { - "code": 2188, - "category": 1 /* Error */ - }, - "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':{NL}{3}": { - "code": 2189, - "category": 1 /* Error */ - }, - "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.": { - "code": 2190, - "category": 1 /* Error */ - }, - "Ambient external module declaration cannot be reopened.": { - "code": 2191, - "category": 1 /* Error */ - }, - "All declarations of merged declaration '{0}' must be exported or not exported.": { - "code": 2192, - "category": 1 /* Error */ - }, - "'super' cannot be referenced in constructor arguments.": { - "code": 2193, - "category": 1 /* Error */ - }, - "Return type of constructor signature must be assignable to the instance type of the class.": { - "code": 2194, - "category": 1 /* Error */ - }, - "Ambient external module declaration must be defined in global context.": { - "code": 2195, - "category": 1 /* Error */ - }, - "Ambient external module declaration cannot specify relative module name.": { - "code": 2196, - "category": 1 /* Error */ - }, - "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.": { - "code": 2197, - "category": 1 /* Error */ - }, - "Could not find the best common type of types of all return statement expressions.": { - "code": 2198, - "category": 1 /* Error */ - }, - "Import declaration cannot refer to external module reference when --noResolve option is set.": { - "code": 2199, - "category": 1 /* Error */ - }, - "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": { - "code": 2200, - "category": 1 /* Error */ - }, - "'continue' statement can only be used within an enclosing iteration statement.": { - "code": 2201, - "category": 1 /* Error */ - }, - "'break' statement can only be used within an enclosing iteration or switch statement.": { - "code": 2202, - "category": 1 /* Error */ - }, - "Jump target not found.": { - "code": 2203, - "category": 1 /* Error */ - }, - "Jump target cannot cross function boundary.": { - "code": 2204, - "category": 1 /* Error */ - }, - "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.": { - "code": 2205, - "category": 1 /* Error */ - }, - "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.": { - "code": 2206, - "category": 1 /* Error */ - }, - "Expression resolves to '_super' that compiler uses to capture base class reference.": { - "code": 2207, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": { - "code": 2208, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of call signature from exported interface has or is using private type '{1}'.": { - "code": 2209, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public static method from exported class has or is using private type '{1}'.": { - "code": 2210, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public method from exported class has or is using private type '{1}'.": { - "code": 2211, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of method from exported interface has or is using private type '{1}'.": { - "code": 2212, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported function has or is using private type '{1}'.": { - "code": 2213, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": { - "code": 2214, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of call signature from exported interface is using inaccessible module {1}": { - "code": 2215, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public static method from exported class is using inaccessible module {1}.": { - "code": 2216, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public method from exported class is using inaccessible module {1}.": { - "code": 2217, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of method from exported interface is using inaccessible module {1}.": { - "code": 2218, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported function is using inaccessible module {1}.": { - "code": 2219, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported class has or is using private type '{1}'.": { - "code": 2220, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported interface has or is using private type '{1}'.": { - "code": 2221, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported class is using inaccessible module {1}.": { - "code": 2222, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported interface is using inaccessible module {1}.": { - "code": 2223, - "category": 1 /* Error */ - }, - "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter.": { - "code": 2224, - "category": 1 /* Error */ - }, - "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.": { - "code": 2225, - "category": 1 /* Error */ - }, - "Type of conditional '{0}' must be identical to '{1}' or '{2}'.": { - "code": 2226, - "category": 1 /* Error */ - }, - "Type of conditional '{0}' must be identical to '{1}', '{2}' or '{3}'.": { - "code": 2227, - "category": 1 /* Error */ - }, - "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.": { - "code": 2228, - "category": 1 /* Error */ - }, - "Constraint of a type parameter cannot reference any type parameter from the same type parameter list.": { - "code": 2229, - "category": 1 /* Error */ - }, - "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.": { - "code": 2230, - "category": 1 /* Error */ - }, - "Parameter '{0}' cannot be referenced in its initializer.": { - "code": 2231, - "category": 1 /* Error */ - }, - "Duplicate string index signature.": { - "code": 2232, - "category": 1 /* Error */ - }, - "Duplicate number index signature.": { - "code": 2233, - "category": 1 /* Error */ - }, - "All declarations of an interface must have identical type parameters.": { - "code": 2234, - "category": 1 /* Error */ - }, - "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.": { - "code": 2235, - "category": 1 /* Error */ - }, - "Type '{0}' is missing property '{1}' from type '{2}'.": { - "code": 4000, - "category": 3 /* NoPrefix */ - }, - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": { - "code": 4001, - "category": 3 /* NoPrefix */ - }, - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": { - "code": 4002, - "category": 3 /* NoPrefix */ - }, - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": { - "code": 4003, - "category": 3 /* NoPrefix */ - }, - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": { - "code": 4004, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' define property '{2}' as private.": { - "code": 4005, - "category": 3 /* NoPrefix */ - }, - "Call signatures of types '{0}' and '{1}' are incompatible.": { - "code": 4006, - "category": 3 /* NoPrefix */ - }, - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { - "code": 4007, - "category": 3 /* NoPrefix */ - }, - "Type '{0}' requires a call signature, but type '{1}' lacks one.": { - "code": 4008, - "category": 3 /* NoPrefix */ - }, - "Construct signatures of types '{0}' and '{1}' are incompatible.": { - "code": 4009, - "category": 3 /* NoPrefix */ - }, - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { - "code": 4010, - "category": 3 /* NoPrefix */ - }, - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": { - "code": 4011, - "category": 3 /* NoPrefix */ - }, - "Index signatures of types '{0}' and '{1}' are incompatible.": { - "code": 4012, - "category": 3 /* NoPrefix */ - }, - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { - "code": 4013, - "category": 3 /* NoPrefix */ - }, - "Call signature expects {0} or fewer parameters.": { - "code": 4014, - "category": 3 /* NoPrefix */ - }, - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": { - "code": 4015, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": { - "code": 4016, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": { - "code": 4017, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": { - "code": 4018, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": { - "code": 4019, - "category": 3 /* NoPrefix */ - }, - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": { - "code": 4020, - "category": 3 /* NoPrefix */ - }, - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": { - "code": 4021, - "category": 3 /* NoPrefix */ - }, - "Type reference cannot refer to container '{0}'.": { - "code": 4022, - "category": 1 /* Error */ - }, - "Type reference must refer to type.": { - "code": 4023, - "category": 1 /* Error */ - }, - "In enums with multiple declarations only one declaration can omit an initializer for the first enum element.": { - "code": 4024, - "category": 1 /* Error */ - }, - " (+ {0} overload(s))": { - "code": 4025, - "category": 2 /* Message */ - }, - "Variable declaration cannot have the same name as an import declaration.": { - "code": 4026, - "category": 1 /* Error */ - }, - "Signature expected {0} type arguments, got {1} instead.": { - "code": 4027, - "category": 1 /* Error */ - }, - "Property '{0}' defined as optional in type '{1}', but is required in type '{2}'.": { - "code": 4028, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference do not refer to same named type.": { - "code": 4029, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments.": { - "code": 4030, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments:{NL}{2}": { - "code": 4031, - "category": 3 /* NoPrefix */ - }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { - "code": 4032, - "category": 3 /* NoPrefix */ - }, - "Types of string indexer of types '{0}' and '{1}' are not identical.": { - "code": 4033, - "category": 3 /* NoPrefix */ - }, - "Types of number indexer of types '{0}' and '{1}' are not identical.": { - "code": 4034, - "category": 3 /* NoPrefix */ - }, - "Type of number indexer in type '{0}' is not assignable to string indexer type in type '{1}'.{NL}{2}": { - "code": 4035, - "category": 3 /* NoPrefix */ - }, - "Type of property '{0}' in type '{1}' is not assignable to string indexer type in type '{2}'.{NL}{3}": { - "code": 4036, - "category": 3 /* NoPrefix */ - }, - "Type of property '{0}' in type '{1}' is not assignable to number indexer type in type '{2}'.{NL}{3}": { - "code": 4037, - "category": 3 /* NoPrefix */ - }, - "Static property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": { - "code": 4038, - "category": 3 /* NoPrefix */ - }, - "Static property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": { - "code": 4039, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' define static property '{2}' as private.": { - "code": 4040, - "category": 3 /* NoPrefix */ - }, - "Current host does not support '{0}' option.": { - "code": 5001, - "category": 1 /* Error */ - }, - "ECMAScript target version '{0}' not supported. Specify a valid target version: '{1}' (default), or '{2}'": { - "code": 5002, - "category": 1 /* Error */ - }, - "Module code generation '{0}' not supported.": { - "code": 5003, - "category": 1 /* Error */ - }, - "Could not find file: '{0}'.": { - "code": 5004, - "category": 1 /* Error */ - }, - "A file cannot have a reference to itself.": { - "code": 5006, - "category": 1 /* Error */ - }, - "Cannot resolve referenced file: '{0}'.": { - "code": 5007, - "category": 1 /* Error */ - }, - "Cannot find the common subdirectory path for the input files.": { - "code": 5009, - "category": 1 /* Error */ - }, - "Emit Error: {0}.": { - "code": 5011, - "category": 1 /* Error */ - }, - "Cannot read file '{0}': {1}": { - "code": 5012, - "category": 1 /* Error */ - }, - "Unsupported file encoding.": { - "code": 5013, - "category": 3 /* NoPrefix */ - }, - "Locale must be of the form or -. For example '{0}' or '{1}'.": { - "code": 5014, - "category": 1 /* Error */ - }, - "Unsupported locale: '{0}'.": { - "code": 5015, - "category": 1 /* Error */ - }, - "Execution Failed.{NL}": { - "code": 5016, - "category": 1 /* Error */ - }, - "Invalid call to 'up'": { - "code": 5019, - "category": 1 /* Error */ - }, - "Invalid call to 'down'": { - "code": 5020, - "category": 1 /* Error */ - }, - "Base64 value '{0}' finished with a continuation bit.": { - "code": 5021, - "category": 1 /* Error */ - }, - "Unknown option '{0}'": { - "code": 5023, - "category": 1 /* Error */ - }, - "Expected {0} arguments to message, got {1} instead.": { - "code": 5024, - "category": 1 /* Error */ - }, - "Expected the message '{0}' to have {1} arguments, but it had {2}": { - "code": 5025, - "category": 1 /* Error */ - }, - "Could not delete file '{0}'": { - "code": 5034, - "category": 1 /* Error */ - }, - "Could not create directory '{0}'": { - "code": 5035, - "category": 1 /* Error */ - }, - "Error while executing file '{0}': ": { - "code": 5036, - "category": 1 /* Error */ - }, - "Cannot compile external modules unless the '--module' flag is provided.": { - "code": 5037, - "category": 1 /* Error */ - }, - "Option mapRoot cannot be specified without specifying sourcemap option.": { - "code": 5038, - "category": 1 /* Error */ - }, - "Option sourceRoot cannot be specified without specifying sourcemap option.": { - "code": 5039, - "category": 1 /* Error */ - }, - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": { - "code": 5040, - "category": 1 /* Error */ - }, - "Option '{0}' specified without '{1}'": { - "code": 5041, - "category": 1 /* Error */ - }, - "'codepage' option not supported on current platform.": { - "code": 5042, - "category": 1 /* Error */ - }, - "Concatenate and emit output to single file.": { - "code": 6001, - "category": 2 /* Message */ - }, - "Generates corresponding {0} file.": { - "code": 6002, - "category": 2 /* Message */ - }, - "Specifies the location where debugger should locate map files instead of generated locations.": { - "code": 6003, - "category": 2 /* Message */ - }, - "Specifies the location where debugger should locate TypeScript files instead of source locations.": { - "code": 6004, - "category": 2 /* Message */ - }, - "Watch input files.": { - "code": 6005, - "category": 2 /* Message */ - }, - "Redirect output structure to the directory.": { - "code": 6006, - "category": 2 /* Message */ - }, - "Do not emit comments to output.": { - "code": 6009, - "category": 2 /* Message */ - }, - "Skip resolution and preprocessing.": { - "code": 6010, - "category": 2 /* Message */ - }, - "Specify ECMAScript target version: '{0}' (default), or '{1}'": { - "code": 6015, - "category": 2 /* Message */ - }, - "Specify module code generation: '{0}' or '{1}'": { - "code": 6016, - "category": 2 /* Message */ - }, - "Print this message.": { - "code": 6017, - "category": 2 /* Message */ - }, - "Print the compiler's version: {0}": { - "code": 6019, - "category": 2 /* Message */ - }, - "Allow use of deprecated '{0}' keyword when referencing an external module.": { - "code": 6021, - "category": 2 /* Message */ - }, - "Specify locale for errors and messages. For example '{0}' or '{1}'": { - "code": 6022, - "category": 2 /* Message */ - }, - "Syntax: {0}": { - "code": 6023, - "category": 2 /* Message */ - }, - "options": { - "code": 6024, - "category": 2 /* Message */ - }, - "file1": { - "code": 6025, - "category": 2 /* Message */ - }, - "Examples:": { - "code": 6026, - "category": 2 /* Message */ - }, - "Options:": { - "code": 6027, - "category": 2 /* Message */ - }, - "Insert command line options and files from a file.": { - "code": 6030, - "category": 2 /* Message */ - }, - "Version {0}": { - "code": 6029, - "category": 2 /* Message */ - }, - "Use the '{0}' flag to see options.": { - "code": 6031, - "category": 2 /* Message */ - }, - "{NL}Recompiling ({0}):": { - "code": 6032, - "category": 2 /* Message */ - }, - "STRING": { - "code": 6033, - "category": 2 /* Message */ - }, - "KIND": { - "code": 6034, - "category": 2 /* Message */ - }, - "file2": { - "code": 6035, - "category": 2 /* Message */ - }, - "VERSION": { - "code": 6036, - "category": 2 /* Message */ - }, - "LOCATION": { - "code": 6037, - "category": 2 /* Message */ - }, - "DIRECTORY": { - "code": 6038, - "category": 2 /* Message */ - }, - "NUMBER": { - "code": 6039, - "category": 2 /* Message */ - }, - "Specify the codepage to use when opening source files.": { - "code": 6040, - "category": 2 /* Message */ - }, - "Additional locations:": { - "code": 6041, - "category": 2 /* Message */ - }, - "This version of the Javascript runtime does not support the '{0}' function.": { - "code": 7000, - "category": 1 /* Error */ - }, - "Unknown rule.": { - "code": 7002, - "category": 1 /* Error */ - }, - "Invalid line number ({0})": { - "code": 7003, - "category": 1 /* Error */ - }, - "Warn on expressions and declarations with an implied 'any' type.": { - "code": 7004, - "category": 2 /* Message */ - }, - "Variable '{0}' implicitly has an 'any' type.": { - "code": 7005, - "category": 1 /* Error */ - }, - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": { - "code": 7006, - "category": 1 /* Error */ - }, - "Parameter '{0}' of function type implicitly has an 'any' type.": { - "code": 7007, - "category": 1 /* Error */ - }, - "Member '{0}' of object type implicitly has an 'any' type.": { - "code": 7008, - "category": 1 /* Error */ - }, - "'new' expression, which lacks a constructor signature, implicitly has an 'any' type.": { - "code": 7009, - "category": 1 /* Error */ - }, - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7010, - "category": 1 /* Error */ - }, - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7011, - "category": 1 /* Error */ - }, - "Parameter '{0}' of lambda function implicitly has an 'any' type.": { - "code": 7012, - "category": 1 /* Error */ - }, - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7013, - "category": 1 /* Error */ - }, - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7014, - "category": 1 /* Error */ - }, - "Array Literal implicitly has an 'any' type from widening.": { - "code": 7015, - "category": 1 /* Error */ - }, - "'{0}', which lacks 'get' accessor and parameter type annotation on 'set' accessor, implicitly has an 'any' type.": { - "code": 7016, - "category": 1 /* Error */ - }, - "Index signature of object type implicitly has an 'any' type.": { - "code": 7017, - "category": 1 /* Error */ - }, - "Object literal's property '{0}' implicitly has an 'any' type from widening.": { - "code": 7018, - "category": 1 /* Error */ - } - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (CharacterCodes) { - CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; - CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; - - CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; - CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; - CharacterCodes[CharacterCodes["lineSeparator"] = 0x2028] = "lineSeparator"; - CharacterCodes[CharacterCodes["paragraphSeparator"] = 0x2029] = "paragraphSeparator"; - - CharacterCodes[CharacterCodes["nextLine"] = 0x0085] = "nextLine"; - - CharacterCodes[CharacterCodes["space"] = 0x0020] = "space"; - CharacterCodes[CharacterCodes["nonBreakingSpace"] = 0x00A0] = "nonBreakingSpace"; - CharacterCodes[CharacterCodes["enQuad"] = 0x2000] = "enQuad"; - CharacterCodes[CharacterCodes["emQuad"] = 0x2001] = "emQuad"; - CharacterCodes[CharacterCodes["enSpace"] = 0x2002] = "enSpace"; - CharacterCodes[CharacterCodes["emSpace"] = 0x2003] = "emSpace"; - CharacterCodes[CharacterCodes["threePerEmSpace"] = 0x2004] = "threePerEmSpace"; - CharacterCodes[CharacterCodes["fourPerEmSpace"] = 0x2005] = "fourPerEmSpace"; - CharacterCodes[CharacterCodes["sixPerEmSpace"] = 0x2006] = "sixPerEmSpace"; - CharacterCodes[CharacterCodes["figureSpace"] = 0x2007] = "figureSpace"; - CharacterCodes[CharacterCodes["punctuationSpace"] = 0x2008] = "punctuationSpace"; - CharacterCodes[CharacterCodes["thinSpace"] = 0x2009] = "thinSpace"; - CharacterCodes[CharacterCodes["hairSpace"] = 0x200A] = "hairSpace"; - CharacterCodes[CharacterCodes["zeroWidthSpace"] = 0x200B] = "zeroWidthSpace"; - CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 0x202F] = "narrowNoBreakSpace"; - CharacterCodes[CharacterCodes["ideographicSpace"] = 0x3000] = "ideographicSpace"; - - CharacterCodes[CharacterCodes["_"] = 95] = "_"; - CharacterCodes[CharacterCodes["$"] = 36] = "$"; - - CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; - CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; - CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; - - CharacterCodes[CharacterCodes["a"] = 97] = "a"; - CharacterCodes[CharacterCodes["b"] = 98] = "b"; - CharacterCodes[CharacterCodes["c"] = 99] = "c"; - CharacterCodes[CharacterCodes["d"] = 100] = "d"; - CharacterCodes[CharacterCodes["e"] = 101] = "e"; - CharacterCodes[CharacterCodes["f"] = 102] = "f"; - CharacterCodes[CharacterCodes["g"] = 103] = "g"; - CharacterCodes[CharacterCodes["h"] = 104] = "h"; - CharacterCodes[CharacterCodes["i"] = 105] = "i"; - CharacterCodes[CharacterCodes["k"] = 107] = "k"; - CharacterCodes[CharacterCodes["l"] = 108] = "l"; - CharacterCodes[CharacterCodes["m"] = 109] = "m"; - CharacterCodes[CharacterCodes["n"] = 110] = "n"; - CharacterCodes[CharacterCodes["o"] = 111] = "o"; - CharacterCodes[CharacterCodes["p"] = 112] = "p"; - CharacterCodes[CharacterCodes["q"] = 113] = "q"; - CharacterCodes[CharacterCodes["r"] = 114] = "r"; - CharacterCodes[CharacterCodes["s"] = 115] = "s"; - CharacterCodes[CharacterCodes["t"] = 116] = "t"; - CharacterCodes[CharacterCodes["u"] = 117] = "u"; - CharacterCodes[CharacterCodes["v"] = 118] = "v"; - CharacterCodes[CharacterCodes["w"] = 119] = "w"; - CharacterCodes[CharacterCodes["x"] = 120] = "x"; - CharacterCodes[CharacterCodes["y"] = 121] = "y"; - CharacterCodes[CharacterCodes["z"] = 122] = "z"; - - CharacterCodes[CharacterCodes["A"] = 65] = "A"; - CharacterCodes[CharacterCodes["E"] = 69] = "E"; - CharacterCodes[CharacterCodes["F"] = 70] = "F"; - CharacterCodes[CharacterCodes["X"] = 88] = "X"; - CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; - - CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; - CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; - CharacterCodes[CharacterCodes["at"] = 64] = "at"; - CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; - CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; - CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; - CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; - CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; - CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; - CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; - CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; - CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; - CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; - CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; - CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; - CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; - CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; - CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; - CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; - CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; - CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; - CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; - CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; - CharacterCodes[CharacterCodes["question"] = 63] = "question"; - CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; - CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; - CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; - CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; - - CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; - CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; - CharacterCodes[CharacterCodes["byteOrderMark"] = 0xFEFF] = "byteOrderMark"; - CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; - CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; - })(TypeScript.CharacterCodes || (TypeScript.CharacterCodes = {})); - var CharacterCodes = TypeScript.CharacterCodes; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - - - (function (ScriptSnapshot) { - var StringScriptSnapshot = (function () { - function StringScriptSnapshot(text) { - this.text = text; - this._lineStartPositions = null; - } - StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); - }; - - StringScriptSnapshot.prototype.getLength = function () { - return this.text.length; - }; - - StringScriptSnapshot.prototype.getLineStartPositions = function () { - if (!this._lineStartPositions) { - this._lineStartPositions = TypeScript.TextUtilities.parseLineStarts(this.text); - } - - return this._lineStartPositions; - }; - - StringScriptSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { - throw TypeScript.Errors.notYetImplemented(); - }; - return StringScriptSnapshot; - })(); - - function fromString(text) { - return new StringScriptSnapshot(text); - } - ScriptSnapshot.fromString = fromString; - })(TypeScript.ScriptSnapshot || (TypeScript.ScriptSnapshot = {})); - var ScriptSnapshot = TypeScript.ScriptSnapshot; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (LineMap1) { - function fromSimpleText(text) { - return new TypeScript.LineMap(function () { - return TypeScript.TextUtilities.parseLineStarts({ charCodeAt: function (index) { - return text.charCodeAt(index); - }, length: text.length() }); - }, text.length()); - } - LineMap1.fromSimpleText = fromSimpleText; - - function fromScriptSnapshot(scriptSnapshot) { - return new TypeScript.LineMap(function () { - return scriptSnapshot.getLineStartPositions(); - }, scriptSnapshot.getLength()); - } - LineMap1.fromScriptSnapshot = fromScriptSnapshot; - - function fromString(text) { - return new TypeScript.LineMap(function () { - return TypeScript.TextUtilities.parseLineStarts(text); - }, text.length); - } - LineMap1.fromString = fromString; - })(TypeScript.LineMap1 || (TypeScript.LineMap1 = {})); - var LineMap1 = TypeScript.LineMap1; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (TextFactory) { - function getStartAndLengthOfLineBreakEndingAt(text, index, info) { - var c = text.charCodeAt(index); - if (c === 10 /* lineFeed */) { - if (index > 0 && text.charCodeAt(index - 1) === 13 /* carriageReturn */) { - info.startPosition = index - 1; - info.length = 2; - } else { - info.startPosition = index; - info.length = 1; - } - } else if (TypeScript.TextUtilities.isAnyLineBreakCharacter(c)) { - info.startPosition = index; - info.length = 1; - } else { - info.startPosition = index + 1; - info.length = 0; - } - } - - var LinebreakInfo = (function () { - function LinebreakInfo(startPosition, length) { - this.startPosition = startPosition; - this.length = length; - } - return LinebreakInfo; - })(); - - var TextLine = (function () { - function TextLine(text, body, lineBreakLength, lineNumber) { - this._text = null; - this._textSpan = null; - if (text === null) { - throw TypeScript.Errors.argumentNull('text'); - } - TypeScript.Debug.assert(lineBreakLength >= 0); - TypeScript.Debug.assert(lineNumber >= 0); - this._text = text; - this._textSpan = body; - this._lineBreakLength = lineBreakLength; - this._lineNumber = lineNumber; - } - TextLine.prototype.start = function () { - return this._textSpan.start(); - }; - - TextLine.prototype.end = function () { - return this._textSpan.end(); - }; - - TextLine.prototype.endIncludingLineBreak = function () { - return this.end() + this._lineBreakLength; - }; - - TextLine.prototype.extent = function () { - return this._textSpan; - }; - - TextLine.prototype.extentIncludingLineBreak = function () { - return TypeScript.TextSpan.fromBounds(this.start(), this.endIncludingLineBreak()); - }; - - TextLine.prototype.toString = function () { - return this._text.toString(this._textSpan); - }; - - TextLine.prototype.lineNumber = function () { - return this._lineNumber; - }; - return TextLine; - })(); - - var TextBase = (function () { - function TextBase() { - this.linebreakInfo = new LinebreakInfo(0, 0); - this.lastLineFoundForPosition = null; - } - TextBase.prototype.length = function () { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.charCodeAt = function (position) { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.checkSubSpan = function (span) { - if (span.start() < 0 || span.start() > this.length() || span.end() > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("span"); - } - }; - - TextBase.prototype.toString = function (span) { - if (typeof span === "undefined") { span = null; } - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.subText = function (span) { - this.checkSubSpan(span); - - return new SubText(this, span); - }; - - TextBase.prototype.substr = function (start, length, intern) { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.lineCount = function () { - return this._lineStarts().length; - }; - - TextBase.prototype.lines = function () { - var lines = []; - - var length = this.lineCount(); - for (var i = 0; i < length; ++i) { - lines[i] = this.getLineFromLineNumber(i); - } - - return lines; - }; - - TextBase.prototype.lineMap = function () { - var _this = this; - return new TypeScript.LineMap(function () { - return _this._lineStarts(); - }, this.length()); - }; - - TextBase.prototype._lineStarts = function () { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.getLineFromLineNumber = function (lineNumber) { - var lineStarts = this._lineStarts(); - - if (lineNumber < 0 || lineNumber >= lineStarts.length) { - throw TypeScript.Errors.argumentOutOfRange("lineNumber"); - } - - var first = lineStarts[lineNumber]; - if (lineNumber === lineStarts.length - 1) { - return new TextLine(this, new TypeScript.TextSpan(first, this.length() - first), 0, lineNumber); - } else { - getStartAndLengthOfLineBreakEndingAt(this, lineStarts[lineNumber + 1] - 1, this.linebreakInfo); - return new TextLine(this, new TypeScript.TextSpan(first, this.linebreakInfo.startPosition - first), this.linebreakInfo.length, lineNumber); - } - }; - - TextBase.prototype.getLineFromPosition = function (position) { - var lastFound = this.lastLineFoundForPosition; - if (lastFound !== null && lastFound.start() <= position && lastFound.endIncludingLineBreak() > position) { - return lastFound; - } - - var lineNumber = this.getLineNumberFromPosition(position); - - var result = this.getLineFromLineNumber(lineNumber); - this.lastLineFoundForPosition = result; - return result; - }; - - TextBase.prototype.getLineNumberFromPosition = function (position) { - if (position < 0 || position > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - if (position === this.length()) { - return this.lineCount() - 1; - } - - var lineNumber = TypeScript.ArrayUtilities.binarySearch(this._lineStarts(), position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; - } - - return lineNumber; - }; - - TextBase.prototype.getLinePosition = function (position) { - if (position < 0 || position > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - var lineNumber = this.getLineNumberFromPosition(position); - - return new TypeScript.LineAndCharacter(lineNumber, position - this._lineStarts()[lineNumber]); - }; - return TextBase; - })(); - - var SubText = (function (_super) { - __extends(SubText, _super); - function SubText(text, span) { - _super.call(this); - this._lazyLineStarts = null; - - if (text === null) { - throw TypeScript.Errors.argumentNull("text"); - } - - if (span.start() < 0 || span.start() >= text.length() || span.end() < 0 || span.end() > text.length()) { - throw TypeScript.Errors.argument("span"); - } - - this.text = text; - this.span = span; - } - SubText.prototype.length = function () { - return this.span.length(); - }; - - SubText.prototype.charCodeAt = function (position) { - if (position < 0 || position > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - return this.text.charCodeAt(this.span.start() + position); - }; - - SubText.prototype.subText = function (span) { - this.checkSubSpan(span); - - return new SubText(this.text, this.getCompositeSpan(span.start(), span.length())); - }; - - SubText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - var span = this.getCompositeSpan(sourceIndex, count); - this.text.copyTo(span.start(), destination, destinationIndex, span.length()); - }; - - SubText.prototype.substr = function (start, length, intern) { - var startInOriginalText = this.span.start() + start; - return this.text.substr(startInOriginalText, length, intern); - }; - - SubText.prototype.getCompositeSpan = function (start, length) { - var compositeStart = TypeScript.MathPrototype.min(this.text.length(), this.span.start() + start); - var compositeEnd = TypeScript.MathPrototype.min(this.text.length(), compositeStart + length); - return new TypeScript.TextSpan(compositeStart, compositeEnd - compositeStart); - }; - - SubText.prototype._lineStarts = function () { - var _this = this; - if (!this._lazyLineStarts) { - this._lazyLineStarts = TypeScript.TextUtilities.parseLineStarts({ charCodeAt: function (index) { - return _this.charCodeAt(index); - }, length: this.length() }); - } - - return this._lazyLineStarts; - }; - return SubText; - })(TextBase); - - var StringText = (function (_super) { - __extends(StringText, _super); - function StringText(data) { - _super.call(this); - this.source = null; - this._lazyLineStarts = null; - - if (data === null) { - throw TypeScript.Errors.argumentNull("data"); - } - - this.source = data; - } - StringText.prototype.length = function () { - return this.source.length; - }; - - StringText.prototype.charCodeAt = function (position) { - if (position < 0 || position >= this.source.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - return this.source.charCodeAt(position); - }; - - StringText.prototype.substr = function (start, length, intern) { - return this.source.substr(start, length); - }; - - StringText.prototype.toString = function (span) { - if (typeof span === "undefined") { span = null; } - if (span === null) { - span = new TypeScript.TextSpan(0, this.length()); - } - - this.checkSubSpan(span); - - if (span.start() === 0 && span.length() === this.length()) { - return this.source; - } - - return this.source.substr(span.start(), span.length()); - }; - - StringText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - TypeScript.StringUtilities.copyTo(this.source, sourceIndex, destination, destinationIndex, count); - }; - - StringText.prototype._lineStarts = function () { - if (this._lazyLineStarts === null) { - this._lazyLineStarts = TypeScript.TextUtilities.parseLineStarts(this.source); - } - - return this._lazyLineStarts; - }; - return StringText; - })(TextBase); - - function createText(value) { - return new StringText(value); - } - TextFactory.createText = createText; - })(TypeScript.TextFactory || (TypeScript.TextFactory = {})); - var TextFactory = TypeScript.TextFactory; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (SimpleText) { - var SimpleSubText = (function () { - function SimpleSubText(text, span) { - this.text = null; - this.span = null; - if (text === null) { - throw TypeScript.Errors.argumentNull("text"); - } - - if (span.start() < 0 || span.start() >= text.length() || span.end() < 0 || span.end() > text.length()) { - throw TypeScript.Errors.argument("span"); - } - - this.text = text; - this.span = span; - } - SimpleSubText.prototype.checkSubSpan = function (span) { - if (span.start() < 0 || span.start() > this.length() || span.end() > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("span"); - } - }; - - SimpleSubText.prototype.checkSubPosition = function (position) { - if (position < 0 || position >= this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - }; - - SimpleSubText.prototype.length = function () { - return this.span.length(); - }; - - SimpleSubText.prototype.subText = function (span) { - this.checkSubSpan(span); - - return new SimpleSubText(this.text, this.getCompositeSpan(span.start(), span.length())); - }; - - SimpleSubText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - var span = this.getCompositeSpan(sourceIndex, count); - this.text.copyTo(span.start(), destination, destinationIndex, span.length()); - }; - - SimpleSubText.prototype.substr = function (start, length, intern) { - var span = this.getCompositeSpan(start, length); - return this.text.substr(span.start(), span.length(), intern); - }; - - SimpleSubText.prototype.getCompositeSpan = function (start, length) { - var compositeStart = TypeScript.MathPrototype.min(this.text.length(), this.span.start() + start); - var compositeEnd = TypeScript.MathPrototype.min(this.text.length(), compositeStart + length); - return new TypeScript.TextSpan(compositeStart, compositeEnd - compositeStart); - }; - - SimpleSubText.prototype.charCodeAt = function (index) { - this.checkSubPosition(index); - return this.text.charCodeAt(this.span.start() + index); - }; - - SimpleSubText.prototype.lineMap = function () { - return TypeScript.LineMap1.fromSimpleText(this); - }; - return SimpleSubText; - })(); - - var SimpleStringText = (function () { - function SimpleStringText(value) { - this.value = value; - this._lineMap = null; - } - SimpleStringText.prototype.length = function () { - return this.value.length; - }; - - SimpleStringText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - TypeScript.StringUtilities.copyTo(this.value, sourceIndex, destination, destinationIndex, count); - }; - - SimpleStringText.prototype.substr = function (start, length, intern) { - if (intern) { - var array = length <= SimpleStringText.charArray.length ? SimpleStringText.charArray : TypeScript.ArrayUtilities.createArray(length, 0); - this.copyTo(start, array, 0, length); - return TypeScript.Collections.DefaultStringTable.addCharArray(array, 0, length); - } - - return this.value.substr(start, length); - }; - - SimpleStringText.prototype.subText = function (span) { - return new SimpleSubText(this, span); - }; - - SimpleStringText.prototype.charCodeAt = function (index) { - return this.value.charCodeAt(index); - }; - - SimpleStringText.prototype.lineMap = function () { - if (!this._lineMap) { - this._lineMap = TypeScript.LineMap1.fromString(this.value); - } - - return this._lineMap; - }; - SimpleStringText.charArray = TypeScript.ArrayUtilities.createArray(1024, 0); - return SimpleStringText; - })(); - - var SimpleScriptSnapshotText = (function () { - function SimpleScriptSnapshotText(scriptSnapshot) { - this.scriptSnapshot = scriptSnapshot; - } - SimpleScriptSnapshotText.prototype.charCodeAt = function (index) { - return this.scriptSnapshot.getText(index, index + 1).charCodeAt(0); - }; - - SimpleScriptSnapshotText.prototype.length = function () { - return this.scriptSnapshot.getLength(); - }; - - SimpleScriptSnapshotText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - var text = this.scriptSnapshot.getText(sourceIndex, sourceIndex + count); - TypeScript.StringUtilities.copyTo(text, 0, destination, destinationIndex, count); - }; - - SimpleScriptSnapshotText.prototype.substr = function (start, length, intern) { - return this.scriptSnapshot.getText(start, start + length); - }; - - SimpleScriptSnapshotText.prototype.subText = function (span) { - return new SimpleSubText(this, span); - }; - - SimpleScriptSnapshotText.prototype.lineMap = function () { - var _this = this; - return new TypeScript.LineMap(function () { - return _this.scriptSnapshot.getLineStartPositions(); - }, this.length()); - }; - return SimpleScriptSnapshotText; - })(); - - function fromString(value) { - return new SimpleStringText(value); - } - SimpleText.fromString = fromString; - - function fromScriptSnapshot(scriptSnapshot) { - return new SimpleScriptSnapshotText(scriptSnapshot); - } - SimpleText.fromScriptSnapshot = fromScriptSnapshot; - })(TypeScript.SimpleText || (TypeScript.SimpleText = {})); - var SimpleText = TypeScript.SimpleText; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (TextUtilities) { - function parseLineStarts(text) { - var length = text.length; - - if (0 === length) { - var result = new Array(); - result.push(0); - return result; - } - - var position = 0; - var index = 0; - var arrayBuilder = new Array(); - var lineNumber = 0; - - while (index < length) { - var c = text.charCodeAt(index); - var lineBreakLength; - - if (c > 13 /* carriageReturn */ && c <= 127) { - index++; - continue; - } else if (c === 13 /* carriageReturn */ && index + 1 < length && text.charCodeAt(index + 1) === 10 /* lineFeed */) { - lineBreakLength = 2; - } else if (c === 10 /* lineFeed */) { - lineBreakLength = 1; - } else { - lineBreakLength = TextUtilities.getLengthOfLineBreak(text, index); - } - - if (0 === lineBreakLength) { - index++; - } else { - arrayBuilder.push(position); - index += lineBreakLength; - position = index; - lineNumber++; - } - } - - arrayBuilder.push(position); - - return arrayBuilder; - } - TextUtilities.parseLineStarts = parseLineStarts; - - function getLengthOfLineBreakSlow(text, index, c) { - if (c === 13 /* carriageReturn */) { - var next = index + 1; - return (next < text.length) && 10 /* lineFeed */ === text.charCodeAt(next) ? 2 : 1; - } else if (isAnyLineBreakCharacter(c)) { - return 1; - } else { - return 0; - } - } - TextUtilities.getLengthOfLineBreakSlow = getLengthOfLineBreakSlow; - - function getLengthOfLineBreak(text, index) { - var c = text.charCodeAt(index); - - if (c > 13 /* carriageReturn */ && c <= 127) { - return 0; - } - - return getLengthOfLineBreakSlow(text, index, c); - } - TextUtilities.getLengthOfLineBreak = getLengthOfLineBreak; - - function isAnyLineBreakCharacter(c) { - return c === 10 /* lineFeed */ || c === 13 /* carriageReturn */ || c === 133 /* nextLine */ || c === 8232 /* lineSeparator */ || c === 8233 /* paragraphSeparator */; - } - TextUtilities.isAnyLineBreakCharacter = isAnyLineBreakCharacter; - })(TypeScript.TextUtilities || (TypeScript.TextUtilities = {})); - var TextUtilities = TypeScript.TextUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextSpan = (function () { - function TextSpan(start, length) { - if (start < 0) { - TypeScript.Errors.argument("start"); - } - - if (length < 0) { - TypeScript.Errors.argument("length"); - } - - this._start = start; - this._length = length; - } - TextSpan.prototype.start = function () { - return this._start; - }; - - TextSpan.prototype.length = function () { - return this._length; - }; - - TextSpan.prototype.end = function () { - return this._start + this._length; - }; - - TextSpan.prototype.isEmpty = function () { - return this._length === 0; - }; - - TextSpan.prototype.containsPosition = function (position) { - return position >= this._start && position < this.end(); - }; - - TextSpan.prototype.containsTextSpan = function (span) { - return span._start >= this._start && span.end() <= this.end(); - }; - - TextSpan.prototype.overlapsWith = function (span) { - var overlapStart = TypeScript.MathPrototype.max(this._start, span._start); - var overlapEnd = TypeScript.MathPrototype.min(this.end(), span.end()); - - return overlapStart < overlapEnd; - }; - - TextSpan.prototype.overlap = function (span) { - var overlapStart = TypeScript.MathPrototype.max(this._start, span._start); - var overlapEnd = TypeScript.MathPrototype.min(this.end(), span.end()); - - if (overlapStart < overlapEnd) { - return TextSpan.fromBounds(overlapStart, overlapEnd); - } - - return null; - }; - - TextSpan.prototype.intersectsWithTextSpan = function (span) { - return span._start <= this.end() && span.end() >= this._start; - }; - - TextSpan.prototype.intersectsWith = function (start, length) { - var end = start + length; - return start <= this.end() && end >= this._start; - }; - - TextSpan.prototype.intersectsWithPosition = function (position) { - return position <= this.end() && position >= this._start; - }; - - TextSpan.prototype.intersection = function (span) { - var intersectStart = TypeScript.MathPrototype.max(this._start, span._start); - var intersectEnd = TypeScript.MathPrototype.min(this.end(), span.end()); - - if (intersectStart <= intersectEnd) { - return TextSpan.fromBounds(intersectStart, intersectEnd); - } - - return null; - }; - - TextSpan.fromBounds = function (start, end) { - TypeScript.Debug.assert(start >= 0); - TypeScript.Debug.assert(end - start >= 0); - return new TextSpan(start, end - start); - }; - return TextSpan; - })(); - TypeScript.TextSpan = TextSpan; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextChangeRange = (function () { - function TextChangeRange(span, newLength) { - if (newLength < 0) { - throw TypeScript.Errors.argumentOutOfRange("newLength"); - } - - this._span = span; - this._newLength = newLength; - } - TextChangeRange.prototype.span = function () { - return this._span; - }; - - TextChangeRange.prototype.newLength = function () { - return this._newLength; - }; - - TextChangeRange.prototype.newSpan = function () { - return new TypeScript.TextSpan(this.span().start(), this.newLength()); - }; - - TextChangeRange.prototype.isUnchanged = function () { - return this.span().isEmpty() && this.newLength() === 0; - }; - - TextChangeRange.collapseChangesFromSingleVersion = function (changes) { - var diff = 0; - var start = 1073741823 /* Max31BitInteger */; - var end = 0; - - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - diff += change.newLength() - change.span().length(); - - if (change.span().start() < start) { - start = change.span().start(); - } - - if (change.span().end() > end) { - end = change.span().end(); - } - } - - if (start > end) { - return null; - } - - var combined = TypeScript.TextSpan.fromBounds(start, end); - var newLen = combined.length() + diff; - - return new TextChangeRange(combined, newLen); - }; - - TextChangeRange.collapseChangesAcrossMultipleVersions = function (changes) { - if (changes.length === 0) { - return TextChangeRange.unchanged; - } - - if (changes.length === 1) { - return changes[0]; - } - - var change0 = changes[0]; - - var oldStartN = change0.span().start(); - var oldEndN = change0.span().end(); - var newEndN = oldStartN + change0.newLength(); - - for (var i = 1; i < changes.length; i++) { - var nextChange = changes[i]; - - var oldStart1 = oldStartN; - var oldEnd1 = oldEndN; - var newEnd1 = newEndN; - - var oldStart2 = nextChange.span().start(); - var oldEnd2 = nextChange.span().end(); - var newEnd2 = oldStart2 + nextChange.newLength(); - - oldStartN = TypeScript.MathPrototype.min(oldStart1, oldStart2); - oldEndN = TypeScript.MathPrototype.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); - newEndN = TypeScript.MathPrototype.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); - } - - return new TextChangeRange(TypeScript.TextSpan.fromBounds(oldStartN, oldEndN), newEndN - oldStartN); - }; - TextChangeRange.unchanged = new TextChangeRange(new TypeScript.TextSpan(0, 0), 0); - return TextChangeRange; - })(); - TypeScript.TextChangeRange = TextChangeRange; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CharacterInfo = (function () { - function CharacterInfo() { - } - CharacterInfo.isDecimalDigit = function (c) { - return c >= 48 /* _0 */ && c <= 57 /* _9 */; - }; - CharacterInfo.isOctalDigit = function (c) { - return c >= 48 /* _0 */ && c <= 55 /* _7 */; - }; - - CharacterInfo.isHexDigit = function (c) { - return CharacterInfo.isDecimalDigit(c) || (c >= 65 /* A */ && c <= 70 /* F */) || (c >= 97 /* a */ && c <= 102 /* f */); - }; - - CharacterInfo.hexValue = function (c) { - return CharacterInfo.isDecimalDigit(c) ? (c - 48 /* _0 */) : (c >= 65 /* A */ && c <= 70 /* F */) ? c - 65 /* A */ + 10 : c - 97 /* a */ + 10; - }; - - CharacterInfo.isWhitespace = function (ch) { - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - return true; - } - - return false; - }; - - CharacterInfo.isLineTerminator = function (ch) { - switch (ch) { - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - return true; - } - - return false; - }; - return CharacterInfo; - })(); - TypeScript.CharacterInfo = CharacterInfo; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxConstants) { - SyntaxConstants[SyntaxConstants["TriviaNewLineMask"] = 0x00000001] = "TriviaNewLineMask"; - SyntaxConstants[SyntaxConstants["TriviaCommentMask"] = 0x00000002] = "TriviaCommentMask"; - SyntaxConstants[SyntaxConstants["TriviaFullWidthShift"] = 2] = "TriviaFullWidthShift"; - - SyntaxConstants[SyntaxConstants["NodeDataComputed"] = 0x00000001] = "NodeDataComputed"; - SyntaxConstants[SyntaxConstants["NodeIncrementallyUnusableMask"] = 0x00000002] = "NodeIncrementallyUnusableMask"; - SyntaxConstants[SyntaxConstants["NodeParsedInStrictModeMask"] = 0x00000004] = "NodeParsedInStrictModeMask"; - SyntaxConstants[SyntaxConstants["NodeFullWidthShift"] = 3] = "NodeFullWidthShift"; - - SyntaxConstants[SyntaxConstants["IsVariableWidthKeyword"] = 1 << 31] = "IsVariableWidthKeyword"; - })(TypeScript.SyntaxConstants || (TypeScript.SyntaxConstants = {})); - var SyntaxConstants = TypeScript.SyntaxConstants; -})(TypeScript || (TypeScript = {})); -var FormattingOptions = (function () { - function FormattingOptions(useTabs, spacesPerTab, indentSpaces, newLineCharacter) { - this.useTabs = useTabs; - this.spacesPerTab = spacesPerTab; - this.indentSpaces = indentSpaces; - this.newLineCharacter = newLineCharacter; - } - FormattingOptions.defaultOptions = new FormattingOptions(false, 4, 4, "\r\n"); - return FormattingOptions; -})(); -var TypeScript; -(function (TypeScript) { - (function (Indentation) { - function columnForEndOfToken(token, syntaxInformationMap, options) { - return columnForStartOfToken(token, syntaxInformationMap, options) + token.width(); - } - Indentation.columnForEndOfToken = columnForEndOfToken; - - function columnForStartOfToken(token, syntaxInformationMap, options) { - var firstTokenInLine = syntaxInformationMap.firstTokenInLineContainingToken(token); - var leadingTextInReverse = []; - - var current = token; - while (current !== firstTokenInLine) { - current = syntaxInformationMap.previousToken(current); - - if (current === firstTokenInLine) { - leadingTextInReverse.push(current.trailingTrivia().fullText()); - leadingTextInReverse.push(current.text()); - } else { - leadingTextInReverse.push(current.fullText()); - } - } - - collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse); - - return columnForLeadingTextInReverse(leadingTextInReverse, options); - } - Indentation.columnForStartOfToken = columnForStartOfToken; - - function columnForStartOfFirstTokenInLineContainingToken(token, syntaxInformationMap, options) { - var firstTokenInLine = syntaxInformationMap.firstTokenInLineContainingToken(token); - var leadingTextInReverse = []; - - collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse); - - return columnForLeadingTextInReverse(leadingTextInReverse, options); - } - Indentation.columnForStartOfFirstTokenInLineContainingToken = columnForStartOfFirstTokenInLineContainingToken; - - function collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse) { - var leadingTrivia = firstTokenInLine.leadingTrivia(); - - for (var i = leadingTrivia.count() - 1; i >= 0; i--) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.kind() === 5 /* NewLineTrivia */) { - break; - } - - if (trivia.kind() === 6 /* MultiLineCommentTrivia */) { - var lineSegments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - leadingTextInReverse.push(TypeScript.ArrayUtilities.last(lineSegments)); - - if (lineSegments.length > 0) { - break; - } - } - - leadingTextInReverse.push(trivia.fullText()); - } - } - - function columnForLeadingTextInReverse(leadingTextInReverse, options) { - var column = 0; - - for (var i = leadingTextInReverse.length - 1; i >= 0; i--) { - var text = leadingTextInReverse[i]; - column = columnForPositionInStringWorker(text, text.length, column, options); - } - - return column; - } - - function columnForPositionInString(input, position, options) { - return columnForPositionInStringWorker(input, position, 0, options); - } - Indentation.columnForPositionInString = columnForPositionInString; - - function columnForPositionInStringWorker(input, position, startColumn, options) { - var column = startColumn; - var spacesPerTab = options.spacesPerTab; - - for (var j = 0; j < position; j++) { - var ch = input.charCodeAt(j); - - if (ch === 9 /* tab */) { - column += spacesPerTab - column % spacesPerTab; - } else { - column++; - } - } - - return column; - } - - function indentationString(column, options) { - var numberOfTabs = 0; - var numberOfSpaces = TypeScript.MathPrototype.max(0, column); - - if (options.useTabs) { - numberOfTabs = Math.floor(column / options.spacesPerTab); - numberOfSpaces -= numberOfTabs * options.spacesPerTab; - } - - return TypeScript.StringUtilities.repeat('\t', numberOfTabs) + TypeScript.StringUtilities.repeat(' ', numberOfSpaces); - } - Indentation.indentationString = indentationString; - - function indentationTrivia(column, options) { - return TypeScript.Syntax.whitespace(this.indentationString(column, options)); - } - Indentation.indentationTrivia = indentationTrivia; - - function firstNonWhitespacePosition(value) { - for (var i = 0; i < value.length; i++) { - var ch = value.charCodeAt(i); - if (!TypeScript.CharacterInfo.isWhitespace(ch)) { - return i; - } - } - - return value.length; - } - Indentation.firstNonWhitespacePosition = firstNonWhitespacePosition; - })(TypeScript.Indentation || (TypeScript.Indentation = {})); - var Indentation = TypeScript.Indentation; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (LanguageVersion) { - LanguageVersion[LanguageVersion["EcmaScript3"] = 0] = "EcmaScript3"; - LanguageVersion[LanguageVersion["EcmaScript5"] = 1] = "EcmaScript5"; - })(TypeScript.LanguageVersion || (TypeScript.LanguageVersion = {})); - var LanguageVersion = TypeScript.LanguageVersion; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ParseOptions = (function () { - function ParseOptions(languageVersion, allowAutomaticSemicolonInsertion) { - this._languageVersion = languageVersion; - this._allowAutomaticSemicolonInsertion = allowAutomaticSemicolonInsertion; - } - ParseOptions.prototype.toJSON = function (key) { - return { allowAutomaticSemicolonInsertion: this._allowAutomaticSemicolonInsertion }; - }; - - ParseOptions.prototype.languageVersion = function () { - return this._languageVersion; - }; - - ParseOptions.prototype.allowAutomaticSemicolonInsertion = function () { - return this._allowAutomaticSemicolonInsertion; - }; - return ParseOptions; - })(); - TypeScript.ParseOptions = ParseOptions; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var PositionedElement = (function () { - function PositionedElement(parent, element, fullStart) { - this._parent = parent; - this._element = element; - this._fullStart = fullStart; - } - PositionedElement.create = function (parent, element, fullStart) { - if (element === null) { - return null; - } - - if (element.isNode()) { - return new PositionedNode(parent, element, fullStart); - } else if (element.isToken()) { - return new PositionedToken(parent, element, fullStart); - } else if (element.isList()) { - return new PositionedList(parent, element, fullStart); - } else if (element.isSeparatedList()) { - return new PositionedSeparatedList(parent, element, fullStart); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - PositionedElement.prototype.parent = function () { - return this._parent; - }; - - PositionedElement.prototype.parentElement = function () { - return this._parent && this._parent._element; - }; - - PositionedElement.prototype.element = function () { - return this._element; - }; - - PositionedElement.prototype.kind = function () { - return this.element().kind(); - }; - - PositionedElement.prototype.childIndex = function (child) { - return TypeScript.Syntax.childIndex(this.element(), child); - }; - - PositionedElement.prototype.childCount = function () { - return this.element().childCount(); - }; - - PositionedElement.prototype.childAt = function (index) { - var offset = TypeScript.Syntax.childOffsetAt(this.element(), index); - return PositionedElement.create(this, this.element().childAt(index), this.fullStart() + offset); - }; - - PositionedElement.prototype.childStart = function (child) { - var offset = TypeScript.Syntax.childOffset(this.element(), child); - return this.fullStart() + offset + child.leadingTriviaWidth(); - }; - - PositionedElement.prototype.childEnd = function (child) { - var offset = TypeScript.Syntax.childOffset(this.element(), child); - return this.fullStart() + offset + child.leadingTriviaWidth() + child.width(); - }; - - PositionedElement.prototype.childStartAt = function (index) { - var offset = TypeScript.Syntax.childOffsetAt(this.element(), index); - var child = this.element().childAt(index); - return this.fullStart() + offset + child.leadingTriviaWidth(); - }; - - PositionedElement.prototype.childEndAt = function (index) { - var offset = TypeScript.Syntax.childOffsetAt(this.element(), index); - var child = this.element().childAt(index); - return this.fullStart() + offset + child.leadingTriviaWidth() + child.width(); - }; - - PositionedElement.prototype.getPositionedChild = function (child) { - var offset = TypeScript.Syntax.childOffset(this.element(), child); - return PositionedElement.create(this, child, this.fullStart() + offset); - }; - - PositionedElement.prototype.fullStart = function () { - return this._fullStart; - }; - - PositionedElement.prototype.fullEnd = function () { - return this.fullStart() + this.element().fullWidth(); - }; - - PositionedElement.prototype.fullWidth = function () { - return this.element().fullWidth(); - }; - - PositionedElement.prototype.start = function () { - return this.fullStart() + this.element().leadingTriviaWidth(); - }; - - PositionedElement.prototype.end = function () { - return this.fullStart() + this.element().leadingTriviaWidth() + this.element().width(); - }; - - PositionedElement.prototype.root = function () { - var current = this; - while (current.parent() !== null) { - current = current.parent(); - } - - return current; - }; - - PositionedElement.prototype.containingNode = function () { - var current = this.parent(); - - while (current !== null && !current.element().isNode()) { - current = current.parent(); - } - - return current; - }; - return PositionedElement; - })(); - TypeScript.PositionedElement = PositionedElement; - - var PositionedNodeOrToken = (function (_super) { - __extends(PositionedNodeOrToken, _super); - function PositionedNodeOrToken(parent, nodeOrToken, fullStart) { - _super.call(this, parent, nodeOrToken, fullStart); - } - PositionedNodeOrToken.prototype.nodeOrToken = function () { - return this.element(); - }; - return PositionedNodeOrToken; - })(PositionedElement); - TypeScript.PositionedNodeOrToken = PositionedNodeOrToken; - - var PositionedNode = (function (_super) { - __extends(PositionedNode, _super); - function PositionedNode(parent, node, fullStart) { - _super.call(this, parent, node, fullStart); - } - PositionedNode.prototype.node = function () { - return this.element(); - }; - return PositionedNode; - })(PositionedNodeOrToken); - TypeScript.PositionedNode = PositionedNode; - - var PositionedToken = (function (_super) { - __extends(PositionedToken, _super); - function PositionedToken(parent, token, fullStart) { - _super.call(this, parent, token, fullStart); - } - PositionedToken.prototype.token = function () { - return this.element(); - }; - - PositionedToken.prototype.previousToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var triviaList = this.token().leadingTrivia(); - if (includeSkippedTokens && triviaList && triviaList.hasSkippedToken()) { - var currentTriviaEndPosition = this.start(); - for (var i = triviaList.count() - 1; i >= 0; i--) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isSkippedToken()) { - return new PositionedSkippedToken(this, trivia.skippedToken(), currentTriviaEndPosition - trivia.fullWidth()); - } - - currentTriviaEndPosition -= trivia.fullWidth(); - } - } - - var start = this.fullStart(); - if (start === 0) { - return null; - } - - return this.root().node().findToken(start - 1, includeSkippedTokens); - }; - - PositionedToken.prototype.nextToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - if (this.token().tokenKind === 10 /* EndOfFileToken */) { - return null; - } - - var triviaList = this.token().trailingTrivia(); - if (includeSkippedTokens && triviaList && triviaList.hasSkippedToken()) { - var fullStart = this.end(); - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isSkippedToken()) { - return new PositionedSkippedToken(this, trivia.skippedToken(), fullStart); - } - - fullStart += trivia.fullWidth(); - } - } - - return this.root().node().findToken(this.fullEnd(), includeSkippedTokens); - }; - return PositionedToken; - })(PositionedNodeOrToken); - TypeScript.PositionedToken = PositionedToken; - - var PositionedList = (function (_super) { - __extends(PositionedList, _super); - function PositionedList(parent, list, fullStart) { - _super.call(this, parent, list, fullStart); - } - PositionedList.prototype.list = function () { - return this.element(); - }; - return PositionedList; - })(PositionedElement); - TypeScript.PositionedList = PositionedList; - - var PositionedSeparatedList = (function (_super) { - __extends(PositionedSeparatedList, _super); - function PositionedSeparatedList(parent, list, fullStart) { - _super.call(this, parent, list, fullStart); - } - PositionedSeparatedList.prototype.list = function () { - return this.element(); - }; - return PositionedSeparatedList; - })(PositionedElement); - TypeScript.PositionedSeparatedList = PositionedSeparatedList; - - var PositionedSkippedToken = (function (_super) { - __extends(PositionedSkippedToken, _super); - function PositionedSkippedToken(parentToken, token, fullStart) { - _super.call(this, parentToken.parent(), token, fullStart); - this._parentToken = parentToken; - } - PositionedSkippedToken.prototype.parentToken = function () { - return this._parentToken; - }; - - PositionedSkippedToken.prototype.previousToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var start = this.fullStart(); - - if (includeSkippedTokens) { - var previousToken; - - if (start >= this.parentToken().end()) { - previousToken = TypeScript.Syntax.findSkippedTokenInTrailingTriviaList(this.parentToken(), start - 1); - - if (previousToken) { - return previousToken; - } - - return this.parentToken(); - } else { - previousToken = TypeScript.Syntax.findSkippedTokenInLeadingTriviaList(this.parentToken(), start - 1); - - if (previousToken) { - return previousToken; - } - } - } - - var start = this.parentToken().fullStart(); - if (start === 0) { - return null; - } - - return this.root().node().findToken(start - 1, includeSkippedTokens); - }; - - PositionedSkippedToken.prototype.nextToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - if (this.token().tokenKind === 10 /* EndOfFileToken */) { - return null; - } - - if (includeSkippedTokens) { - var end = this.end(); - var nextToken; - - if (end <= this.parentToken().start()) { - nextToken = TypeScript.Syntax.findSkippedTokenInLeadingTriviaList(this.parentToken(), end); - - if (nextToken) { - return nextToken; - } - - return this.parentToken(); - } else { - nextToken = TypeScript.Syntax.findSkippedTokenInTrailingTriviaList(this.parentToken(), end); - - if (nextToken) { - return nextToken; - } - } - } - - return this.root().node().findToken(this.parentToken().fullEnd(), includeSkippedTokens); - }; - return PositionedSkippedToken; - })(PositionedToken); - TypeScript.PositionedSkippedToken = PositionedSkippedToken; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxKind) { - SyntaxKind[SyntaxKind["None"] = 0] = "None"; - SyntaxKind[SyntaxKind["List"] = 1] = "List"; - SyntaxKind[SyntaxKind["SeparatedList"] = 2] = "SeparatedList"; - SyntaxKind[SyntaxKind["TriviaList"] = 3] = "TriviaList"; - - SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 4] = "WhitespaceTrivia"; - SyntaxKind[SyntaxKind["NewLineTrivia"] = 5] = "NewLineTrivia"; - SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 6] = "MultiLineCommentTrivia"; - SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 7] = "SingleLineCommentTrivia"; - SyntaxKind[SyntaxKind["SkippedTokenTrivia"] = 8] = "SkippedTokenTrivia"; - - SyntaxKind[SyntaxKind["ErrorToken"] = 9] = "ErrorToken"; - SyntaxKind[SyntaxKind["EndOfFileToken"] = 10] = "EndOfFileToken"; - - SyntaxKind[SyntaxKind["IdentifierName"] = 11] = "IdentifierName"; - - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 12] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NumericLiteral"] = 13] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 14] = "StringLiteral"; - - SyntaxKind[SyntaxKind["BreakKeyword"] = 15] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 16] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 17] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 18] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 19] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 20] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 21] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 22] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 23] = "ElseKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 24] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 25] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 26] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 27] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 28] = "IfKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 29] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 30] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 31] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 32] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 33] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 34] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 35] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 36] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 37] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 38] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 39] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 40] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 41] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 42] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 43] = "WithKeyword"; - - SyntaxKind[SyntaxKind["ClassKeyword"] = 44] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 45] = "ConstKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 46] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 47] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 48] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 49] = "ImportKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 50] = "SuperKeyword"; - - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 51] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 52] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 53] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 54] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 55] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 56] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 57] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 58] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 59] = "YieldKeyword"; - - SyntaxKind[SyntaxKind["AnyKeyword"] = 60] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 61] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 62] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 63] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 64] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 65] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 66] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 67] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 68] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 69] = "StringKeyword"; - - SyntaxKind[SyntaxKind["OpenBraceToken"] = 70] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 71] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 72] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 73] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 74] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 75] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 76] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 77] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 78] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 79] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 80] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 81] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 82] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 83] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 84] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 85] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 86] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 87] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 88] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 89] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 90] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 91] = "AsteriskToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 92] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 93] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 94] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 95] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 96] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 97] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 98] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 99] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 100] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 101] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 102] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 103] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 104] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 105] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 106] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 107] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 108] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 109] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 110] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 111] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 112] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 113] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 114] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 115] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 116] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 117] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 118] = "SlashToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 119] = "SlashEqualsToken"; - - SyntaxKind[SyntaxKind["SourceUnit"] = 120] = "SourceUnit"; - - SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; - - SyntaxKind[SyntaxKind["ObjectType"] = 122] = "ObjectType"; - SyntaxKind[SyntaxKind["FunctionType"] = 123] = "FunctionType"; - SyntaxKind[SyntaxKind["ArrayType"] = 124] = "ArrayType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 125] = "ConstructorType"; - SyntaxKind[SyntaxKind["GenericType"] = 126] = "GenericType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 127] = "TypeQuery"; - - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 128] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 129] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 130] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 131] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 132] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 133] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 134] = "ExportAssignment"; - - SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 135] = "MemberFunctionDeclaration"; - SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 136] = "MemberVariableDeclaration"; - SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 137] = "ConstructorDeclaration"; - SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 138] = "IndexMemberDeclaration"; - - SyntaxKind[SyntaxKind["GetAccessor"] = 139] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 140] = "SetAccessor"; - - SyntaxKind[SyntaxKind["PropertySignature"] = 141] = "PropertySignature"; - SyntaxKind[SyntaxKind["CallSignature"] = 142] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 143] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 144] = "IndexSignature"; - SyntaxKind[SyntaxKind["MethodSignature"] = 145] = "MethodSignature"; - - SyntaxKind[SyntaxKind["Block"] = 146] = "Block"; - SyntaxKind[SyntaxKind["IfStatement"] = 147] = "IfStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 148] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 149] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 150] = "ReturnStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 151] = "SwitchStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 152] = "BreakStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 153] = "ContinueStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 154] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 155] = "ForInStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 156] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 157] = "ThrowStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 158] = "WhileStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 159] = "TryStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 160] = "LabeledStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 161] = "DoStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 162] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 163] = "WithStatement"; - - SyntaxKind[SyntaxKind["PlusExpression"] = 164] = "PlusExpression"; - SyntaxKind[SyntaxKind["NegateExpression"] = 165] = "NegateExpression"; - SyntaxKind[SyntaxKind["BitwiseNotExpression"] = 166] = "BitwiseNotExpression"; - SyntaxKind[SyntaxKind["LogicalNotExpression"] = 167] = "LogicalNotExpression"; - SyntaxKind[SyntaxKind["PreIncrementExpression"] = 168] = "PreIncrementExpression"; - SyntaxKind[SyntaxKind["PreDecrementExpression"] = 169] = "PreDecrementExpression"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 170] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 171] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 172] = "VoidExpression"; - SyntaxKind[SyntaxKind["CommaExpression"] = 173] = "CommaExpression"; - SyntaxKind[SyntaxKind["AssignmentExpression"] = 174] = "AssignmentExpression"; - SyntaxKind[SyntaxKind["AddAssignmentExpression"] = 175] = "AddAssignmentExpression"; - SyntaxKind[SyntaxKind["SubtractAssignmentExpression"] = 176] = "SubtractAssignmentExpression"; - SyntaxKind[SyntaxKind["MultiplyAssignmentExpression"] = 177] = "MultiplyAssignmentExpression"; - SyntaxKind[SyntaxKind["DivideAssignmentExpression"] = 178] = "DivideAssignmentExpression"; - SyntaxKind[SyntaxKind["ModuloAssignmentExpression"] = 179] = "ModuloAssignmentExpression"; - SyntaxKind[SyntaxKind["AndAssignmentExpression"] = 180] = "AndAssignmentExpression"; - SyntaxKind[SyntaxKind["ExclusiveOrAssignmentExpression"] = 181] = "ExclusiveOrAssignmentExpression"; - SyntaxKind[SyntaxKind["OrAssignmentExpression"] = 182] = "OrAssignmentExpression"; - SyntaxKind[SyntaxKind["LeftShiftAssignmentExpression"] = 183] = "LeftShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftAssignmentExpression"] = 184] = "SignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftAssignmentExpression"] = 185] = "UnsignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 186] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["LogicalOrExpression"] = 187] = "LogicalOrExpression"; - SyntaxKind[SyntaxKind["LogicalAndExpression"] = 188] = "LogicalAndExpression"; - SyntaxKind[SyntaxKind["BitwiseOrExpression"] = 189] = "BitwiseOrExpression"; - SyntaxKind[SyntaxKind["BitwiseExclusiveOrExpression"] = 190] = "BitwiseExclusiveOrExpression"; - SyntaxKind[SyntaxKind["BitwiseAndExpression"] = 191] = "BitwiseAndExpression"; - SyntaxKind[SyntaxKind["EqualsWithTypeConversionExpression"] = 192] = "EqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["NotEqualsWithTypeConversionExpression"] = 193] = "NotEqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["EqualsExpression"] = 194] = "EqualsExpression"; - SyntaxKind[SyntaxKind["NotEqualsExpression"] = 195] = "NotEqualsExpression"; - SyntaxKind[SyntaxKind["LessThanExpression"] = 196] = "LessThanExpression"; - SyntaxKind[SyntaxKind["GreaterThanExpression"] = 197] = "GreaterThanExpression"; - SyntaxKind[SyntaxKind["LessThanOrEqualExpression"] = 198] = "LessThanOrEqualExpression"; - SyntaxKind[SyntaxKind["GreaterThanOrEqualExpression"] = 199] = "GreaterThanOrEqualExpression"; - SyntaxKind[SyntaxKind["InstanceOfExpression"] = 200] = "InstanceOfExpression"; - SyntaxKind[SyntaxKind["InExpression"] = 201] = "InExpression"; - SyntaxKind[SyntaxKind["LeftShiftExpression"] = 202] = "LeftShiftExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftExpression"] = 203] = "SignedRightShiftExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftExpression"] = 204] = "UnsignedRightShiftExpression"; - SyntaxKind[SyntaxKind["MultiplyExpression"] = 205] = "MultiplyExpression"; - SyntaxKind[SyntaxKind["DivideExpression"] = 206] = "DivideExpression"; - SyntaxKind[SyntaxKind["ModuloExpression"] = 207] = "ModuloExpression"; - SyntaxKind[SyntaxKind["AddExpression"] = 208] = "AddExpression"; - SyntaxKind[SyntaxKind["SubtractExpression"] = 209] = "SubtractExpression"; - SyntaxKind[SyntaxKind["PostIncrementExpression"] = 210] = "PostIncrementExpression"; - SyntaxKind[SyntaxKind["PostDecrementExpression"] = 211] = "PostDecrementExpression"; - SyntaxKind[SyntaxKind["MemberAccessExpression"] = 212] = "MemberAccessExpression"; - SyntaxKind[SyntaxKind["InvocationExpression"] = 213] = "InvocationExpression"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 214] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 215] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 216] = "ObjectCreationExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 217] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 218] = "ParenthesizedArrowFunctionExpression"; - SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 219] = "SimpleArrowFunctionExpression"; - SyntaxKind[SyntaxKind["CastExpression"] = 220] = "CastExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 221] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 222] = "FunctionExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 223] = "OmittedExpression"; - - SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarator"] = 225] = "VariableDeclarator"; - - SyntaxKind[SyntaxKind["ArgumentList"] = 226] = "ArgumentList"; - SyntaxKind[SyntaxKind["ParameterList"] = 227] = "ParameterList"; - SyntaxKind[SyntaxKind["TypeArgumentList"] = 228] = "TypeArgumentList"; - SyntaxKind[SyntaxKind["TypeParameterList"] = 229] = "TypeParameterList"; - - SyntaxKind[SyntaxKind["ExtendsHeritageClause"] = 230] = "ExtendsHeritageClause"; - SyntaxKind[SyntaxKind["ImplementsHeritageClause"] = 231] = "ImplementsHeritageClause"; - SyntaxKind[SyntaxKind["EqualsValueClause"] = 232] = "EqualsValueClause"; - SyntaxKind[SyntaxKind["CaseSwitchClause"] = 233] = "CaseSwitchClause"; - SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 234] = "DefaultSwitchClause"; - SyntaxKind[SyntaxKind["ElseClause"] = 235] = "ElseClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 236] = "CatchClause"; - SyntaxKind[SyntaxKind["FinallyClause"] = 237] = "FinallyClause"; - - SyntaxKind[SyntaxKind["TypeParameter"] = 238] = "TypeParameter"; - SyntaxKind[SyntaxKind["Constraint"] = 239] = "Constraint"; - - SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 240] = "SimplePropertyAssignment"; - - SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 241] = "FunctionPropertyAssignment"; - - SyntaxKind[SyntaxKind["Parameter"] = 242] = "Parameter"; - SyntaxKind[SyntaxKind["EnumElement"] = 243] = "EnumElement"; - SyntaxKind[SyntaxKind["TypeAnnotation"] = 244] = "TypeAnnotation"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 246] = "ModuleNameModuleReference"; - SyntaxKind[SyntaxKind["Last"] = SyntaxKind.ModuleNameModuleReference] = "Last"; - - SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword"; - SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword"; - - SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword"; - SyntaxKind[SyntaxKind["LastFutureReservedKeyword"] = SyntaxKind.SuperKeyword] = "LastFutureReservedKeyword"; - - SyntaxKind[SyntaxKind["FirstFutureReservedStrictKeyword"] = SyntaxKind.ImplementsKeyword] = "FirstFutureReservedStrictKeyword"; - SyntaxKind[SyntaxKind["LastFutureReservedStrictKeyword"] = SyntaxKind.YieldKeyword] = "LastFutureReservedStrictKeyword"; - - SyntaxKind[SyntaxKind["FirstTypeScriptKeyword"] = SyntaxKind.AnyKeyword] = "FirstTypeScriptKeyword"; - SyntaxKind[SyntaxKind["LastTypeScriptKeyword"] = SyntaxKind.StringKeyword] = "LastTypeScriptKeyword"; - - SyntaxKind[SyntaxKind["FirstKeyword"] = SyntaxKind.FirstStandardKeyword] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = SyntaxKind.LastTypeScriptKeyword] = "LastKeyword"; - - SyntaxKind[SyntaxKind["FirstToken"] = SyntaxKind.ErrorToken] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.SlashEqualsToken] = "LastToken"; - - SyntaxKind[SyntaxKind["FirstPunctuation"] = SyntaxKind.OpenBraceToken] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = SyntaxKind.SlashEqualsToken] = "LastPunctuation"; - - SyntaxKind[SyntaxKind["FirstFixedWidth"] = SyntaxKind.FirstKeyword] = "FirstFixedWidth"; - SyntaxKind[SyntaxKind["LastFixedWidth"] = SyntaxKind.LastPunctuation] = "LastFixedWidth"; - - SyntaxKind[SyntaxKind["FirstTrivia"] = SyntaxKind.WhitespaceTrivia] = "FirstTrivia"; - SyntaxKind[SyntaxKind["LastTrivia"] = SyntaxKind.SkippedTokenTrivia] = "LastTrivia"; - })(TypeScript.SyntaxKind || (TypeScript.SyntaxKind = {})); - var SyntaxKind = TypeScript.SyntaxKind; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxFacts) { - var textToKeywordKind = { - "any": 60 /* AnyKeyword */, - "boolean": 61 /* BooleanKeyword */, - "break": 15 /* BreakKeyword */, - "case": 16 /* CaseKeyword */, - "catch": 17 /* CatchKeyword */, - "class": 44 /* ClassKeyword */, - "continue": 18 /* ContinueKeyword */, - "const": 45 /* ConstKeyword */, - "constructor": 62 /* ConstructorKeyword */, - "debugger": 19 /* DebuggerKeyword */, - "declare": 63 /* DeclareKeyword */, - "default": 20 /* DefaultKeyword */, - "delete": 21 /* DeleteKeyword */, - "do": 22 /* DoKeyword */, - "else": 23 /* ElseKeyword */, - "enum": 46 /* EnumKeyword */, - "export": 47 /* ExportKeyword */, - "extends": 48 /* ExtendsKeyword */, - "false": 24 /* FalseKeyword */, - "finally": 25 /* FinallyKeyword */, - "for": 26 /* ForKeyword */, - "function": 27 /* FunctionKeyword */, - "get": 64 /* GetKeyword */, - "if": 28 /* IfKeyword */, - "implements": 51 /* ImplementsKeyword */, - "import": 49 /* ImportKeyword */, - "in": 29 /* InKeyword */, - "instanceof": 30 /* InstanceOfKeyword */, - "interface": 52 /* InterfaceKeyword */, - "let": 53 /* LetKeyword */, - "module": 65 /* ModuleKeyword */, - "new": 31 /* NewKeyword */, - "null": 32 /* NullKeyword */, - "number": 67 /* NumberKeyword */, - "package": 54 /* PackageKeyword */, - "private": 55 /* PrivateKeyword */, - "protected": 56 /* ProtectedKeyword */, - "public": 57 /* PublicKeyword */, - "require": 66 /* RequireKeyword */, - "return": 33 /* ReturnKeyword */, - "set": 68 /* SetKeyword */, - "static": 58 /* StaticKeyword */, - "string": 69 /* StringKeyword */, - "super": 50 /* SuperKeyword */, - "switch": 34 /* SwitchKeyword */, - "this": 35 /* ThisKeyword */, - "throw": 36 /* ThrowKeyword */, - "true": 37 /* TrueKeyword */, - "try": 38 /* TryKeyword */, - "typeof": 39 /* TypeOfKeyword */, - "var": 40 /* VarKeyword */, - "void": 41 /* VoidKeyword */, - "while": 42 /* WhileKeyword */, - "with": 43 /* WithKeyword */, - "yield": 59 /* YieldKeyword */, - "{": 70 /* OpenBraceToken */, - "}": 71 /* CloseBraceToken */, - "(": 72 /* OpenParenToken */, - ")": 73 /* CloseParenToken */, - "[": 74 /* OpenBracketToken */, - "]": 75 /* CloseBracketToken */, - ".": 76 /* DotToken */, - "...": 77 /* DotDotDotToken */, - ";": 78 /* SemicolonToken */, - ",": 79 /* CommaToken */, - "<": 80 /* LessThanToken */, - ">": 81 /* GreaterThanToken */, - "<=": 82 /* LessThanEqualsToken */, - ">=": 83 /* GreaterThanEqualsToken */, - "==": 84 /* EqualsEqualsToken */, - "=>": 85 /* EqualsGreaterThanToken */, - "!=": 86 /* ExclamationEqualsToken */, - "===": 87 /* EqualsEqualsEqualsToken */, - "!==": 88 /* ExclamationEqualsEqualsToken */, - "+": 89 /* PlusToken */, - "-": 90 /* MinusToken */, - "*": 91 /* AsteriskToken */, - "%": 92 /* PercentToken */, - "++": 93 /* PlusPlusToken */, - "--": 94 /* MinusMinusToken */, - "<<": 95 /* LessThanLessThanToken */, - ">>": 96 /* GreaterThanGreaterThanToken */, - ">>>": 97 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 98 /* AmpersandToken */, - "|": 99 /* BarToken */, - "^": 100 /* CaretToken */, - "!": 101 /* ExclamationToken */, - "~": 102 /* TildeToken */, - "&&": 103 /* AmpersandAmpersandToken */, - "||": 104 /* BarBarToken */, - "?": 105 /* QuestionToken */, - ":": 106 /* ColonToken */, - "=": 107 /* EqualsToken */, - "+=": 108 /* PlusEqualsToken */, - "-=": 109 /* MinusEqualsToken */, - "*=": 110 /* AsteriskEqualsToken */, - "%=": 111 /* PercentEqualsToken */, - "<<=": 112 /* LessThanLessThanEqualsToken */, - ">>=": 113 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 115 /* AmpersandEqualsToken */, - "|=": 116 /* BarEqualsToken */, - "^=": 117 /* CaretEqualsToken */, - "/": 118 /* SlashToken */, - "/=": 119 /* SlashEqualsToken */ - }; - - var kindToText = new Array(); - - for (var name in textToKeywordKind) { - if (textToKeywordKind.hasOwnProperty(name)) { - kindToText[textToKeywordKind[name]] = name; - } - } - - kindToText[62 /* ConstructorKeyword */] = "constructor"; - - function getTokenKind(text) { - if (textToKeywordKind.hasOwnProperty(text)) { - return textToKeywordKind[text]; - } - - return 0 /* None */; - } - SyntaxFacts.getTokenKind = getTokenKind; - - function getText(kind) { - var result = kindToText[kind]; - return result !== undefined ? result : null; - } - SyntaxFacts.getText = getText; - - function isTokenKind(kind) { - return kind >= 9 /* FirstToken */ && kind <= 119 /* LastToken */; - } - SyntaxFacts.isTokenKind = isTokenKind; - - function isAnyKeyword(kind) { - return kind >= 15 /* FirstKeyword */ && kind <= 69 /* LastKeyword */; - } - SyntaxFacts.isAnyKeyword = isAnyKeyword; - - function isStandardKeyword(kind) { - return kind >= 15 /* FirstStandardKeyword */ && kind <= 43 /* LastStandardKeyword */; - } - SyntaxFacts.isStandardKeyword = isStandardKeyword; - - function isFutureReservedKeyword(kind) { - return kind >= 44 /* FirstFutureReservedKeyword */ && kind <= 50 /* LastFutureReservedKeyword */; - } - SyntaxFacts.isFutureReservedKeyword = isFutureReservedKeyword; - - function isFutureReservedStrictKeyword(kind) { - return kind >= 51 /* FirstFutureReservedStrictKeyword */ && kind <= 59 /* LastFutureReservedStrictKeyword */; - } - SyntaxFacts.isFutureReservedStrictKeyword = isFutureReservedStrictKeyword; - - function isAnyPunctuation(kind) { - return kind >= 70 /* FirstPunctuation */ && kind <= 119 /* LastPunctuation */; - } - SyntaxFacts.isAnyPunctuation = isAnyPunctuation; - - function isPrefixUnaryExpressionOperatorToken(tokenKind) { - return getPrefixUnaryExpressionFromOperatorToken(tokenKind) !== 0 /* None */; - } - SyntaxFacts.isPrefixUnaryExpressionOperatorToken = isPrefixUnaryExpressionOperatorToken; - - function isBinaryExpressionOperatorToken(tokenKind) { - return getBinaryExpressionFromOperatorToken(tokenKind) !== 0 /* None */; - } - SyntaxFacts.isBinaryExpressionOperatorToken = isBinaryExpressionOperatorToken; - - function getPrefixUnaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 89 /* PlusToken */: - return 164 /* PlusExpression */; - case 90 /* MinusToken */: - return 165 /* NegateExpression */; - case 102 /* TildeToken */: - return 166 /* BitwiseNotExpression */; - case 101 /* ExclamationToken */: - return 167 /* LogicalNotExpression */; - case 93 /* PlusPlusToken */: - return 168 /* PreIncrementExpression */; - case 94 /* MinusMinusToken */: - return 169 /* PreDecrementExpression */; - - default: - return 0 /* None */; - } - } - SyntaxFacts.getPrefixUnaryExpressionFromOperatorToken = getPrefixUnaryExpressionFromOperatorToken; - - function getPostfixUnaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 93 /* PlusPlusToken */: - return 210 /* PostIncrementExpression */; - case 94 /* MinusMinusToken */: - return 211 /* PostDecrementExpression */; - default: - return 0 /* None */; - } - } - SyntaxFacts.getPostfixUnaryExpressionFromOperatorToken = getPostfixUnaryExpressionFromOperatorToken; - - function getBinaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 91 /* AsteriskToken */: - return 205 /* MultiplyExpression */; - - case 118 /* SlashToken */: - return 206 /* DivideExpression */; - - case 92 /* PercentToken */: - return 207 /* ModuloExpression */; - - case 89 /* PlusToken */: - return 208 /* AddExpression */; - - case 90 /* MinusToken */: - return 209 /* SubtractExpression */; - - case 95 /* LessThanLessThanToken */: - return 202 /* LeftShiftExpression */; - - case 96 /* GreaterThanGreaterThanToken */: - return 203 /* SignedRightShiftExpression */; - - case 97 /* GreaterThanGreaterThanGreaterThanToken */: - return 204 /* UnsignedRightShiftExpression */; - - case 80 /* LessThanToken */: - return 196 /* LessThanExpression */; - - case 81 /* GreaterThanToken */: - return 197 /* GreaterThanExpression */; - - case 82 /* LessThanEqualsToken */: - return 198 /* LessThanOrEqualExpression */; - - case 83 /* GreaterThanEqualsToken */: - return 199 /* GreaterThanOrEqualExpression */; - - case 30 /* InstanceOfKeyword */: - return 200 /* InstanceOfExpression */; - - case 29 /* InKeyword */: - return 201 /* InExpression */; - - case 84 /* EqualsEqualsToken */: - return 192 /* EqualsWithTypeConversionExpression */; - - case 86 /* ExclamationEqualsToken */: - return 193 /* NotEqualsWithTypeConversionExpression */; - - case 87 /* EqualsEqualsEqualsToken */: - return 194 /* EqualsExpression */; - - case 88 /* ExclamationEqualsEqualsToken */: - return 195 /* NotEqualsExpression */; - - case 98 /* AmpersandToken */: - return 191 /* BitwiseAndExpression */; - - case 100 /* CaretToken */: - return 190 /* BitwiseExclusiveOrExpression */; - - case 99 /* BarToken */: - return 189 /* BitwiseOrExpression */; - - case 103 /* AmpersandAmpersandToken */: - return 188 /* LogicalAndExpression */; - - case 104 /* BarBarToken */: - return 187 /* LogicalOrExpression */; - - case 116 /* BarEqualsToken */: - return 182 /* OrAssignmentExpression */; - - case 115 /* AmpersandEqualsToken */: - return 180 /* AndAssignmentExpression */; - - case 117 /* CaretEqualsToken */: - return 181 /* ExclusiveOrAssignmentExpression */; - - case 112 /* LessThanLessThanEqualsToken */: - return 183 /* LeftShiftAssignmentExpression */; - - case 113 /* GreaterThanGreaterThanEqualsToken */: - return 184 /* SignedRightShiftAssignmentExpression */; - - case 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - return 185 /* UnsignedRightShiftAssignmentExpression */; - - case 108 /* PlusEqualsToken */: - return 175 /* AddAssignmentExpression */; - - case 109 /* MinusEqualsToken */: - return 176 /* SubtractAssignmentExpression */; - - case 110 /* AsteriskEqualsToken */: - return 177 /* MultiplyAssignmentExpression */; - - case 119 /* SlashEqualsToken */: - return 178 /* DivideAssignmentExpression */; - - case 111 /* PercentEqualsToken */: - return 179 /* ModuloAssignmentExpression */; - - case 107 /* EqualsToken */: - return 174 /* AssignmentExpression */; - - case 79 /* CommaToken */: - return 173 /* CommaExpression */; - - default: - return 0 /* None */; - } - } - SyntaxFacts.getBinaryExpressionFromOperatorToken = getBinaryExpressionFromOperatorToken; - - function getOperatorTokenFromBinaryExpression(tokenKind) { - switch (tokenKind) { - case 205 /* MultiplyExpression */: - return 91 /* AsteriskToken */; - - case 206 /* DivideExpression */: - return 118 /* SlashToken */; - - case 207 /* ModuloExpression */: - return 92 /* PercentToken */; - - case 208 /* AddExpression */: - return 89 /* PlusToken */; - - case 209 /* SubtractExpression */: - return 90 /* MinusToken */; - - case 202 /* LeftShiftExpression */: - return 95 /* LessThanLessThanToken */; - - case 203 /* SignedRightShiftExpression */: - return 96 /* GreaterThanGreaterThanToken */; - - case 204 /* UnsignedRightShiftExpression */: - return 97 /* GreaterThanGreaterThanGreaterThanToken */; - - case 196 /* LessThanExpression */: - return 80 /* LessThanToken */; - - case 197 /* GreaterThanExpression */: - return 81 /* GreaterThanToken */; - - case 198 /* LessThanOrEqualExpression */: - return 82 /* LessThanEqualsToken */; - - case 199 /* GreaterThanOrEqualExpression */: - return 83 /* GreaterThanEqualsToken */; - - case 200 /* InstanceOfExpression */: - return 30 /* InstanceOfKeyword */; - - case 201 /* InExpression */: - return 29 /* InKeyword */; - - case 192 /* EqualsWithTypeConversionExpression */: - return 84 /* EqualsEqualsToken */; - - case 193 /* NotEqualsWithTypeConversionExpression */: - return 86 /* ExclamationEqualsToken */; - - case 194 /* EqualsExpression */: - return 87 /* EqualsEqualsEqualsToken */; - - case 195 /* NotEqualsExpression */: - return 88 /* ExclamationEqualsEqualsToken */; - - case 191 /* BitwiseAndExpression */: - return 98 /* AmpersandToken */; - - case 190 /* BitwiseExclusiveOrExpression */: - return 100 /* CaretToken */; - - case 189 /* BitwiseOrExpression */: - return 99 /* BarToken */; - - case 188 /* LogicalAndExpression */: - return 103 /* AmpersandAmpersandToken */; - - case 187 /* LogicalOrExpression */: - return 104 /* BarBarToken */; - - case 182 /* OrAssignmentExpression */: - return 116 /* BarEqualsToken */; - - case 180 /* AndAssignmentExpression */: - return 115 /* AmpersandEqualsToken */; - - case 181 /* ExclusiveOrAssignmentExpression */: - return 117 /* CaretEqualsToken */; - - case 183 /* LeftShiftAssignmentExpression */: - return 112 /* LessThanLessThanEqualsToken */; - - case 184 /* SignedRightShiftAssignmentExpression */: - return 113 /* GreaterThanGreaterThanEqualsToken */; - - case 185 /* UnsignedRightShiftAssignmentExpression */: - return 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - - case 175 /* AddAssignmentExpression */: - return 108 /* PlusEqualsToken */; - - case 176 /* SubtractAssignmentExpression */: - return 109 /* MinusEqualsToken */; - - case 177 /* MultiplyAssignmentExpression */: - return 110 /* AsteriskEqualsToken */; - - case 178 /* DivideAssignmentExpression */: - return 119 /* SlashEqualsToken */; - - case 179 /* ModuloAssignmentExpression */: - return 111 /* PercentEqualsToken */; - - case 174 /* AssignmentExpression */: - return 107 /* EqualsToken */; - - case 173 /* CommaExpression */: - return 79 /* CommaToken */; - - default: - return 0 /* None */; - } - } - SyntaxFacts.getOperatorTokenFromBinaryExpression = getOperatorTokenFromBinaryExpression; - - function isAnyDivideToken(kind) { - switch (kind) { - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - return true; - default: - return false; - } - } - SyntaxFacts.isAnyDivideToken = isAnyDivideToken; - - function isAnyDivideOrRegularExpressionToken(kind) { - switch (kind) { - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - case 12 /* RegularExpressionLiteral */: - return true; - default: - return false; - } - } - SyntaxFacts.isAnyDivideOrRegularExpressionToken = isAnyDivideOrRegularExpressionToken; - })(TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); - var SyntaxFacts = TypeScript.SyntaxFacts; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var isKeywordStartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isIdentifierStartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isIdentifierPartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isNumericLiteralStart = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - - for (var character = 0; character < 127 /* maxAsciiCharacter */; character++) { - if (character >= 97 /* a */ && character <= 122 /* z */) { - isIdentifierStartCharacter[character] = true; - isIdentifierPartCharacter[character] = true; - } else if ((character >= 65 /* A */ && character <= 90 /* Z */) || character === 95 /* _ */ || character === 36 /* $ */) { - isIdentifierStartCharacter[character] = true; - isIdentifierPartCharacter[character] = true; - } else if (character >= 48 /* _0 */ && character <= 57 /* _9 */) { - isIdentifierPartCharacter[character] = true; - isNumericLiteralStart[character] = true; - } - } - - isNumericLiteralStart[46 /* dot */] = true; - - for (var keywordKind = 15 /* FirstKeyword */; keywordKind <= 69 /* LastKeyword */; keywordKind++) { - var keyword = TypeScript.SyntaxFacts.getText(keywordKind); - isKeywordStartCharacter[keyword.charCodeAt(0)] = true; - } - - var Scanner = (function () { - function Scanner(fileName, text, languageVersion, window) { - if (typeof window === "undefined") { window = TypeScript.ArrayUtilities.createArray(2048, 0); } - this.slidingWindow = new TypeScript.SlidingWindow(this, window, 0, text.length()); - this.fileName = fileName; - this.text = text; - this._languageVersion = languageVersion; - } - Scanner.prototype.languageVersion = function () { - return this._languageVersion; - }; - - Scanner.prototype.fetchMoreItems = function (argument, sourceIndex, window, destinationIndex, spaceAvailable) { - var charactersRemaining = this.text.length() - sourceIndex; - var amountToRead = TypeScript.MathPrototype.min(charactersRemaining, spaceAvailable); - this.text.copyTo(sourceIndex, window, destinationIndex, amountToRead); - return amountToRead; - }; - - Scanner.prototype.currentCharCode = function () { - return this.slidingWindow.currentItem(null); - }; - - Scanner.prototype.absoluteIndex = function () { - return this.slidingWindow.absoluteIndex(); - }; - - Scanner.prototype.setAbsoluteIndex = function (index) { - this.slidingWindow.setAbsoluteIndex(index); - }; - - Scanner.prototype.scan = function (diagnostics, allowRegularExpression) { - var diagnosticsLength = diagnostics.length; - var fullStart = this.slidingWindow.absoluteIndex(); - var leadingTriviaInfo = this.scanTriviaInfo(diagnostics, false); - - var start = this.slidingWindow.absoluteIndex(); - var kindAndFlags = this.scanSyntaxToken(diagnostics, allowRegularExpression); - var end = this.slidingWindow.absoluteIndex(); - - var trailingTriviaInfo = this.scanTriviaInfo(diagnostics, true); - var fullEnd = this.slidingWindow.absoluteIndex(); - - var isVariableWidthKeyword = (kindAndFlags & -2147483648 /* IsVariableWidthKeyword */) !== 0; - var kind = kindAndFlags & ~-2147483648 /* IsVariableWidthKeyword */; - - var token = this.createToken(fullStart, leadingTriviaInfo, start, kind, end, fullEnd, trailingTriviaInfo, isVariableWidthKeyword); - - return diagnosticsLength !== diagnostics.length ? TypeScript.Syntax.realizeToken(token) : token; - }; - - Scanner.prototype.createToken = function (fullStart, leadingTriviaInfo, start, kind, end, fullEnd, trailingTriviaInfo, isVariableWidthKeyword) { - if (!isVariableWidthKeyword && kind >= 15 /* FirstFixedWidth */) { - if (leadingTriviaInfo === 0) { - if (trailingTriviaInfo === 0) { - return new TypeScript.Syntax.FixedWidthTokenWithNoTrivia(kind); - } else { - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - return new TypeScript.Syntax.FixedWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo); - } - } else if (trailingTriviaInfo === 0) { - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - return new TypeScript.Syntax.FixedWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo); - } else { - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - return new TypeScript.Syntax.FixedWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo); - } - } else { - var width = end - start; - - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - - if (leadingTriviaInfo === 0) { - if (trailingTriviaInfo === 0) { - return new TypeScript.Syntax.VariableWidthTokenWithNoTrivia(fullText, kind); - } else { - return new TypeScript.Syntax.VariableWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo); - } - } else if (trailingTriviaInfo === 0) { - return new TypeScript.Syntax.VariableWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo); - } else { - return new TypeScript.Syntax.VariableWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo); - } - } - }; - - Scanner.scanTrivia = function (text, start, length, isTrailing) { - var scanner = new Scanner(null, text.subText(new TypeScript.TextSpan(start, length)), 1 /* EcmaScript5 */, Scanner.triviaWindow); - return scanner.scanTrivia(text, start, isTrailing); - }; - - Scanner.prototype.scanTrivia = function (underlyingText, underlyingTextStart, isTrailing) { - var trivia = new Array(); - - while (true) { - if (!this.slidingWindow.isAtEndOfSource()) { - var ch = this.currentCharCode(); - - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - trivia.push(this.scanWhitespaceTrivia(underlyingText, underlyingTextStart)); - continue; - - case 47 /* slash */: - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 47 /* slash */) { - trivia.push(this.scanSingleLineCommentTrivia(underlyingText, underlyingTextStart)); - continue; - } - - if (ch2 === 42 /* asterisk */) { - trivia.push(this.scanMultiLineCommentTrivia(underlyingText, underlyingTextStart)); - continue; - } - - throw TypeScript.Errors.invalidOperation(); - - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - trivia.push(this.scanLineTerminatorSequenceTrivia(ch)); - - if (!isTrailing) { - continue; - } - - break; - - default: - throw TypeScript.Errors.invalidOperation(); - } - } - - return TypeScript.Syntax.triviaList(trivia); - } - }; - - Scanner.prototype.scanTriviaInfo = function (diagnostics, isTrailing) { - var width = 0; - var hasCommentOrNewLine = 0; - - while (true) { - var ch = this.currentCharCode(); - - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - this.slidingWindow.moveToNextItem(); - width++; - continue; - - case 47 /* slash */: - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 47 /* slash */) { - hasCommentOrNewLine |= 2 /* TriviaCommentMask */; - width += this.scanSingleLineCommentTriviaLength(); - continue; - } - - if (ch2 === 42 /* asterisk */) { - hasCommentOrNewLine |= 2 /* TriviaCommentMask */; - width += this.scanMultiLineCommentTriviaLength(diagnostics); - continue; - } - - break; - - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - hasCommentOrNewLine |= 1 /* TriviaNewLineMask */; - width += this.scanLineTerminatorSequenceLength(ch); - - if (!isTrailing) { - continue; - } - - break; - } - - return (width << 2 /* TriviaFullWidthShift */) | hasCommentOrNewLine; - } - }; - - Scanner.prototype.isNewLineCharacter = function (ch) { - switch (ch) { - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - return true; - default: - return false; - } - }; - - Scanner.prototype.scanWhitespaceTrivia = function (underlyingText, underlyingTextStart) { - var absoluteStartIndex = this.absoluteIndex(); - - var width = 0; - while (true) { - var ch = this.currentCharCode(); - - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - this.slidingWindow.moveToNextItem(); - width++; - continue; - } - - break; - } - - return TypeScript.Syntax.deferredTrivia(4 /* WhitespaceTrivia */, underlyingText, underlyingTextStart + absoluteStartIndex, width); - }; - - Scanner.prototype.scanSingleLineCommentTrivia = function (underlyingText, underlyingTextStart) { - var absoluteStartIndex = this.slidingWindow.absoluteIndex(); - var width = this.scanSingleLineCommentTriviaLength(); - - return TypeScript.Syntax.deferredTrivia(7 /* SingleLineCommentTrivia */, underlyingText, underlyingTextStart + absoluteStartIndex, width); - }; - - Scanner.prototype.scanSingleLineCommentTriviaLength = function () { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - - var width = 2; - while (true) { - if (this.slidingWindow.isAtEndOfSource() || this.isNewLineCharacter(this.currentCharCode())) { - return width; - } - - this.slidingWindow.moveToNextItem(); - width++; - } - }; - - Scanner.prototype.scanMultiLineCommentTrivia = function (underlyingText, underlyingTextStart) { - var absoluteStartIndex = this.absoluteIndex(); - var width = this.scanMultiLineCommentTriviaLength(null); - - return TypeScript.Syntax.deferredTrivia(6 /* MultiLineCommentTrivia */, underlyingText, underlyingTextStart + absoluteStartIndex, width); - }; - - Scanner.prototype.scanMultiLineCommentTriviaLength = function (diagnostics) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - - var width = 2; - while (true) { - if (this.slidingWindow.isAtEndOfSource()) { - if (diagnostics !== null) { - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), this.slidingWindow.absoluteIndex(), 0, TypeScript.DiagnosticCode.AsteriskSlash_expected, null)); - } - - return width; - } - - var ch = this.currentCharCode(); - if (ch === 42 /* asterisk */ && this.slidingWindow.peekItemN(1) === 47 /* slash */) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - width += 2; - return width; - } - - this.slidingWindow.moveToNextItem(); - width++; - } - }; - - Scanner.prototype.scanLineTerminatorSequenceTrivia = function (ch) { - var absoluteStartIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - var width = this.scanLineTerminatorSequenceLength(ch); - - var text = this.substring(absoluteStartIndex, absoluteStartIndex + width, false); - this.slidingWindow.releaseAndUnpinAbsoluteIndex(absoluteStartIndex); - - return TypeScript.Syntax.trivia(5 /* NewLineTrivia */, text); - }; - - Scanner.prototype.scanLineTerminatorSequenceLength = function (ch) { - this.slidingWindow.moveToNextItem(); - - if (ch === 13 /* carriageReturn */ && this.currentCharCode() === 10 /* lineFeed */) { - this.slidingWindow.moveToNextItem(); - return 2; - } else { - return 1; - } - }; - - Scanner.prototype.scanSyntaxToken = function (diagnostics, allowRegularExpression) { - if (this.slidingWindow.isAtEndOfSource()) { - return 10 /* EndOfFileToken */; - } - - var character = this.currentCharCode(); - - switch (character) { - case 34 /* doubleQuote */: - case 39 /* singleQuote */: - return this.scanStringLiteral(diagnostics); - - case 47 /* slash */: - return this.scanSlashToken(allowRegularExpression); - - case 46 /* dot */: - return this.scanDotToken(diagnostics); - - case 45 /* minus */: - return this.scanMinusToken(); - - case 33 /* exclamation */: - return this.scanExclamationToken(); - - case 61 /* equals */: - return this.scanEqualsToken(); - - case 124 /* bar */: - return this.scanBarToken(); - - case 42 /* asterisk */: - return this.scanAsteriskToken(); - - case 43 /* plus */: - return this.scanPlusToken(); - - case 37 /* percent */: - return this.scanPercentToken(); - - case 38 /* ampersand */: - return this.scanAmpersandToken(); - - case 94 /* caret */: - return this.scanCaretToken(); - - case 60 /* lessThan */: - return this.scanLessThanToken(); - - case 62 /* greaterThan */: - return this.advanceAndSetTokenKind(81 /* GreaterThanToken */); - - case 44 /* comma */: - return this.advanceAndSetTokenKind(79 /* CommaToken */); - - case 58 /* colon */: - return this.advanceAndSetTokenKind(106 /* ColonToken */); - - case 59 /* semicolon */: - return this.advanceAndSetTokenKind(78 /* SemicolonToken */); - - case 126 /* tilde */: - return this.advanceAndSetTokenKind(102 /* TildeToken */); - - case 40 /* openParen */: - return this.advanceAndSetTokenKind(72 /* OpenParenToken */); - - case 41 /* closeParen */: - return this.advanceAndSetTokenKind(73 /* CloseParenToken */); - - case 123 /* openBrace */: - return this.advanceAndSetTokenKind(70 /* OpenBraceToken */); - - case 125 /* closeBrace */: - return this.advanceAndSetTokenKind(71 /* CloseBraceToken */); - - case 91 /* openBracket */: - return this.advanceAndSetTokenKind(74 /* OpenBracketToken */); - - case 93 /* closeBracket */: - return this.advanceAndSetTokenKind(75 /* CloseBracketToken */); - - case 63 /* question */: - return this.advanceAndSetTokenKind(105 /* QuestionToken */); - } - - if (isNumericLiteralStart[character]) { - return this.scanNumericLiteral(diagnostics); - } - - if (isIdentifierStartCharacter[character]) { - var result = this.tryFastScanIdentifierOrKeyword(character); - if (result !== 0 /* None */) { - return result; - } - } - - if (this.isIdentifierStart(this.peekCharOrUnicodeEscape())) { - return this.slowScanIdentifierOrKeyword(diagnostics); - } - - return this.scanDefaultCharacter(character, diagnostics); - }; - - Scanner.prototype.isIdentifierStart = function (interpretedChar) { - if (isIdentifierStartCharacter[interpretedChar]) { - return true; - } - - return interpretedChar > 127 /* maxAsciiCharacter */ && TypeScript.Unicode.isIdentifierStart(interpretedChar, this._languageVersion); - }; - - Scanner.prototype.isIdentifierPart = function (interpretedChar) { - if (isIdentifierPartCharacter[interpretedChar]) { - return true; - } - - return interpretedChar > 127 /* maxAsciiCharacter */ && TypeScript.Unicode.isIdentifierPart(interpretedChar, this._languageVersion); - }; - - Scanner.prototype.tryFastScanIdentifierOrKeyword = function (firstCharacter) { - var slidingWindow = this.slidingWindow; - var window = slidingWindow.window; - - var startIndex = slidingWindow.currentRelativeItemIndex; - var endIndex = slidingWindow.windowCount; - var currentIndex = startIndex; - var character = 0; - - while (currentIndex < endIndex) { - character = window[currentIndex]; - if (!isIdentifierPartCharacter[character]) { - break; - } - - currentIndex++; - } - - if (currentIndex === endIndex) { - return 0 /* None */; - } else if (character === 92 /* backslash */ || character > 127 /* maxAsciiCharacter */) { - return 0 /* None */; - } else { - var kind; - var identifierLength = currentIndex - startIndex; - if (isKeywordStartCharacter[firstCharacter]) { - kind = TypeScript.ScannerUtilities.identifierKind(window, startIndex, identifierLength); - } else { - kind = 11 /* IdentifierName */; - } - - slidingWindow.setAbsoluteIndex(slidingWindow.absoluteIndex() + identifierLength); - - return kind; - } - }; - - Scanner.prototype.slowScanIdentifierOrKeyword = function (diagnostics) { - var startIndex = this.slidingWindow.absoluteIndex(); - var sawUnicodeEscape = false; - - do { - var unicodeEscape = this.scanCharOrUnicodeEscape(diagnostics); - sawUnicodeEscape = sawUnicodeEscape || unicodeEscape; - } while(this.isIdentifierPart(this.peekCharOrUnicodeEscape())); - - var length = this.slidingWindow.absoluteIndex() - startIndex; - var text = this.text.substr(startIndex, length, false); - var valueText = TypeScript.Syntax.massageEscapes(text); - - var keywordKind = TypeScript.SyntaxFacts.getTokenKind(valueText); - if (keywordKind >= 15 /* FirstKeyword */ && keywordKind <= 69 /* LastKeyword */) { - if (sawUnicodeEscape) { - return keywordKind | -2147483648 /* IsVariableWidthKeyword */; - } else { - return keywordKind; - } - } - - return 11 /* IdentifierName */; - }; - - Scanner.prototype.scanNumericLiteral = function (diagnostics) { - if (this.isHexNumericLiteral()) { - this.scanHexNumericLiteral(); - } else if (this.isOctalNumericLiteral()) { - this.scanOctalNumericLiteral(diagnostics); - } else { - this.scanDecimalNumericLiteral(); - } - - return 13 /* NumericLiteral */; - }; - - Scanner.prototype.isOctalNumericLiteral = function () { - return this.currentCharCode() === 48 /* _0 */ && TypeScript.CharacterInfo.isOctalDigit(this.slidingWindow.peekItemN(1)); - }; - - Scanner.prototype.scanOctalNumericLiteral = function (diagnostics) { - var position = this.absoluteIndex(); - - while (TypeScript.CharacterInfo.isOctalDigit(this.currentCharCode())) { - this.slidingWindow.moveToNextItem(); - } - - if (this.languageVersion() >= 1 /* EcmaScript5 */) { - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), position, this.absoluteIndex() - position, TypeScript.DiagnosticCode.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher, null)); - } - }; - - Scanner.prototype.scanDecimalDigits = function () { - while (TypeScript.CharacterInfo.isDecimalDigit(this.currentCharCode())) { - this.slidingWindow.moveToNextItem(); - } - }; - - Scanner.prototype.scanDecimalNumericLiteral = function () { - this.scanDecimalDigits(); - - if (this.currentCharCode() === 46 /* dot */) { - this.slidingWindow.moveToNextItem(); - } - - this.scanDecimalDigits(); - - var ch = this.currentCharCode(); - if (ch === 101 /* e */ || ch === 69 /* E */) { - var nextChar1 = this.slidingWindow.peekItemN(1); - - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar1)) { - this.slidingWindow.moveToNextItem(); - this.scanDecimalDigits(); - } else if (nextChar1 === 45 /* minus */ || nextChar1 === 43 /* plus */) { - var nextChar2 = this.slidingWindow.peekItemN(2); - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar2)) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - this.scanDecimalDigits(); - } - } - } - }; - - Scanner.prototype.scanHexNumericLiteral = function () { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - - while (TypeScript.CharacterInfo.isHexDigit(this.currentCharCode())) { - this.slidingWindow.moveToNextItem(); - } - }; - - Scanner.prototype.isHexNumericLiteral = function () { - if (this.currentCharCode() === 48 /* _0 */) { - var ch = this.slidingWindow.peekItemN(1); - - if (ch === 120 /* x */ || ch === 88 /* X */) { - ch = this.slidingWindow.peekItemN(2); - - return TypeScript.CharacterInfo.isHexDigit(ch); - } - } - - return false; - }; - - Scanner.prototype.advanceAndSetTokenKind = function (kind) { - this.slidingWindow.moveToNextItem(); - return kind; - }; - - Scanner.prototype.scanLessThanToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 82 /* LessThanEqualsToken */; - } else if (this.currentCharCode() === 60 /* lessThan */) { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 112 /* LessThanLessThanEqualsToken */; - } else { - return 95 /* LessThanLessThanToken */; - } - } else { - return 80 /* LessThanToken */; - } - }; - - Scanner.prototype.scanBarToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 116 /* BarEqualsToken */; - } else if (this.currentCharCode() === 124 /* bar */) { - this.slidingWindow.moveToNextItem(); - return 104 /* BarBarToken */; - } else { - return 99 /* BarToken */; - } - }; - - Scanner.prototype.scanCaretToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 117 /* CaretEqualsToken */; - } else { - return 100 /* CaretToken */; - } - }; - - Scanner.prototype.scanAmpersandToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 115 /* AmpersandEqualsToken */; - } else if (this.currentCharCode() === 38 /* ampersand */) { - this.slidingWindow.moveToNextItem(); - return 103 /* AmpersandAmpersandToken */; - } else { - return 98 /* AmpersandToken */; - } - }; - - Scanner.prototype.scanPercentToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 111 /* PercentEqualsToken */; - } else { - return 92 /* PercentToken */; - } - }; - - Scanner.prototype.scanMinusToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 109 /* MinusEqualsToken */; - } else if (character === 45 /* minus */) { - this.slidingWindow.moveToNextItem(); - return 94 /* MinusMinusToken */; - } else { - return 90 /* MinusToken */; - } - }; - - Scanner.prototype.scanPlusToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 108 /* PlusEqualsToken */; - } else if (character === 43 /* plus */) { - this.slidingWindow.moveToNextItem(); - return 93 /* PlusPlusToken */; - } else { - return 89 /* PlusToken */; - } - }; - - Scanner.prototype.scanAsteriskToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 110 /* AsteriskEqualsToken */; - } else { - return 91 /* AsteriskToken */; - } - }; - - Scanner.prototype.scanEqualsToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - return 87 /* EqualsEqualsEqualsToken */; - } else { - return 84 /* EqualsEqualsToken */; - } - } else if (character === 62 /* greaterThan */) { - this.slidingWindow.moveToNextItem(); - return 85 /* EqualsGreaterThanToken */; - } else { - return 107 /* EqualsToken */; - } - }; - - Scanner.prototype.isDotPrefixedNumericLiteral = function () { - if (this.currentCharCode() === 46 /* dot */) { - var ch = this.slidingWindow.peekItemN(1); - return TypeScript.CharacterInfo.isDecimalDigit(ch); - } - - return false; - }; - - Scanner.prototype.scanDotToken = function (diagnostics) { - if (this.isDotPrefixedNumericLiteral()) { - return this.scanNumericLiteral(diagnostics); - } - - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 46 /* dot */ && this.slidingWindow.peekItemN(1) === 46 /* dot */) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - return 77 /* DotDotDotToken */; - } else { - return 76 /* DotToken */; - } - }; - - Scanner.prototype.scanSlashToken = function (allowRegularExpression) { - if (allowRegularExpression) { - var result = this.tryScanRegularExpressionToken(); - if (result !== 0 /* None */) { - return result; - } - } - - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 119 /* SlashEqualsToken */; - } else { - return 118 /* SlashToken */; - } - }; - - Scanner.prototype.tryScanRegularExpressionToken = function () { - var startIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - - this.slidingWindow.moveToNextItem(); - - var inEscape = false; - var inCharacterClass = false; - while (true) { - var ch = this.currentCharCode(); - - if (this.isNewLineCharacter(ch) || this.slidingWindow.isAtEndOfSource()) { - this.slidingWindow.rewindToPinnedIndex(startIndex); - this.slidingWindow.releaseAndUnpinAbsoluteIndex(startIndex); - return 0 /* None */; - } - - this.slidingWindow.moveToNextItem(); - if (inEscape) { - inEscape = false; - continue; - } - - switch (ch) { - case 92 /* backslash */: - inEscape = true; - continue; - - case 91 /* openBracket */: - inCharacterClass = true; - continue; - - case 93 /* closeBracket */: - inCharacterClass = false; - continue; - - case 47 /* slash */: - if (inCharacterClass) { - continue; - } - - break; - - default: - continue; - } - - break; - } - - while (isIdentifierPartCharacter[this.currentCharCode()]) { - this.slidingWindow.moveToNextItem(); - } - - this.slidingWindow.releaseAndUnpinAbsoluteIndex(startIndex); - return 12 /* RegularExpressionLiteral */; - }; - - Scanner.prototype.scanExclamationToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - return 88 /* ExclamationEqualsEqualsToken */; - } else { - return 86 /* ExclamationEqualsToken */; - } - } else { - return 101 /* ExclamationToken */; - } - }; - - Scanner.prototype.scanDefaultCharacter = function (character, diagnostics) { - var position = this.slidingWindow.absoluteIndex(); - this.slidingWindow.moveToNextItem(); - - var text = String.fromCharCode(character); - var messageText = this.getErrorMessageText(text); - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), position, 1, TypeScript.DiagnosticCode.Unexpected_character_0, [messageText])); - - return 9 /* ErrorToken */; - }; - - Scanner.prototype.getErrorMessageText = function (text) { - if (text === "\\") { - return '"\\"'; - } - - return JSON.stringify(text); - }; - - Scanner.prototype.skipEscapeSequence = function (diagnostics) { - var rewindPoint = this.slidingWindow.getAndPinAbsoluteIndex(); - - this.slidingWindow.moveToNextItem(); - - var ch = this.currentCharCode(); - this.slidingWindow.moveToNextItem(); - switch (ch) { - case 120 /* x */: - case 117 /* u */: - this.slidingWindow.rewindToPinnedIndex(rewindPoint); - var value = this.scanUnicodeOrHexEscape(diagnostics); - break; - - case 13 /* carriageReturn */: - if (this.currentCharCode() === 10 /* lineFeed */) { - this.slidingWindow.moveToNextItem(); - } - break; - - default: - break; - } - - this.slidingWindow.releaseAndUnpinAbsoluteIndex(rewindPoint); - }; - - Scanner.prototype.scanStringLiteral = function (diagnostics) { - var quoteCharacter = this.currentCharCode(); - - this.slidingWindow.moveToNextItem(); - - while (true) { - var ch = this.currentCharCode(); - if (ch === 92 /* backslash */) { - this.skipEscapeSequence(diagnostics); - } else if (ch === quoteCharacter) { - this.slidingWindow.moveToNextItem(); - break; - } else if (this.isNewLineCharacter(ch) || this.slidingWindow.isAtEndOfSource()) { - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), TypeScript.MathPrototype.min(this.slidingWindow.absoluteIndex(), this.text.length()), 1, TypeScript.DiagnosticCode.Missing_close_quote_character, null)); - break; - } else { - this.slidingWindow.moveToNextItem(); - } - } - - return 14 /* StringLiteral */; - }; - - Scanner.prototype.isUnicodeEscape = function (character) { - if (character === 92 /* backslash */) { - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 117 /* u */) { - return true; - } - } - - return false; - }; - - Scanner.prototype.peekCharOrUnicodeEscape = function () { - var character = this.currentCharCode(); - if (this.isUnicodeEscape(character)) { - return this.peekUnicodeOrHexEscape(); - } else { - return character; - } - }; - - Scanner.prototype.peekUnicodeOrHexEscape = function () { - var startIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - - var ch = this.scanUnicodeOrHexEscape(null); - - this.slidingWindow.rewindToPinnedIndex(startIndex); - this.slidingWindow.releaseAndUnpinAbsoluteIndex(startIndex); - - return ch; - }; - - Scanner.prototype.scanCharOrUnicodeEscape = function (errors) { - var ch = this.currentCharCode(); - if (ch === 92 /* backslash */) { - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 117 /* u */) { - this.scanUnicodeOrHexEscape(errors); - return true; - } - } - - this.slidingWindow.moveToNextItem(); - return false; - }; - - Scanner.prototype.scanUnicodeOrHexEscape = function (errors) { - var start = this.slidingWindow.absoluteIndex(); - var character = this.currentCharCode(); - - this.slidingWindow.moveToNextItem(); - - character = this.currentCharCode(); - - var intChar = 0; - this.slidingWindow.moveToNextItem(); - - var count = character === 117 /* u */ ? 4 : 2; - - for (var i = 0; i < count; i++) { - var ch2 = this.currentCharCode(); - if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { - if (errors !== null) { - var end = this.slidingWindow.absoluteIndex(); - var info = this.createIllegalEscapeDiagnostic(start, end); - errors.push(info); - } - - break; - } - - intChar = (intChar << 4) + TypeScript.CharacterInfo.hexValue(ch2); - this.slidingWindow.moveToNextItem(); - } - - return intChar; - }; - - Scanner.prototype.substring = function (start, end, intern) { - var length = end - start; - var offset = start - this.slidingWindow.windowAbsoluteStartIndex; - - if (intern) { - return TypeScript.Collections.DefaultStringTable.addCharArray(this.slidingWindow.window, offset, length); - } else { - return TypeScript.StringUtilities.fromCharCodeArray(this.slidingWindow.window.slice(offset, offset + length)); - } - }; - - Scanner.prototype.createIllegalEscapeDiagnostic = function (start, end) { - return new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), start, end - start, TypeScript.DiagnosticCode.Unrecognized_escape_sequence, null); - }; - - Scanner.isValidIdentifier = function (text, languageVersion) { - var scanner = new Scanner(null, text, languageVersion, Scanner.triviaWindow); - var errors = new Array(); - var token = scanner.scan(errors, false); - - return errors.length === 0 && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token) && token.width() === text.length(); - }; - Scanner.triviaWindow = TypeScript.ArrayUtilities.createArray(2048, 0); - return Scanner; - })(); - TypeScript.Scanner = Scanner; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ScannerUtilities = (function () { - function ScannerUtilities() { - } - ScannerUtilities.identifierKind = function (array, startIndex, length) { - switch (length) { - case 2: - switch (array[startIndex]) { - case 100 /* d */: - return (array[startIndex + 1] === 111 /* o */) ? 22 /* DoKeyword */ : 11 /* IdentifierName */; - case 105 /* i */: - switch (array[startIndex + 1]) { - case 102 /* f */: - return 28 /* IfKeyword */; - case 110 /* n */: - return 29 /* InKeyword */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 3: - switch (array[startIndex]) { - case 102 /* f */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 114 /* r */) ? 26 /* ForKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 119 /* w */) ? 31 /* NewKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - return (array[startIndex + 1] === 114 /* r */ && array[startIndex + 2] === 121 /* y */) ? 38 /* TryKeyword */ : 11 /* IdentifierName */; - case 118 /* v */: - return (array[startIndex + 1] === 97 /* a */ && array[startIndex + 2] === 114 /* r */) ? 40 /* VarKeyword */ : 11 /* IdentifierName */; - case 108 /* l */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */) ? 53 /* LetKeyword */ : 11 /* IdentifierName */; - case 97 /* a */: - return (array[startIndex + 1] === 110 /* n */ && array[startIndex + 2] === 121 /* y */) ? 60 /* AnyKeyword */ : 11 /* IdentifierName */; - case 103 /* g */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */) ? 64 /* GetKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */) ? 68 /* SetKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 4: - switch (array[startIndex]) { - case 99 /* c */: - return (array[startIndex + 1] === 97 /* a */ && array[startIndex + 2] === 115 /* s */ && array[startIndex + 3] === 101 /* e */) ? 16 /* CaseKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - switch (array[startIndex + 1]) { - case 108 /* l */: - return (array[startIndex + 2] === 115 /* s */ && array[startIndex + 3] === 101 /* e */) ? 23 /* ElseKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (array[startIndex + 2] === 117 /* u */ && array[startIndex + 3] === 109 /* m */) ? 46 /* EnumKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 110 /* n */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 108 /* l */ && array[startIndex + 3] === 108 /* l */) ? 32 /* NullKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - switch (array[startIndex + 1]) { - case 104 /* h */: - return (array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 115 /* s */) ? 35 /* ThisKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 2] === 117 /* u */ && array[startIndex + 3] === 101 /* e */) ? 37 /* TrueKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 118 /* v */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 100 /* d */) ? 41 /* VoidKeyword */ : 11 /* IdentifierName */; - case 119 /* w */: - return (array[startIndex + 1] === 105 /* i */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 104 /* h */) ? 43 /* WithKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 5: - switch (array[startIndex]) { - case 98 /* b */: - return (array[startIndex + 1] === 114 /* r */ && array[startIndex + 2] === 101 /* e */ && array[startIndex + 3] === 97 /* a */ && array[startIndex + 4] === 107 /* k */) ? 15 /* BreakKeyword */ : 11 /* IdentifierName */; - case 99 /* c */: - switch (array[startIndex + 1]) { - case 97 /* a */: - return (array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 99 /* c */ && array[startIndex + 4] === 104 /* h */) ? 17 /* CatchKeyword */ : 11 /* IdentifierName */; - case 108 /* l */: - return (array[startIndex + 2] === 97 /* a */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 115 /* s */) ? 44 /* ClassKeyword */ : 11 /* IdentifierName */; - case 111 /* o */: - return (array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 116 /* t */) ? 45 /* ConstKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 102 /* f */: - return (array[startIndex + 1] === 97 /* a */ && array[startIndex + 2] === 108 /* l */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 101 /* e */) ? 24 /* FalseKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - return (array[startIndex + 1] === 104 /* h */ && array[startIndex + 2] === 114 /* r */ && array[startIndex + 3] === 111 /* o */ && array[startIndex + 4] === 119 /* w */) ? 36 /* ThrowKeyword */ : 11 /* IdentifierName */; - case 119 /* w */: - return (array[startIndex + 1] === 104 /* h */ && array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 101 /* e */) ? 42 /* WhileKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 114 /* r */) ? 50 /* SuperKeyword */ : 11 /* IdentifierName */; - case 121 /* y */: - return (array[startIndex + 1] === 105 /* i */ && array[startIndex + 2] === 101 /* e */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 100 /* d */) ? 59 /* YieldKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 6: - switch (array[startIndex]) { - case 100 /* d */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 108 /* l */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 116 /* t */ && array[startIndex + 5] === 101 /* e */) ? 21 /* DeleteKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 110 /* n */) ? 33 /* ReturnKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - switch (array[startIndex + 1]) { - case 119 /* w */: - return (array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 99 /* c */ && array[startIndex + 5] === 104 /* h */) ? 34 /* SwitchKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - switch (array[startIndex + 2]) { - case 97 /* a */: - return (array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 99 /* c */) ? 58 /* StaticKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 3] === 105 /* i */ && array[startIndex + 4] === 110 /* n */ && array[startIndex + 5] === 103 /* g */) ? 69 /* StringKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 116 /* t */: - return (array[startIndex + 1] === 121 /* y */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 111 /* o */ && array[startIndex + 5] === 102 /* f */) ? 39 /* TypeOfKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - return (array[startIndex + 1] === 120 /* x */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 111 /* o */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 116 /* t */) ? 47 /* ExportKeyword */ : 11 /* IdentifierName */; - case 105 /* i */: - return (array[startIndex + 1] === 109 /* m */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 111 /* o */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 116 /* t */) ? 49 /* ImportKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 98 /* b */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 99 /* c */) ? 57 /* PublicKeyword */ : 11 /* IdentifierName */; - case 109 /* m */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 100 /* d */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 108 /* l */ && array[startIndex + 5] === 101 /* e */) ? 65 /* ModuleKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 109 /* m */ && array[startIndex + 3] === 98 /* b */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 114 /* r */) ? 67 /* NumberKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 7: - switch (array[startIndex]) { - case 100 /* d */: - switch (array[startIndex + 1]) { - case 101 /* e */: - switch (array[startIndex + 2]) { - case 102 /* f */: - return (array[startIndex + 3] === 97 /* a */ && array[startIndex + 4] === 117 /* u */ && array[startIndex + 5] === 108 /* l */ && array[startIndex + 6] === 116 /* t */) ? 20 /* DefaultKeyword */ : 11 /* IdentifierName */; - case 99 /* c */: - return (array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 114 /* r */ && array[startIndex + 6] === 101 /* e */) ? 63 /* DeclareKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 102 /* f */: - return (array[startIndex + 1] === 105 /* i */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 97 /* a */ && array[startIndex + 4] === 108 /* l */ && array[startIndex + 5] === 108 /* l */ && array[startIndex + 6] === 121 /* y */) ? 25 /* FinallyKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - return (array[startIndex + 1] === 120 /* x */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 110 /* n */ && array[startIndex + 5] === 100 /* d */ && array[startIndex + 6] === 115 /* s */) ? 48 /* ExtendsKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - switch (array[startIndex + 1]) { - case 97 /* a */: - return (array[startIndex + 2] === 99 /* c */ && array[startIndex + 3] === 107 /* k */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 103 /* g */ && array[startIndex + 6] === 101 /* e */) ? 54 /* PackageKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 118 /* v */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 116 /* t */ && array[startIndex + 6] === 101 /* e */) ? 55 /* PrivateKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 98 /* b */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 111 /* o */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 97 /* a */ && array[startIndex + 6] === 110 /* n */) ? 61 /* BooleanKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 113 /* q */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 114 /* r */ && array[startIndex + 6] === 101 /* e */) ? 66 /* RequireKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 8: - switch (array[startIndex]) { - case 99 /* c */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 110 /* n */ && array[startIndex + 6] === 117 /* u */ && array[startIndex + 7] === 101 /* e */) ? 18 /* ContinueKeyword */ : 11 /* IdentifierName */; - case 100 /* d */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 98 /* b */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 103 /* g */ && array[startIndex + 5] === 103 /* g */ && array[startIndex + 6] === 101 /* e */ && array[startIndex + 7] === 114 /* r */) ? 19 /* DebuggerKeyword */ : 11 /* IdentifierName */; - case 102 /* f */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 99 /* c */ && array[startIndex + 4] === 116 /* t */ && array[startIndex + 5] === 105 /* i */ && array[startIndex + 6] === 111 /* o */ && array[startIndex + 7] === 110 /* n */) ? 27 /* FunctionKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 9: - switch (array[startIndex]) { - case 105 /* i */: - return (array[startIndex + 1] === 110 /* n */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 102 /* f */ && array[startIndex + 6] === 97 /* a */ && array[startIndex + 7] === 99 /* c */ && array[startIndex + 8] === 101 /* e */) ? 52 /* InterfaceKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - return (array[startIndex + 1] === 114 /* r */ && array[startIndex + 2] === 111 /* o */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 99 /* c */ && array[startIndex + 6] === 116 /* t */ && array[startIndex + 7] === 101 /* e */ && array[startIndex + 8] === 100 /* d */) ? 56 /* ProtectedKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 10: - switch (array[startIndex]) { - case 105 /* i */: - switch (array[startIndex + 1]) { - case 110 /* n */: - return (array[startIndex + 2] === 115 /* s */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 110 /* n */ && array[startIndex + 6] === 99 /* c */ && array[startIndex + 7] === 101 /* e */ && array[startIndex + 8] === 111 /* o */ && array[startIndex + 9] === 102 /* f */) ? 30 /* InstanceOfKeyword */ : 11 /* IdentifierName */; - case 109 /* m */: - return (array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 109 /* m */ && array[startIndex + 6] === 101 /* e */ && array[startIndex + 7] === 110 /* n */ && array[startIndex + 8] === 116 /* t */ && array[startIndex + 9] === 115 /* s */) ? 51 /* ImplementsKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 11: - return (array[startIndex] === 99 /* c */ && array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 116 /* t */ && array[startIndex + 5] === 114 /* r */ && array[startIndex + 6] === 117 /* u */ && array[startIndex + 7] === 99 /* c */ && array[startIndex + 8] === 116 /* t */ && array[startIndex + 9] === 111 /* o */ && array[startIndex + 10] === 114 /* r */) ? 62 /* ConstructorKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - }; - return ScannerUtilities; - })(); - TypeScript.ScannerUtilities = ScannerUtilities; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var EmptySeparatedSyntaxList = (function () { - function EmptySeparatedSyntaxList() { - } - EmptySeparatedSyntaxList.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - EmptySeparatedSyntaxList.prototype.isNode = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isToken = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isList = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isSeparatedList = function () { - return true; - }; - - EmptySeparatedSyntaxList.prototype.toJSON = function (key) { - return []; - }; - - EmptySeparatedSyntaxList.prototype.childCount = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.nonSeparatorCount = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.separatorCount = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.toArray = function () { - return []; - }; - - EmptySeparatedSyntaxList.prototype.toNonSeparatorArray = function () { - return []; - }; - - EmptySeparatedSyntaxList.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySeparatedSyntaxList.prototype.nonSeparatorAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySeparatedSyntaxList.prototype.separatorAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySeparatedSyntaxList.prototype.collectTextElements = function (elements) { - }; - - EmptySeparatedSyntaxList.prototype.firstToken = function () { - return null; - }; - - EmptySeparatedSyntaxList.prototype.lastToken = function () { - return null; - }; - - EmptySeparatedSyntaxList.prototype.fullWidth = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.fullText = function () { - return ""; - }; - - EmptySeparatedSyntaxList.prototype.width = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.isTypeScriptSpecific = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isIncrementallyUnusable = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - throw TypeScript.Errors.invalidOperation(); - }; - - EmptySeparatedSyntaxList.prototype.insertChildrenInto = function (array, index) { - }; - - EmptySeparatedSyntaxList.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySeparatedSyntaxList.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySeparatedSyntaxList.prototype.leadingTriviaWidth = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.trailingTriviaWidth = function () { - return 0; - }; - return EmptySeparatedSyntaxList; - })(); - - Syntax.emptySeparatedList = new EmptySeparatedSyntaxList(); - - var SingletonSeparatedSyntaxList = (function () { - function SingletonSeparatedSyntaxList(item) { - this.item = item; - } - SingletonSeparatedSyntaxList.prototype.toJSON = function (key) { - return [this.item]; - }; - - SingletonSeparatedSyntaxList.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - SingletonSeparatedSyntaxList.prototype.isNode = function () { - return false; - }; - SingletonSeparatedSyntaxList.prototype.isToken = function () { - return false; - }; - SingletonSeparatedSyntaxList.prototype.isList = function () { - return false; - }; - SingletonSeparatedSyntaxList.prototype.isSeparatedList = function () { - return true; - }; - - SingletonSeparatedSyntaxList.prototype.childCount = function () { - return 1; - }; - SingletonSeparatedSyntaxList.prototype.nonSeparatorCount = function () { - return 1; - }; - SingletonSeparatedSyntaxList.prototype.separatorCount = function () { - return 0; - }; - - SingletonSeparatedSyntaxList.prototype.toArray = function () { - return [this.item]; - }; - SingletonSeparatedSyntaxList.prototype.toNonSeparatorArray = function () { - return [this.item]; - }; - - SingletonSeparatedSyntaxList.prototype.childAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSeparatedSyntaxList.prototype.nonSeparatorAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSeparatedSyntaxList.prototype.separatorAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - SingletonSeparatedSyntaxList.prototype.collectTextElements = function (elements) { - this.item.collectTextElements(elements); - }; - - SingletonSeparatedSyntaxList.prototype.firstToken = function () { - return this.item.firstToken(); - }; - - SingletonSeparatedSyntaxList.prototype.lastToken = function () { - return this.item.lastToken(); - }; - - SingletonSeparatedSyntaxList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - - SingletonSeparatedSyntaxList.prototype.width = function () { - return this.item.width(); - }; - - SingletonSeparatedSyntaxList.prototype.fullText = function () { - return this.item.fullText(); - }; - - SingletonSeparatedSyntaxList.prototype.leadingTrivia = function () { - return this.item.leadingTrivia(); - }; - - SingletonSeparatedSyntaxList.prototype.trailingTrivia = function () { - return this.item.trailingTrivia(); - }; - - SingletonSeparatedSyntaxList.prototype.leadingTriviaWidth = function () { - return this.item.leadingTriviaWidth(); - }; - - SingletonSeparatedSyntaxList.prototype.trailingTriviaWidth = function () { - return this.item.trailingTriviaWidth(); - }; - - SingletonSeparatedSyntaxList.prototype.isTypeScriptSpecific = function () { - return this.item.isTypeScriptSpecific(); - }; - - SingletonSeparatedSyntaxList.prototype.isIncrementallyUnusable = function () { - return this.item.isIncrementallyUnusable(); - }; - - SingletonSeparatedSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - return this.item.findTokenInternal(new TypeScript.PositionedSeparatedList(parent, this, fullStart), position, fullStart); - }; - - SingletonSeparatedSyntaxList.prototype.insertChildrenInto = function (array, index) { - array.splice(index, 0, this.item); - }; - return SingletonSeparatedSyntaxList; - })(); - - var NormalSeparatedSyntaxList = (function () { - function NormalSeparatedSyntaxList(elements) { - this._data = 0; - this.elements = elements; - } - NormalSeparatedSyntaxList.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - NormalSeparatedSyntaxList.prototype.isToken = function () { - return false; - }; - NormalSeparatedSyntaxList.prototype.isNode = function () { - return false; - }; - NormalSeparatedSyntaxList.prototype.isList = function () { - return false; - }; - NormalSeparatedSyntaxList.prototype.isSeparatedList = function () { - return true; - }; - NormalSeparatedSyntaxList.prototype.toJSON = function (key) { - return this.elements; - }; - - NormalSeparatedSyntaxList.prototype.childCount = function () { - return this.elements.length; - }; - NormalSeparatedSyntaxList.prototype.nonSeparatorCount = function () { - return TypeScript.IntegerUtilities.integerDivide(this.elements.length + 1, 2); - }; - NormalSeparatedSyntaxList.prototype.separatorCount = function () { - return TypeScript.IntegerUtilities.integerDivide(this.elements.length, 2); - }; - - NormalSeparatedSyntaxList.prototype.toArray = function () { - return this.elements.slice(0); - }; - - NormalSeparatedSyntaxList.prototype.toNonSeparatorArray = function () { - var result = []; - for (var i = 0, n = this.nonSeparatorCount(); i < n; i++) { - result.push(this.nonSeparatorAt(i)); - } - - return result; - }; - - NormalSeparatedSyntaxList.prototype.childAt = function (index) { - if (index < 0 || index >= this.elements.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.elements[index]; - }; - - NormalSeparatedSyntaxList.prototype.nonSeparatorAt = function (index) { - var value = index * 2; - if (value < 0 || value >= this.elements.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.elements[value]; - }; - - NormalSeparatedSyntaxList.prototype.separatorAt = function (index) { - var value = index * 2 + 1; - if (value < 0 || value >= this.elements.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.elements[value]; - }; - - NormalSeparatedSyntaxList.prototype.firstToken = function () { - var token; - for (var i = 0, n = this.elements.length; i < n; i++) { - if (i % 2 === 0) { - var nodeOrToken = this.elements[i]; - token = nodeOrToken.firstToken(); - if (token !== null) { - return token; - } - } else { - token = this.elements[i]; - if (token.width() > 0) { - return token; - } - } - } - - return null; - }; - - NormalSeparatedSyntaxList.prototype.lastToken = function () { - var token; - for (var i = this.elements.length - 1; i >= 0; i--) { - if (i % 2 === 0) { - var nodeOrToken = this.elements[i]; - token = nodeOrToken.lastToken(); - if (token !== null) { - return token; - } - } else { - token = this.elements[i]; - if (token.width() > 0) { - return token; - } - } - } - - return null; - }; - - NormalSeparatedSyntaxList.prototype.fullText = function () { - var elements = []; - this.collectTextElements(elements); - return elements.join(""); - }; - - NormalSeparatedSyntaxList.prototype.isTypeScriptSpecific = function () { - for (var i = 0, n = this.nonSeparatorCount(); i < n; i++) { - if (this.nonSeparatorAt(i).isTypeScriptSpecific()) { - return true; - } - } - - return false; - }; - - NormalSeparatedSyntaxList.prototype.isIncrementallyUnusable = function () { - return (this.data() & 2 /* NodeIncrementallyUnusableMask */) !== 0; - }; - - NormalSeparatedSyntaxList.prototype.fullWidth = function () { - return this.data() >>> 3 /* NodeFullWidthShift */; - }; - - NormalSeparatedSyntaxList.prototype.width = function () { - var fullWidth = this.fullWidth(); - return fullWidth - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - NormalSeparatedSyntaxList.prototype.leadingTrivia = function () { - return this.firstToken().leadingTrivia(); - }; - - NormalSeparatedSyntaxList.prototype.trailingTrivia = function () { - return this.lastToken().trailingTrivia(); - }; - - NormalSeparatedSyntaxList.prototype.leadingTriviaWidth = function () { - return this.firstToken().leadingTriviaWidth(); - }; - - NormalSeparatedSyntaxList.prototype.trailingTriviaWidth = function () { - return this.lastToken().trailingTriviaWidth(); - }; - - NormalSeparatedSyntaxList.prototype.computeData = function () { - var fullWidth = 0; - var isIncrementallyUnusable = false; - - for (var i = 0, n = this.elements.length; i < n; i++) { - var element = this.elements[i]; - - var childWidth = element.fullWidth(); - fullWidth += childWidth; - - isIncrementallyUnusable = isIncrementallyUnusable || element.isIncrementallyUnusable(); - } - - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - }; - - NormalSeparatedSyntaxList.prototype.data = function () { - if ((this._data & 1 /* NodeDataComputed */) === 0) { - this._data = this.computeData(); - } - - return this._data; - }; - - NormalSeparatedSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - parent = new TypeScript.PositionedSeparatedList(parent, this, fullStart); - for (var i = 0, n = this.elements.length; i < n; i++) { - var element = this.elements[i]; - - var childWidth = element.fullWidth(); - if (position < childWidth) { - return element.findTokenInternal(parent, position, fullStart); - } - - position -= childWidth; - fullStart += childWidth; - } - - throw TypeScript.Errors.invalidOperation(); - }; - - NormalSeparatedSyntaxList.prototype.collectTextElements = function (elements) { - for (var i = 0, n = this.elements.length; i < n; i++) { - var element = this.elements[i]; - element.collectTextElements(elements); - } - }; - - NormalSeparatedSyntaxList.prototype.insertChildrenInto = function (array, index) { - if (index === 0) { - array.unshift.apply(array, this.elements); - } else { - array.splice.apply(array, [index, 0].concat(this.elements)); - } - }; - return NormalSeparatedSyntaxList; - })(); - - function separatedList(nodes) { - return separatedListAndValidate(nodes, false); - } - Syntax.separatedList = separatedList; - - function separatedListAndValidate(nodes, validate) { - if (nodes === undefined || nodes === null || nodes.length === 0) { - return Syntax.emptySeparatedList; - } - - if (validate) { - for (var i = 0; i < nodes.length; i++) { - var item = nodes[i]; - - if (i % 2 === 1) { - } - } - } - - if (nodes.length === 1) { - return new SingletonSeparatedSyntaxList(nodes[0]); - } - - return new NormalSeparatedSyntaxList(nodes); - } - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SlidingWindow = (function () { - function SlidingWindow(source, window, defaultValue, sourceLength) { - if (typeof sourceLength === "undefined") { sourceLength = -1; } - this.source = source; - this.window = window; - this.defaultValue = defaultValue; - this.sourceLength = sourceLength; - this.windowCount = 0; - this.windowAbsoluteStartIndex = 0; - this.currentRelativeItemIndex = 0; - this._pinCount = 0; - this.firstPinnedAbsoluteIndex = -1; - } - SlidingWindow.prototype.windowAbsoluteEndIndex = function () { - return this.windowAbsoluteStartIndex + this.windowCount; - }; - - SlidingWindow.prototype.addMoreItemsToWindow = function (argument) { - if (this.sourceLength >= 0 && this.absoluteIndex() >= this.sourceLength) { - return false; - } - - if (this.windowCount >= this.window.length) { - this.tryShiftOrGrowWindow(); - } - - var spaceAvailable = this.window.length - this.windowCount; - var amountFetched = this.source.fetchMoreItems(argument, this.windowAbsoluteEndIndex(), this.window, this.windowCount, spaceAvailable); - - this.windowCount += amountFetched; - return amountFetched > 0; - }; - - SlidingWindow.prototype.tryShiftOrGrowWindow = function () { - var currentIndexIsPastWindowHalfwayPoint = this.currentRelativeItemIndex > (this.window.length >>> 1); - - var isAllowedToShift = this.firstPinnedAbsoluteIndex === -1 || this.firstPinnedAbsoluteIndex > this.windowAbsoluteStartIndex; - - if (currentIndexIsPastWindowHalfwayPoint && isAllowedToShift) { - var shiftStartIndex = this.firstPinnedAbsoluteIndex === -1 ? this.currentRelativeItemIndex : this.firstPinnedAbsoluteIndex - this.windowAbsoluteStartIndex; - - var shiftCount = this.windowCount - shiftStartIndex; - - if (shiftCount > 0) { - TypeScript.ArrayUtilities.copy(this.window, shiftStartIndex, this.window, 0, shiftCount); - } - - this.windowAbsoluteStartIndex += shiftStartIndex; - - this.windowCount -= shiftStartIndex; - - this.currentRelativeItemIndex -= shiftStartIndex; - } else { - TypeScript.ArrayUtilities.grow(this.window, this.window.length * 2, this.defaultValue); - } - }; - - SlidingWindow.prototype.absoluteIndex = function () { - return this.windowAbsoluteStartIndex + this.currentRelativeItemIndex; - }; - - SlidingWindow.prototype.isAtEndOfSource = function () { - return this.absoluteIndex() >= this.sourceLength; - }; - - SlidingWindow.prototype.getAndPinAbsoluteIndex = function () { - var absoluteIndex = this.absoluteIndex(); - var pinCount = this._pinCount++; - if (pinCount === 0) { - this.firstPinnedAbsoluteIndex = absoluteIndex; - } - - return absoluteIndex; - }; - - SlidingWindow.prototype.releaseAndUnpinAbsoluteIndex = function (absoluteIndex) { - this._pinCount--; - if (this._pinCount === 0) { - this.firstPinnedAbsoluteIndex = -1; - } - }; - - SlidingWindow.prototype.rewindToPinnedIndex = function (absoluteIndex) { - var relativeIndex = absoluteIndex - this.windowAbsoluteStartIndex; - - this.currentRelativeItemIndex = relativeIndex; - }; - - SlidingWindow.prototype.currentItem = function (argument) { - if (this.currentRelativeItemIndex >= this.windowCount) { - if (!this.addMoreItemsToWindow(argument)) { - return this.defaultValue; - } - } - - return this.window[this.currentRelativeItemIndex]; - }; - - SlidingWindow.prototype.peekItemN = function (n) { - while (this.currentRelativeItemIndex + n >= this.windowCount) { - if (!this.addMoreItemsToWindow(null)) { - return this.defaultValue; - } - } - - return this.window[this.currentRelativeItemIndex + n]; - }; - - SlidingWindow.prototype.moveToNextItem = function () { - this.currentRelativeItemIndex++; - }; - - SlidingWindow.prototype.disgardAllItemsFromCurrentIndexOnwards = function () { - this.windowCount = this.currentRelativeItemIndex; - }; - - SlidingWindow.prototype.setAbsoluteIndex = function (absoluteIndex) { - if (this.absoluteIndex() === absoluteIndex) { - return; - } - - if (this._pinCount > 0) { - } - - if (absoluteIndex >= this.windowAbsoluteStartIndex && absoluteIndex < this.windowAbsoluteEndIndex()) { - this.currentRelativeItemIndex = (absoluteIndex - this.windowAbsoluteStartIndex); - } else { - this.windowAbsoluteStartIndex = absoluteIndex; - - this.windowCount = 0; - - this.currentRelativeItemIndex = 0; - } - }; - - SlidingWindow.prototype.pinCount = function () { - return this._pinCount; - }; - return SlidingWindow; - })(); - TypeScript.SlidingWindow = SlidingWindow; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - function emptySourceUnit() { - return Syntax.normalModeFactory.sourceUnit(Syntax.emptyList, Syntax.token(10 /* EndOfFileToken */, { text: "" })); - } - Syntax.emptySourceUnit = emptySourceUnit; - - function getStandaloneExpression(positionedToken) { - var token = positionedToken.token(); - if (positionedToken !== null && positionedToken.kind() === 11 /* IdentifierName */) { - var parentPositionedNode = positionedToken.containingNode(); - var parentNode = parentPositionedNode.node(); - - if (parentNode.kind() === 121 /* QualifiedName */ && parentNode.right === token) { - return parentPositionedNode; - } else if (parentNode.kind() === 212 /* MemberAccessExpression */ && parentNode.name === token) { - return parentPositionedNode; - } - } - - return positionedToken; - } - Syntax.getStandaloneExpression = getStandaloneExpression; - - function isInModuleOrTypeContext(positionedToken) { - if (positionedToken !== null) { - var positionedNodeOrToken = Syntax.getStandaloneExpression(positionedToken); - var parent = positionedNodeOrToken.containingNode(); - - if (parent !== null) { - switch (parent.kind()) { - case 246 /* ModuleNameModuleReference */: - return true; - case 121 /* QualifiedName */: - return true; - default: - return isInTypeOnlyContext(positionedToken); - } - } - } - - return false; - } - Syntax.isInModuleOrTypeContext = isInModuleOrTypeContext; - - function isInTypeOnlyContext(positionedToken) { - var positionedNodeOrToken = Syntax.getStandaloneExpression(positionedToken); - var positionedParent = positionedNodeOrToken.containingNode(); - - var parent = positionedParent.node(); - var nodeOrToken = positionedNodeOrToken.nodeOrToken(); - - if (parent !== null) { - switch (parent.kind()) { - case 124 /* ArrayType */: - return parent.type === nodeOrToken; - case 220 /* CastExpression */: - return parent.type === nodeOrToken; - case 244 /* TypeAnnotation */: - case 230 /* ExtendsHeritageClause */: - case 231 /* ImplementsHeritageClause */: - case 228 /* TypeArgumentList */: - return true; - } - } - - return false; - } - Syntax.isInTypeOnlyContext = isInTypeOnlyContext; - - function childOffset(parent, child) { - var offset = 0; - for (var i = 0, n = parent.childCount(); i < n; i++) { - var current = parent.childAt(i); - if (current === child) { - return offset; - } - - if (current !== null) { - offset += current.fullWidth(); - } - } - - throw TypeScript.Errors.invalidOperation(); - } - Syntax.childOffset = childOffset; - - function childOffsetAt(parent, index) { - var offset = 0; - for (var i = 0; i < index; i++) { - var current = parent.childAt(i); - if (current !== null) { - offset += current.fullWidth(); - } - } - - return offset; - } - Syntax.childOffsetAt = childOffsetAt; - - function childIndex(parent, child) { - for (var i = 0, n = parent.childCount(); i < n; i++) { - var current = parent.childAt(i); - if (current === child) { - return i; - } - } - - throw TypeScript.Errors.invalidOperation(); - } - Syntax.childIndex = childIndex; - - function nodeStructuralEquals(node1, node2) { - if (node1 === null) { - return node2 === null; - } - - return node1.structuralEquals(node2); - } - Syntax.nodeStructuralEquals = nodeStructuralEquals; - - function nodeOrTokenStructuralEquals(node1, node2) { - if (node1 === node2) { - return true; - } - - if (node1 === null || node2 === null) { - return false; - } - - if (node1.isToken()) { - return node2.isToken() ? tokenStructuralEquals(node1, node2) : false; - } - - return node2.isNode() ? nodeStructuralEquals(node1, node2) : false; - } - Syntax.nodeOrTokenStructuralEquals = nodeOrTokenStructuralEquals; - - function tokenStructuralEquals(token1, token2) { - if (token1 === token2) { - return true; - } - - if (token1 === null || token2 === null) { - return false; - } - - return token1.kind() === token2.kind() && token1.width() === token2.width() && token1.fullWidth() === token2.fullWidth() && token1.text() === token2.text() && Syntax.triviaListStructuralEquals(token1.leadingTrivia(), token2.leadingTrivia()) && Syntax.triviaListStructuralEquals(token1.trailingTrivia(), token2.trailingTrivia()); - } - Syntax.tokenStructuralEquals = tokenStructuralEquals; - - function triviaListStructuralEquals(triviaList1, triviaList2) { - if (triviaList1.count() !== triviaList2.count()) { - return false; - } - - for (var i = 0, n = triviaList1.count(); i < n; i++) { - if (!Syntax.triviaStructuralEquals(triviaList1.syntaxTriviaAt(i), triviaList2.syntaxTriviaAt(i))) { - return false; - } - } - - return true; - } - Syntax.triviaListStructuralEquals = triviaListStructuralEquals; - - function triviaStructuralEquals(trivia1, trivia2) { - return trivia1.kind() === trivia2.kind() && trivia1.fullWidth() === trivia2.fullWidth() && trivia1.fullText() === trivia2.fullText(); - } - Syntax.triviaStructuralEquals = triviaStructuralEquals; - - function listStructuralEquals(list1, list2) { - if (list1.childCount() !== list2.childCount()) { - return false; - } - - for (var i = 0, n = list1.childCount(); i < n; i++) { - var child1 = list1.childAt(i); - var child2 = list2.childAt(i); - - if (!Syntax.nodeOrTokenStructuralEquals(child1, child2)) { - return false; - } - } - - return true; - } - Syntax.listStructuralEquals = listStructuralEquals; - - function separatedListStructuralEquals(list1, list2) { - if (list1.childCount() !== list2.childCount()) { - return false; - } - - for (var i = 0, n = list1.childCount(); i < n; i++) { - var element1 = list1.childAt(i); - var element2 = list2.childAt(i); - if (!Syntax.nodeOrTokenStructuralEquals(element1, element2)) { - return false; - } - } - - return true; - } - Syntax.separatedListStructuralEquals = separatedListStructuralEquals; - - function elementStructuralEquals(element1, element2) { - if (element1 === element2) { - return true; - } - - if (element1 === null || element2 === null) { - return false; - } - - if (element2.kind() !== element2.kind()) { - return false; - } - - if (element1.isToken()) { - return tokenStructuralEquals(element1, element2); - } else if (element1.isNode()) { - return nodeStructuralEquals(element1, element2); - } else if (element1.isList()) { - return listStructuralEquals(element1, element2); - } else if (element1.isSeparatedList()) { - return separatedListStructuralEquals(element1, element2); - } - - throw TypeScript.Errors.invalidOperation(); - } - Syntax.elementStructuralEquals = elementStructuralEquals; - - function identifierName(text, info) { - if (typeof info === "undefined") { info = null; } - return Syntax.identifier(text); - } - Syntax.identifierName = identifierName; - - function trueExpression() { - return Syntax.token(37 /* TrueKeyword */); - } - Syntax.trueExpression = trueExpression; - - function falseExpression() { - return Syntax.token(24 /* FalseKeyword */); - } - Syntax.falseExpression = falseExpression; - - function numericLiteralExpression(text) { - return Syntax.token(13 /* NumericLiteral */, { text: text }); - } - Syntax.numericLiteralExpression = numericLiteralExpression; - - function stringLiteralExpression(text) { - return Syntax.token(14 /* StringLiteral */, { text: text }); - } - Syntax.stringLiteralExpression = stringLiteralExpression; - - function isSuperInvocationExpression(node) { - return node.kind() === 213 /* InvocationExpression */ && node.expression.kind() === 50 /* SuperKeyword */; - } - Syntax.isSuperInvocationExpression = isSuperInvocationExpression; - - function isSuperInvocationExpressionStatement(node) { - return node.kind() === 149 /* ExpressionStatement */ && isSuperInvocationExpression(node.expression); - } - Syntax.isSuperInvocationExpressionStatement = isSuperInvocationExpressionStatement; - - function isSuperMemberAccessExpression(node) { - return node.kind() === 212 /* MemberAccessExpression */ && node.expression.kind() === 50 /* SuperKeyword */; - } - Syntax.isSuperMemberAccessExpression = isSuperMemberAccessExpression; - - function isSuperMemberAccessInvocationExpression(node) { - return node.kind() === 213 /* InvocationExpression */ && isSuperMemberAccessExpression(node.expression); - } - Syntax.isSuperMemberAccessInvocationExpression = isSuperMemberAccessInvocationExpression; - - function assignmentExpression(left, token, right) { - return Syntax.normalModeFactory.binaryExpression(174 /* AssignmentExpression */, left, token, right); - } - Syntax.assignmentExpression = assignmentExpression; - - function nodeHasSkippedOrMissingTokens(node) { - for (var i = 0; i < node.childCount(); i++) { - var child = node.childAt(i); - if (child !== null && child.isToken()) { - var token = child; - - if (token.hasSkippedToken() || (token.width() === 0 && token.kind() !== 10 /* EndOfFileToken */)) { - return true; - } - } - } - return false; - } - Syntax.nodeHasSkippedOrMissingTokens = nodeHasSkippedOrMissingTokens; - - function isUnterminatedStringLiteral(token) { - if (token && token.kind() === 14 /* StringLiteral */) { - var text = token.text(); - return text.length < 2 || text.charCodeAt(text.length - 1) !== text.charCodeAt(0); - } - - return false; - } - Syntax.isUnterminatedStringLiteral = isUnterminatedStringLiteral; - - function isUnterminatedMultilineCommentTrivia(trivia) { - if (trivia && trivia.kind() === 6 /* MultiLineCommentTrivia */) { - var text = trivia.fullText(); - return text.length < 4 || text.substring(text.length - 2) !== "*/"; - } - return false; - } - Syntax.isUnterminatedMultilineCommentTrivia = isUnterminatedMultilineCommentTrivia; - - function isEntirelyInsideCommentTrivia(trivia, fullStart, position) { - if (trivia && trivia.isComment() && position > fullStart) { - var end = fullStart + trivia.fullWidth(); - if (position < end) { - return true; - } else if (position === end) { - return trivia.kind() === 7 /* SingleLineCommentTrivia */ || isUnterminatedMultilineCommentTrivia(trivia); - } - } - - return false; - } - Syntax.isEntirelyInsideCommentTrivia = isEntirelyInsideCommentTrivia; - - function isEntirelyInsideComment(sourceUnit, position) { - var positionedToken = sourceUnit.findToken(position); - var fullStart = positionedToken.fullStart(); - var triviaList = null; - var lastTriviaBeforeToken = null; - - if (positionedToken.kind() === 10 /* EndOfFileToken */) { - if (positionedToken.token().hasLeadingTrivia()) { - triviaList = positionedToken.token().leadingTrivia(); - } else { - positionedToken = positionedToken.previousToken(); - if (positionedToken) { - if (positionedToken && positionedToken.token().hasTrailingTrivia()) { - triviaList = positionedToken.token().trailingTrivia(); - fullStart = positionedToken.end(); - } - } - } - } else { - if (position <= (fullStart + positionedToken.token().leadingTriviaWidth())) { - triviaList = positionedToken.token().leadingTrivia(); - } else if (position >= (fullStart + positionedToken.token().width())) { - triviaList = positionedToken.token().trailingTrivia(); - fullStart = positionedToken.end(); - } - } - - if (triviaList) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (position <= fullStart) { - break; - } else if (position <= fullStart + trivia.fullWidth() && trivia.isComment()) { - lastTriviaBeforeToken = trivia; - break; - } - - fullStart += trivia.fullWidth(); - } - } - - return lastTriviaBeforeToken && isEntirelyInsideCommentTrivia(lastTriviaBeforeToken, fullStart, position); - } - Syntax.isEntirelyInsideComment = isEntirelyInsideComment; - - function isEntirelyInStringOrRegularExpressionLiteral(sourceUnit, position) { - var positionedToken = sourceUnit.findToken(position); - - if (positionedToken) { - if (positionedToken.kind() === 10 /* EndOfFileToken */) { - positionedToken = positionedToken.previousToken(); - return positionedToken && positionedToken.token().trailingTriviaWidth() === 0 && isUnterminatedStringLiteral(positionedToken.token()); - } else if (position > positionedToken.start()) { - return (position < positionedToken.end() && (positionedToken.kind() === 14 /* StringLiteral */ || positionedToken.kind() === 12 /* RegularExpressionLiteral */)) || (position <= positionedToken.end() && isUnterminatedStringLiteral(positionedToken.token())); - } - } - - return false; - } - Syntax.isEntirelyInStringOrRegularExpressionLiteral = isEntirelyInStringOrRegularExpressionLiteral; - - function findSkippedTokenInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = null; - var fullStart; - - if (lookInLeadingTriviaList) { - triviaList = positionedToken.token().leadingTrivia(); - fullStart = positionedToken.fullStart(); - } else { - triviaList = positionedToken.token().trailingTrivia(); - fullStart = positionedToken.end(); - } - - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - var triviaWidth = trivia.fullWidth(); - - if (trivia.isSkippedToken() && position >= fullStart && position <= fullStart + triviaWidth) { - return new TypeScript.PositionedSkippedToken(positionedToken, trivia.skippedToken(), fullStart); - } - - fullStart += triviaWidth; - } - } - - return null; - } - - function findSkippedTokenOnLeftInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = null; - var fullEnd; - - if (lookInLeadingTriviaList) { - triviaList = positionedToken.token().leadingTrivia(); - fullEnd = positionedToken.fullStart() + triviaList.fullWidth(); - } else { - triviaList = positionedToken.token().trailingTrivia(); - fullEnd = positionedToken.fullEnd(); - } - - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = triviaList.count() - 1; i >= 0; i--) { - var trivia = triviaList.syntaxTriviaAt(i); - var triviaWidth = trivia.fullWidth(); - - if (trivia.isSkippedToken() && position >= fullEnd) { - return new TypeScript.PositionedSkippedToken(positionedToken, trivia.skippedToken(), fullEnd - triviaWidth); - } - - fullEnd -= triviaWidth; - } - } - - return null; - } - - function findSkippedTokenInLeadingTriviaList(positionedToken, position) { - return findSkippedTokenInTriviaList(positionedToken, position, true); - } - Syntax.findSkippedTokenInLeadingTriviaList = findSkippedTokenInLeadingTriviaList; - - function findSkippedTokenInTrailingTriviaList(positionedToken, position) { - return findSkippedTokenInTriviaList(positionedToken, position, false); - } - Syntax.findSkippedTokenInTrailingTriviaList = findSkippedTokenInTrailingTriviaList; - - function findSkippedTokenInPositionedToken(positionedToken, position) { - var positionInLeadingTriviaList = (position < positionedToken.start()); - return findSkippedTokenInTriviaList(positionedToken, position, positionInLeadingTriviaList); - } - Syntax.findSkippedTokenInPositionedToken = findSkippedTokenInPositionedToken; - - function findSkippedTokenOnLeft(positionedToken, position) { - var positionInLeadingTriviaList = (position < positionedToken.start()); - return findSkippedTokenOnLeftInTriviaList(positionedToken, position, positionInLeadingTriviaList); - } - Syntax.findSkippedTokenOnLeft = findSkippedTokenOnLeft; - - function getAncestorOfKind(positionedToken, kind) { - while (positionedToken && positionedToken.parent()) { - if (positionedToken.parent().kind() === kind) { - return positionedToken.parent(); - } - - positionedToken = positionedToken.parent(); - } - - return null; - } - Syntax.getAncestorOfKind = getAncestorOfKind; - - function hasAncestorOfKind(positionedToken, kind) { - return Syntax.getAncestorOfKind(positionedToken, kind) !== null; - } - Syntax.hasAncestorOfKind = hasAncestorOfKind; - - function isIntegerLiteral(expression) { - if (expression) { - switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - expression = expression.operand; - return expression.isToken() && TypeScript.IntegerUtilities.isInteger(expression.text()); - - case 13 /* NumericLiteral */: - var text = expression.text(); - return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); - } - } - - return false; - } - Syntax.isIntegerLiteral = isIntegerLiteral; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var NormalModeFactory = (function () { - function NormalModeFactory() { - } - NormalModeFactory.prototype.sourceUnit = function (moduleElements, endOfFileToken) { - return new TypeScript.SourceUnitSyntax(moduleElements, endOfFileToken, false); - }; - NormalModeFactory.prototype.externalModuleReference = function (requireKeyword, openParenToken, stringLiteral, closeParenToken) { - return new TypeScript.ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, false); - }; - NormalModeFactory.prototype.moduleNameModuleReference = function (moduleName) { - return new TypeScript.ModuleNameModuleReferenceSyntax(moduleName, false); - }; - NormalModeFactory.prototype.importDeclaration = function (modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - return new TypeScript.ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, false); - }; - NormalModeFactory.prototype.exportAssignment = function (exportKeyword, equalsToken, identifier, semicolonToken) { - return new TypeScript.ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, false); - }; - NormalModeFactory.prototype.classDeclaration = function (modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - return new TypeScript.ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, false); - }; - NormalModeFactory.prototype.interfaceDeclaration = function (modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - return new TypeScript.InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, false); - }; - NormalModeFactory.prototype.heritageClause = function (kind, extendsOrImplementsKeyword, typeNames) { - return new TypeScript.HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, false); - }; - NormalModeFactory.prototype.moduleDeclaration = function (modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - return new TypeScript.ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, false); - }; - NormalModeFactory.prototype.functionDeclaration = function (modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - return new TypeScript.FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, false); - }; - NormalModeFactory.prototype.variableStatement = function (modifiers, variableDeclaration, semicolonToken) { - return new TypeScript.VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, false); - }; - NormalModeFactory.prototype.variableDeclaration = function (varKeyword, variableDeclarators) { - return new TypeScript.VariableDeclarationSyntax(varKeyword, variableDeclarators, false); - }; - NormalModeFactory.prototype.variableDeclarator = function (propertyName, typeAnnotation, equalsValueClause) { - return new TypeScript.VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, false); - }; - NormalModeFactory.prototype.equalsValueClause = function (equalsToken, value) { - return new TypeScript.EqualsValueClauseSyntax(equalsToken, value, false); - }; - NormalModeFactory.prototype.prefixUnaryExpression = function (kind, operatorToken, operand) { - return new TypeScript.PrefixUnaryExpressionSyntax(kind, operatorToken, operand, false); - }; - NormalModeFactory.prototype.arrayLiteralExpression = function (openBracketToken, expressions, closeBracketToken) { - return new TypeScript.ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, false); - }; - NormalModeFactory.prototype.omittedExpression = function () { - return new TypeScript.OmittedExpressionSyntax(false); - }; - NormalModeFactory.prototype.parenthesizedExpression = function (openParenToken, expression, closeParenToken) { - return new TypeScript.ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, false); - }; - NormalModeFactory.prototype.simpleArrowFunctionExpression = function (identifier, equalsGreaterThanToken, block, expression) { - return new TypeScript.SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, false); - }; - NormalModeFactory.prototype.parenthesizedArrowFunctionExpression = function (callSignature, equalsGreaterThanToken, block, expression) { - return new TypeScript.ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, false); - }; - NormalModeFactory.prototype.qualifiedName = function (left, dotToken, right) { - return new TypeScript.QualifiedNameSyntax(left, dotToken, right, false); - }; - NormalModeFactory.prototype.typeArgumentList = function (lessThanToken, typeArguments, greaterThanToken) { - return new TypeScript.TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, false); - }; - NormalModeFactory.prototype.constructorType = function (newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, false); - }; - NormalModeFactory.prototype.functionType = function (typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, false); - }; - NormalModeFactory.prototype.objectType = function (openBraceToken, typeMembers, closeBraceToken) { - return new TypeScript.ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, false); - }; - NormalModeFactory.prototype.arrayType = function (type, openBracketToken, closeBracketToken) { - return new TypeScript.ArrayTypeSyntax(type, openBracketToken, closeBracketToken, false); - }; - NormalModeFactory.prototype.genericType = function (name, typeArgumentList) { - return new TypeScript.GenericTypeSyntax(name, typeArgumentList, false); - }; - NormalModeFactory.prototype.typeQuery = function (typeOfKeyword, name) { - return new TypeScript.TypeQuerySyntax(typeOfKeyword, name, false); - }; - NormalModeFactory.prototype.typeAnnotation = function (colonToken, type) { - return new TypeScript.TypeAnnotationSyntax(colonToken, type, false); - }; - NormalModeFactory.prototype.block = function (openBraceToken, statements, closeBraceToken) { - return new TypeScript.BlockSyntax(openBraceToken, statements, closeBraceToken, false); - }; - NormalModeFactory.prototype.parameter = function (dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - return new TypeScript.ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, false); - }; - NormalModeFactory.prototype.memberAccessExpression = function (expression, dotToken, name) { - return new TypeScript.MemberAccessExpressionSyntax(expression, dotToken, name, false); - }; - NormalModeFactory.prototype.postfixUnaryExpression = function (kind, operand, operatorToken) { - return new TypeScript.PostfixUnaryExpressionSyntax(kind, operand, operatorToken, false); - }; - NormalModeFactory.prototype.elementAccessExpression = function (expression, openBracketToken, argumentExpression, closeBracketToken) { - return new TypeScript.ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, false); - }; - NormalModeFactory.prototype.invocationExpression = function (expression, argumentList) { - return new TypeScript.InvocationExpressionSyntax(expression, argumentList, false); - }; - NormalModeFactory.prototype.argumentList = function (typeArgumentList, openParenToken, _arguments, closeParenToken) { - return new TypeScript.ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, false); - }; - NormalModeFactory.prototype.binaryExpression = function (kind, left, operatorToken, right) { - return new TypeScript.BinaryExpressionSyntax(kind, left, operatorToken, right, false); - }; - NormalModeFactory.prototype.conditionalExpression = function (condition, questionToken, whenTrue, colonToken, whenFalse) { - return new TypeScript.ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, false); - }; - NormalModeFactory.prototype.constructSignature = function (newKeyword, callSignature) { - return new TypeScript.ConstructSignatureSyntax(newKeyword, callSignature, false); - }; - NormalModeFactory.prototype.methodSignature = function (propertyName, questionToken, callSignature) { - return new TypeScript.MethodSignatureSyntax(propertyName, questionToken, callSignature, false); - }; - NormalModeFactory.prototype.indexSignature = function (openBracketToken, parameter, closeBracketToken, typeAnnotation) { - return new TypeScript.IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, false); - }; - NormalModeFactory.prototype.propertySignature = function (propertyName, questionToken, typeAnnotation) { - return new TypeScript.PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, false); - }; - NormalModeFactory.prototype.callSignature = function (typeParameterList, parameterList, typeAnnotation) { - return new TypeScript.CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, false); - }; - NormalModeFactory.prototype.parameterList = function (openParenToken, parameters, closeParenToken) { - return new TypeScript.ParameterListSyntax(openParenToken, parameters, closeParenToken, false); - }; - NormalModeFactory.prototype.typeParameterList = function (lessThanToken, typeParameters, greaterThanToken) { - return new TypeScript.TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, false); - }; - NormalModeFactory.prototype.typeParameter = function (identifier, constraint) { - return new TypeScript.TypeParameterSyntax(identifier, constraint, false); - }; - NormalModeFactory.prototype.constraint = function (extendsKeyword, type) { - return new TypeScript.ConstraintSyntax(extendsKeyword, type, false); - }; - NormalModeFactory.prototype.elseClause = function (elseKeyword, statement) { - return new TypeScript.ElseClauseSyntax(elseKeyword, statement, false); - }; - NormalModeFactory.prototype.ifStatement = function (ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - return new TypeScript.IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, false); - }; - NormalModeFactory.prototype.expressionStatement = function (expression, semicolonToken) { - return new TypeScript.ExpressionStatementSyntax(expression, semicolonToken, false); - }; - NormalModeFactory.prototype.constructorDeclaration = function (modifiers, constructorKeyword, callSignature, block, semicolonToken) { - return new TypeScript.ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, false); - }; - NormalModeFactory.prototype.memberFunctionDeclaration = function (modifiers, propertyName, callSignature, block, semicolonToken) { - return new TypeScript.MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, false); - }; - NormalModeFactory.prototype.getAccessor = function (modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block) { - return new TypeScript.GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, false); - }; - NormalModeFactory.prototype.setAccessor = function (modifiers, setKeyword, propertyName, parameterList, block) { - return new TypeScript.SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, false); - }; - NormalModeFactory.prototype.memberVariableDeclaration = function (modifiers, variableDeclarator, semicolonToken) { - return new TypeScript.MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, false); - }; - NormalModeFactory.prototype.indexMemberDeclaration = function (modifiers, indexSignature, semicolonToken) { - return new TypeScript.IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, false); - }; - NormalModeFactory.prototype.throwStatement = function (throwKeyword, expression, semicolonToken) { - return new TypeScript.ThrowStatementSyntax(throwKeyword, expression, semicolonToken, false); - }; - NormalModeFactory.prototype.returnStatement = function (returnKeyword, expression, semicolonToken) { - return new TypeScript.ReturnStatementSyntax(returnKeyword, expression, semicolonToken, false); - }; - NormalModeFactory.prototype.objectCreationExpression = function (newKeyword, expression, argumentList) { - return new TypeScript.ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, false); - }; - NormalModeFactory.prototype.switchStatement = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - return new TypeScript.SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, false); - }; - NormalModeFactory.prototype.caseSwitchClause = function (caseKeyword, expression, colonToken, statements) { - return new TypeScript.CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, false); - }; - NormalModeFactory.prototype.defaultSwitchClause = function (defaultKeyword, colonToken, statements) { - return new TypeScript.DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, false); - }; - NormalModeFactory.prototype.breakStatement = function (breakKeyword, identifier, semicolonToken) { - return new TypeScript.BreakStatementSyntax(breakKeyword, identifier, semicolonToken, false); - }; - NormalModeFactory.prototype.continueStatement = function (continueKeyword, identifier, semicolonToken) { - return new TypeScript.ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, false); - }; - NormalModeFactory.prototype.forStatement = function (forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - return new TypeScript.ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.forInStatement = function (forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - return new TypeScript.ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.whileStatement = function (whileKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.withStatement = function (withKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.enumDeclaration = function (modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - return new TypeScript.EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, false); - }; - NormalModeFactory.prototype.enumElement = function (propertyName, equalsValueClause) { - return new TypeScript.EnumElementSyntax(propertyName, equalsValueClause, false); - }; - NormalModeFactory.prototype.castExpression = function (lessThanToken, type, greaterThanToken, expression) { - return new TypeScript.CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, false); - }; - NormalModeFactory.prototype.objectLiteralExpression = function (openBraceToken, propertyAssignments, closeBraceToken) { - return new TypeScript.ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, false); - }; - NormalModeFactory.prototype.simplePropertyAssignment = function (propertyName, colonToken, expression) { - return new TypeScript.SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, false); - }; - NormalModeFactory.prototype.functionPropertyAssignment = function (propertyName, callSignature, block) { - return new TypeScript.FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, false); - }; - NormalModeFactory.prototype.functionExpression = function (functionKeyword, identifier, callSignature, block) { - return new TypeScript.FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, false); - }; - NormalModeFactory.prototype.emptyStatement = function (semicolonToken) { - return new TypeScript.EmptyStatementSyntax(semicolonToken, false); - }; - NormalModeFactory.prototype.tryStatement = function (tryKeyword, block, catchClause, finallyClause) { - return new TypeScript.TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, false); - }; - NormalModeFactory.prototype.catchClause = function (catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - return new TypeScript.CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, false); - }; - NormalModeFactory.prototype.finallyClause = function (finallyKeyword, block) { - return new TypeScript.FinallyClauseSyntax(finallyKeyword, block, false); - }; - NormalModeFactory.prototype.labeledStatement = function (identifier, colonToken, statement) { - return new TypeScript.LabeledStatementSyntax(identifier, colonToken, statement, false); - }; - NormalModeFactory.prototype.doStatement = function (doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - return new TypeScript.DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, false); - }; - NormalModeFactory.prototype.typeOfExpression = function (typeOfKeyword, expression) { - return new TypeScript.TypeOfExpressionSyntax(typeOfKeyword, expression, false); - }; - NormalModeFactory.prototype.deleteExpression = function (deleteKeyword, expression) { - return new TypeScript.DeleteExpressionSyntax(deleteKeyword, expression, false); - }; - NormalModeFactory.prototype.voidExpression = function (voidKeyword, expression) { - return new TypeScript.VoidExpressionSyntax(voidKeyword, expression, false); - }; - NormalModeFactory.prototype.debuggerStatement = function (debuggerKeyword, semicolonToken) { - return new TypeScript.DebuggerStatementSyntax(debuggerKeyword, semicolonToken, false); - }; - return NormalModeFactory; - })(); - Syntax.NormalModeFactory = NormalModeFactory; - - var StrictModeFactory = (function () { - function StrictModeFactory() { - } - StrictModeFactory.prototype.sourceUnit = function (moduleElements, endOfFileToken) { - return new TypeScript.SourceUnitSyntax(moduleElements, endOfFileToken, true); - }; - StrictModeFactory.prototype.externalModuleReference = function (requireKeyword, openParenToken, stringLiteral, closeParenToken) { - return new TypeScript.ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, true); - }; - StrictModeFactory.prototype.moduleNameModuleReference = function (moduleName) { - return new TypeScript.ModuleNameModuleReferenceSyntax(moduleName, true); - }; - StrictModeFactory.prototype.importDeclaration = function (modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - return new TypeScript.ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, true); - }; - StrictModeFactory.prototype.exportAssignment = function (exportKeyword, equalsToken, identifier, semicolonToken) { - return new TypeScript.ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, true); - }; - StrictModeFactory.prototype.classDeclaration = function (modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - return new TypeScript.ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, true); - }; - StrictModeFactory.prototype.interfaceDeclaration = function (modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - return new TypeScript.InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, true); - }; - StrictModeFactory.prototype.heritageClause = function (kind, extendsOrImplementsKeyword, typeNames) { - return new TypeScript.HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, true); - }; - StrictModeFactory.prototype.moduleDeclaration = function (modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - return new TypeScript.ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, true); - }; - StrictModeFactory.prototype.functionDeclaration = function (modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - return new TypeScript.FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, true); - }; - StrictModeFactory.prototype.variableStatement = function (modifiers, variableDeclaration, semicolonToken) { - return new TypeScript.VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, true); - }; - StrictModeFactory.prototype.variableDeclaration = function (varKeyword, variableDeclarators) { - return new TypeScript.VariableDeclarationSyntax(varKeyword, variableDeclarators, true); - }; - StrictModeFactory.prototype.variableDeclarator = function (propertyName, typeAnnotation, equalsValueClause) { - return new TypeScript.VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, true); - }; - StrictModeFactory.prototype.equalsValueClause = function (equalsToken, value) { - return new TypeScript.EqualsValueClauseSyntax(equalsToken, value, true); - }; - StrictModeFactory.prototype.prefixUnaryExpression = function (kind, operatorToken, operand) { - return new TypeScript.PrefixUnaryExpressionSyntax(kind, operatorToken, operand, true); - }; - StrictModeFactory.prototype.arrayLiteralExpression = function (openBracketToken, expressions, closeBracketToken) { - return new TypeScript.ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, true); - }; - StrictModeFactory.prototype.omittedExpression = function () { - return new TypeScript.OmittedExpressionSyntax(true); - }; - StrictModeFactory.prototype.parenthesizedExpression = function (openParenToken, expression, closeParenToken) { - return new TypeScript.ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, true); - }; - StrictModeFactory.prototype.simpleArrowFunctionExpression = function (identifier, equalsGreaterThanToken, block, expression) { - return new TypeScript.SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, true); - }; - StrictModeFactory.prototype.parenthesizedArrowFunctionExpression = function (callSignature, equalsGreaterThanToken, block, expression) { - return new TypeScript.ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, true); - }; - StrictModeFactory.prototype.qualifiedName = function (left, dotToken, right) { - return new TypeScript.QualifiedNameSyntax(left, dotToken, right, true); - }; - StrictModeFactory.prototype.typeArgumentList = function (lessThanToken, typeArguments, greaterThanToken) { - return new TypeScript.TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, true); - }; - StrictModeFactory.prototype.constructorType = function (newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, true); - }; - StrictModeFactory.prototype.functionType = function (typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, true); - }; - StrictModeFactory.prototype.objectType = function (openBraceToken, typeMembers, closeBraceToken) { - return new TypeScript.ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, true); - }; - StrictModeFactory.prototype.arrayType = function (type, openBracketToken, closeBracketToken) { - return new TypeScript.ArrayTypeSyntax(type, openBracketToken, closeBracketToken, true); - }; - StrictModeFactory.prototype.genericType = function (name, typeArgumentList) { - return new TypeScript.GenericTypeSyntax(name, typeArgumentList, true); - }; - StrictModeFactory.prototype.typeQuery = function (typeOfKeyword, name) { - return new TypeScript.TypeQuerySyntax(typeOfKeyword, name, true); - }; - StrictModeFactory.prototype.typeAnnotation = function (colonToken, type) { - return new TypeScript.TypeAnnotationSyntax(colonToken, type, true); - }; - StrictModeFactory.prototype.block = function (openBraceToken, statements, closeBraceToken) { - return new TypeScript.BlockSyntax(openBraceToken, statements, closeBraceToken, true); - }; - StrictModeFactory.prototype.parameter = function (dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - return new TypeScript.ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, true); - }; - StrictModeFactory.prototype.memberAccessExpression = function (expression, dotToken, name) { - return new TypeScript.MemberAccessExpressionSyntax(expression, dotToken, name, true); - }; - StrictModeFactory.prototype.postfixUnaryExpression = function (kind, operand, operatorToken) { - return new TypeScript.PostfixUnaryExpressionSyntax(kind, operand, operatorToken, true); - }; - StrictModeFactory.prototype.elementAccessExpression = function (expression, openBracketToken, argumentExpression, closeBracketToken) { - return new TypeScript.ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, true); - }; - StrictModeFactory.prototype.invocationExpression = function (expression, argumentList) { - return new TypeScript.InvocationExpressionSyntax(expression, argumentList, true); - }; - StrictModeFactory.prototype.argumentList = function (typeArgumentList, openParenToken, _arguments, closeParenToken) { - return new TypeScript.ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, true); - }; - StrictModeFactory.prototype.binaryExpression = function (kind, left, operatorToken, right) { - return new TypeScript.BinaryExpressionSyntax(kind, left, operatorToken, right, true); - }; - StrictModeFactory.prototype.conditionalExpression = function (condition, questionToken, whenTrue, colonToken, whenFalse) { - return new TypeScript.ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, true); - }; - StrictModeFactory.prototype.constructSignature = function (newKeyword, callSignature) { - return new TypeScript.ConstructSignatureSyntax(newKeyword, callSignature, true); - }; - StrictModeFactory.prototype.methodSignature = function (propertyName, questionToken, callSignature) { - return new TypeScript.MethodSignatureSyntax(propertyName, questionToken, callSignature, true); - }; - StrictModeFactory.prototype.indexSignature = function (openBracketToken, parameter, closeBracketToken, typeAnnotation) { - return new TypeScript.IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, true); - }; - StrictModeFactory.prototype.propertySignature = function (propertyName, questionToken, typeAnnotation) { - return new TypeScript.PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, true); - }; - StrictModeFactory.prototype.callSignature = function (typeParameterList, parameterList, typeAnnotation) { - return new TypeScript.CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, true); - }; - StrictModeFactory.prototype.parameterList = function (openParenToken, parameters, closeParenToken) { - return new TypeScript.ParameterListSyntax(openParenToken, parameters, closeParenToken, true); - }; - StrictModeFactory.prototype.typeParameterList = function (lessThanToken, typeParameters, greaterThanToken) { - return new TypeScript.TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, true); - }; - StrictModeFactory.prototype.typeParameter = function (identifier, constraint) { - return new TypeScript.TypeParameterSyntax(identifier, constraint, true); - }; - StrictModeFactory.prototype.constraint = function (extendsKeyword, type) { - return new TypeScript.ConstraintSyntax(extendsKeyword, type, true); - }; - StrictModeFactory.prototype.elseClause = function (elseKeyword, statement) { - return new TypeScript.ElseClauseSyntax(elseKeyword, statement, true); - }; - StrictModeFactory.prototype.ifStatement = function (ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - return new TypeScript.IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, true); - }; - StrictModeFactory.prototype.expressionStatement = function (expression, semicolonToken) { - return new TypeScript.ExpressionStatementSyntax(expression, semicolonToken, true); - }; - StrictModeFactory.prototype.constructorDeclaration = function (modifiers, constructorKeyword, callSignature, block, semicolonToken) { - return new TypeScript.ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, true); - }; - StrictModeFactory.prototype.memberFunctionDeclaration = function (modifiers, propertyName, callSignature, block, semicolonToken) { - return new TypeScript.MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, true); - }; - StrictModeFactory.prototype.getAccessor = function (modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block) { - return new TypeScript.GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, true); - }; - StrictModeFactory.prototype.setAccessor = function (modifiers, setKeyword, propertyName, parameterList, block) { - return new TypeScript.SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, true); - }; - StrictModeFactory.prototype.memberVariableDeclaration = function (modifiers, variableDeclarator, semicolonToken) { - return new TypeScript.MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, true); - }; - StrictModeFactory.prototype.indexMemberDeclaration = function (modifiers, indexSignature, semicolonToken) { - return new TypeScript.IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, true); - }; - StrictModeFactory.prototype.throwStatement = function (throwKeyword, expression, semicolonToken) { - return new TypeScript.ThrowStatementSyntax(throwKeyword, expression, semicolonToken, true); - }; - StrictModeFactory.prototype.returnStatement = function (returnKeyword, expression, semicolonToken) { - return new TypeScript.ReturnStatementSyntax(returnKeyword, expression, semicolonToken, true); - }; - StrictModeFactory.prototype.objectCreationExpression = function (newKeyword, expression, argumentList) { - return new TypeScript.ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, true); - }; - StrictModeFactory.prototype.switchStatement = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - return new TypeScript.SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, true); - }; - StrictModeFactory.prototype.caseSwitchClause = function (caseKeyword, expression, colonToken, statements) { - return new TypeScript.CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, true); - }; - StrictModeFactory.prototype.defaultSwitchClause = function (defaultKeyword, colonToken, statements) { - return new TypeScript.DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, true); - }; - StrictModeFactory.prototype.breakStatement = function (breakKeyword, identifier, semicolonToken) { - return new TypeScript.BreakStatementSyntax(breakKeyword, identifier, semicolonToken, true); - }; - StrictModeFactory.prototype.continueStatement = function (continueKeyword, identifier, semicolonToken) { - return new TypeScript.ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, true); - }; - StrictModeFactory.prototype.forStatement = function (forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - return new TypeScript.ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.forInStatement = function (forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - return new TypeScript.ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.whileStatement = function (whileKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.withStatement = function (withKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.enumDeclaration = function (modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - return new TypeScript.EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, true); - }; - StrictModeFactory.prototype.enumElement = function (propertyName, equalsValueClause) { - return new TypeScript.EnumElementSyntax(propertyName, equalsValueClause, true); - }; - StrictModeFactory.prototype.castExpression = function (lessThanToken, type, greaterThanToken, expression) { - return new TypeScript.CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, true); - }; - StrictModeFactory.prototype.objectLiteralExpression = function (openBraceToken, propertyAssignments, closeBraceToken) { - return new TypeScript.ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, true); - }; - StrictModeFactory.prototype.simplePropertyAssignment = function (propertyName, colonToken, expression) { - return new TypeScript.SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, true); - }; - StrictModeFactory.prototype.functionPropertyAssignment = function (propertyName, callSignature, block) { - return new TypeScript.FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, true); - }; - StrictModeFactory.prototype.functionExpression = function (functionKeyword, identifier, callSignature, block) { - return new TypeScript.FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, true); - }; - StrictModeFactory.prototype.emptyStatement = function (semicolonToken) { - return new TypeScript.EmptyStatementSyntax(semicolonToken, true); - }; - StrictModeFactory.prototype.tryStatement = function (tryKeyword, block, catchClause, finallyClause) { - return new TypeScript.TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, true); - }; - StrictModeFactory.prototype.catchClause = function (catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - return new TypeScript.CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, true); - }; - StrictModeFactory.prototype.finallyClause = function (finallyKeyword, block) { - return new TypeScript.FinallyClauseSyntax(finallyKeyword, block, true); - }; - StrictModeFactory.prototype.labeledStatement = function (identifier, colonToken, statement) { - return new TypeScript.LabeledStatementSyntax(identifier, colonToken, statement, true); - }; - StrictModeFactory.prototype.doStatement = function (doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - return new TypeScript.DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, true); - }; - StrictModeFactory.prototype.typeOfExpression = function (typeOfKeyword, expression) { - return new TypeScript.TypeOfExpressionSyntax(typeOfKeyword, expression, true); - }; - StrictModeFactory.prototype.deleteExpression = function (deleteKeyword, expression) { - return new TypeScript.DeleteExpressionSyntax(deleteKeyword, expression, true); - }; - StrictModeFactory.prototype.voidExpression = function (voidKeyword, expression) { - return new TypeScript.VoidExpressionSyntax(voidKeyword, expression, true); - }; - StrictModeFactory.prototype.debuggerStatement = function (debuggerKeyword, semicolonToken) { - return new TypeScript.DebuggerStatementSyntax(debuggerKeyword, semicolonToken, true); - }; - return StrictModeFactory; - })(); - Syntax.StrictModeFactory = StrictModeFactory; - - Syntax.normalModeFactory = new NormalModeFactory(); - Syntax.strictModeFactory = new StrictModeFactory(); - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxFacts) { - function isDirectivePrologueElement(node) { - if (node.kind() === 149 /* ExpressionStatement */) { - var expressionStatement = node; - var expression = expressionStatement.expression; - - if (expression.kind() === 14 /* StringLiteral */) { - return true; - } - } - - return false; - } - SyntaxFacts.isDirectivePrologueElement = isDirectivePrologueElement; - - function isUseStrictDirective(node) { - var expressionStatement = node; - var stringLiteral = expressionStatement.expression; - - var text = stringLiteral.text(); - return text === '"use strict"' || text === "'use strict'"; - } - SyntaxFacts.isUseStrictDirective = isUseStrictDirective; - - function isIdentifierNameOrAnyKeyword(token) { - var tokenKind = token.tokenKind; - return tokenKind === 11 /* IdentifierName */ || SyntaxFacts.isAnyKeyword(tokenKind); - } - SyntaxFacts.isIdentifierNameOrAnyKeyword = isIdentifierNameOrAnyKeyword; - })(TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); - var SyntaxFacts = TypeScript.SyntaxFacts; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var EmptySyntaxList = (function () { - function EmptySyntaxList() { - } - EmptySyntaxList.prototype.kind = function () { - return 1 /* List */; - }; - - EmptySyntaxList.prototype.isNode = function () { - return false; - }; - EmptySyntaxList.prototype.isToken = function () { - return false; - }; - EmptySyntaxList.prototype.isList = function () { - return true; - }; - EmptySyntaxList.prototype.isSeparatedList = function () { - return false; - }; - - EmptySyntaxList.prototype.toJSON = function (key) { - return []; - }; - - EmptySyntaxList.prototype.childCount = function () { - return 0; - }; - - EmptySyntaxList.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySyntaxList.prototype.toArray = function () { - return []; - }; - - EmptySyntaxList.prototype.collectTextElements = function (elements) { - }; - - EmptySyntaxList.prototype.firstToken = function () { - return null; - }; - - EmptySyntaxList.prototype.lastToken = function () { - return null; - }; - - EmptySyntaxList.prototype.fullWidth = function () { - return 0; - }; - - EmptySyntaxList.prototype.width = function () { - return 0; - }; - - EmptySyntaxList.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySyntaxList.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySyntaxList.prototype.leadingTriviaWidth = function () { - return 0; - }; - - EmptySyntaxList.prototype.trailingTriviaWidth = function () { - return 0; - }; - - EmptySyntaxList.prototype.fullText = function () { - return ""; - }; - - EmptySyntaxList.prototype.isTypeScriptSpecific = function () { - return false; - }; - - EmptySyntaxList.prototype.isIncrementallyUnusable = function () { - return false; - }; - - EmptySyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - throw TypeScript.Errors.invalidOperation(); - }; - - EmptySyntaxList.prototype.insertChildrenInto = function (array, index) { - }; - return EmptySyntaxList; - })(); - Syntax.EmptySyntaxList = EmptySyntaxList; - - Syntax.emptyList = new EmptySyntaxList(); - - var SingletonSyntaxList = (function () { - function SingletonSyntaxList(item) { - this.item = item; - } - SingletonSyntaxList.prototype.kind = function () { - return 1 /* List */; - }; - - SingletonSyntaxList.prototype.isToken = function () { - return false; - }; - SingletonSyntaxList.prototype.isNode = function () { - return false; - }; - SingletonSyntaxList.prototype.isList = function () { - return true; - }; - SingletonSyntaxList.prototype.isSeparatedList = function () { - return false; - }; - - SingletonSyntaxList.prototype.toJSON = function (key) { - return [this.item]; - }; - - SingletonSyntaxList.prototype.childCount = function () { - return 1; - }; - - SingletonSyntaxList.prototype.childAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSyntaxList.prototype.toArray = function () { - return [this.item]; - }; - - SingletonSyntaxList.prototype.collectTextElements = function (elements) { - this.item.collectTextElements(elements); - }; - - SingletonSyntaxList.prototype.firstToken = function () { - return this.item.firstToken(); - }; - - SingletonSyntaxList.prototype.lastToken = function () { - return this.item.lastToken(); - }; - - SingletonSyntaxList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - - SingletonSyntaxList.prototype.width = function () { - return this.item.width(); - }; - - SingletonSyntaxList.prototype.leadingTrivia = function () { - return this.item.leadingTrivia(); - }; - - SingletonSyntaxList.prototype.trailingTrivia = function () { - return this.item.trailingTrivia(); - }; - - SingletonSyntaxList.prototype.leadingTriviaWidth = function () { - return this.item.leadingTriviaWidth(); - }; - - SingletonSyntaxList.prototype.trailingTriviaWidth = function () { - return this.item.trailingTriviaWidth(); - }; - - SingletonSyntaxList.prototype.fullText = function () { - return this.item.fullText(); - }; - - SingletonSyntaxList.prototype.isTypeScriptSpecific = function () { - return this.item.isTypeScriptSpecific(); - }; - - SingletonSyntaxList.prototype.isIncrementallyUnusable = function () { - return this.item.isIncrementallyUnusable(); - }; - - SingletonSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - return this.item.findTokenInternal(new TypeScript.PositionedList(parent, this, fullStart), position, fullStart); - }; - - SingletonSyntaxList.prototype.insertChildrenInto = function (array, index) { - array.splice(index, 0, this.item); - }; - return SingletonSyntaxList; - })(); - - var NormalSyntaxList = (function () { - function NormalSyntaxList(nodeOrTokens) { - this._data = 0; - this.nodeOrTokens = nodeOrTokens; - } - NormalSyntaxList.prototype.kind = function () { - return 1 /* List */; - }; - - NormalSyntaxList.prototype.isNode = function () { - return false; - }; - NormalSyntaxList.prototype.isToken = function () { - return false; - }; - NormalSyntaxList.prototype.isList = function () { - return true; - }; - NormalSyntaxList.prototype.isSeparatedList = function () { - return false; - }; - - NormalSyntaxList.prototype.toJSON = function (key) { - return this.nodeOrTokens; - }; - - NormalSyntaxList.prototype.childCount = function () { - return this.nodeOrTokens.length; - }; - - NormalSyntaxList.prototype.childAt = function (index) { - if (index < 0 || index >= this.nodeOrTokens.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.nodeOrTokens[index]; - }; - - NormalSyntaxList.prototype.toArray = function () { - return this.nodeOrTokens.slice(0); - }; - - NormalSyntaxList.prototype.collectTextElements = function (elements) { - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var element = this.nodeOrTokens[i]; - element.collectTextElements(elements); - } - }; - - NormalSyntaxList.prototype.firstToken = function () { - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var token = this.nodeOrTokens[i].firstToken(); - if (token !== null) { - return token; - } - } - - return null; - }; - - NormalSyntaxList.prototype.lastToken = function () { - for (var i = this.nodeOrTokens.length - 1; i >= 0; i--) { - var token = this.nodeOrTokens[i].lastToken(); - if (token !== null) { - return token; - } - } - - return null; - }; - - NormalSyntaxList.prototype.fullText = function () { - var elements = new Array(); - this.collectTextElements(elements); - return elements.join(""); - }; - - NormalSyntaxList.prototype.isTypeScriptSpecific = function () { - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - if (this.nodeOrTokens[i].isTypeScriptSpecific()) { - return true; - } - } - - return false; - }; - - NormalSyntaxList.prototype.isIncrementallyUnusable = function () { - return (this.data() & 2 /* NodeIncrementallyUnusableMask */) !== 0; - }; - - NormalSyntaxList.prototype.fullWidth = function () { - return this.data() >>> 3 /* NodeFullWidthShift */; - }; - - NormalSyntaxList.prototype.width = function () { - var fullWidth = this.fullWidth(); - return fullWidth - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - NormalSyntaxList.prototype.leadingTrivia = function () { - return this.firstToken().leadingTrivia(); - }; - - NormalSyntaxList.prototype.trailingTrivia = function () { - return this.lastToken().trailingTrivia(); - }; - - NormalSyntaxList.prototype.leadingTriviaWidth = function () { - return this.firstToken().leadingTriviaWidth(); - }; - - NormalSyntaxList.prototype.trailingTriviaWidth = function () { - return this.lastToken().trailingTriviaWidth(); - }; - - NormalSyntaxList.prototype.computeData = function () { - var fullWidth = 0; - var isIncrementallyUnusable = false; - - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var node = this.nodeOrTokens[i]; - fullWidth += node.fullWidth(); - isIncrementallyUnusable = isIncrementallyUnusable || node.isIncrementallyUnusable(); - } - - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - }; - - NormalSyntaxList.prototype.data = function () { - if ((this._data & 1 /* NodeDataComputed */) === 0) { - this._data = this.computeData(); - } - - return this._data; - }; - - NormalSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - parent = new TypeScript.PositionedList(parent, this, fullStart); - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var nodeOrToken = this.nodeOrTokens[i]; - - var childWidth = nodeOrToken.fullWidth(); - if (position < childWidth) { - return nodeOrToken.findTokenInternal(parent, position, fullStart); - } - - position -= childWidth; - fullStart += childWidth; - } - - throw TypeScript.Errors.invalidOperation(); - }; - - NormalSyntaxList.prototype.insertChildrenInto = function (array, index) { - if (index === 0) { - array.unshift.apply(array, this.nodeOrTokens); - } else { - array.splice.apply(array, [index, 0].concat(this.nodeOrTokens)); - } - }; - return NormalSyntaxList; - })(); - - function list(nodes) { - if (nodes === undefined || nodes === null || nodes.length === 0) { - return Syntax.emptyList; - } - - if (nodes.length === 1) { - var item = nodes[0]; - return new SingletonSyntaxList(item); - } - - return new NormalSyntaxList(nodes); - } - Syntax.list = list; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxNode = (function () { - function SyntaxNode(parsedInStrictMode) { - this._data = parsedInStrictMode ? 4 /* NodeParsedInStrictModeMask */ : 0; - } - SyntaxNode.prototype.isNode = function () { - return true; - }; - SyntaxNode.prototype.isToken = function () { - return false; - }; - SyntaxNode.prototype.isList = function () { - return false; - }; - SyntaxNode.prototype.isSeparatedList = function () { - return false; - }; - - SyntaxNode.prototype.kind = function () { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.childCount = function () { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.childAt = function (slot) { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.firstToken = function () { - for (var i = 0, n = this.childCount(); i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - if (element.fullWidth() > 0 || element.kind() === 10 /* EndOfFileToken */) { - return element.firstToken(); - } - } - } - - return null; - }; - - SyntaxNode.prototype.lastToken = function () { - for (var i = this.childCount() - 1; i >= 0; i--) { - var element = this.childAt(i); - - if (element !== null) { - if (element.fullWidth() > 0 || element.kind() === 10 /* EndOfFileToken */) { - return element.lastToken(); - } - } - } - - return null; - }; - - SyntaxNode.prototype.insertChildrenInto = function (array, index) { - for (var i = this.childCount() - 1; i >= 0; i--) { - var element = this.childAt(i); - - if (element !== null) { - if (element.isNode() || element.isToken()) { - array.splice(index, 0, element); - } else if (element.isList()) { - element.insertChildrenInto(array, index); - } else if (element.isSeparatedList()) { - element.insertChildrenInto(array, index); - } else { - throw TypeScript.Errors.invalidOperation(); - } - } - } - }; - - SyntaxNode.prototype.leadingTrivia = function () { - var firstToken = this.firstToken(); - return firstToken ? firstToken.leadingTrivia() : TypeScript.Syntax.emptyTriviaList; - }; - - SyntaxNode.prototype.trailingTrivia = function () { - var lastToken = this.lastToken(); - return lastToken ? lastToken.trailingTrivia() : TypeScript.Syntax.emptyTriviaList; - }; - - SyntaxNode.prototype.toJSON = function (key) { - var result = { - kind: TypeScript.SyntaxKind[this.kind()], - fullWidth: this.fullWidth() - }; - - if (this.isIncrementallyUnusable()) { - result.isIncrementallyUnusable = true; - } - - if (this.parsedInStrictMode()) { - result.parsedInStrictMode = true; - } - - var thisAsIndexable = this; - for (var i = 0, n = this.childCount(); i < n; i++) { - var value = this.childAt(i); - - if (value) { - for (var name in this) { - if (value === thisAsIndexable[name]) { - result[name] = value; - break; - } - } - } - } - - return result; - }; - - SyntaxNode.prototype.accept = function (visitor) { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.fullText = function () { - var elements = []; - this.collectTextElements(elements); - return elements.join(""); - }; - - SyntaxNode.prototype.collectTextElements = function (elements) { - for (var i = 0, n = this.childCount(); i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - element.collectTextElements(elements); - } - } - }; - - SyntaxNode.prototype.replaceToken = function (token1, token2) { - if (token1 === token2) { - return this; - } - - return this.accept(new TypeScript.SyntaxTokenReplacer(token1, token2)); - }; - - SyntaxNode.prototype.withLeadingTrivia = function (trivia) { - return this.replaceToken(this.firstToken(), this.firstToken().withLeadingTrivia(trivia)); - }; - - SyntaxNode.prototype.withTrailingTrivia = function (trivia) { - return this.replaceToken(this.lastToken(), this.lastToken().withTrailingTrivia(trivia)); - }; - - SyntaxNode.prototype.hasLeadingTrivia = function () { - return this.lastToken().hasLeadingTrivia(); - }; - - SyntaxNode.prototype.hasTrailingTrivia = function () { - return this.lastToken().hasTrailingTrivia(); - }; - - SyntaxNode.prototype.isTypeScriptSpecific = function () { - return false; - }; - - SyntaxNode.prototype.isIncrementallyUnusable = function () { - return (this.data() & 2 /* NodeIncrementallyUnusableMask */) !== 0; - }; - - SyntaxNode.prototype.parsedInStrictMode = function () { - return (this.data() & 4 /* NodeParsedInStrictModeMask */) !== 0; - }; - - SyntaxNode.prototype.fullWidth = function () { - return this.data() >>> 3 /* NodeFullWidthShift */; - }; - - SyntaxNode.prototype.computeData = function () { - var slotCount = this.childCount(); - - var fullWidth = 0; - var childWidth = 0; - - var isIncrementallyUnusable = ((this._data & 2 /* NodeIncrementallyUnusableMask */) !== 0) || slotCount === 0; - - for (var i = 0, n = slotCount; i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - childWidth = element.fullWidth(); - fullWidth += childWidth; - - if (!isIncrementallyUnusable) { - isIncrementallyUnusable = element.isIncrementallyUnusable(); - } - } - } - - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - }; - - SyntaxNode.prototype.data = function () { - if ((this._data & 1 /* NodeDataComputed */) === 0) { - this._data |= this.computeData(); - } - - return this._data; - }; - - SyntaxNode.prototype.findToken = function (position, includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var endOfFileToken = this.tryGetEndOfFileAt(position); - if (endOfFileToken !== null) { - return endOfFileToken; - } - - if (position < 0 || position >= this.fullWidth()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - var positionedToken = this.findTokenInternal(null, position, 0); - - if (includeSkippedTokens) { - return TypeScript.Syntax.findSkippedTokenInPositionedToken(positionedToken, position) || positionedToken; - } - - return positionedToken; - }; - - SyntaxNode.prototype.tryGetEndOfFileAt = function (position) { - if (this.kind() === 120 /* SourceUnit */ && position === this.fullWidth()) { - var sourceUnit = this; - return new TypeScript.PositionedToken(new TypeScript.PositionedNode(null, sourceUnit, 0), sourceUnit.endOfFileToken, sourceUnit.moduleElements.fullWidth()); - } - - return null; - }; - - SyntaxNode.prototype.findTokenInternal = function (parent, position, fullStart) { - parent = new TypeScript.PositionedNode(parent, this, fullStart); - for (var i = 0, n = this.childCount(); i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - var childWidth = element.fullWidth(); - - if (position < childWidth) { - return element.findTokenInternal(parent, position, fullStart); - } - - position -= childWidth; - fullStart += childWidth; - } - } - - throw TypeScript.Errors.invalidOperation(); - }; - - SyntaxNode.prototype.findTokenOnLeft = function (position, includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var positionedToken = this.findToken(position, false); - var start = positionedToken.start(); - - if (includeSkippedTokens) { - positionedToken = TypeScript.Syntax.findSkippedTokenOnLeft(positionedToken, position) || positionedToken; - } - - if (position > start) { - return positionedToken; - } - - if (positionedToken.fullStart() === 0) { - return null; - } - - return positionedToken.previousToken(includeSkippedTokens); - }; - - SyntaxNode.prototype.findCompleteTokenOnLeft = function (position, includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var positionedToken = this.findToken(position, false); - - if (includeSkippedTokens) { - positionedToken = TypeScript.Syntax.findSkippedTokenOnLeft(positionedToken, position) || positionedToken; - } - - if (positionedToken.token().width() > 0 && position >= positionedToken.end()) { - return positionedToken; - } - - return positionedToken.previousToken(includeSkippedTokens); - }; - - SyntaxNode.prototype.isModuleElement = function () { - return false; - }; - - SyntaxNode.prototype.isClassElement = function () { - return false; - }; - - SyntaxNode.prototype.isTypeMember = function () { - return false; - }; - - SyntaxNode.prototype.isStatement = function () { - return false; - }; - - SyntaxNode.prototype.isExpression = function () { - return false; - }; - - SyntaxNode.prototype.isSwitchClause = function () { - return false; - }; - - SyntaxNode.prototype.structuralEquals = function (node) { - if (this === node) { - return true; - } - if (node === null) { - return false; - } - if (this.kind() !== node.kind()) { - return false; - } - - for (var i = 0, n = this.childCount(); i < n; i++) { - var element1 = this.childAt(i); - var element2 = node.childAt(i); - - if (!TypeScript.Syntax.elementStructuralEquals(element1, element2)) { - return false; - } - } - - return true; - }; - - SyntaxNode.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - SyntaxNode.prototype.leadingTriviaWidth = function () { - var firstToken = this.firstToken(); - return firstToken === null ? 0 : firstToken.leadingTriviaWidth(); - }; - - SyntaxNode.prototype.trailingTriviaWidth = function () { - var lastToken = this.lastToken(); - return lastToken === null ? 0 : lastToken.trailingTriviaWidth(); - }; - return SyntaxNode; - })(); - TypeScript.SyntaxNode = SyntaxNode; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SourceUnitSyntax = (function (_super) { - __extends(SourceUnitSyntax, _super); - function SourceUnitSyntax(moduleElements, endOfFileToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.moduleElements = moduleElements; - this.endOfFileToken = endOfFileToken; - } - SourceUnitSyntax.prototype.accept = function (visitor) { - return visitor.visitSourceUnit(this); - }; - - SourceUnitSyntax.prototype.kind = function () { - return 120 /* SourceUnit */; - }; - - SourceUnitSyntax.prototype.childCount = function () { - return 2; - }; - - SourceUnitSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.moduleElements; - case 1: - return this.endOfFileToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SourceUnitSyntax.prototype.update = function (moduleElements, endOfFileToken) { - if (this.moduleElements === moduleElements && this.endOfFileToken === endOfFileToken) { - return this; - } - - return new SourceUnitSyntax(moduleElements, endOfFileToken, this.parsedInStrictMode()); - }; - - SourceUnitSyntax.create = function (endOfFileToken) { - return new SourceUnitSyntax(TypeScript.Syntax.emptyList, endOfFileToken, false); - }; - - SourceUnitSyntax.create1 = function (endOfFileToken) { - return new SourceUnitSyntax(TypeScript.Syntax.emptyList, endOfFileToken, false); - }; - - SourceUnitSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SourceUnitSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SourceUnitSyntax.prototype.withModuleElements = function (moduleElements) { - return this.update(moduleElements, this.endOfFileToken); - }; - - SourceUnitSyntax.prototype.withModuleElement = function (moduleElement) { - return this.withModuleElements(TypeScript.Syntax.list([moduleElement])); - }; - - SourceUnitSyntax.prototype.withEndOfFileToken = function (endOfFileToken) { - return this.update(this.moduleElements, endOfFileToken); - }; - - SourceUnitSyntax.prototype.isTypeScriptSpecific = function () { - if (this.moduleElements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return SourceUnitSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SourceUnitSyntax = SourceUnitSyntax; - - var ExternalModuleReferenceSyntax = (function (_super) { - __extends(ExternalModuleReferenceSyntax, _super); - function ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.requireKeyword = requireKeyword; - this.openParenToken = openParenToken; - this.stringLiteral = stringLiteral; - this.closeParenToken = closeParenToken; - } - ExternalModuleReferenceSyntax.prototype.accept = function (visitor) { - return visitor.visitExternalModuleReference(this); - }; - - ExternalModuleReferenceSyntax.prototype.kind = function () { - return 245 /* ExternalModuleReference */; - }; - - ExternalModuleReferenceSyntax.prototype.childCount = function () { - return 4; - }; - - ExternalModuleReferenceSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.requireKeyword; - case 1: - return this.openParenToken; - case 2: - return this.stringLiteral; - case 3: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ExternalModuleReferenceSyntax.prototype.isModuleReference = function () { - return true; - }; - - ExternalModuleReferenceSyntax.prototype.update = function (requireKeyword, openParenToken, stringLiteral, closeParenToken) { - if (this.requireKeyword === requireKeyword && this.openParenToken === openParenToken && this.stringLiteral === stringLiteral && this.closeParenToken === closeParenToken) { - return this; - } - - return new ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, this.parsedInStrictMode()); - }; - - ExternalModuleReferenceSyntax.create1 = function (stringLiteral) { - return new ExternalModuleReferenceSyntax(TypeScript.Syntax.token(66 /* RequireKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), stringLiteral, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ExternalModuleReferenceSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ExternalModuleReferenceSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ExternalModuleReferenceSyntax.prototype.withRequireKeyword = function (requireKeyword) { - return this.update(requireKeyword, this.openParenToken, this.stringLiteral, this.closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.requireKeyword, openParenToken, this.stringLiteral, this.closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.withStringLiteral = function (stringLiteral) { - return this.update(this.requireKeyword, this.openParenToken, stringLiteral, this.closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.requireKeyword, this.openParenToken, this.stringLiteral, closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ExternalModuleReferenceSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ExternalModuleReferenceSyntax = ExternalModuleReferenceSyntax; - - var ModuleNameModuleReferenceSyntax = (function (_super) { - __extends(ModuleNameModuleReferenceSyntax, _super); - function ModuleNameModuleReferenceSyntax(moduleName, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.moduleName = moduleName; - } - ModuleNameModuleReferenceSyntax.prototype.accept = function (visitor) { - return visitor.visitModuleNameModuleReference(this); - }; - - ModuleNameModuleReferenceSyntax.prototype.kind = function () { - return 246 /* ModuleNameModuleReference */; - }; - - ModuleNameModuleReferenceSyntax.prototype.childCount = function () { - return 1; - }; - - ModuleNameModuleReferenceSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.moduleName; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ModuleNameModuleReferenceSyntax.prototype.isModuleReference = function () { - return true; - }; - - ModuleNameModuleReferenceSyntax.prototype.update = function (moduleName) { - if (this.moduleName === moduleName) { - return this; - } - - return new ModuleNameModuleReferenceSyntax(moduleName, this.parsedInStrictMode()); - }; - - ModuleNameModuleReferenceSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ModuleNameModuleReferenceSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ModuleNameModuleReferenceSyntax.prototype.withModuleName = function (moduleName) { - return this.update(moduleName); - }; - - ModuleNameModuleReferenceSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ModuleNameModuleReferenceSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ModuleNameModuleReferenceSyntax = ModuleNameModuleReferenceSyntax; - - var ImportDeclarationSyntax = (function (_super) { - __extends(ImportDeclarationSyntax, _super); - function ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.importKeyword = importKeyword; - this.identifier = identifier; - this.equalsToken = equalsToken; - this.moduleReference = moduleReference; - this.semicolonToken = semicolonToken; - } - ImportDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitImportDeclaration(this); - }; - - ImportDeclarationSyntax.prototype.kind = function () { - return 133 /* ImportDeclaration */; - }; - - ImportDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - ImportDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.importKeyword; - case 2: - return this.identifier; - case 3: - return this.equalsToken; - case 4: - return this.moduleReference; - case 5: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ImportDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - ImportDeclarationSyntax.prototype.update = function (modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - if (this.modifiers === modifiers && this.importKeyword === importKeyword && this.identifier === identifier && this.equalsToken === equalsToken && this.moduleReference === moduleReference && this.semicolonToken === semicolonToken) { - return this; - } - - return new ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, this.parsedInStrictMode()); - }; - - ImportDeclarationSyntax.create = function (importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - return new ImportDeclarationSyntax(TypeScript.Syntax.emptyList, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, false); - }; - - ImportDeclarationSyntax.create1 = function (identifier, moduleReference) { - return new ImportDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(49 /* ImportKeyword */), identifier, TypeScript.Syntax.token(107 /* EqualsToken */), moduleReference, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ImportDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ImportDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ImportDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.importKeyword, this.identifier, this.equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ImportDeclarationSyntax.prototype.withImportKeyword = function (importKeyword) { - return this.update(this.modifiers, importKeyword, this.identifier, this.equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.importKeyword, identifier, this.equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withEqualsToken = function (equalsToken) { - return this.update(this.modifiers, this.importKeyword, this.identifier, equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withModuleReference = function (moduleReference) { - return this.update(this.modifiers, this.importKeyword, this.identifier, this.equalsToken, moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.importKeyword, this.identifier, this.equalsToken, this.moduleReference, semicolonToken); - }; - - ImportDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ImportDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ImportDeclarationSyntax = ImportDeclarationSyntax; - - var ExportAssignmentSyntax = (function (_super) { - __extends(ExportAssignmentSyntax, _super); - function ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.exportKeyword = exportKeyword; - this.equalsToken = equalsToken; - this.identifier = identifier; - this.semicolonToken = semicolonToken; - } - ExportAssignmentSyntax.prototype.accept = function (visitor) { - return visitor.visitExportAssignment(this); - }; - - ExportAssignmentSyntax.prototype.kind = function () { - return 134 /* ExportAssignment */; - }; - - ExportAssignmentSyntax.prototype.childCount = function () { - return 4; - }; - - ExportAssignmentSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.exportKeyword; - case 1: - return this.equalsToken; - case 2: - return this.identifier; - case 3: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ExportAssignmentSyntax.prototype.isModuleElement = function () { - return true; - }; - - ExportAssignmentSyntax.prototype.update = function (exportKeyword, equalsToken, identifier, semicolonToken) { - if (this.exportKeyword === exportKeyword && this.equalsToken === equalsToken && this.identifier === identifier && this.semicolonToken === semicolonToken) { - return this; - } - - return new ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, this.parsedInStrictMode()); - }; - - ExportAssignmentSyntax.create1 = function (identifier) { - return new ExportAssignmentSyntax(TypeScript.Syntax.token(47 /* ExportKeyword */), TypeScript.Syntax.token(107 /* EqualsToken */), identifier, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ExportAssignmentSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ExportAssignmentSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ExportAssignmentSyntax.prototype.withExportKeyword = function (exportKeyword) { - return this.update(exportKeyword, this.equalsToken, this.identifier, this.semicolonToken); - }; - - ExportAssignmentSyntax.prototype.withEqualsToken = function (equalsToken) { - return this.update(this.exportKeyword, equalsToken, this.identifier, this.semicolonToken); - }; - - ExportAssignmentSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.exportKeyword, this.equalsToken, identifier, this.semicolonToken); - }; - - ExportAssignmentSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.exportKeyword, this.equalsToken, this.identifier, semicolonToken); - }; - - ExportAssignmentSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ExportAssignmentSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ExportAssignmentSyntax = ExportAssignmentSyntax; - - var ClassDeclarationSyntax = (function (_super) { - __extends(ClassDeclarationSyntax, _super); - function ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.classKeyword = classKeyword; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.openBraceToken = openBraceToken; - this.classElements = classElements; - this.closeBraceToken = closeBraceToken; - } - ClassDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitClassDeclaration(this); - }; - - ClassDeclarationSyntax.prototype.kind = function () { - return 131 /* ClassDeclaration */; - }; - - ClassDeclarationSyntax.prototype.childCount = function () { - return 8; - }; - - ClassDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.classKeyword; - case 2: - return this.identifier; - case 3: - return this.typeParameterList; - case 4: - return this.heritageClauses; - case 5: - return this.openBraceToken; - case 6: - return this.classElements; - case 7: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ClassDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - ClassDeclarationSyntax.prototype.update = function (modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - if (this.modifiers === modifiers && this.classKeyword === classKeyword && this.identifier === identifier && this.typeParameterList === typeParameterList && this.heritageClauses === heritageClauses && this.openBraceToken === openBraceToken && this.classElements === classElements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, this.parsedInStrictMode()); - }; - - ClassDeclarationSyntax.create = function (classKeyword, identifier, openBraceToken, closeBraceToken) { - return new ClassDeclarationSyntax(TypeScript.Syntax.emptyList, classKeyword, identifier, null, TypeScript.Syntax.emptyList, openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - ClassDeclarationSyntax.create1 = function (identifier) { - return new ClassDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(44 /* ClassKeyword */), identifier, null, TypeScript.Syntax.emptyList, TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ClassDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ClassDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ClassDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ClassDeclarationSyntax.prototype.withClassKeyword = function (classKeyword) { - return this.update(this.modifiers, classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.classKeyword, identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(this.modifiers, this.classKeyword, this.identifier, typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withHeritageClauses = function (heritageClauses) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withHeritageClause = function (heritageClause) { - return this.withHeritageClauses(TypeScript.Syntax.list([heritageClause])); - }; - - ClassDeclarationSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withClassElements = function (classElements) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withClassElement = function (classElement) { - return this.withClassElements(TypeScript.Syntax.list([classElement])); - }; - - ClassDeclarationSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ClassDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ClassDeclarationSyntax = ClassDeclarationSyntax; - - var InterfaceDeclarationSyntax = (function (_super) { - __extends(InterfaceDeclarationSyntax, _super); - function InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.interfaceKeyword = interfaceKeyword; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.body = body; - } - InterfaceDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitInterfaceDeclaration(this); - }; - - InterfaceDeclarationSyntax.prototype.kind = function () { - return 128 /* InterfaceDeclaration */; - }; - - InterfaceDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - InterfaceDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.interfaceKeyword; - case 2: - return this.identifier; - case 3: - return this.typeParameterList; - case 4: - return this.heritageClauses; - case 5: - return this.body; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - InterfaceDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - InterfaceDeclarationSyntax.prototype.update = function (modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - if (this.modifiers === modifiers && this.interfaceKeyword === interfaceKeyword && this.identifier === identifier && this.typeParameterList === typeParameterList && this.heritageClauses === heritageClauses && this.body === body) { - return this; - } - - return new InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, this.parsedInStrictMode()); - }; - - InterfaceDeclarationSyntax.create = function (interfaceKeyword, identifier, body) { - return new InterfaceDeclarationSyntax(TypeScript.Syntax.emptyList, interfaceKeyword, identifier, null, TypeScript.Syntax.emptyList, body, false); - }; - - InterfaceDeclarationSyntax.create1 = function (identifier) { - return new InterfaceDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(52 /* InterfaceKeyword */), identifier, null, TypeScript.Syntax.emptyList, ObjectTypeSyntax.create1(), false); - }; - - InterfaceDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - InterfaceDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - InterfaceDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.interfaceKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - InterfaceDeclarationSyntax.prototype.withInterfaceKeyword = function (interfaceKeyword) { - return this.update(this.modifiers, interfaceKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.interfaceKeyword, identifier, this.typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(this.modifiers, this.interfaceKeyword, this.identifier, typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withHeritageClauses = function (heritageClauses) { - return this.update(this.modifiers, this.interfaceKeyword, this.identifier, this.typeParameterList, heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withHeritageClause = function (heritageClause) { - return this.withHeritageClauses(TypeScript.Syntax.list([heritageClause])); - }; - - InterfaceDeclarationSyntax.prototype.withBody = function (body) { - return this.update(this.modifiers, this.interfaceKeyword, this.identifier, this.typeParameterList, this.heritageClauses, body); - }; - - InterfaceDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return InterfaceDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.InterfaceDeclarationSyntax = InterfaceDeclarationSyntax; - - var HeritageClauseSyntax = (function (_super) { - __extends(HeritageClauseSyntax, _super); - function HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.extendsOrImplementsKeyword = extendsOrImplementsKeyword; - this.typeNames = typeNames; - - this._kind = kind; - } - HeritageClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitHeritageClause(this); - }; - - HeritageClauseSyntax.prototype.childCount = function () { - return 2; - }; - - HeritageClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.extendsOrImplementsKeyword; - case 1: - return this.typeNames; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - HeritageClauseSyntax.prototype.kind = function () { - return this._kind; - }; - - HeritageClauseSyntax.prototype.update = function (kind, extendsOrImplementsKeyword, typeNames) { - if (this._kind === kind && this.extendsOrImplementsKeyword === extendsOrImplementsKeyword && this.typeNames === typeNames) { - return this; - } - - return new HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, this.parsedInStrictMode()); - }; - - HeritageClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - HeritageClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - HeritageClauseSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.extendsOrImplementsKeyword, this.typeNames); - }; - - HeritageClauseSyntax.prototype.withExtendsOrImplementsKeyword = function (extendsOrImplementsKeyword) { - return this.update(this._kind, extendsOrImplementsKeyword, this.typeNames); - }; - - HeritageClauseSyntax.prototype.withTypeNames = function (typeNames) { - return this.update(this._kind, this.extendsOrImplementsKeyword, typeNames); - }; - - HeritageClauseSyntax.prototype.withTypeName = function (typeName) { - return this.withTypeNames(TypeScript.Syntax.separatedList([typeName])); - }; - - HeritageClauseSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return HeritageClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.HeritageClauseSyntax = HeritageClauseSyntax; - - var ModuleDeclarationSyntax = (function (_super) { - __extends(ModuleDeclarationSyntax, _super); - function ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.moduleKeyword = moduleKeyword; - this.name = name; - this.stringLiteral = stringLiteral; - this.openBraceToken = openBraceToken; - this.moduleElements = moduleElements; - this.closeBraceToken = closeBraceToken; - } - ModuleDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitModuleDeclaration(this); - }; - - ModuleDeclarationSyntax.prototype.kind = function () { - return 130 /* ModuleDeclaration */; - }; - - ModuleDeclarationSyntax.prototype.childCount = function () { - return 7; - }; - - ModuleDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.moduleKeyword; - case 2: - return this.name; - case 3: - return this.stringLiteral; - case 4: - return this.openBraceToken; - case 5: - return this.moduleElements; - case 6: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ModuleDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - ModuleDeclarationSyntax.prototype.update = function (modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - if (this.modifiers === modifiers && this.moduleKeyword === moduleKeyword && this.name === name && this.stringLiteral === stringLiteral && this.openBraceToken === openBraceToken && this.moduleElements === moduleElements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, this.parsedInStrictMode()); - }; - - ModuleDeclarationSyntax.create = function (moduleKeyword, openBraceToken, closeBraceToken) { - return new ModuleDeclarationSyntax(TypeScript.Syntax.emptyList, moduleKeyword, null, null, openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - ModuleDeclarationSyntax.create1 = function () { - return new ModuleDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(65 /* ModuleKeyword */), null, null, TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ModuleDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ModuleDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ModuleDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ModuleDeclarationSyntax.prototype.withModuleKeyword = function (moduleKeyword) { - return this.update(this.modifiers, moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withName = function (name) { - return this.update(this.modifiers, this.moduleKeyword, name, this.stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withStringLiteral = function (stringLiteral) { - return this.update(this.modifiers, this.moduleKeyword, this.name, stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.modifiers, this.moduleKeyword, this.name, this.stringLiteral, openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withModuleElements = function (moduleElements) { - return this.update(this.modifiers, this.moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withModuleElement = function (moduleElement) { - return this.withModuleElements(TypeScript.Syntax.list([moduleElement])); - }; - - ModuleDeclarationSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.modifiers, this.moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, this.moduleElements, closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ModuleDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ModuleDeclarationSyntax = ModuleDeclarationSyntax; - - var FunctionDeclarationSyntax = (function (_super) { - __extends(FunctionDeclarationSyntax, _super); - function FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.functionKeyword = functionKeyword; - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - this.semicolonToken = semicolonToken; - } - FunctionDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionDeclaration(this); - }; - - FunctionDeclarationSyntax.prototype.kind = function () { - return 129 /* FunctionDeclaration */; - }; - - FunctionDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - FunctionDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.functionKeyword; - case 2: - return this.identifier; - case 3: - return this.callSignature; - case 4: - return this.block; - case 5: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionDeclarationSyntax.prototype.isStatement = function () { - return true; - }; - - FunctionDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - FunctionDeclarationSyntax.prototype.update = function (modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - if (this.modifiers === modifiers && this.functionKeyword === functionKeyword && this.identifier === identifier && this.callSignature === callSignature && this.block === block && this.semicolonToken === semicolonToken) { - return this; - } - - return new FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, this.parsedInStrictMode()); - }; - - FunctionDeclarationSyntax.create = function (functionKeyword, identifier, callSignature) { - return new FunctionDeclarationSyntax(TypeScript.Syntax.emptyList, functionKeyword, identifier, callSignature, null, null, false); - }; - - FunctionDeclarationSyntax.create1 = function (identifier) { - return new FunctionDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(27 /* FunctionKeyword */), identifier, CallSignatureSyntax.create1(), null, null, false); - }; - - FunctionDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.functionKeyword, this.identifier, this.callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - FunctionDeclarationSyntax.prototype.withFunctionKeyword = function (functionKeyword) { - return this.update(this.modifiers, functionKeyword, this.identifier, this.callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.functionKeyword, identifier, this.callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.modifiers, this.functionKeyword, this.identifier, callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.functionKeyword, this.identifier, this.callSignature, block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.functionKeyword, this.identifier, this.callSignature, this.block, semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - if (this.modifiers.childCount() > 0) { - return true; - } - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - if (this.block !== null && this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FunctionDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionDeclarationSyntax = FunctionDeclarationSyntax; - - var VariableStatementSyntax = (function (_super) { - __extends(VariableStatementSyntax, _super); - function VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.variableDeclaration = variableDeclaration; - this.semicolonToken = semicolonToken; - } - VariableStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitVariableStatement(this); - }; - - VariableStatementSyntax.prototype.kind = function () { - return 148 /* VariableStatement */; - }; - - VariableStatementSyntax.prototype.childCount = function () { - return 3; - }; - - VariableStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.variableDeclaration; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VariableStatementSyntax.prototype.isStatement = function () { - return true; - }; - - VariableStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - VariableStatementSyntax.prototype.update = function (modifiers, variableDeclaration, semicolonToken) { - if (this.modifiers === modifiers && this.variableDeclaration === variableDeclaration && this.semicolonToken === semicolonToken) { - return this; - } - - return new VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, this.parsedInStrictMode()); - }; - - VariableStatementSyntax.create = function (variableDeclaration, semicolonToken) { - return new VariableStatementSyntax(TypeScript.Syntax.emptyList, variableDeclaration, semicolonToken, false); - }; - - VariableStatementSyntax.create1 = function (variableDeclaration) { - return new VariableStatementSyntax(TypeScript.Syntax.emptyList, variableDeclaration, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - VariableStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VariableStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VariableStatementSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.variableDeclaration, this.semicolonToken); - }; - - VariableStatementSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - VariableStatementSyntax.prototype.withVariableDeclaration = function (variableDeclaration) { - return this.update(this.modifiers, variableDeclaration, this.semicolonToken); - }; - - VariableStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.variableDeclaration, semicolonToken); - }; - - VariableStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.modifiers.childCount() > 0) { - return true; - } - if (this.variableDeclaration.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VariableStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VariableStatementSyntax = VariableStatementSyntax; - - var VariableDeclarationSyntax = (function (_super) { - __extends(VariableDeclarationSyntax, _super); - function VariableDeclarationSyntax(varKeyword, variableDeclarators, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.varKeyword = varKeyword; - this.variableDeclarators = variableDeclarators; - } - VariableDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitVariableDeclaration(this); - }; - - VariableDeclarationSyntax.prototype.kind = function () { - return 224 /* VariableDeclaration */; - }; - - VariableDeclarationSyntax.prototype.childCount = function () { - return 2; - }; - - VariableDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.varKeyword; - case 1: - return this.variableDeclarators; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VariableDeclarationSyntax.prototype.update = function (varKeyword, variableDeclarators) { - if (this.varKeyword === varKeyword && this.variableDeclarators === variableDeclarators) { - return this; - } - - return new VariableDeclarationSyntax(varKeyword, variableDeclarators, this.parsedInStrictMode()); - }; - - VariableDeclarationSyntax.create1 = function (variableDeclarators) { - return new VariableDeclarationSyntax(TypeScript.Syntax.token(40 /* VarKeyword */), variableDeclarators, false); - }; - - VariableDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VariableDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VariableDeclarationSyntax.prototype.withVarKeyword = function (varKeyword) { - return this.update(varKeyword, this.variableDeclarators); - }; - - VariableDeclarationSyntax.prototype.withVariableDeclarators = function (variableDeclarators) { - return this.update(this.varKeyword, variableDeclarators); - }; - - VariableDeclarationSyntax.prototype.withVariableDeclarator = function (variableDeclarator) { - return this.withVariableDeclarators(TypeScript.Syntax.separatedList([variableDeclarator])); - }; - - VariableDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - if (this.variableDeclarators.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VariableDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VariableDeclarationSyntax = VariableDeclarationSyntax; - - var VariableDeclaratorSyntax = (function (_super) { - __extends(VariableDeclaratorSyntax, _super); - function VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - } - VariableDeclaratorSyntax.prototype.accept = function (visitor) { - return visitor.visitVariableDeclarator(this); - }; - - VariableDeclaratorSyntax.prototype.kind = function () { - return 225 /* VariableDeclarator */; - }; - - VariableDeclaratorSyntax.prototype.childCount = function () { - return 3; - }; - - VariableDeclaratorSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.typeAnnotation; - case 2: - return this.equalsValueClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VariableDeclaratorSyntax.prototype.update = function (propertyName, typeAnnotation, equalsValueClause) { - if (this.propertyName === propertyName && this.typeAnnotation === typeAnnotation && this.equalsValueClause === equalsValueClause) { - return this; - } - - return new VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, this.parsedInStrictMode()); - }; - - VariableDeclaratorSyntax.create = function (propertyName) { - return new VariableDeclaratorSyntax(propertyName, null, null, false); - }; - - VariableDeclaratorSyntax.create1 = function (propertyName) { - return new VariableDeclaratorSyntax(propertyName, null, null, false); - }; - - VariableDeclaratorSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VariableDeclaratorSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VariableDeclaratorSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.typeAnnotation, this.equalsValueClause); - }; - - VariableDeclaratorSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.propertyName, typeAnnotation, this.equalsValueClause); - }; - - VariableDeclaratorSyntax.prototype.withEqualsValueClause = function (equalsValueClause) { - return this.update(this.propertyName, this.typeAnnotation, equalsValueClause); - }; - - VariableDeclaratorSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeAnnotation !== null) { - return true; - } - if (this.equalsValueClause !== null && this.equalsValueClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VariableDeclaratorSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VariableDeclaratorSyntax = VariableDeclaratorSyntax; - - var EqualsValueClauseSyntax = (function (_super) { - __extends(EqualsValueClauseSyntax, _super); - function EqualsValueClauseSyntax(equalsToken, value, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.equalsToken = equalsToken; - this.value = value; - } - EqualsValueClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitEqualsValueClause(this); - }; - - EqualsValueClauseSyntax.prototype.kind = function () { - return 232 /* EqualsValueClause */; - }; - - EqualsValueClauseSyntax.prototype.childCount = function () { - return 2; - }; - - EqualsValueClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.equalsToken; - case 1: - return this.value; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EqualsValueClauseSyntax.prototype.update = function (equalsToken, value) { - if (this.equalsToken === equalsToken && this.value === value) { - return this; - } - - return new EqualsValueClauseSyntax(equalsToken, value, this.parsedInStrictMode()); - }; - - EqualsValueClauseSyntax.create1 = function (value) { - return new EqualsValueClauseSyntax(TypeScript.Syntax.token(107 /* EqualsToken */), value, false); - }; - - EqualsValueClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EqualsValueClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EqualsValueClauseSyntax.prototype.withEqualsToken = function (equalsToken) { - return this.update(equalsToken, this.value); - }; - - EqualsValueClauseSyntax.prototype.withValue = function (value) { - return this.update(this.equalsToken, value); - }; - - EqualsValueClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.value.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return EqualsValueClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EqualsValueClauseSyntax = EqualsValueClauseSyntax; - - var PrefixUnaryExpressionSyntax = (function (_super) { - __extends(PrefixUnaryExpressionSyntax, _super); - function PrefixUnaryExpressionSyntax(kind, operatorToken, operand, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.operatorToken = operatorToken; - this.operand = operand; - - this._kind = kind; - } - PrefixUnaryExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitPrefixUnaryExpression(this); - }; - - PrefixUnaryExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - PrefixUnaryExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.operatorToken; - case 1: - return this.operand; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - PrefixUnaryExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - PrefixUnaryExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - PrefixUnaryExpressionSyntax.prototype.kind = function () { - return this._kind; - }; - - PrefixUnaryExpressionSyntax.prototype.update = function (kind, operatorToken, operand) { - if (this._kind === kind && this.operatorToken === operatorToken && this.operand === operand) { - return this; - } - - return new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.parsedInStrictMode()); - }; - - PrefixUnaryExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - PrefixUnaryExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - PrefixUnaryExpressionSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.operatorToken, this.operand); - }; - - PrefixUnaryExpressionSyntax.prototype.withOperatorToken = function (operatorToken) { - return this.update(this._kind, operatorToken, this.operand); - }; - - PrefixUnaryExpressionSyntax.prototype.withOperand = function (operand) { - return this.update(this._kind, this.operatorToken, operand); - }; - - PrefixUnaryExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.operand.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return PrefixUnaryExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.PrefixUnaryExpressionSyntax = PrefixUnaryExpressionSyntax; - - var ArrayLiteralExpressionSyntax = (function (_super) { - __extends(ArrayLiteralExpressionSyntax, _super); - function ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBracketToken = openBracketToken; - this.expressions = expressions; - this.closeBracketToken = closeBracketToken; - } - ArrayLiteralExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitArrayLiteralExpression(this); - }; - - ArrayLiteralExpressionSyntax.prototype.kind = function () { - return 214 /* ArrayLiteralExpression */; - }; - - ArrayLiteralExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ArrayLiteralExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBracketToken; - case 1: - return this.expressions; - case 2: - return this.closeBracketToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ArrayLiteralExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.update = function (openBracketToken, expressions, closeBracketToken) { - if (this.openBracketToken === openBracketToken && this.expressions === expressions && this.closeBracketToken === closeBracketToken) { - return this; - } - - return new ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, this.parsedInStrictMode()); - }; - - ArrayLiteralExpressionSyntax.create = function (openBracketToken, closeBracketToken) { - return new ArrayLiteralExpressionSyntax(openBracketToken, TypeScript.Syntax.emptySeparatedList, closeBracketToken, false); - }; - - ArrayLiteralExpressionSyntax.create1 = function () { - return new ArrayLiteralExpressionSyntax(TypeScript.Syntax.token(74 /* OpenBracketToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(75 /* CloseBracketToken */), false); - }; - - ArrayLiteralExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ArrayLiteralExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ArrayLiteralExpressionSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(openBracketToken, this.expressions, this.closeBracketToken); - }; - - ArrayLiteralExpressionSyntax.prototype.withExpressions = function (expressions) { - return this.update(this.openBracketToken, expressions, this.closeBracketToken); - }; - - ArrayLiteralExpressionSyntax.prototype.withExpression = function (expression) { - return this.withExpressions(TypeScript.Syntax.separatedList([expression])); - }; - - ArrayLiteralExpressionSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.openBracketToken, this.expressions, closeBracketToken); - }; - - ArrayLiteralExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expressions.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ArrayLiteralExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ArrayLiteralExpressionSyntax = ArrayLiteralExpressionSyntax; - - var OmittedExpressionSyntax = (function (_super) { - __extends(OmittedExpressionSyntax, _super); - function OmittedExpressionSyntax(parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - } - OmittedExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitOmittedExpression(this); - }; - - OmittedExpressionSyntax.prototype.kind = function () { - return 223 /* OmittedExpression */; - }; - - OmittedExpressionSyntax.prototype.childCount = function () { - return 0; - }; - - OmittedExpressionSyntax.prototype.childAt = function (slot) { - throw TypeScript.Errors.invalidOperation(); - }; - - OmittedExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - OmittedExpressionSyntax.prototype.update = function () { - return this; - }; - - OmittedExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - OmittedExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - OmittedExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return OmittedExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.OmittedExpressionSyntax = OmittedExpressionSyntax; - - var ParenthesizedExpressionSyntax = (function (_super) { - __extends(ParenthesizedExpressionSyntax, _super); - function ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openParenToken = openParenToken; - this.expression = expression; - this.closeParenToken = closeParenToken; - } - ParenthesizedExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitParenthesizedExpression(this); - }; - - ParenthesizedExpressionSyntax.prototype.kind = function () { - return 217 /* ParenthesizedExpression */; - }; - - ParenthesizedExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ParenthesizedExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openParenToken; - case 1: - return this.expression; - case 2: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParenthesizedExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.update = function (openParenToken, expression, closeParenToken) { - if (this.openParenToken === openParenToken && this.expression === expression && this.closeParenToken === closeParenToken) { - return this; - } - - return new ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, this.parsedInStrictMode()); - }; - - ParenthesizedExpressionSyntax.create1 = function (expression) { - return new ParenthesizedExpressionSyntax(TypeScript.Syntax.token(72 /* OpenParenToken */), expression, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ParenthesizedExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParenthesizedExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParenthesizedExpressionSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(openParenToken, this.expression, this.closeParenToken); - }; - - ParenthesizedExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.openParenToken, expression, this.closeParenToken); - }; - - ParenthesizedExpressionSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.openParenToken, this.expression, closeParenToken); - }; - - ParenthesizedExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ParenthesizedExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParenthesizedExpressionSyntax = ParenthesizedExpressionSyntax; - - var SimpleArrowFunctionExpressionSyntax = (function (_super) { - __extends(SimpleArrowFunctionExpressionSyntax, _super); - function SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.identifier = identifier; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.block = block; - this.expression = expression; - } - SimpleArrowFunctionExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitSimpleArrowFunctionExpression(this); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.kind = function () { - return 219 /* SimpleArrowFunctionExpression */; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.identifier; - case 1: - return this.equalsGreaterThanToken; - case 2: - return this.block; - case 3: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isArrowFunctionExpression = function () { - return true; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.update = function (identifier, equalsGreaterThanToken, block, expression) { - if (this.identifier === identifier && this.equalsGreaterThanToken === equalsGreaterThanToken && this.block === block && this.expression === expression) { - return this; - } - - return new SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, this.parsedInStrictMode()); - }; - - SimpleArrowFunctionExpressionSyntax.create = function (identifier, equalsGreaterThanToken) { - return new SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, null, null, false); - }; - - SimpleArrowFunctionExpressionSyntax.create1 = function (identifier) { - return new SimpleArrowFunctionExpressionSyntax(identifier, TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), null, null, false); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withIdentifier = function (identifier) { - return this.update(identifier, this.equalsGreaterThanToken, this.block, this.expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.identifier, equalsGreaterThanToken, this.block, this.expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withBlock = function (block) { - return this.update(this.identifier, this.equalsGreaterThanToken, block, this.expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.identifier, this.equalsGreaterThanToken, this.block, expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return SimpleArrowFunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SimpleArrowFunctionExpressionSyntax = SimpleArrowFunctionExpressionSyntax; - - var ParenthesizedArrowFunctionExpressionSyntax = (function (_super) { - __extends(ParenthesizedArrowFunctionExpressionSyntax, _super); - function ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.callSignature = callSignature; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.block = block; - this.expression = expression; - } - ParenthesizedArrowFunctionExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitParenthesizedArrowFunctionExpression(this); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.kind = function () { - return 218 /* ParenthesizedArrowFunctionExpression */; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.callSignature; - case 1: - return this.equalsGreaterThanToken; - case 2: - return this.block; - case 3: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isArrowFunctionExpression = function () { - return true; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.update = function (callSignature, equalsGreaterThanToken, block, expression) { - if (this.callSignature === callSignature && this.equalsGreaterThanToken === equalsGreaterThanToken && this.block === block && this.expression === expression) { - return this; - } - - return new ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, this.parsedInStrictMode()); - }; - - ParenthesizedArrowFunctionExpressionSyntax.create = function (callSignature, equalsGreaterThanToken) { - return new ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, null, null, false); - }; - - ParenthesizedArrowFunctionExpressionSyntax.create1 = function () { - return new ParenthesizedArrowFunctionExpressionSyntax(CallSignatureSyntax.create1(), TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), null, null, false); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(callSignature, this.equalsGreaterThanToken, this.block, this.expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.callSignature, equalsGreaterThanToken, this.block, this.expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withBlock = function (block) { - return this.update(this.callSignature, this.equalsGreaterThanToken, block, this.expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.callSignature, this.equalsGreaterThanToken, this.block, expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ParenthesizedArrowFunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParenthesizedArrowFunctionExpressionSyntax = ParenthesizedArrowFunctionExpressionSyntax; - - var QualifiedNameSyntax = (function (_super) { - __extends(QualifiedNameSyntax, _super); - function QualifiedNameSyntax(left, dotToken, right, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.left = left; - this.dotToken = dotToken; - this.right = right; - } - QualifiedNameSyntax.prototype.accept = function (visitor) { - return visitor.visitQualifiedName(this); - }; - - QualifiedNameSyntax.prototype.kind = function () { - return 121 /* QualifiedName */; - }; - - QualifiedNameSyntax.prototype.childCount = function () { - return 3; - }; - - QualifiedNameSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.left; - case 1: - return this.dotToken; - case 2: - return this.right; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - QualifiedNameSyntax.prototype.isName = function () { - return true; - }; - - QualifiedNameSyntax.prototype.isType = function () { - return true; - }; - - QualifiedNameSyntax.prototype.update = function (left, dotToken, right) { - if (this.left === left && this.dotToken === dotToken && this.right === right) { - return this; - } - - return new QualifiedNameSyntax(left, dotToken, right, this.parsedInStrictMode()); - }; - - QualifiedNameSyntax.create1 = function (left, right) { - return new QualifiedNameSyntax(left, TypeScript.Syntax.token(76 /* DotToken */), right, false); - }; - - QualifiedNameSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - QualifiedNameSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - QualifiedNameSyntax.prototype.withLeft = function (left) { - return this.update(left, this.dotToken, this.right); - }; - - QualifiedNameSyntax.prototype.withDotToken = function (dotToken) { - return this.update(this.left, dotToken, this.right); - }; - - QualifiedNameSyntax.prototype.withRight = function (right) { - return this.update(this.left, this.dotToken, right); - }; - - QualifiedNameSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return QualifiedNameSyntax; - })(TypeScript.SyntaxNode); - TypeScript.QualifiedNameSyntax = QualifiedNameSyntax; - - var TypeArgumentListSyntax = (function (_super) { - __extends(TypeArgumentListSyntax, _super); - function TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.lessThanToken = lessThanToken; - this.typeArguments = typeArguments; - this.greaterThanToken = greaterThanToken; - } - TypeArgumentListSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeArgumentList(this); - }; - - TypeArgumentListSyntax.prototype.kind = function () { - return 228 /* TypeArgumentList */; - }; - - TypeArgumentListSyntax.prototype.childCount = function () { - return 3; - }; - - TypeArgumentListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.lessThanToken; - case 1: - return this.typeArguments; - case 2: - return this.greaterThanToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeArgumentListSyntax.prototype.update = function (lessThanToken, typeArguments, greaterThanToken) { - if (this.lessThanToken === lessThanToken && this.typeArguments === typeArguments && this.greaterThanToken === greaterThanToken) { - return this; - } - - return new TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, this.parsedInStrictMode()); - }; - - TypeArgumentListSyntax.create = function (lessThanToken, greaterThanToken) { - return new TypeArgumentListSyntax(lessThanToken, TypeScript.Syntax.emptySeparatedList, greaterThanToken, false); - }; - - TypeArgumentListSyntax.create1 = function () { - return new TypeArgumentListSyntax(TypeScript.Syntax.token(80 /* LessThanToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(81 /* GreaterThanToken */), false); - }; - - TypeArgumentListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeArgumentListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeArgumentListSyntax.prototype.withLessThanToken = function (lessThanToken) { - return this.update(lessThanToken, this.typeArguments, this.greaterThanToken); - }; - - TypeArgumentListSyntax.prototype.withTypeArguments = function (typeArguments) { - return this.update(this.lessThanToken, typeArguments, this.greaterThanToken); - }; - - TypeArgumentListSyntax.prototype.withTypeArgument = function (typeArgument) { - return this.withTypeArguments(TypeScript.Syntax.separatedList([typeArgument])); - }; - - TypeArgumentListSyntax.prototype.withGreaterThanToken = function (greaterThanToken) { - return this.update(this.lessThanToken, this.typeArguments, greaterThanToken); - }; - - TypeArgumentListSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeArgumentListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeArgumentListSyntax = TypeArgumentListSyntax; - - var ConstructorTypeSyntax = (function (_super) { - __extends(ConstructorTypeSyntax, _super); - function ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.newKeyword = newKeyword; - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.type = type; - } - ConstructorTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitConstructorType(this); - }; - - ConstructorTypeSyntax.prototype.kind = function () { - return 125 /* ConstructorType */; - }; - - ConstructorTypeSyntax.prototype.childCount = function () { - return 5; - }; - - ConstructorTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.newKeyword; - case 1: - return this.typeParameterList; - case 2: - return this.parameterList; - case 3: - return this.equalsGreaterThanToken; - case 4: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstructorTypeSyntax.prototype.isType = function () { - return true; - }; - - ConstructorTypeSyntax.prototype.update = function (newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - if (this.newKeyword === newKeyword && this.typeParameterList === typeParameterList && this.parameterList === parameterList && this.equalsGreaterThanToken === equalsGreaterThanToken && this.type === type) { - return this; - } - - return new ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, this.parsedInStrictMode()); - }; - - ConstructorTypeSyntax.create = function (newKeyword, parameterList, equalsGreaterThanToken, type) { - return new ConstructorTypeSyntax(newKeyword, null, parameterList, equalsGreaterThanToken, type, false); - }; - - ConstructorTypeSyntax.create1 = function (type) { - return new ConstructorTypeSyntax(TypeScript.Syntax.token(31 /* NewKeyword */), null, ParameterListSyntax.create1(), TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), type, false); - }; - - ConstructorTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstructorTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstructorTypeSyntax.prototype.withNewKeyword = function (newKeyword) { - return this.update(newKeyword, this.typeParameterList, this.parameterList, this.equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(this.newKeyword, typeParameterList, this.parameterList, this.equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.newKeyword, this.typeParameterList, parameterList, this.equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.newKeyword, this.typeParameterList, this.parameterList, equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withType = function (type) { - return this.update(this.newKeyword, this.typeParameterList, this.parameterList, this.equalsGreaterThanToken, type); - }; - - ConstructorTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstructorTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstructorTypeSyntax = ConstructorTypeSyntax; - - var FunctionTypeSyntax = (function (_super) { - __extends(FunctionTypeSyntax, _super); - function FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.type = type; - } - FunctionTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionType(this); - }; - - FunctionTypeSyntax.prototype.kind = function () { - return 123 /* FunctionType */; - }; - - FunctionTypeSyntax.prototype.childCount = function () { - return 4; - }; - - FunctionTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeParameterList; - case 1: - return this.parameterList; - case 2: - return this.equalsGreaterThanToken; - case 3: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionTypeSyntax.prototype.isType = function () { - return true; - }; - - FunctionTypeSyntax.prototype.update = function (typeParameterList, parameterList, equalsGreaterThanToken, type) { - if (this.typeParameterList === typeParameterList && this.parameterList === parameterList && this.equalsGreaterThanToken === equalsGreaterThanToken && this.type === type) { - return this; - } - - return new FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, this.parsedInStrictMode()); - }; - - FunctionTypeSyntax.create = function (parameterList, equalsGreaterThanToken, type) { - return new FunctionTypeSyntax(null, parameterList, equalsGreaterThanToken, type, false); - }; - - FunctionTypeSyntax.create1 = function (type) { - return new FunctionTypeSyntax(null, ParameterListSyntax.create1(), TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), type, false); - }; - - FunctionTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionTypeSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(typeParameterList, this.parameterList, this.equalsGreaterThanToken, this.type); - }; - - FunctionTypeSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.typeParameterList, parameterList, this.equalsGreaterThanToken, this.type); - }; - - FunctionTypeSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.typeParameterList, this.parameterList, equalsGreaterThanToken, this.type); - }; - - FunctionTypeSyntax.prototype.withType = function (type) { - return this.update(this.typeParameterList, this.parameterList, this.equalsGreaterThanToken, type); - }; - - FunctionTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return FunctionTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionTypeSyntax = FunctionTypeSyntax; - - var ObjectTypeSyntax = (function (_super) { - __extends(ObjectTypeSyntax, _super); - function ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBraceToken = openBraceToken; - this.typeMembers = typeMembers; - this.closeBraceToken = closeBraceToken; - } - ObjectTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitObjectType(this); - }; - - ObjectTypeSyntax.prototype.kind = function () { - return 122 /* ObjectType */; - }; - - ObjectTypeSyntax.prototype.childCount = function () { - return 3; - }; - - ObjectTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBraceToken; - case 1: - return this.typeMembers; - case 2: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ObjectTypeSyntax.prototype.isType = function () { - return true; - }; - - ObjectTypeSyntax.prototype.update = function (openBraceToken, typeMembers, closeBraceToken) { - if (this.openBraceToken === openBraceToken && this.typeMembers === typeMembers && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, this.parsedInStrictMode()); - }; - - ObjectTypeSyntax.create = function (openBraceToken, closeBraceToken) { - return new ObjectTypeSyntax(openBraceToken, TypeScript.Syntax.emptySeparatedList, closeBraceToken, false); - }; - - ObjectTypeSyntax.create1 = function () { - return new ObjectTypeSyntax(TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ObjectTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ObjectTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ObjectTypeSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(openBraceToken, this.typeMembers, this.closeBraceToken); - }; - - ObjectTypeSyntax.prototype.withTypeMembers = function (typeMembers) { - return this.update(this.openBraceToken, typeMembers, this.closeBraceToken); - }; - - ObjectTypeSyntax.prototype.withTypeMember = function (typeMember) { - return this.withTypeMembers(TypeScript.Syntax.separatedList([typeMember])); - }; - - ObjectTypeSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.openBraceToken, this.typeMembers, closeBraceToken); - }; - - ObjectTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ObjectTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ObjectTypeSyntax = ObjectTypeSyntax; - - var ArrayTypeSyntax = (function (_super) { - __extends(ArrayTypeSyntax, _super); - function ArrayTypeSyntax(type, openBracketToken, closeBracketToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.type = type; - this.openBracketToken = openBracketToken; - this.closeBracketToken = closeBracketToken; - } - ArrayTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitArrayType(this); - }; - - ArrayTypeSyntax.prototype.kind = function () { - return 124 /* ArrayType */; - }; - - ArrayTypeSyntax.prototype.childCount = function () { - return 3; - }; - - ArrayTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.type; - case 1: - return this.openBracketToken; - case 2: - return this.closeBracketToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ArrayTypeSyntax.prototype.isType = function () { - return true; - }; - - ArrayTypeSyntax.prototype.update = function (type, openBracketToken, closeBracketToken) { - if (this.type === type && this.openBracketToken === openBracketToken && this.closeBracketToken === closeBracketToken) { - return this; - } - - return new ArrayTypeSyntax(type, openBracketToken, closeBracketToken, this.parsedInStrictMode()); - }; - - ArrayTypeSyntax.create1 = function (type) { - return new ArrayTypeSyntax(type, TypeScript.Syntax.token(74 /* OpenBracketToken */), TypeScript.Syntax.token(75 /* CloseBracketToken */), false); - }; - - ArrayTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ArrayTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ArrayTypeSyntax.prototype.withType = function (type) { - return this.update(type, this.openBracketToken, this.closeBracketToken); - }; - - ArrayTypeSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(this.type, openBracketToken, this.closeBracketToken); - }; - - ArrayTypeSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.type, this.openBracketToken, closeBracketToken); - }; - - ArrayTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ArrayTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ArrayTypeSyntax = ArrayTypeSyntax; - - var GenericTypeSyntax = (function (_super) { - __extends(GenericTypeSyntax, _super); - function GenericTypeSyntax(name, typeArgumentList, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.name = name; - this.typeArgumentList = typeArgumentList; - } - GenericTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitGenericType(this); - }; - - GenericTypeSyntax.prototype.kind = function () { - return 126 /* GenericType */; - }; - - GenericTypeSyntax.prototype.childCount = function () { - return 2; - }; - - GenericTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.name; - case 1: - return this.typeArgumentList; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - GenericTypeSyntax.prototype.isType = function () { - return true; - }; - - GenericTypeSyntax.prototype.update = function (name, typeArgumentList) { - if (this.name === name && this.typeArgumentList === typeArgumentList) { - return this; - } - - return new GenericTypeSyntax(name, typeArgumentList, this.parsedInStrictMode()); - }; - - GenericTypeSyntax.create1 = function (name) { - return new GenericTypeSyntax(name, TypeArgumentListSyntax.create1(), false); - }; - - GenericTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - GenericTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - GenericTypeSyntax.prototype.withName = function (name) { - return this.update(name, this.typeArgumentList); - }; - - GenericTypeSyntax.prototype.withTypeArgumentList = function (typeArgumentList) { - return this.update(this.name, typeArgumentList); - }; - - GenericTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return GenericTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.GenericTypeSyntax = GenericTypeSyntax; - - var TypeQuerySyntax = (function (_super) { - __extends(TypeQuerySyntax, _super); - function TypeQuerySyntax(typeOfKeyword, name, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeOfKeyword = typeOfKeyword; - this.name = name; - } - TypeQuerySyntax.prototype.accept = function (visitor) { - return visitor.visitTypeQuery(this); - }; - - TypeQuerySyntax.prototype.kind = function () { - return 127 /* TypeQuery */; - }; - - TypeQuerySyntax.prototype.childCount = function () { - return 2; - }; - - TypeQuerySyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeOfKeyword; - case 1: - return this.name; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeQuerySyntax.prototype.isType = function () { - return true; - }; - - TypeQuerySyntax.prototype.update = function (typeOfKeyword, name) { - if (this.typeOfKeyword === typeOfKeyword && this.name === name) { - return this; - } - - return new TypeQuerySyntax(typeOfKeyword, name, this.parsedInStrictMode()); - }; - - TypeQuerySyntax.create1 = function (name) { - return new TypeQuerySyntax(TypeScript.Syntax.token(39 /* TypeOfKeyword */), name, false); - }; - - TypeQuerySyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeQuerySyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeQuerySyntax.prototype.withTypeOfKeyword = function (typeOfKeyword) { - return this.update(typeOfKeyword, this.name); - }; - - TypeQuerySyntax.prototype.withName = function (name) { - return this.update(this.typeOfKeyword, name); - }; - - TypeQuerySyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeQuerySyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeQuerySyntax = TypeQuerySyntax; - - var TypeAnnotationSyntax = (function (_super) { - __extends(TypeAnnotationSyntax, _super); - function TypeAnnotationSyntax(colonToken, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.colonToken = colonToken; - this.type = type; - } - TypeAnnotationSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeAnnotation(this); - }; - - TypeAnnotationSyntax.prototype.kind = function () { - return 244 /* TypeAnnotation */; - }; - - TypeAnnotationSyntax.prototype.childCount = function () { - return 2; - }; - - TypeAnnotationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.colonToken; - case 1: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeAnnotationSyntax.prototype.update = function (colonToken, type) { - if (this.colonToken === colonToken && this.type === type) { - return this; - } - - return new TypeAnnotationSyntax(colonToken, type, this.parsedInStrictMode()); - }; - - TypeAnnotationSyntax.create1 = function (type) { - return new TypeAnnotationSyntax(TypeScript.Syntax.token(106 /* ColonToken */), type, false); - }; - - TypeAnnotationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeAnnotationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeAnnotationSyntax.prototype.withColonToken = function (colonToken) { - return this.update(colonToken, this.type); - }; - - TypeAnnotationSyntax.prototype.withType = function (type) { - return this.update(this.colonToken, type); - }; - - TypeAnnotationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeAnnotationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeAnnotationSyntax = TypeAnnotationSyntax; - - var BlockSyntax = (function (_super) { - __extends(BlockSyntax, _super); - function BlockSyntax(openBraceToken, statements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBraceToken = openBraceToken; - this.statements = statements; - this.closeBraceToken = closeBraceToken; - } - BlockSyntax.prototype.accept = function (visitor) { - return visitor.visitBlock(this); - }; - - BlockSyntax.prototype.kind = function () { - return 146 /* Block */; - }; - - BlockSyntax.prototype.childCount = function () { - return 3; - }; - - BlockSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBraceToken; - case 1: - return this.statements; - case 2: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - BlockSyntax.prototype.isStatement = function () { - return true; - }; - - BlockSyntax.prototype.isModuleElement = function () { - return true; - }; - - BlockSyntax.prototype.update = function (openBraceToken, statements, closeBraceToken) { - if (this.openBraceToken === openBraceToken && this.statements === statements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new BlockSyntax(openBraceToken, statements, closeBraceToken, this.parsedInStrictMode()); - }; - - BlockSyntax.create = function (openBraceToken, closeBraceToken) { - return new BlockSyntax(openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - BlockSyntax.create1 = function () { - return new BlockSyntax(TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - BlockSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - BlockSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - BlockSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(openBraceToken, this.statements, this.closeBraceToken); - }; - - BlockSyntax.prototype.withStatements = function (statements) { - return this.update(this.openBraceToken, statements, this.closeBraceToken); - }; - - BlockSyntax.prototype.withStatement = function (statement) { - return this.withStatements(TypeScript.Syntax.list([statement])); - }; - - BlockSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.openBraceToken, this.statements, closeBraceToken); - }; - - BlockSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return BlockSyntax; - })(TypeScript.SyntaxNode); - TypeScript.BlockSyntax = BlockSyntax; - - var ParameterSyntax = (function (_super) { - __extends(ParameterSyntax, _super); - function ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.dotDotDotToken = dotDotDotToken; - this.modifiers = modifiers; - this.identifier = identifier; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - } - ParameterSyntax.prototype.accept = function (visitor) { - return visitor.visitParameter(this); - }; - - ParameterSyntax.prototype.kind = function () { - return 242 /* Parameter */; - }; - - ParameterSyntax.prototype.childCount = function () { - return 6; - }; - - ParameterSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.dotDotDotToken; - case 1: - return this.modifiers; - case 2: - return this.identifier; - case 3: - return this.questionToken; - case 4: - return this.typeAnnotation; - case 5: - return this.equalsValueClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParameterSyntax.prototype.update = function (dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - if (this.dotDotDotToken === dotDotDotToken && this.modifiers === modifiers && this.identifier === identifier && this.questionToken === questionToken && this.typeAnnotation === typeAnnotation && this.equalsValueClause === equalsValueClause) { - return this; - } - - return new ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, this.parsedInStrictMode()); - }; - - ParameterSyntax.create = function (identifier) { - return new ParameterSyntax(null, TypeScript.Syntax.emptyList, identifier, null, null, null, false); - }; - - ParameterSyntax.create1 = function (identifier) { - return new ParameterSyntax(null, TypeScript.Syntax.emptyList, identifier, null, null, null, false); - }; - - ParameterSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParameterSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParameterSyntax.prototype.withDotDotDotToken = function (dotDotDotToken) { - return this.update(dotDotDotToken, this.modifiers, this.identifier, this.questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withModifiers = function (modifiers) { - return this.update(this.dotDotDotToken, modifiers, this.identifier, this.questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ParameterSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.dotDotDotToken, this.modifiers, identifier, this.questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.dotDotDotToken, this.modifiers, this.identifier, questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.dotDotDotToken, this.modifiers, this.identifier, this.questionToken, typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withEqualsValueClause = function (equalsValueClause) { - return this.update(this.dotDotDotToken, this.modifiers, this.identifier, this.questionToken, this.typeAnnotation, equalsValueClause); - }; - - ParameterSyntax.prototype.isTypeScriptSpecific = function () { - if (this.dotDotDotToken !== null) { - return true; - } - if (this.modifiers.isTypeScriptSpecific()) { - return true; - } - if (this.questionToken !== null) { - return true; - } - if (this.typeAnnotation !== null) { - return true; - } - if (this.equalsValueClause !== null) { - return true; - } - return false; - }; - return ParameterSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParameterSyntax = ParameterSyntax; - - var MemberAccessExpressionSyntax = (function (_super) { - __extends(MemberAccessExpressionSyntax, _super); - function MemberAccessExpressionSyntax(expression, dotToken, name, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.dotToken = dotToken; - this.name = name; - } - MemberAccessExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitMemberAccessExpression(this); - }; - - MemberAccessExpressionSyntax.prototype.kind = function () { - return 212 /* MemberAccessExpression */; - }; - - MemberAccessExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - MemberAccessExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.dotToken; - case 2: - return this.name; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MemberAccessExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.update = function (expression, dotToken, name) { - if (this.expression === expression && this.dotToken === dotToken && this.name === name) { - return this; - } - - return new MemberAccessExpressionSyntax(expression, dotToken, name, this.parsedInStrictMode()); - }; - - MemberAccessExpressionSyntax.create1 = function (expression, name) { - return new MemberAccessExpressionSyntax(expression, TypeScript.Syntax.token(76 /* DotToken */), name, false); - }; - - MemberAccessExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MemberAccessExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MemberAccessExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.dotToken, this.name); - }; - - MemberAccessExpressionSyntax.prototype.withDotToken = function (dotToken) { - return this.update(this.expression, dotToken, this.name); - }; - - MemberAccessExpressionSyntax.prototype.withName = function (name) { - return this.update(this.expression, this.dotToken, name); - }; - - MemberAccessExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return MemberAccessExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MemberAccessExpressionSyntax = MemberAccessExpressionSyntax; - - var PostfixUnaryExpressionSyntax = (function (_super) { - __extends(PostfixUnaryExpressionSyntax, _super); - function PostfixUnaryExpressionSyntax(kind, operand, operatorToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.operand = operand; - this.operatorToken = operatorToken; - - this._kind = kind; - } - PostfixUnaryExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitPostfixUnaryExpression(this); - }; - - PostfixUnaryExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - PostfixUnaryExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.operand; - case 1: - return this.operatorToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - PostfixUnaryExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - PostfixUnaryExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - PostfixUnaryExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - PostfixUnaryExpressionSyntax.prototype.kind = function () { - return this._kind; - }; - - PostfixUnaryExpressionSyntax.prototype.update = function (kind, operand, operatorToken) { - if (this._kind === kind && this.operand === operand && this.operatorToken === operatorToken) { - return this; - } - - return new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.parsedInStrictMode()); - }; - - PostfixUnaryExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - PostfixUnaryExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - PostfixUnaryExpressionSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.operand, this.operatorToken); - }; - - PostfixUnaryExpressionSyntax.prototype.withOperand = function (operand) { - return this.update(this._kind, operand, this.operatorToken); - }; - - PostfixUnaryExpressionSyntax.prototype.withOperatorToken = function (operatorToken) { - return this.update(this._kind, this.operand, operatorToken); - }; - - PostfixUnaryExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.operand.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return PostfixUnaryExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.PostfixUnaryExpressionSyntax = PostfixUnaryExpressionSyntax; - - var ElementAccessExpressionSyntax = (function (_super) { - __extends(ElementAccessExpressionSyntax, _super); - function ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.openBracketToken = openBracketToken; - this.argumentExpression = argumentExpression; - this.closeBracketToken = closeBracketToken; - } - ElementAccessExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitElementAccessExpression(this); - }; - - ElementAccessExpressionSyntax.prototype.kind = function () { - return 221 /* ElementAccessExpression */; - }; - - ElementAccessExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - ElementAccessExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.openBracketToken; - case 2: - return this.argumentExpression; - case 3: - return this.closeBracketToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ElementAccessExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.update = function (expression, openBracketToken, argumentExpression, closeBracketToken) { - if (this.expression === expression && this.openBracketToken === openBracketToken && this.argumentExpression === argumentExpression && this.closeBracketToken === closeBracketToken) { - return this; - } - - return new ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, this.parsedInStrictMode()); - }; - - ElementAccessExpressionSyntax.create1 = function (expression, argumentExpression) { - return new ElementAccessExpressionSyntax(expression, TypeScript.Syntax.token(74 /* OpenBracketToken */), argumentExpression, TypeScript.Syntax.token(75 /* CloseBracketToken */), false); - }; - - ElementAccessExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ElementAccessExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ElementAccessExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.openBracketToken, this.argumentExpression, this.closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(this.expression, openBracketToken, this.argumentExpression, this.closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.withArgumentExpression = function (argumentExpression) { - return this.update(this.expression, this.openBracketToken, argumentExpression, this.closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.expression, this.openBracketToken, this.argumentExpression, closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.argumentExpression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ElementAccessExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ElementAccessExpressionSyntax = ElementAccessExpressionSyntax; - - var InvocationExpressionSyntax = (function (_super) { - __extends(InvocationExpressionSyntax, _super); - function InvocationExpressionSyntax(expression, argumentList, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.argumentList = argumentList; - } - InvocationExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitInvocationExpression(this); - }; - - InvocationExpressionSyntax.prototype.kind = function () { - return 213 /* InvocationExpression */; - }; - - InvocationExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - InvocationExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.argumentList; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - InvocationExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.update = function (expression, argumentList) { - if (this.expression === expression && this.argumentList === argumentList) { - return this; - } - - return new InvocationExpressionSyntax(expression, argumentList, this.parsedInStrictMode()); - }; - - InvocationExpressionSyntax.create1 = function (expression) { - return new InvocationExpressionSyntax(expression, ArgumentListSyntax.create1(), false); - }; - - InvocationExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - InvocationExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - InvocationExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.argumentList); - }; - - InvocationExpressionSyntax.prototype.withArgumentList = function (argumentList) { - return this.update(this.expression, argumentList); - }; - - InvocationExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.argumentList.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return InvocationExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.InvocationExpressionSyntax = InvocationExpressionSyntax; - - var ArgumentListSyntax = (function (_super) { - __extends(ArgumentListSyntax, _super); - function ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeArgumentList = typeArgumentList; - this.openParenToken = openParenToken; - this.closeParenToken = closeParenToken; - - this.arguments = _arguments; - } - ArgumentListSyntax.prototype.accept = function (visitor) { - return visitor.visitArgumentList(this); - }; - - ArgumentListSyntax.prototype.kind = function () { - return 226 /* ArgumentList */; - }; - - ArgumentListSyntax.prototype.childCount = function () { - return 4; - }; - - ArgumentListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeArgumentList; - case 1: - return this.openParenToken; - case 2: - return this.arguments; - case 3: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ArgumentListSyntax.prototype.update = function (typeArgumentList, openParenToken, _arguments, closeParenToken) { - if (this.typeArgumentList === typeArgumentList && this.openParenToken === openParenToken && this.arguments === _arguments && this.closeParenToken === closeParenToken) { - return this; - } - - return new ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, this.parsedInStrictMode()); - }; - - ArgumentListSyntax.create = function (openParenToken, closeParenToken) { - return new ArgumentListSyntax(null, openParenToken, TypeScript.Syntax.emptySeparatedList, closeParenToken, false); - }; - - ArgumentListSyntax.create1 = function () { - return new ArgumentListSyntax(null, TypeScript.Syntax.token(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ArgumentListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ArgumentListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ArgumentListSyntax.prototype.withTypeArgumentList = function (typeArgumentList) { - return this.update(typeArgumentList, this.openParenToken, this.arguments, this.closeParenToken); - }; - - ArgumentListSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.typeArgumentList, openParenToken, this.arguments, this.closeParenToken); - }; - - ArgumentListSyntax.prototype.withArguments = function (_arguments) { - return this.update(this.typeArgumentList, this.openParenToken, _arguments, this.closeParenToken); - }; - - ArgumentListSyntax.prototype.withArgument = function (_argument) { - return this.withArguments(TypeScript.Syntax.separatedList([_argument])); - }; - - ArgumentListSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.typeArgumentList, this.openParenToken, this.arguments, closeParenToken); - }; - - ArgumentListSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeArgumentList !== null && this.typeArgumentList.isTypeScriptSpecific()) { - return true; - } - if (this.arguments.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ArgumentListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ArgumentListSyntax = ArgumentListSyntax; - - var BinaryExpressionSyntax = (function (_super) { - __extends(BinaryExpressionSyntax, _super); - function BinaryExpressionSyntax(kind, left, operatorToken, right, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.left = left; - this.operatorToken = operatorToken; - this.right = right; - - this._kind = kind; - } - BinaryExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitBinaryExpression(this); - }; - - BinaryExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - BinaryExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.left; - case 1: - return this.operatorToken; - case 2: - return this.right; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - BinaryExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - BinaryExpressionSyntax.prototype.kind = function () { - return this._kind; - }; - - BinaryExpressionSyntax.prototype.update = function (kind, left, operatorToken, right) { - if (this._kind === kind && this.left === left && this.operatorToken === operatorToken && this.right === right) { - return this; - } - - return new BinaryExpressionSyntax(kind, left, operatorToken, right, this.parsedInStrictMode()); - }; - - BinaryExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - BinaryExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - BinaryExpressionSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.left, this.operatorToken, this.right); - }; - - BinaryExpressionSyntax.prototype.withLeft = function (left) { - return this.update(this._kind, left, this.operatorToken, this.right); - }; - - BinaryExpressionSyntax.prototype.withOperatorToken = function (operatorToken) { - return this.update(this._kind, this.left, operatorToken, this.right); - }; - - BinaryExpressionSyntax.prototype.withRight = function (right) { - return this.update(this._kind, this.left, this.operatorToken, right); - }; - - BinaryExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.left.isTypeScriptSpecific()) { - return true; - } - if (this.right.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return BinaryExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.BinaryExpressionSyntax = BinaryExpressionSyntax; - - var ConditionalExpressionSyntax = (function (_super) { - __extends(ConditionalExpressionSyntax, _super); - function ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.condition = condition; - this.questionToken = questionToken; - this.whenTrue = whenTrue; - this.colonToken = colonToken; - this.whenFalse = whenFalse; - } - ConditionalExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitConditionalExpression(this); - }; - - ConditionalExpressionSyntax.prototype.kind = function () { - return 186 /* ConditionalExpression */; - }; - - ConditionalExpressionSyntax.prototype.childCount = function () { - return 5; - }; - - ConditionalExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.condition; - case 1: - return this.questionToken; - case 2: - return this.whenTrue; - case 3: - return this.colonToken; - case 4: - return this.whenFalse; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConditionalExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ConditionalExpressionSyntax.prototype.update = function (condition, questionToken, whenTrue, colonToken, whenFalse) { - if (this.condition === condition && this.questionToken === questionToken && this.whenTrue === whenTrue && this.colonToken === colonToken && this.whenFalse === whenFalse) { - return this; - } - - return new ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, this.parsedInStrictMode()); - }; - - ConditionalExpressionSyntax.create1 = function (condition, whenTrue, whenFalse) { - return new ConditionalExpressionSyntax(condition, TypeScript.Syntax.token(105 /* QuestionToken */), whenTrue, TypeScript.Syntax.token(106 /* ColonToken */), whenFalse, false); - }; - - ConditionalExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConditionalExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConditionalExpressionSyntax.prototype.withCondition = function (condition) { - return this.update(condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.condition, questionToken, this.whenTrue, this.colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withWhenTrue = function (whenTrue) { - return this.update(this.condition, this.questionToken, whenTrue, this.colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.condition, this.questionToken, this.whenTrue, colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withWhenFalse = function (whenFalse) { - return this.update(this.condition, this.questionToken, this.whenTrue, this.colonToken, whenFalse); - }; - - ConditionalExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.whenTrue.isTypeScriptSpecific()) { - return true; - } - if (this.whenFalse.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ConditionalExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConditionalExpressionSyntax = ConditionalExpressionSyntax; - - var ConstructSignatureSyntax = (function (_super) { - __extends(ConstructSignatureSyntax, _super); - function ConstructSignatureSyntax(newKeyword, callSignature, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.newKeyword = newKeyword; - this.callSignature = callSignature; - } - ConstructSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitConstructSignature(this); - }; - - ConstructSignatureSyntax.prototype.kind = function () { - return 143 /* ConstructSignature */; - }; - - ConstructSignatureSyntax.prototype.childCount = function () { - return 2; - }; - - ConstructSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.newKeyword; - case 1: - return this.callSignature; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstructSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - ConstructSignatureSyntax.prototype.update = function (newKeyword, callSignature) { - if (this.newKeyword === newKeyword && this.callSignature === callSignature) { - return this; - } - - return new ConstructSignatureSyntax(newKeyword, callSignature, this.parsedInStrictMode()); - }; - - ConstructSignatureSyntax.create1 = function () { - return new ConstructSignatureSyntax(TypeScript.Syntax.token(31 /* NewKeyword */), CallSignatureSyntax.create1(), false); - }; - - ConstructSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstructSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstructSignatureSyntax.prototype.withNewKeyword = function (newKeyword) { - return this.update(newKeyword, this.callSignature); - }; - - ConstructSignatureSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.newKeyword, callSignature); - }; - - ConstructSignatureSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstructSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstructSignatureSyntax = ConstructSignatureSyntax; - - var MethodSignatureSyntax = (function (_super) { - __extends(MethodSignatureSyntax, _super); - function MethodSignatureSyntax(propertyName, questionToken, callSignature, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.callSignature = callSignature; - } - MethodSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitMethodSignature(this); - }; - - MethodSignatureSyntax.prototype.kind = function () { - return 145 /* MethodSignature */; - }; - - MethodSignatureSyntax.prototype.childCount = function () { - return 3; - }; - - MethodSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.questionToken; - case 2: - return this.callSignature; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MethodSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - MethodSignatureSyntax.prototype.update = function (propertyName, questionToken, callSignature) { - if (this.propertyName === propertyName && this.questionToken === questionToken && this.callSignature === callSignature) { - return this; - } - - return new MethodSignatureSyntax(propertyName, questionToken, callSignature, this.parsedInStrictMode()); - }; - - MethodSignatureSyntax.create = function (propertyName, callSignature) { - return new MethodSignatureSyntax(propertyName, null, callSignature, false); - }; - - MethodSignatureSyntax.create1 = function (propertyName) { - return new MethodSignatureSyntax(propertyName, null, CallSignatureSyntax.create1(), false); - }; - - MethodSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MethodSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MethodSignatureSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.questionToken, this.callSignature); - }; - - MethodSignatureSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.propertyName, questionToken, this.callSignature); - }; - - MethodSignatureSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.propertyName, this.questionToken, callSignature); - }; - - MethodSignatureSyntax.prototype.isTypeScriptSpecific = function () { - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return MethodSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MethodSignatureSyntax = MethodSignatureSyntax; - - var IndexSignatureSyntax = (function (_super) { - __extends(IndexSignatureSyntax, _super); - function IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBracketToken = openBracketToken; - this.parameter = parameter; - this.closeBracketToken = closeBracketToken; - this.typeAnnotation = typeAnnotation; - } - IndexSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitIndexSignature(this); - }; - - IndexSignatureSyntax.prototype.kind = function () { - return 144 /* IndexSignature */; - }; - - IndexSignatureSyntax.prototype.childCount = function () { - return 4; - }; - - IndexSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBracketToken; - case 1: - return this.parameter; - case 2: - return this.closeBracketToken; - case 3: - return this.typeAnnotation; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - IndexSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - IndexSignatureSyntax.prototype.update = function (openBracketToken, parameter, closeBracketToken, typeAnnotation) { - if (this.openBracketToken === openBracketToken && this.parameter === parameter && this.closeBracketToken === closeBracketToken && this.typeAnnotation === typeAnnotation) { - return this; - } - - return new IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, this.parsedInStrictMode()); - }; - - IndexSignatureSyntax.create = function (openBracketToken, parameter, closeBracketToken) { - return new IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, null, false); - }; - - IndexSignatureSyntax.create1 = function (parameter) { - return new IndexSignatureSyntax(TypeScript.Syntax.token(74 /* OpenBracketToken */), parameter, TypeScript.Syntax.token(75 /* CloseBracketToken */), null, false); - }; - - IndexSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - IndexSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - IndexSignatureSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(openBracketToken, this.parameter, this.closeBracketToken, this.typeAnnotation); - }; - - IndexSignatureSyntax.prototype.withParameter = function (parameter) { - return this.update(this.openBracketToken, parameter, this.closeBracketToken, this.typeAnnotation); - }; - - IndexSignatureSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.openBracketToken, this.parameter, closeBracketToken, this.typeAnnotation); - }; - - IndexSignatureSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.openBracketToken, this.parameter, this.closeBracketToken, typeAnnotation); - }; - - IndexSignatureSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return IndexSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.IndexSignatureSyntax = IndexSignatureSyntax; - - var PropertySignatureSyntax = (function (_super) { - __extends(PropertySignatureSyntax, _super); - function PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - } - PropertySignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitPropertySignature(this); - }; - - PropertySignatureSyntax.prototype.kind = function () { - return 141 /* PropertySignature */; - }; - - PropertySignatureSyntax.prototype.childCount = function () { - return 3; - }; - - PropertySignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.questionToken; - case 2: - return this.typeAnnotation; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - PropertySignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - PropertySignatureSyntax.prototype.update = function (propertyName, questionToken, typeAnnotation) { - if (this.propertyName === propertyName && this.questionToken === questionToken && this.typeAnnotation === typeAnnotation) { - return this; - } - - return new PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, this.parsedInStrictMode()); - }; - - PropertySignatureSyntax.create = function (propertyName) { - return new PropertySignatureSyntax(propertyName, null, null, false); - }; - - PropertySignatureSyntax.create1 = function (propertyName) { - return new PropertySignatureSyntax(propertyName, null, null, false); - }; - - PropertySignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - PropertySignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - PropertySignatureSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.questionToken, this.typeAnnotation); - }; - - PropertySignatureSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.propertyName, questionToken, this.typeAnnotation); - }; - - PropertySignatureSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.propertyName, this.questionToken, typeAnnotation); - }; - - PropertySignatureSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return PropertySignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.PropertySignatureSyntax = PropertySignatureSyntax; - - var CallSignatureSyntax = (function (_super) { - __extends(CallSignatureSyntax, _super); - function CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - } - CallSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitCallSignature(this); - }; - - CallSignatureSyntax.prototype.kind = function () { - return 142 /* CallSignature */; - }; - - CallSignatureSyntax.prototype.childCount = function () { - return 3; - }; - - CallSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeParameterList; - case 1: - return this.parameterList; - case 2: - return this.typeAnnotation; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CallSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - CallSignatureSyntax.prototype.update = function (typeParameterList, parameterList, typeAnnotation) { - if (this.typeParameterList === typeParameterList && this.parameterList === parameterList && this.typeAnnotation === typeAnnotation) { - return this; - } - - return new CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, this.parsedInStrictMode()); - }; - - CallSignatureSyntax.create = function (parameterList) { - return new CallSignatureSyntax(null, parameterList, null, false); - }; - - CallSignatureSyntax.create1 = function () { - return new CallSignatureSyntax(null, ParameterListSyntax.create1(), null, false); - }; - - CallSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CallSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CallSignatureSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(typeParameterList, this.parameterList, this.typeAnnotation); - }; - - CallSignatureSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.typeParameterList, parameterList, this.typeAnnotation); - }; - - CallSignatureSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.typeParameterList, this.parameterList, typeAnnotation); - }; - - CallSignatureSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeParameterList !== null) { - return true; - } - if (this.parameterList.isTypeScriptSpecific()) { - return true; - } - if (this.typeAnnotation !== null) { - return true; - } - return false; - }; - return CallSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CallSignatureSyntax = CallSignatureSyntax; - - var ParameterListSyntax = (function (_super) { - __extends(ParameterListSyntax, _super); - function ParameterListSyntax(openParenToken, parameters, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openParenToken = openParenToken; - this.parameters = parameters; - this.closeParenToken = closeParenToken; - } - ParameterListSyntax.prototype.accept = function (visitor) { - return visitor.visitParameterList(this); - }; - - ParameterListSyntax.prototype.kind = function () { - return 227 /* ParameterList */; - }; - - ParameterListSyntax.prototype.childCount = function () { - return 3; - }; - - ParameterListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openParenToken; - case 1: - return this.parameters; - case 2: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParameterListSyntax.prototype.update = function (openParenToken, parameters, closeParenToken) { - if (this.openParenToken === openParenToken && this.parameters === parameters && this.closeParenToken === closeParenToken) { - return this; - } - - return new ParameterListSyntax(openParenToken, parameters, closeParenToken, this.parsedInStrictMode()); - }; - - ParameterListSyntax.create = function (openParenToken, closeParenToken) { - return new ParameterListSyntax(openParenToken, TypeScript.Syntax.emptySeparatedList, closeParenToken, false); - }; - - ParameterListSyntax.create1 = function () { - return new ParameterListSyntax(TypeScript.Syntax.token(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ParameterListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParameterListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParameterListSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(openParenToken, this.parameters, this.closeParenToken); - }; - - ParameterListSyntax.prototype.withParameters = function (parameters) { - return this.update(this.openParenToken, parameters, this.closeParenToken); - }; - - ParameterListSyntax.prototype.withParameter = function (parameter) { - return this.withParameters(TypeScript.Syntax.separatedList([parameter])); - }; - - ParameterListSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.openParenToken, this.parameters, closeParenToken); - }; - - ParameterListSyntax.prototype.isTypeScriptSpecific = function () { - if (this.parameters.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ParameterListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParameterListSyntax = ParameterListSyntax; - - var TypeParameterListSyntax = (function (_super) { - __extends(TypeParameterListSyntax, _super); - function TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.lessThanToken = lessThanToken; - this.typeParameters = typeParameters; - this.greaterThanToken = greaterThanToken; - } - TypeParameterListSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeParameterList(this); - }; - - TypeParameterListSyntax.prototype.kind = function () { - return 229 /* TypeParameterList */; - }; - - TypeParameterListSyntax.prototype.childCount = function () { - return 3; - }; - - TypeParameterListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.lessThanToken; - case 1: - return this.typeParameters; - case 2: - return this.greaterThanToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeParameterListSyntax.prototype.update = function (lessThanToken, typeParameters, greaterThanToken) { - if (this.lessThanToken === lessThanToken && this.typeParameters === typeParameters && this.greaterThanToken === greaterThanToken) { - return this; - } - - return new TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, this.parsedInStrictMode()); - }; - - TypeParameterListSyntax.create = function (lessThanToken, greaterThanToken) { - return new TypeParameterListSyntax(lessThanToken, TypeScript.Syntax.emptySeparatedList, greaterThanToken, false); - }; - - TypeParameterListSyntax.create1 = function () { - return new TypeParameterListSyntax(TypeScript.Syntax.token(80 /* LessThanToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(81 /* GreaterThanToken */), false); - }; - - TypeParameterListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeParameterListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeParameterListSyntax.prototype.withLessThanToken = function (lessThanToken) { - return this.update(lessThanToken, this.typeParameters, this.greaterThanToken); - }; - - TypeParameterListSyntax.prototype.withTypeParameters = function (typeParameters) { - return this.update(this.lessThanToken, typeParameters, this.greaterThanToken); - }; - - TypeParameterListSyntax.prototype.withTypeParameter = function (typeParameter) { - return this.withTypeParameters(TypeScript.Syntax.separatedList([typeParameter])); - }; - - TypeParameterListSyntax.prototype.withGreaterThanToken = function (greaterThanToken) { - return this.update(this.lessThanToken, this.typeParameters, greaterThanToken); - }; - - TypeParameterListSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeParameterListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeParameterListSyntax = TypeParameterListSyntax; - - var TypeParameterSyntax = (function (_super) { - __extends(TypeParameterSyntax, _super); - function TypeParameterSyntax(identifier, constraint, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.identifier = identifier; - this.constraint = constraint; - } - TypeParameterSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeParameter(this); - }; - - TypeParameterSyntax.prototype.kind = function () { - return 238 /* TypeParameter */; - }; - - TypeParameterSyntax.prototype.childCount = function () { - return 2; - }; - - TypeParameterSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.identifier; - case 1: - return this.constraint; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeParameterSyntax.prototype.update = function (identifier, constraint) { - if (this.identifier === identifier && this.constraint === constraint) { - return this; - } - - return new TypeParameterSyntax(identifier, constraint, this.parsedInStrictMode()); - }; - - TypeParameterSyntax.create = function (identifier) { - return new TypeParameterSyntax(identifier, null, false); - }; - - TypeParameterSyntax.create1 = function (identifier) { - return new TypeParameterSyntax(identifier, null, false); - }; - - TypeParameterSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeParameterSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeParameterSyntax.prototype.withIdentifier = function (identifier) { - return this.update(identifier, this.constraint); - }; - - TypeParameterSyntax.prototype.withConstraint = function (constraint) { - return this.update(this.identifier, constraint); - }; - - TypeParameterSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeParameterSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeParameterSyntax = TypeParameterSyntax; - - var ConstraintSyntax = (function (_super) { - __extends(ConstraintSyntax, _super); - function ConstraintSyntax(extendsKeyword, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.extendsKeyword = extendsKeyword; - this.type = type; - } - ConstraintSyntax.prototype.accept = function (visitor) { - return visitor.visitConstraint(this); - }; - - ConstraintSyntax.prototype.kind = function () { - return 239 /* Constraint */; - }; - - ConstraintSyntax.prototype.childCount = function () { - return 2; - }; - - ConstraintSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.extendsKeyword; - case 1: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstraintSyntax.prototype.update = function (extendsKeyword, type) { - if (this.extendsKeyword === extendsKeyword && this.type === type) { - return this; - } - - return new ConstraintSyntax(extendsKeyword, type, this.parsedInStrictMode()); - }; - - ConstraintSyntax.create1 = function (type) { - return new ConstraintSyntax(TypeScript.Syntax.token(48 /* ExtendsKeyword */), type, false); - }; - - ConstraintSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstraintSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstraintSyntax.prototype.withExtendsKeyword = function (extendsKeyword) { - return this.update(extendsKeyword, this.type); - }; - - ConstraintSyntax.prototype.withType = function (type) { - return this.update(this.extendsKeyword, type); - }; - - ConstraintSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstraintSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstraintSyntax = ConstraintSyntax; - - var ElseClauseSyntax = (function (_super) { - __extends(ElseClauseSyntax, _super); - function ElseClauseSyntax(elseKeyword, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.elseKeyword = elseKeyword; - this.statement = statement; - } - ElseClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitElseClause(this); - }; - - ElseClauseSyntax.prototype.kind = function () { - return 235 /* ElseClause */; - }; - - ElseClauseSyntax.prototype.childCount = function () { - return 2; - }; - - ElseClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.elseKeyword; - case 1: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ElseClauseSyntax.prototype.update = function (elseKeyword, statement) { - if (this.elseKeyword === elseKeyword && this.statement === statement) { - return this; - } - - return new ElseClauseSyntax(elseKeyword, statement, this.parsedInStrictMode()); - }; - - ElseClauseSyntax.create1 = function (statement) { - return new ElseClauseSyntax(TypeScript.Syntax.token(23 /* ElseKeyword */), statement, false); - }; - - ElseClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ElseClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ElseClauseSyntax.prototype.withElseKeyword = function (elseKeyword) { - return this.update(elseKeyword, this.statement); - }; - - ElseClauseSyntax.prototype.withStatement = function (statement) { - return this.update(this.elseKeyword, statement); - }; - - ElseClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ElseClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ElseClauseSyntax = ElseClauseSyntax; - - var IfStatementSyntax = (function (_super) { - __extends(IfStatementSyntax, _super); - function IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.ifKeyword = ifKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.statement = statement; - this.elseClause = elseClause; - } - IfStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitIfStatement(this); - }; - - IfStatementSyntax.prototype.kind = function () { - return 147 /* IfStatement */; - }; - - IfStatementSyntax.prototype.childCount = function () { - return 6; - }; - - IfStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.ifKeyword; - case 1: - return this.openParenToken; - case 2: - return this.condition; - case 3: - return this.closeParenToken; - case 4: - return this.statement; - case 5: - return this.elseClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - IfStatementSyntax.prototype.isStatement = function () { - return true; - }; - - IfStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - IfStatementSyntax.prototype.update = function (ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - if (this.ifKeyword === ifKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.statement === statement && this.elseClause === elseClause) { - return this; - } - - return new IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, this.parsedInStrictMode()); - }; - - IfStatementSyntax.create = function (ifKeyword, openParenToken, condition, closeParenToken, statement) { - return new IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, null, false); - }; - - IfStatementSyntax.create1 = function (condition, statement) { - return new IfStatementSyntax(TypeScript.Syntax.token(28 /* IfKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, null, false); - }; - - IfStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - IfStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - IfStatementSyntax.prototype.withIfKeyword = function (ifKeyword) { - return this.update(ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.ifKeyword, openParenToken, this.condition, this.closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.ifKeyword, this.openParenToken, condition, this.closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.ifKeyword, this.openParenToken, this.condition, closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withElseClause = function (elseClause) { - return this.update(this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, elseClause); - }; - - IfStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - if (this.elseClause !== null && this.elseClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return IfStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.IfStatementSyntax = IfStatementSyntax; - - var ExpressionStatementSyntax = (function (_super) { - __extends(ExpressionStatementSyntax, _super); - function ExpressionStatementSyntax(expression, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.semicolonToken = semicolonToken; - } - ExpressionStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitExpressionStatement(this); - }; - - ExpressionStatementSyntax.prototype.kind = function () { - return 149 /* ExpressionStatement */; - }; - - ExpressionStatementSyntax.prototype.childCount = function () { - return 2; - }; - - ExpressionStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ExpressionStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ExpressionStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ExpressionStatementSyntax.prototype.update = function (expression, semicolonToken) { - if (this.expression === expression && this.semicolonToken === semicolonToken) { - return this; - } - - return new ExpressionStatementSyntax(expression, semicolonToken, this.parsedInStrictMode()); - }; - - ExpressionStatementSyntax.create1 = function (expression) { - return new ExpressionStatementSyntax(expression, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ExpressionStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ExpressionStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ExpressionStatementSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.semicolonToken); - }; - - ExpressionStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.expression, semicolonToken); - }; - - ExpressionStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ExpressionStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ExpressionStatementSyntax = ExpressionStatementSyntax; - - var ConstructorDeclarationSyntax = (function (_super) { - __extends(ConstructorDeclarationSyntax, _super); - function ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.constructorKeyword = constructorKeyword; - this.callSignature = callSignature; - this.block = block; - this.semicolonToken = semicolonToken; - } - ConstructorDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitConstructorDeclaration(this); - }; - - ConstructorDeclarationSyntax.prototype.kind = function () { - return 137 /* ConstructorDeclaration */; - }; - - ConstructorDeclarationSyntax.prototype.childCount = function () { - return 5; - }; - - ConstructorDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.constructorKeyword; - case 2: - return this.callSignature; - case 3: - return this.block; - case 4: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstructorDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - ConstructorDeclarationSyntax.prototype.update = function (modifiers, constructorKeyword, callSignature, block, semicolonToken) { - if (this.modifiers === modifiers && this.constructorKeyword === constructorKeyword && this.callSignature === callSignature && this.block === block && this.semicolonToken === semicolonToken) { - return this; - } - - return new ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, this.parsedInStrictMode()); - }; - - ConstructorDeclarationSyntax.create = function (constructorKeyword, callSignature) { - return new ConstructorDeclarationSyntax(TypeScript.Syntax.emptyList, constructorKeyword, callSignature, null, null, false); - }; - - ConstructorDeclarationSyntax.create1 = function () { - return new ConstructorDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(62 /* ConstructorKeyword */), CallSignatureSyntax.create1(), null, null, false); - }; - - ConstructorDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstructorDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstructorDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.constructorKeyword, this.callSignature, this.block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ConstructorDeclarationSyntax.prototype.withConstructorKeyword = function (constructorKeyword) { - return this.update(this.modifiers, constructorKeyword, this.callSignature, this.block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.modifiers, this.constructorKeyword, callSignature, this.block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.constructorKeyword, this.callSignature, block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.constructorKeyword, this.callSignature, this.block, semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstructorDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstructorDeclarationSyntax = ConstructorDeclarationSyntax; - - var MemberFunctionDeclarationSyntax = (function (_super) { - __extends(MemberFunctionDeclarationSyntax, _super); - function MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - this.semicolonToken = semicolonToken; - } - MemberFunctionDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitMemberFunctionDeclaration(this); - }; - - MemberFunctionDeclarationSyntax.prototype.kind = function () { - return 135 /* MemberFunctionDeclaration */; - }; - - MemberFunctionDeclarationSyntax.prototype.childCount = function () { - return 5; - }; - - MemberFunctionDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.propertyName; - case 2: - return this.callSignature; - case 3: - return this.block; - case 4: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MemberFunctionDeclarationSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - MemberFunctionDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - MemberFunctionDeclarationSyntax.prototype.update = function (modifiers, propertyName, callSignature, block, semicolonToken) { - if (this.modifiers === modifiers && this.propertyName === propertyName && this.callSignature === callSignature && this.block === block && this.semicolonToken === semicolonToken) { - return this; - } - - return new MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, this.parsedInStrictMode()); - }; - - MemberFunctionDeclarationSyntax.create = function (propertyName, callSignature) { - return new MemberFunctionDeclarationSyntax(TypeScript.Syntax.emptyList, propertyName, callSignature, null, null, false); - }; - - MemberFunctionDeclarationSyntax.create1 = function (propertyName) { - return new MemberFunctionDeclarationSyntax(TypeScript.Syntax.emptyList, propertyName, CallSignatureSyntax.create1(), null, null, false); - }; - - MemberFunctionDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MemberFunctionDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MemberFunctionDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.propertyName, this.callSignature, this.block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - MemberFunctionDeclarationSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(this.modifiers, propertyName, this.callSignature, this.block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.modifiers, this.propertyName, callSignature, this.block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.propertyName, this.callSignature, block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.propertyName, this.callSignature, this.block, semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return MemberFunctionDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MemberFunctionDeclarationSyntax = MemberFunctionDeclarationSyntax; - - var GetAccessorSyntax = (function (_super) { - __extends(GetAccessorSyntax, _super); - function GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.getKeyword = getKeyword; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - this.block = block; - } - GetAccessorSyntax.prototype.accept = function (visitor) { - return visitor.visitGetAccessor(this); - }; - - GetAccessorSyntax.prototype.kind = function () { - return 139 /* GetAccessor */; - }; - - GetAccessorSyntax.prototype.childCount = function () { - return 6; - }; - - GetAccessorSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.getKeyword; - case 2: - return this.propertyName; - case 3: - return this.parameterList; - case 4: - return this.typeAnnotation; - case 5: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - GetAccessorSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - GetAccessorSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - GetAccessorSyntax.prototype.isClassElement = function () { - return true; - }; - - GetAccessorSyntax.prototype.update = function (modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block) { - if (this.modifiers === modifiers && this.getKeyword === getKeyword && this.propertyName === propertyName && this.parameterList === parameterList && this.typeAnnotation === typeAnnotation && this.block === block) { - return this; - } - - return new GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, this.parsedInStrictMode()); - }; - - GetAccessorSyntax.create = function (getKeyword, propertyName, parameterList, block) { - return new GetAccessorSyntax(TypeScript.Syntax.emptyList, getKeyword, propertyName, parameterList, null, block, false); - }; - - GetAccessorSyntax.create1 = function (propertyName) { - return new GetAccessorSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(64 /* GetKeyword */), propertyName, ParameterListSyntax.create1(), null, BlockSyntax.create1(), false); - }; - - GetAccessorSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - GetAccessorSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - GetAccessorSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.getKeyword, this.propertyName, this.parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - GetAccessorSyntax.prototype.withGetKeyword = function (getKeyword) { - return this.update(this.modifiers, getKeyword, this.propertyName, this.parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(this.modifiers, this.getKeyword, propertyName, this.parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.modifiers, this.getKeyword, this.propertyName, parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.modifiers, this.getKeyword, this.propertyName, this.parameterList, typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.getKeyword, this.propertyName, this.parameterList, this.typeAnnotation, block); - }; - - GetAccessorSyntax.prototype.isTypeScriptSpecific = function () { - if (this.modifiers.childCount() > 0) { - return true; - } - if (this.parameterList.isTypeScriptSpecific()) { - return true; - } - if (this.typeAnnotation !== null) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return GetAccessorSyntax; - })(TypeScript.SyntaxNode); - TypeScript.GetAccessorSyntax = GetAccessorSyntax; - - var SetAccessorSyntax = (function (_super) { - __extends(SetAccessorSyntax, _super); - function SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.setKeyword = setKeyword; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.block = block; - } - SetAccessorSyntax.prototype.accept = function (visitor) { - return visitor.visitSetAccessor(this); - }; - - SetAccessorSyntax.prototype.kind = function () { - return 140 /* SetAccessor */; - }; - - SetAccessorSyntax.prototype.childCount = function () { - return 5; - }; - - SetAccessorSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.setKeyword; - case 2: - return this.propertyName; - case 3: - return this.parameterList; - case 4: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SetAccessorSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - SetAccessorSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - SetAccessorSyntax.prototype.isClassElement = function () { - return true; - }; - - SetAccessorSyntax.prototype.update = function (modifiers, setKeyword, propertyName, parameterList, block) { - if (this.modifiers === modifiers && this.setKeyword === setKeyword && this.propertyName === propertyName && this.parameterList === parameterList && this.block === block) { - return this; - } - - return new SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, this.parsedInStrictMode()); - }; - - SetAccessorSyntax.create = function (setKeyword, propertyName, parameterList, block) { - return new SetAccessorSyntax(TypeScript.Syntax.emptyList, setKeyword, propertyName, parameterList, block, false); - }; - - SetAccessorSyntax.create1 = function (propertyName) { - return new SetAccessorSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(68 /* SetKeyword */), propertyName, ParameterListSyntax.create1(), BlockSyntax.create1(), false); - }; - - SetAccessorSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SetAccessorSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SetAccessorSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.setKeyword, this.propertyName, this.parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - SetAccessorSyntax.prototype.withSetKeyword = function (setKeyword) { - return this.update(this.modifiers, setKeyword, this.propertyName, this.parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(this.modifiers, this.setKeyword, propertyName, this.parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.modifiers, this.setKeyword, this.propertyName, parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.setKeyword, this.propertyName, this.parameterList, block); - }; - - SetAccessorSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return SetAccessorSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SetAccessorSyntax = SetAccessorSyntax; - - var MemberVariableDeclarationSyntax = (function (_super) { - __extends(MemberVariableDeclarationSyntax, _super); - function MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.variableDeclarator = variableDeclarator; - this.semicolonToken = semicolonToken; - } - MemberVariableDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitMemberVariableDeclaration(this); - }; - - MemberVariableDeclarationSyntax.prototype.kind = function () { - return 136 /* MemberVariableDeclaration */; - }; - - MemberVariableDeclarationSyntax.prototype.childCount = function () { - return 3; - }; - - MemberVariableDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.variableDeclarator; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MemberVariableDeclarationSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - MemberVariableDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - MemberVariableDeclarationSyntax.prototype.update = function (modifiers, variableDeclarator, semicolonToken) { - if (this.modifiers === modifiers && this.variableDeclarator === variableDeclarator && this.semicolonToken === semicolonToken) { - return this; - } - - return new MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, this.parsedInStrictMode()); - }; - - MemberVariableDeclarationSyntax.create = function (variableDeclarator, semicolonToken) { - return new MemberVariableDeclarationSyntax(TypeScript.Syntax.emptyList, variableDeclarator, semicolonToken, false); - }; - - MemberVariableDeclarationSyntax.create1 = function (variableDeclarator) { - return new MemberVariableDeclarationSyntax(TypeScript.Syntax.emptyList, variableDeclarator, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - MemberVariableDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MemberVariableDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MemberVariableDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.variableDeclarator, this.semicolonToken); - }; - - MemberVariableDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - MemberVariableDeclarationSyntax.prototype.withVariableDeclarator = function (variableDeclarator) { - return this.update(this.modifiers, variableDeclarator, this.semicolonToken); - }; - - MemberVariableDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.variableDeclarator, semicolonToken); - }; - - MemberVariableDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return MemberVariableDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MemberVariableDeclarationSyntax = MemberVariableDeclarationSyntax; - - var IndexMemberDeclarationSyntax = (function (_super) { - __extends(IndexMemberDeclarationSyntax, _super); - function IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.indexSignature = indexSignature; - this.semicolonToken = semicolonToken; - } - IndexMemberDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitIndexMemberDeclaration(this); - }; - - IndexMemberDeclarationSyntax.prototype.kind = function () { - return 138 /* IndexMemberDeclaration */; - }; - - IndexMemberDeclarationSyntax.prototype.childCount = function () { - return 3; - }; - - IndexMemberDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.indexSignature; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - IndexMemberDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - IndexMemberDeclarationSyntax.prototype.update = function (modifiers, indexSignature, semicolonToken) { - if (this.modifiers === modifiers && this.indexSignature === indexSignature && this.semicolonToken === semicolonToken) { - return this; - } - - return new IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, this.parsedInStrictMode()); - }; - - IndexMemberDeclarationSyntax.create = function (indexSignature, semicolonToken) { - return new IndexMemberDeclarationSyntax(TypeScript.Syntax.emptyList, indexSignature, semicolonToken, false); - }; - - IndexMemberDeclarationSyntax.create1 = function (indexSignature) { - return new IndexMemberDeclarationSyntax(TypeScript.Syntax.emptyList, indexSignature, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - IndexMemberDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - IndexMemberDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - IndexMemberDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.indexSignature, this.semicolonToken); - }; - - IndexMemberDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - IndexMemberDeclarationSyntax.prototype.withIndexSignature = function (indexSignature) { - return this.update(this.modifiers, indexSignature, this.semicolonToken); - }; - - IndexMemberDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.indexSignature, semicolonToken); - }; - - IndexMemberDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return IndexMemberDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.IndexMemberDeclarationSyntax = IndexMemberDeclarationSyntax; - - var ThrowStatementSyntax = (function (_super) { - __extends(ThrowStatementSyntax, _super); - function ThrowStatementSyntax(throwKeyword, expression, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.throwKeyword = throwKeyword; - this.expression = expression; - this.semicolonToken = semicolonToken; - } - ThrowStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitThrowStatement(this); - }; - - ThrowStatementSyntax.prototype.kind = function () { - return 157 /* ThrowStatement */; - }; - - ThrowStatementSyntax.prototype.childCount = function () { - return 3; - }; - - ThrowStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.throwKeyword; - case 1: - return this.expression; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ThrowStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ThrowStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ThrowStatementSyntax.prototype.update = function (throwKeyword, expression, semicolonToken) { - if (this.throwKeyword === throwKeyword && this.expression === expression && this.semicolonToken === semicolonToken) { - return this; - } - - return new ThrowStatementSyntax(throwKeyword, expression, semicolonToken, this.parsedInStrictMode()); - }; - - ThrowStatementSyntax.create1 = function (expression) { - return new ThrowStatementSyntax(TypeScript.Syntax.token(36 /* ThrowKeyword */), expression, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ThrowStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ThrowStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ThrowStatementSyntax.prototype.withThrowKeyword = function (throwKeyword) { - return this.update(throwKeyword, this.expression, this.semicolonToken); - }; - - ThrowStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.throwKeyword, expression, this.semicolonToken); - }; - - ThrowStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.throwKeyword, this.expression, semicolonToken); - }; - - ThrowStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ThrowStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ThrowStatementSyntax = ThrowStatementSyntax; - - var ReturnStatementSyntax = (function (_super) { - __extends(ReturnStatementSyntax, _super); - function ReturnStatementSyntax(returnKeyword, expression, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.returnKeyword = returnKeyword; - this.expression = expression; - this.semicolonToken = semicolonToken; - } - ReturnStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitReturnStatement(this); - }; - - ReturnStatementSyntax.prototype.kind = function () { - return 150 /* ReturnStatement */; - }; - - ReturnStatementSyntax.prototype.childCount = function () { - return 3; - }; - - ReturnStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.returnKeyword; - case 1: - return this.expression; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ReturnStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ReturnStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ReturnStatementSyntax.prototype.update = function (returnKeyword, expression, semicolonToken) { - if (this.returnKeyword === returnKeyword && this.expression === expression && this.semicolonToken === semicolonToken) { - return this; - } - - return new ReturnStatementSyntax(returnKeyword, expression, semicolonToken, this.parsedInStrictMode()); - }; - - ReturnStatementSyntax.create = function (returnKeyword, semicolonToken) { - return new ReturnStatementSyntax(returnKeyword, null, semicolonToken, false); - }; - - ReturnStatementSyntax.create1 = function () { - return new ReturnStatementSyntax(TypeScript.Syntax.token(33 /* ReturnKeyword */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ReturnStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ReturnStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ReturnStatementSyntax.prototype.withReturnKeyword = function (returnKeyword) { - return this.update(returnKeyword, this.expression, this.semicolonToken); - }; - - ReturnStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.returnKeyword, expression, this.semicolonToken); - }; - - ReturnStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.returnKeyword, this.expression, semicolonToken); - }; - - ReturnStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression !== null && this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ReturnStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ReturnStatementSyntax = ReturnStatementSyntax; - - var ObjectCreationExpressionSyntax = (function (_super) { - __extends(ObjectCreationExpressionSyntax, _super); - function ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.newKeyword = newKeyword; - this.expression = expression; - this.argumentList = argumentList; - } - ObjectCreationExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitObjectCreationExpression(this); - }; - - ObjectCreationExpressionSyntax.prototype.kind = function () { - return 216 /* ObjectCreationExpression */; - }; - - ObjectCreationExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ObjectCreationExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.newKeyword; - case 1: - return this.expression; - case 2: - return this.argumentList; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ObjectCreationExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.update = function (newKeyword, expression, argumentList) { - if (this.newKeyword === newKeyword && this.expression === expression && this.argumentList === argumentList) { - return this; - } - - return new ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, this.parsedInStrictMode()); - }; - - ObjectCreationExpressionSyntax.create = function (newKeyword, expression) { - return new ObjectCreationExpressionSyntax(newKeyword, expression, null, false); - }; - - ObjectCreationExpressionSyntax.create1 = function (expression) { - return new ObjectCreationExpressionSyntax(TypeScript.Syntax.token(31 /* NewKeyword */), expression, null, false); - }; - - ObjectCreationExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ObjectCreationExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ObjectCreationExpressionSyntax.prototype.withNewKeyword = function (newKeyword) { - return this.update(newKeyword, this.expression, this.argumentList); - }; - - ObjectCreationExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.newKeyword, expression, this.argumentList); - }; - - ObjectCreationExpressionSyntax.prototype.withArgumentList = function (argumentList) { - return this.update(this.newKeyword, this.expression, argumentList); - }; - - ObjectCreationExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.argumentList !== null && this.argumentList.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ObjectCreationExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ObjectCreationExpressionSyntax = ObjectCreationExpressionSyntax; - - var SwitchStatementSyntax = (function (_super) { - __extends(SwitchStatementSyntax, _super); - function SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.switchKeyword = switchKeyword; - this.openParenToken = openParenToken; - this.expression = expression; - this.closeParenToken = closeParenToken; - this.openBraceToken = openBraceToken; - this.switchClauses = switchClauses; - this.closeBraceToken = closeBraceToken; - } - SwitchStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitSwitchStatement(this); - }; - - SwitchStatementSyntax.prototype.kind = function () { - return 151 /* SwitchStatement */; - }; - - SwitchStatementSyntax.prototype.childCount = function () { - return 7; - }; - - SwitchStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.switchKeyword; - case 1: - return this.openParenToken; - case 2: - return this.expression; - case 3: - return this.closeParenToken; - case 4: - return this.openBraceToken; - case 5: - return this.switchClauses; - case 6: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SwitchStatementSyntax.prototype.isStatement = function () { - return true; - }; - - SwitchStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - SwitchStatementSyntax.prototype.update = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - if (this.switchKeyword === switchKeyword && this.openParenToken === openParenToken && this.expression === expression && this.closeParenToken === closeParenToken && this.openBraceToken === openBraceToken && this.switchClauses === switchClauses && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, this.parsedInStrictMode()); - }; - - SwitchStatementSyntax.create = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, closeBraceToken) { - return new SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - SwitchStatementSyntax.create1 = function (expression) { - return new SwitchStatementSyntax(TypeScript.Syntax.token(34 /* SwitchKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), expression, TypeScript.Syntax.token(73 /* CloseParenToken */), TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - SwitchStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SwitchStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SwitchStatementSyntax.prototype.withSwitchKeyword = function (switchKeyword) { - return this.update(switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.switchKeyword, openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.switchKeyword, this.openParenToken, expression, this.closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withSwitchClauses = function (switchClauses) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withSwitchClause = function (switchClause) { - return this.withSwitchClauses(TypeScript.Syntax.list([switchClause])); - }; - - SwitchStatementSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.switchClauses, closeBraceToken); - }; - - SwitchStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.switchClauses.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return SwitchStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SwitchStatementSyntax = SwitchStatementSyntax; - - var CaseSwitchClauseSyntax = (function (_super) { - __extends(CaseSwitchClauseSyntax, _super); - function CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.caseKeyword = caseKeyword; - this.expression = expression; - this.colonToken = colonToken; - this.statements = statements; - } - CaseSwitchClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitCaseSwitchClause(this); - }; - - CaseSwitchClauseSyntax.prototype.kind = function () { - return 233 /* CaseSwitchClause */; - }; - - CaseSwitchClauseSyntax.prototype.childCount = function () { - return 4; - }; - - CaseSwitchClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.caseKeyword; - case 1: - return this.expression; - case 2: - return this.colonToken; - case 3: - return this.statements; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CaseSwitchClauseSyntax.prototype.isSwitchClause = function () { - return true; - }; - - CaseSwitchClauseSyntax.prototype.update = function (caseKeyword, expression, colonToken, statements) { - if (this.caseKeyword === caseKeyword && this.expression === expression && this.colonToken === colonToken && this.statements === statements) { - return this; - } - - return new CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, this.parsedInStrictMode()); - }; - - CaseSwitchClauseSyntax.create = function (caseKeyword, expression, colonToken) { - return new CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, TypeScript.Syntax.emptyList, false); - }; - - CaseSwitchClauseSyntax.create1 = function (expression) { - return new CaseSwitchClauseSyntax(TypeScript.Syntax.token(16 /* CaseKeyword */), expression, TypeScript.Syntax.token(106 /* ColonToken */), TypeScript.Syntax.emptyList, false); - }; - - CaseSwitchClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CaseSwitchClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CaseSwitchClauseSyntax.prototype.withCaseKeyword = function (caseKeyword) { - return this.update(caseKeyword, this.expression, this.colonToken, this.statements); - }; - - CaseSwitchClauseSyntax.prototype.withExpression = function (expression) { - return this.update(this.caseKeyword, expression, this.colonToken, this.statements); - }; - - CaseSwitchClauseSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.caseKeyword, this.expression, colonToken, this.statements); - }; - - CaseSwitchClauseSyntax.prototype.withStatements = function (statements) { - return this.update(this.caseKeyword, this.expression, this.colonToken, statements); - }; - - CaseSwitchClauseSyntax.prototype.withStatement = function (statement) { - return this.withStatements(TypeScript.Syntax.list([statement])); - }; - - CaseSwitchClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.statements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return CaseSwitchClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CaseSwitchClauseSyntax = CaseSwitchClauseSyntax; - - var DefaultSwitchClauseSyntax = (function (_super) { - __extends(DefaultSwitchClauseSyntax, _super); - function DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.defaultKeyword = defaultKeyword; - this.colonToken = colonToken; - this.statements = statements; - } - DefaultSwitchClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitDefaultSwitchClause(this); - }; - - DefaultSwitchClauseSyntax.prototype.kind = function () { - return 234 /* DefaultSwitchClause */; - }; - - DefaultSwitchClauseSyntax.prototype.childCount = function () { - return 3; - }; - - DefaultSwitchClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.defaultKeyword; - case 1: - return this.colonToken; - case 2: - return this.statements; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DefaultSwitchClauseSyntax.prototype.isSwitchClause = function () { - return true; - }; - - DefaultSwitchClauseSyntax.prototype.update = function (defaultKeyword, colonToken, statements) { - if (this.defaultKeyword === defaultKeyword && this.colonToken === colonToken && this.statements === statements) { - return this; - } - - return new DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, this.parsedInStrictMode()); - }; - - DefaultSwitchClauseSyntax.create = function (defaultKeyword, colonToken) { - return new DefaultSwitchClauseSyntax(defaultKeyword, colonToken, TypeScript.Syntax.emptyList, false); - }; - - DefaultSwitchClauseSyntax.create1 = function () { - return new DefaultSwitchClauseSyntax(TypeScript.Syntax.token(20 /* DefaultKeyword */), TypeScript.Syntax.token(106 /* ColonToken */), TypeScript.Syntax.emptyList, false); - }; - - DefaultSwitchClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DefaultSwitchClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DefaultSwitchClauseSyntax.prototype.withDefaultKeyword = function (defaultKeyword) { - return this.update(defaultKeyword, this.colonToken, this.statements); - }; - - DefaultSwitchClauseSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.defaultKeyword, colonToken, this.statements); - }; - - DefaultSwitchClauseSyntax.prototype.withStatements = function (statements) { - return this.update(this.defaultKeyword, this.colonToken, statements); - }; - - DefaultSwitchClauseSyntax.prototype.withStatement = function (statement) { - return this.withStatements(TypeScript.Syntax.list([statement])); - }; - - DefaultSwitchClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return DefaultSwitchClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DefaultSwitchClauseSyntax = DefaultSwitchClauseSyntax; - - var BreakStatementSyntax = (function (_super) { - __extends(BreakStatementSyntax, _super); - function BreakStatementSyntax(breakKeyword, identifier, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.breakKeyword = breakKeyword; - this.identifier = identifier; - this.semicolonToken = semicolonToken; - } - BreakStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitBreakStatement(this); - }; - - BreakStatementSyntax.prototype.kind = function () { - return 152 /* BreakStatement */; - }; - - BreakStatementSyntax.prototype.childCount = function () { - return 3; - }; - - BreakStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.breakKeyword; - case 1: - return this.identifier; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - BreakStatementSyntax.prototype.isStatement = function () { - return true; - }; - - BreakStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - BreakStatementSyntax.prototype.update = function (breakKeyword, identifier, semicolonToken) { - if (this.breakKeyword === breakKeyword && this.identifier === identifier && this.semicolonToken === semicolonToken) { - return this; - } - - return new BreakStatementSyntax(breakKeyword, identifier, semicolonToken, this.parsedInStrictMode()); - }; - - BreakStatementSyntax.create = function (breakKeyword, semicolonToken) { - return new BreakStatementSyntax(breakKeyword, null, semicolonToken, false); - }; - - BreakStatementSyntax.create1 = function () { - return new BreakStatementSyntax(TypeScript.Syntax.token(15 /* BreakKeyword */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - BreakStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - BreakStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - BreakStatementSyntax.prototype.withBreakKeyword = function (breakKeyword) { - return this.update(breakKeyword, this.identifier, this.semicolonToken); - }; - - BreakStatementSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.breakKeyword, identifier, this.semicolonToken); - }; - - BreakStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.breakKeyword, this.identifier, semicolonToken); - }; - - BreakStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return BreakStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.BreakStatementSyntax = BreakStatementSyntax; - - var ContinueStatementSyntax = (function (_super) { - __extends(ContinueStatementSyntax, _super); - function ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.continueKeyword = continueKeyword; - this.identifier = identifier; - this.semicolonToken = semicolonToken; - } - ContinueStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitContinueStatement(this); - }; - - ContinueStatementSyntax.prototype.kind = function () { - return 153 /* ContinueStatement */; - }; - - ContinueStatementSyntax.prototype.childCount = function () { - return 3; - }; - - ContinueStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.continueKeyword; - case 1: - return this.identifier; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ContinueStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ContinueStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ContinueStatementSyntax.prototype.update = function (continueKeyword, identifier, semicolonToken) { - if (this.continueKeyword === continueKeyword && this.identifier === identifier && this.semicolonToken === semicolonToken) { - return this; - } - - return new ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, this.parsedInStrictMode()); - }; - - ContinueStatementSyntax.create = function (continueKeyword, semicolonToken) { - return new ContinueStatementSyntax(continueKeyword, null, semicolonToken, false); - }; - - ContinueStatementSyntax.create1 = function () { - return new ContinueStatementSyntax(TypeScript.Syntax.token(18 /* ContinueKeyword */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ContinueStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ContinueStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ContinueStatementSyntax.prototype.withContinueKeyword = function (continueKeyword) { - return this.update(continueKeyword, this.identifier, this.semicolonToken); - }; - - ContinueStatementSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.continueKeyword, identifier, this.semicolonToken); - }; - - ContinueStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.continueKeyword, this.identifier, semicolonToken); - }; - - ContinueStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return ContinueStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ContinueStatementSyntax = ContinueStatementSyntax; - - var ForStatementSyntax = (function (_super) { - __extends(ForStatementSyntax, _super); - function ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.forKeyword = forKeyword; - this.openParenToken = openParenToken; - this.variableDeclaration = variableDeclaration; - this.initializer = initializer; - this.firstSemicolonToken = firstSemicolonToken; - this.condition = condition; - this.secondSemicolonToken = secondSemicolonToken; - this.incrementor = incrementor; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - ForStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitForStatement(this); - }; - - ForStatementSyntax.prototype.kind = function () { - return 154 /* ForStatement */; - }; - - ForStatementSyntax.prototype.childCount = function () { - return 10; - }; - - ForStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.forKeyword; - case 1: - return this.openParenToken; - case 2: - return this.variableDeclaration; - case 3: - return this.initializer; - case 4: - return this.firstSemicolonToken; - case 5: - return this.condition; - case 6: - return this.secondSemicolonToken; - case 7: - return this.incrementor; - case 8: - return this.closeParenToken; - case 9: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ForStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - ForStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ForStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ForStatementSyntax.prototype.update = function (forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - if (this.forKeyword === forKeyword && this.openParenToken === openParenToken && this.variableDeclaration === variableDeclaration && this.initializer === initializer && this.firstSemicolonToken === firstSemicolonToken && this.condition === condition && this.secondSemicolonToken === secondSemicolonToken && this.incrementor === incrementor && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, this.parsedInStrictMode()); - }; - - ForStatementSyntax.create = function (forKeyword, openParenToken, firstSemicolonToken, secondSemicolonToken, closeParenToken, statement) { - return new ForStatementSyntax(forKeyword, openParenToken, null, null, firstSemicolonToken, null, secondSemicolonToken, null, closeParenToken, statement, false); - }; - - ForStatementSyntax.create1 = function (statement) { - return new ForStatementSyntax(TypeScript.Syntax.token(26 /* ForKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), null, null, TypeScript.Syntax.token(78 /* SemicolonToken */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), null, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - ForStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ForStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ForStatementSyntax.prototype.withForKeyword = function (forKeyword) { - return this.update(forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.forKeyword, openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withVariableDeclaration = function (variableDeclaration) { - return this.update(this.forKeyword, this.openParenToken, variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withInitializer = function (initializer) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withFirstSemicolonToken = function (firstSemicolonToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withSecondSemicolonToken = function (secondSemicolonToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withIncrementor = function (incrementor) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, statement); - }; - - ForStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.variableDeclaration !== null && this.variableDeclaration.isTypeScriptSpecific()) { - return true; - } - if (this.initializer !== null && this.initializer.isTypeScriptSpecific()) { - return true; - } - if (this.condition !== null && this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.incrementor !== null && this.incrementor.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ForStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ForStatementSyntax = ForStatementSyntax; - - var ForInStatementSyntax = (function (_super) { - __extends(ForInStatementSyntax, _super); - function ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.forKeyword = forKeyword; - this.openParenToken = openParenToken; - this.variableDeclaration = variableDeclaration; - this.left = left; - this.inKeyword = inKeyword; - this.expression = expression; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - ForInStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitForInStatement(this); - }; - - ForInStatementSyntax.prototype.kind = function () { - return 155 /* ForInStatement */; - }; - - ForInStatementSyntax.prototype.childCount = function () { - return 8; - }; - - ForInStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.forKeyword; - case 1: - return this.openParenToken; - case 2: - return this.variableDeclaration; - case 3: - return this.left; - case 4: - return this.inKeyword; - case 5: - return this.expression; - case 6: - return this.closeParenToken; - case 7: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ForInStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - ForInStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ForInStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ForInStatementSyntax.prototype.update = function (forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - if (this.forKeyword === forKeyword && this.openParenToken === openParenToken && this.variableDeclaration === variableDeclaration && this.left === left && this.inKeyword === inKeyword && this.expression === expression && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, this.parsedInStrictMode()); - }; - - ForInStatementSyntax.create = function (forKeyword, openParenToken, inKeyword, expression, closeParenToken, statement) { - return new ForInStatementSyntax(forKeyword, openParenToken, null, null, inKeyword, expression, closeParenToken, statement, false); - }; - - ForInStatementSyntax.create1 = function (expression, statement) { - return new ForInStatementSyntax(TypeScript.Syntax.token(26 /* ForKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), null, null, TypeScript.Syntax.token(29 /* InKeyword */), expression, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - ForInStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ForInStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ForInStatementSyntax.prototype.withForKeyword = function (forKeyword) { - return this.update(forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.forKeyword, openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withVariableDeclaration = function (variableDeclaration) { - return this.update(this.forKeyword, this.openParenToken, variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withLeft = function (left) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withInKeyword = function (inKeyword) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, statement); - }; - - ForInStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.variableDeclaration !== null && this.variableDeclaration.isTypeScriptSpecific()) { - return true; - } - if (this.left !== null && this.left.isTypeScriptSpecific()) { - return true; - } - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ForInStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ForInStatementSyntax = ForInStatementSyntax; - - var WhileStatementSyntax = (function (_super) { - __extends(WhileStatementSyntax, _super); - function WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.whileKeyword = whileKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - WhileStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitWhileStatement(this); - }; - - WhileStatementSyntax.prototype.kind = function () { - return 158 /* WhileStatement */; - }; - - WhileStatementSyntax.prototype.childCount = function () { - return 5; - }; - - WhileStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.whileKeyword; - case 1: - return this.openParenToken; - case 2: - return this.condition; - case 3: - return this.closeParenToken; - case 4: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - WhileStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - WhileStatementSyntax.prototype.isStatement = function () { - return true; - }; - - WhileStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - WhileStatementSyntax.prototype.update = function (whileKeyword, openParenToken, condition, closeParenToken, statement) { - if (this.whileKeyword === whileKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, this.parsedInStrictMode()); - }; - - WhileStatementSyntax.create1 = function (condition, statement) { - return new WhileStatementSyntax(TypeScript.Syntax.token(42 /* WhileKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - WhileStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - WhileStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - WhileStatementSyntax.prototype.withWhileKeyword = function (whileKeyword) { - return this.update(whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.whileKeyword, openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.whileKeyword, this.openParenToken, condition, this.closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.whileKeyword, this.openParenToken, this.condition, closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, statement); - }; - - WhileStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return WhileStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.WhileStatementSyntax = WhileStatementSyntax; - - var WithStatementSyntax = (function (_super) { - __extends(WithStatementSyntax, _super); - function WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.withKeyword = withKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - WithStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitWithStatement(this); - }; - - WithStatementSyntax.prototype.kind = function () { - return 163 /* WithStatement */; - }; - - WithStatementSyntax.prototype.childCount = function () { - return 5; - }; - - WithStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.withKeyword; - case 1: - return this.openParenToken; - case 2: - return this.condition; - case 3: - return this.closeParenToken; - case 4: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - WithStatementSyntax.prototype.isStatement = function () { - return true; - }; - - WithStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - WithStatementSyntax.prototype.update = function (withKeyword, openParenToken, condition, closeParenToken, statement) { - if (this.withKeyword === withKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, this.parsedInStrictMode()); - }; - - WithStatementSyntax.create1 = function (condition, statement) { - return new WithStatementSyntax(TypeScript.Syntax.token(43 /* WithKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - WithStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - WithStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - WithStatementSyntax.prototype.withWithKeyword = function (withKeyword) { - return this.update(withKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.withKeyword, openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.withKeyword, this.openParenToken, condition, this.closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.withKeyword, this.openParenToken, this.condition, closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.withKeyword, this.openParenToken, this.condition, this.closeParenToken, statement); - }; - - WithStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return WithStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.WithStatementSyntax = WithStatementSyntax; - - var EnumDeclarationSyntax = (function (_super) { - __extends(EnumDeclarationSyntax, _super); - function EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.enumKeyword = enumKeyword; - this.identifier = identifier; - this.openBraceToken = openBraceToken; - this.enumElements = enumElements; - this.closeBraceToken = closeBraceToken; - } - EnumDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitEnumDeclaration(this); - }; - - EnumDeclarationSyntax.prototype.kind = function () { - return 132 /* EnumDeclaration */; - }; - - EnumDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - EnumDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.enumKeyword; - case 2: - return this.identifier; - case 3: - return this.openBraceToken; - case 4: - return this.enumElements; - case 5: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EnumDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - EnumDeclarationSyntax.prototype.update = function (modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - if (this.modifiers === modifiers && this.enumKeyword === enumKeyword && this.identifier === identifier && this.openBraceToken === openBraceToken && this.enumElements === enumElements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, this.parsedInStrictMode()); - }; - - EnumDeclarationSyntax.create = function (enumKeyword, identifier, openBraceToken, closeBraceToken) { - return new EnumDeclarationSyntax(TypeScript.Syntax.emptyList, enumKeyword, identifier, openBraceToken, TypeScript.Syntax.emptySeparatedList, closeBraceToken, false); - }; - - EnumDeclarationSyntax.create1 = function (identifier) { - return new EnumDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(46 /* EnumKeyword */), identifier, TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - EnumDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EnumDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EnumDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.enumKeyword, this.identifier, this.openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - EnumDeclarationSyntax.prototype.withEnumKeyword = function (enumKeyword) { - return this.update(this.modifiers, enumKeyword, this.identifier, this.openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.enumKeyword, identifier, this.openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.modifiers, this.enumKeyword, this.identifier, openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withEnumElements = function (enumElements) { - return this.update(this.modifiers, this.enumKeyword, this.identifier, this.openBraceToken, enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withEnumElement = function (enumElement) { - return this.withEnumElements(TypeScript.Syntax.separatedList([enumElement])); - }; - - EnumDeclarationSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.modifiers, this.enumKeyword, this.identifier, this.openBraceToken, this.enumElements, closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return EnumDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EnumDeclarationSyntax = EnumDeclarationSyntax; - - var EnumElementSyntax = (function (_super) { - __extends(EnumElementSyntax, _super); - function EnumElementSyntax(propertyName, equalsValueClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.equalsValueClause = equalsValueClause; - } - EnumElementSyntax.prototype.accept = function (visitor) { - return visitor.visitEnumElement(this); - }; - - EnumElementSyntax.prototype.kind = function () { - return 243 /* EnumElement */; - }; - - EnumElementSyntax.prototype.childCount = function () { - return 2; - }; - - EnumElementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.equalsValueClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EnumElementSyntax.prototype.update = function (propertyName, equalsValueClause) { - if (this.propertyName === propertyName && this.equalsValueClause === equalsValueClause) { - return this; - } - - return new EnumElementSyntax(propertyName, equalsValueClause, this.parsedInStrictMode()); - }; - - EnumElementSyntax.create = function (propertyName) { - return new EnumElementSyntax(propertyName, null, false); - }; - - EnumElementSyntax.create1 = function (propertyName) { - return new EnumElementSyntax(propertyName, null, false); - }; - - EnumElementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EnumElementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EnumElementSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.equalsValueClause); - }; - - EnumElementSyntax.prototype.withEqualsValueClause = function (equalsValueClause) { - return this.update(this.propertyName, equalsValueClause); - }; - - EnumElementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.equalsValueClause !== null && this.equalsValueClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return EnumElementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EnumElementSyntax = EnumElementSyntax; - - var CastExpressionSyntax = (function (_super) { - __extends(CastExpressionSyntax, _super); - function CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.lessThanToken = lessThanToken; - this.type = type; - this.greaterThanToken = greaterThanToken; - this.expression = expression; - } - CastExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitCastExpression(this); - }; - - CastExpressionSyntax.prototype.kind = function () { - return 220 /* CastExpression */; - }; - - CastExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - CastExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.lessThanToken; - case 1: - return this.type; - case 2: - return this.greaterThanToken; - case 3: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CastExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - CastExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - CastExpressionSyntax.prototype.update = function (lessThanToken, type, greaterThanToken, expression) { - if (this.lessThanToken === lessThanToken && this.type === type && this.greaterThanToken === greaterThanToken && this.expression === expression) { - return this; - } - - return new CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, this.parsedInStrictMode()); - }; - - CastExpressionSyntax.create1 = function (type, expression) { - return new CastExpressionSyntax(TypeScript.Syntax.token(80 /* LessThanToken */), type, TypeScript.Syntax.token(81 /* GreaterThanToken */), expression, false); - }; - - CastExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CastExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CastExpressionSyntax.prototype.withLessThanToken = function (lessThanToken) { - return this.update(lessThanToken, this.type, this.greaterThanToken, this.expression); - }; - - CastExpressionSyntax.prototype.withType = function (type) { - return this.update(this.lessThanToken, type, this.greaterThanToken, this.expression); - }; - - CastExpressionSyntax.prototype.withGreaterThanToken = function (greaterThanToken) { - return this.update(this.lessThanToken, this.type, greaterThanToken, this.expression); - }; - - CastExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.lessThanToken, this.type, this.greaterThanToken, expression); - }; - - CastExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return CastExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CastExpressionSyntax = CastExpressionSyntax; - - var ObjectLiteralExpressionSyntax = (function (_super) { - __extends(ObjectLiteralExpressionSyntax, _super); - function ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBraceToken = openBraceToken; - this.propertyAssignments = propertyAssignments; - this.closeBraceToken = closeBraceToken; - } - ObjectLiteralExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitObjectLiteralExpression(this); - }; - - ObjectLiteralExpressionSyntax.prototype.kind = function () { - return 215 /* ObjectLiteralExpression */; - }; - - ObjectLiteralExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ObjectLiteralExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBraceToken; - case 1: - return this.propertyAssignments; - case 2: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ObjectLiteralExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.update = function (openBraceToken, propertyAssignments, closeBraceToken) { - if (this.openBraceToken === openBraceToken && this.propertyAssignments === propertyAssignments && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, this.parsedInStrictMode()); - }; - - ObjectLiteralExpressionSyntax.create = function (openBraceToken, closeBraceToken) { - return new ObjectLiteralExpressionSyntax(openBraceToken, TypeScript.Syntax.emptySeparatedList, closeBraceToken, false); - }; - - ObjectLiteralExpressionSyntax.create1 = function () { - return new ObjectLiteralExpressionSyntax(TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ObjectLiteralExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ObjectLiteralExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ObjectLiteralExpressionSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(openBraceToken, this.propertyAssignments, this.closeBraceToken); - }; - - ObjectLiteralExpressionSyntax.prototype.withPropertyAssignments = function (propertyAssignments) { - return this.update(this.openBraceToken, propertyAssignments, this.closeBraceToken); - }; - - ObjectLiteralExpressionSyntax.prototype.withPropertyAssignment = function (propertyAssignment) { - return this.withPropertyAssignments(TypeScript.Syntax.separatedList([propertyAssignment])); - }; - - ObjectLiteralExpressionSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.openBraceToken, this.propertyAssignments, closeBraceToken); - }; - - ObjectLiteralExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.propertyAssignments.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ObjectLiteralExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ObjectLiteralExpressionSyntax = ObjectLiteralExpressionSyntax; - - var SimplePropertyAssignmentSyntax = (function (_super) { - __extends(SimplePropertyAssignmentSyntax, _super); - function SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.colonToken = colonToken; - this.expression = expression; - } - SimplePropertyAssignmentSyntax.prototype.accept = function (visitor) { - return visitor.visitSimplePropertyAssignment(this); - }; - - SimplePropertyAssignmentSyntax.prototype.kind = function () { - return 240 /* SimplePropertyAssignment */; - }; - - SimplePropertyAssignmentSyntax.prototype.childCount = function () { - return 3; - }; - - SimplePropertyAssignmentSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.colonToken; - case 2: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SimplePropertyAssignmentSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - SimplePropertyAssignmentSyntax.prototype.update = function (propertyName, colonToken, expression) { - if (this.propertyName === propertyName && this.colonToken === colonToken && this.expression === expression) { - return this; - } - - return new SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, this.parsedInStrictMode()); - }; - - SimplePropertyAssignmentSyntax.create1 = function (propertyName, expression) { - return new SimplePropertyAssignmentSyntax(propertyName, TypeScript.Syntax.token(106 /* ColonToken */), expression, false); - }; - - SimplePropertyAssignmentSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SimplePropertyAssignmentSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SimplePropertyAssignmentSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.colonToken, this.expression); - }; - - SimplePropertyAssignmentSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.propertyName, colonToken, this.expression); - }; - - SimplePropertyAssignmentSyntax.prototype.withExpression = function (expression) { - return this.update(this.propertyName, this.colonToken, expression); - }; - - SimplePropertyAssignmentSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return SimplePropertyAssignmentSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SimplePropertyAssignmentSyntax = SimplePropertyAssignmentSyntax; - - var FunctionPropertyAssignmentSyntax = (function (_super) { - __extends(FunctionPropertyAssignmentSyntax, _super); - function FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - } - FunctionPropertyAssignmentSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionPropertyAssignment(this); - }; - - FunctionPropertyAssignmentSyntax.prototype.kind = function () { - return 241 /* FunctionPropertyAssignment */; - }; - - FunctionPropertyAssignmentSyntax.prototype.childCount = function () { - return 3; - }; - - FunctionPropertyAssignmentSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.callSignature; - case 2: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionPropertyAssignmentSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - FunctionPropertyAssignmentSyntax.prototype.update = function (propertyName, callSignature, block) { - if (this.propertyName === propertyName && this.callSignature === callSignature && this.block === block) { - return this; - } - - return new FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, this.parsedInStrictMode()); - }; - - FunctionPropertyAssignmentSyntax.create1 = function (propertyName) { - return new FunctionPropertyAssignmentSyntax(propertyName, CallSignatureSyntax.create1(), BlockSyntax.create1(), false); - }; - - FunctionPropertyAssignmentSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionPropertyAssignmentSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionPropertyAssignmentSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.callSignature, this.block); - }; - - FunctionPropertyAssignmentSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.propertyName, callSignature, this.block); - }; - - FunctionPropertyAssignmentSyntax.prototype.withBlock = function (block) { - return this.update(this.propertyName, this.callSignature, block); - }; - - FunctionPropertyAssignmentSyntax.prototype.isTypeScriptSpecific = function () { - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FunctionPropertyAssignmentSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionPropertyAssignmentSyntax = FunctionPropertyAssignmentSyntax; - - var FunctionExpressionSyntax = (function (_super) { - __extends(FunctionExpressionSyntax, _super); - function FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.functionKeyword = functionKeyword; - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - } - FunctionExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionExpression(this); - }; - - FunctionExpressionSyntax.prototype.kind = function () { - return 222 /* FunctionExpression */; - }; - - FunctionExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - FunctionExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.functionKeyword; - case 1: - return this.identifier; - case 2: - return this.callSignature; - case 3: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.update = function (functionKeyword, identifier, callSignature, block) { - if (this.functionKeyword === functionKeyword && this.identifier === identifier && this.callSignature === callSignature && this.block === block) { - return this; - } - - return new FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, this.parsedInStrictMode()); - }; - - FunctionExpressionSyntax.create = function (functionKeyword, callSignature, block) { - return new FunctionExpressionSyntax(functionKeyword, null, callSignature, block, false); - }; - - FunctionExpressionSyntax.create1 = function () { - return new FunctionExpressionSyntax(TypeScript.Syntax.token(27 /* FunctionKeyword */), null, CallSignatureSyntax.create1(), BlockSyntax.create1(), false); - }; - - FunctionExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionExpressionSyntax.prototype.withFunctionKeyword = function (functionKeyword) { - return this.update(functionKeyword, this.identifier, this.callSignature, this.block); - }; - - FunctionExpressionSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.functionKeyword, identifier, this.callSignature, this.block); - }; - - FunctionExpressionSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.functionKeyword, this.identifier, callSignature, this.block); - }; - - FunctionExpressionSyntax.prototype.withBlock = function (block) { - return this.update(this.functionKeyword, this.identifier, this.callSignature, block); - }; - - FunctionExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionExpressionSyntax = FunctionExpressionSyntax; - - var EmptyStatementSyntax = (function (_super) { - __extends(EmptyStatementSyntax, _super); - function EmptyStatementSyntax(semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.semicolonToken = semicolonToken; - } - EmptyStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitEmptyStatement(this); - }; - - EmptyStatementSyntax.prototype.kind = function () { - return 156 /* EmptyStatement */; - }; - - EmptyStatementSyntax.prototype.childCount = function () { - return 1; - }; - - EmptyStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EmptyStatementSyntax.prototype.isStatement = function () { - return true; - }; - - EmptyStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - EmptyStatementSyntax.prototype.update = function (semicolonToken) { - if (this.semicolonToken === semicolonToken) { - return this; - } - - return new EmptyStatementSyntax(semicolonToken, this.parsedInStrictMode()); - }; - - EmptyStatementSyntax.create1 = function () { - return new EmptyStatementSyntax(TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - EmptyStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EmptyStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EmptyStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(semicolonToken); - }; - - EmptyStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return EmptyStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EmptyStatementSyntax = EmptyStatementSyntax; - - var TryStatementSyntax = (function (_super) { - __extends(TryStatementSyntax, _super); - function TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.tryKeyword = tryKeyword; - this.block = block; - this.catchClause = catchClause; - this.finallyClause = finallyClause; - } - TryStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitTryStatement(this); - }; - - TryStatementSyntax.prototype.kind = function () { - return 159 /* TryStatement */; - }; - - TryStatementSyntax.prototype.childCount = function () { - return 4; - }; - - TryStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.tryKeyword; - case 1: - return this.block; - case 2: - return this.catchClause; - case 3: - return this.finallyClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TryStatementSyntax.prototype.isStatement = function () { - return true; - }; - - TryStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - TryStatementSyntax.prototype.update = function (tryKeyword, block, catchClause, finallyClause) { - if (this.tryKeyword === tryKeyword && this.block === block && this.catchClause === catchClause && this.finallyClause === finallyClause) { - return this; - } - - return new TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, this.parsedInStrictMode()); - }; - - TryStatementSyntax.create = function (tryKeyword, block) { - return new TryStatementSyntax(tryKeyword, block, null, null, false); - }; - - TryStatementSyntax.create1 = function () { - return new TryStatementSyntax(TypeScript.Syntax.token(38 /* TryKeyword */), BlockSyntax.create1(), null, null, false); - }; - - TryStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TryStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TryStatementSyntax.prototype.withTryKeyword = function (tryKeyword) { - return this.update(tryKeyword, this.block, this.catchClause, this.finallyClause); - }; - - TryStatementSyntax.prototype.withBlock = function (block) { - return this.update(this.tryKeyword, block, this.catchClause, this.finallyClause); - }; - - TryStatementSyntax.prototype.withCatchClause = function (catchClause) { - return this.update(this.tryKeyword, this.block, catchClause, this.finallyClause); - }; - - TryStatementSyntax.prototype.withFinallyClause = function (finallyClause) { - return this.update(this.tryKeyword, this.block, this.catchClause, finallyClause); - }; - - TryStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.block.isTypeScriptSpecific()) { - return true; - } - if (this.catchClause !== null && this.catchClause.isTypeScriptSpecific()) { - return true; - } - if (this.finallyClause !== null && this.finallyClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return TryStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TryStatementSyntax = TryStatementSyntax; - - var CatchClauseSyntax = (function (_super) { - __extends(CatchClauseSyntax, _super); - function CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.catchKeyword = catchKeyword; - this.openParenToken = openParenToken; - this.identifier = identifier; - this.typeAnnotation = typeAnnotation; - this.closeParenToken = closeParenToken; - this.block = block; - } - CatchClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitCatchClause(this); - }; - - CatchClauseSyntax.prototype.kind = function () { - return 236 /* CatchClause */; - }; - - CatchClauseSyntax.prototype.childCount = function () { - return 6; - }; - - CatchClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.catchKeyword; - case 1: - return this.openParenToken; - case 2: - return this.identifier; - case 3: - return this.typeAnnotation; - case 4: - return this.closeParenToken; - case 5: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CatchClauseSyntax.prototype.update = function (catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - if (this.catchKeyword === catchKeyword && this.openParenToken === openParenToken && this.identifier === identifier && this.typeAnnotation === typeAnnotation && this.closeParenToken === closeParenToken && this.block === block) { - return this; - } - - return new CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, this.parsedInStrictMode()); - }; - - CatchClauseSyntax.create = function (catchKeyword, openParenToken, identifier, closeParenToken, block) { - return new CatchClauseSyntax(catchKeyword, openParenToken, identifier, null, closeParenToken, block, false); - }; - - CatchClauseSyntax.create1 = function (identifier) { - return new CatchClauseSyntax(TypeScript.Syntax.token(17 /* CatchKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), identifier, null, TypeScript.Syntax.token(73 /* CloseParenToken */), BlockSyntax.create1(), false); - }; - - CatchClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CatchClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CatchClauseSyntax.prototype.withCatchKeyword = function (catchKeyword) { - return this.update(catchKeyword, this.openParenToken, this.identifier, this.typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.catchKeyword, openParenToken, this.identifier, this.typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.catchKeyword, this.openParenToken, identifier, this.typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.catchKeyword, this.openParenToken, this.identifier, typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.catchKeyword, this.openParenToken, this.identifier, this.typeAnnotation, closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withBlock = function (block) { - return this.update(this.catchKeyword, this.openParenToken, this.identifier, this.typeAnnotation, this.closeParenToken, block); - }; - - CatchClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeAnnotation !== null && this.typeAnnotation.isTypeScriptSpecific()) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return CatchClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CatchClauseSyntax = CatchClauseSyntax; - - var FinallyClauseSyntax = (function (_super) { - __extends(FinallyClauseSyntax, _super); - function FinallyClauseSyntax(finallyKeyword, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.finallyKeyword = finallyKeyword; - this.block = block; - } - FinallyClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitFinallyClause(this); - }; - - FinallyClauseSyntax.prototype.kind = function () { - return 237 /* FinallyClause */; - }; - - FinallyClauseSyntax.prototype.childCount = function () { - return 2; - }; - - FinallyClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.finallyKeyword; - case 1: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FinallyClauseSyntax.prototype.update = function (finallyKeyword, block) { - if (this.finallyKeyword === finallyKeyword && this.block === block) { - return this; - } - - return new FinallyClauseSyntax(finallyKeyword, block, this.parsedInStrictMode()); - }; - - FinallyClauseSyntax.create1 = function () { - return new FinallyClauseSyntax(TypeScript.Syntax.token(25 /* FinallyKeyword */), BlockSyntax.create1(), false); - }; - - FinallyClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FinallyClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FinallyClauseSyntax.prototype.withFinallyKeyword = function (finallyKeyword) { - return this.update(finallyKeyword, this.block); - }; - - FinallyClauseSyntax.prototype.withBlock = function (block) { - return this.update(this.finallyKeyword, block); - }; - - FinallyClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FinallyClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FinallyClauseSyntax = FinallyClauseSyntax; - - var LabeledStatementSyntax = (function (_super) { - __extends(LabeledStatementSyntax, _super); - function LabeledStatementSyntax(identifier, colonToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.identifier = identifier; - this.colonToken = colonToken; - this.statement = statement; - } - LabeledStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitLabeledStatement(this); - }; - - LabeledStatementSyntax.prototype.kind = function () { - return 160 /* LabeledStatement */; - }; - - LabeledStatementSyntax.prototype.childCount = function () { - return 3; - }; - - LabeledStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.identifier; - case 1: - return this.colonToken; - case 2: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - LabeledStatementSyntax.prototype.isStatement = function () { - return true; - }; - - LabeledStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - LabeledStatementSyntax.prototype.update = function (identifier, colonToken, statement) { - if (this.identifier === identifier && this.colonToken === colonToken && this.statement === statement) { - return this; - } - - return new LabeledStatementSyntax(identifier, colonToken, statement, this.parsedInStrictMode()); - }; - - LabeledStatementSyntax.create1 = function (identifier, statement) { - return new LabeledStatementSyntax(identifier, TypeScript.Syntax.token(106 /* ColonToken */), statement, false); - }; - - LabeledStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - LabeledStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - LabeledStatementSyntax.prototype.withIdentifier = function (identifier) { - return this.update(identifier, this.colonToken, this.statement); - }; - - LabeledStatementSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.identifier, colonToken, this.statement); - }; - - LabeledStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.identifier, this.colonToken, statement); - }; - - LabeledStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return LabeledStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.LabeledStatementSyntax = LabeledStatementSyntax; - - var DoStatementSyntax = (function (_super) { - __extends(DoStatementSyntax, _super); - function DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.doKeyword = doKeyword; - this.statement = statement; - this.whileKeyword = whileKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.semicolonToken = semicolonToken; - } - DoStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitDoStatement(this); - }; - - DoStatementSyntax.prototype.kind = function () { - return 161 /* DoStatement */; - }; - - DoStatementSyntax.prototype.childCount = function () { - return 7; - }; - - DoStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.doKeyword; - case 1: - return this.statement; - case 2: - return this.whileKeyword; - case 3: - return this.openParenToken; - case 4: - return this.condition; - case 5: - return this.closeParenToken; - case 6: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DoStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - DoStatementSyntax.prototype.isStatement = function () { - return true; - }; - - DoStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - DoStatementSyntax.prototype.update = function (doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - if (this.doKeyword === doKeyword && this.statement === statement && this.whileKeyword === whileKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.semicolonToken === semicolonToken) { - return this; - } - - return new DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.parsedInStrictMode()); - }; - - DoStatementSyntax.create1 = function (statement, condition) { - return new DoStatementSyntax(TypeScript.Syntax.token(22 /* DoKeyword */), statement, TypeScript.Syntax.token(42 /* WhileKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - DoStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DoStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DoStatementSyntax.prototype.withDoKeyword = function (doKeyword) { - return this.update(doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.doKeyword, statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withWhileKeyword = function (whileKeyword) { - return this.update(this.doKeyword, this.statement, whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, semicolonToken); - }; - - DoStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statement.isTypeScriptSpecific()) { - return true; - } - if (this.condition.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return DoStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DoStatementSyntax = DoStatementSyntax; - - var TypeOfExpressionSyntax = (function (_super) { - __extends(TypeOfExpressionSyntax, _super); - function TypeOfExpressionSyntax(typeOfKeyword, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeOfKeyword = typeOfKeyword; - this.expression = expression; - } - TypeOfExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeOfExpression(this); - }; - - TypeOfExpressionSyntax.prototype.kind = function () { - return 171 /* TypeOfExpression */; - }; - - TypeOfExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - TypeOfExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeOfKeyword; - case 1: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeOfExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - TypeOfExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - TypeOfExpressionSyntax.prototype.update = function (typeOfKeyword, expression) { - if (this.typeOfKeyword === typeOfKeyword && this.expression === expression) { - return this; - } - - return new TypeOfExpressionSyntax(typeOfKeyword, expression, this.parsedInStrictMode()); - }; - - TypeOfExpressionSyntax.create1 = function (expression) { - return new TypeOfExpressionSyntax(TypeScript.Syntax.token(39 /* TypeOfKeyword */), expression, false); - }; - - TypeOfExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeOfExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeOfExpressionSyntax.prototype.withTypeOfKeyword = function (typeOfKeyword) { - return this.update(typeOfKeyword, this.expression); - }; - - TypeOfExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.typeOfKeyword, expression); - }; - - TypeOfExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return TypeOfExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeOfExpressionSyntax = TypeOfExpressionSyntax; - - var DeleteExpressionSyntax = (function (_super) { - __extends(DeleteExpressionSyntax, _super); - function DeleteExpressionSyntax(deleteKeyword, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.deleteKeyword = deleteKeyword; - this.expression = expression; - } - DeleteExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitDeleteExpression(this); - }; - - DeleteExpressionSyntax.prototype.kind = function () { - return 170 /* DeleteExpression */; - }; - - DeleteExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - DeleteExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.deleteKeyword; - case 1: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DeleteExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - DeleteExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - DeleteExpressionSyntax.prototype.update = function (deleteKeyword, expression) { - if (this.deleteKeyword === deleteKeyword && this.expression === expression) { - return this; - } - - return new DeleteExpressionSyntax(deleteKeyword, expression, this.parsedInStrictMode()); - }; - - DeleteExpressionSyntax.create1 = function (expression) { - return new DeleteExpressionSyntax(TypeScript.Syntax.token(21 /* DeleteKeyword */), expression, false); - }; - - DeleteExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DeleteExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DeleteExpressionSyntax.prototype.withDeleteKeyword = function (deleteKeyword) { - return this.update(deleteKeyword, this.expression); - }; - - DeleteExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.deleteKeyword, expression); - }; - - DeleteExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return DeleteExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DeleteExpressionSyntax = DeleteExpressionSyntax; - - var VoidExpressionSyntax = (function (_super) { - __extends(VoidExpressionSyntax, _super); - function VoidExpressionSyntax(voidKeyword, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.voidKeyword = voidKeyword; - this.expression = expression; - } - VoidExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitVoidExpression(this); - }; - - VoidExpressionSyntax.prototype.kind = function () { - return 172 /* VoidExpression */; - }; - - VoidExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - VoidExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.voidKeyword; - case 1: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VoidExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - VoidExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - VoidExpressionSyntax.prototype.update = function (voidKeyword, expression) { - if (this.voidKeyword === voidKeyword && this.expression === expression) { - return this; - } - - return new VoidExpressionSyntax(voidKeyword, expression, this.parsedInStrictMode()); - }; - - VoidExpressionSyntax.create1 = function (expression) { - return new VoidExpressionSyntax(TypeScript.Syntax.token(41 /* VoidKeyword */), expression, false); - }; - - VoidExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VoidExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VoidExpressionSyntax.prototype.withVoidKeyword = function (voidKeyword) { - return this.update(voidKeyword, this.expression); - }; - - VoidExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.voidKeyword, expression); - }; - - VoidExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VoidExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VoidExpressionSyntax = VoidExpressionSyntax; - - var DebuggerStatementSyntax = (function (_super) { - __extends(DebuggerStatementSyntax, _super); - function DebuggerStatementSyntax(debuggerKeyword, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.debuggerKeyword = debuggerKeyword; - this.semicolonToken = semicolonToken; - } - DebuggerStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitDebuggerStatement(this); - }; - - DebuggerStatementSyntax.prototype.kind = function () { - return 162 /* DebuggerStatement */; - }; - - DebuggerStatementSyntax.prototype.childCount = function () { - return 2; - }; - - DebuggerStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.debuggerKeyword; - case 1: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DebuggerStatementSyntax.prototype.isStatement = function () { - return true; - }; - - DebuggerStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - DebuggerStatementSyntax.prototype.update = function (debuggerKeyword, semicolonToken) { - if (this.debuggerKeyword === debuggerKeyword && this.semicolonToken === semicolonToken) { - return this; - } - - return new DebuggerStatementSyntax(debuggerKeyword, semicolonToken, this.parsedInStrictMode()); - }; - - DebuggerStatementSyntax.create1 = function () { - return new DebuggerStatementSyntax(TypeScript.Syntax.token(19 /* DebuggerKeyword */), TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - DebuggerStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DebuggerStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DebuggerStatementSyntax.prototype.withDebuggerKeyword = function (debuggerKeyword) { - return this.update(debuggerKeyword, this.semicolonToken); - }; - - DebuggerStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.debuggerKeyword, semicolonToken); - }; - - DebuggerStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return DebuggerStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DebuggerStatementSyntax = DebuggerStatementSyntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxRewriter = (function () { - function SyntaxRewriter() { - } - SyntaxRewriter.prototype.visitToken = function (token) { - return token; - }; - - SyntaxRewriter.prototype.visitNode = function (node) { - return node.accept(this); - }; - - SyntaxRewriter.prototype.visitNodeOrToken = function (node) { - return node.isToken() ? this.visitToken(node) : this.visitNode(node); - }; - - SyntaxRewriter.prototype.visitList = function (list) { - var newItems = null; - - for (var i = 0, n = list.childCount(); i < n; i++) { - var item = list.childAt(i); - var newItem = this.visitNodeOrToken(item); - - if (item !== newItem && newItems === null) { - newItems = []; - for (var j = 0; j < i; j++) { - newItems.push(list.childAt(j)); - } - } - - if (newItems) { - newItems.push(newItem); - } - } - - return newItems === null ? list : TypeScript.Syntax.list(newItems); - }; - - SyntaxRewriter.prototype.visitSeparatedList = function (list) { - var newItems = null; - - for (var i = 0, n = list.childCount(); i < n; i++) { - var item = list.childAt(i); - var newItem = item.isToken() ? this.visitToken(item) : this.visitNode(item); - - if (item !== newItem && newItems === null) { - newItems = []; - for (var j = 0; j < i; j++) { - newItems.push(list.childAt(j)); - } - } - - if (newItems) { - newItems.push(newItem); - } - } - - return newItems === null ? list : TypeScript.Syntax.separatedList(newItems); - }; - - SyntaxRewriter.prototype.visitSourceUnit = function (node) { - return node.update(this.visitList(node.moduleElements), this.visitToken(node.endOfFileToken)); - }; - - SyntaxRewriter.prototype.visitExternalModuleReference = function (node) { - return node.update(this.visitToken(node.requireKeyword), this.visitToken(node.openParenToken), this.visitToken(node.stringLiteral), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitModuleNameModuleReference = function (node) { - return node.update(this.visitNodeOrToken(node.moduleName)); - }; - - SyntaxRewriter.prototype.visitImportDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.importKeyword), this.visitToken(node.identifier), this.visitToken(node.equalsToken), this.visitNodeOrToken(node.moduleReference), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitExportAssignment = function (node) { - return node.update(this.visitToken(node.exportKeyword), this.visitToken(node.equalsToken), this.visitToken(node.identifier), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitClassDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.classKeyword), this.visitToken(node.identifier), node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitList(node.heritageClauses), this.visitToken(node.openBraceToken), this.visitList(node.classElements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitInterfaceDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.interfaceKeyword), this.visitToken(node.identifier), node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitList(node.heritageClauses), this.visitNode(node.body)); - }; - - SyntaxRewriter.prototype.visitHeritageClause = function (node) { - return node.update(node.kind(), this.visitToken(node.extendsOrImplementsKeyword), this.visitSeparatedList(node.typeNames)); - }; - - SyntaxRewriter.prototype.visitModuleDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.moduleKeyword), node.name === null ? null : this.visitNodeOrToken(node.name), node.stringLiteral === null ? null : this.visitToken(node.stringLiteral), this.visitToken(node.openBraceToken), this.visitList(node.moduleElements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitFunctionDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.functionKeyword), this.visitToken(node.identifier), this.visitNode(node.callSignature), node.block === null ? null : this.visitNode(node.block), node.semicolonToken === null ? null : this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitVariableStatement = function (node) { - return node.update(this.visitList(node.modifiers), this.visitNode(node.variableDeclaration), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitVariableDeclaration = function (node) { - return node.update(this.visitToken(node.varKeyword), this.visitSeparatedList(node.variableDeclarators)); - }; - - SyntaxRewriter.prototype.visitVariableDeclarator = function (node) { - return node.update(this.visitToken(node.propertyName), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), node.equalsValueClause === null ? null : this.visitNode(node.equalsValueClause)); - }; - - SyntaxRewriter.prototype.visitEqualsValueClause = function (node) { - return node.update(this.visitToken(node.equalsToken), this.visitNodeOrToken(node.value)); - }; - - SyntaxRewriter.prototype.visitPrefixUnaryExpression = function (node) { - return node.update(node.kind(), this.visitToken(node.operatorToken), this.visitNodeOrToken(node.operand)); - }; - - SyntaxRewriter.prototype.visitArrayLiteralExpression = function (node) { - return node.update(this.visitToken(node.openBracketToken), this.visitSeparatedList(node.expressions), this.visitToken(node.closeBracketToken)); - }; - - SyntaxRewriter.prototype.visitOmittedExpression = function (node) { - return node; - }; - - SyntaxRewriter.prototype.visitParenthesizedExpression = function (node) { - return node.update(this.visitToken(node.openParenToken), this.visitNodeOrToken(node.expression), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitSimpleArrowFunctionExpression = function (node) { - return node.update(this.visitToken(node.identifier), this.visitToken(node.equalsGreaterThanToken), node.block === null ? null : this.visitNode(node.block), node.expression === null ? null : this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - return node.update(this.visitNode(node.callSignature), this.visitToken(node.equalsGreaterThanToken), node.block === null ? null : this.visitNode(node.block), node.expression === null ? null : this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitQualifiedName = function (node) { - return node.update(this.visitNodeOrToken(node.left), this.visitToken(node.dotToken), this.visitToken(node.right)); - }; - - SyntaxRewriter.prototype.visitTypeArgumentList = function (node) { - return node.update(this.visitToken(node.lessThanToken), this.visitSeparatedList(node.typeArguments), this.visitToken(node.greaterThanToken)); - }; - - SyntaxRewriter.prototype.visitConstructorType = function (node) { - return node.update(this.visitToken(node.newKeyword), node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitNode(node.parameterList), this.visitToken(node.equalsGreaterThanToken), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitFunctionType = function (node) { - return node.update(node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitNode(node.parameterList), this.visitToken(node.equalsGreaterThanToken), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitObjectType = function (node) { - return node.update(this.visitToken(node.openBraceToken), this.visitSeparatedList(node.typeMembers), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitArrayType = function (node) { - return node.update(this.visitNodeOrToken(node.type), this.visitToken(node.openBracketToken), this.visitToken(node.closeBracketToken)); - }; - - SyntaxRewriter.prototype.visitGenericType = function (node) { - return node.update(this.visitNodeOrToken(node.name), this.visitNode(node.typeArgumentList)); - }; - - SyntaxRewriter.prototype.visitTypeQuery = function (node) { - return node.update(this.visitToken(node.typeOfKeyword), this.visitNodeOrToken(node.name)); - }; - - SyntaxRewriter.prototype.visitTypeAnnotation = function (node) { - return node.update(this.visitToken(node.colonToken), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitBlock = function (node) { - return node.update(this.visitToken(node.openBraceToken), this.visitList(node.statements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitParameter = function (node) { - return node.update(node.dotDotDotToken === null ? null : this.visitToken(node.dotDotDotToken), this.visitList(node.modifiers), this.visitToken(node.identifier), node.questionToken === null ? null : this.visitToken(node.questionToken), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), node.equalsValueClause === null ? null : this.visitNode(node.equalsValueClause)); - }; - - SyntaxRewriter.prototype.visitMemberAccessExpression = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitToken(node.dotToken), this.visitToken(node.name)); - }; - - SyntaxRewriter.prototype.visitPostfixUnaryExpression = function (node) { - return node.update(node.kind(), this.visitNodeOrToken(node.operand), this.visitToken(node.operatorToken)); - }; - - SyntaxRewriter.prototype.visitElementAccessExpression = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitToken(node.openBracketToken), this.visitNodeOrToken(node.argumentExpression), this.visitToken(node.closeBracketToken)); - }; - - SyntaxRewriter.prototype.visitInvocationExpression = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitNode(node.argumentList)); - }; - - SyntaxRewriter.prototype.visitArgumentList = function (node) { - return node.update(node.typeArgumentList === null ? null : this.visitNode(node.typeArgumentList), this.visitToken(node.openParenToken), this.visitSeparatedList(node.arguments), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitBinaryExpression = function (node) { - return node.update(node.kind(), this.visitNodeOrToken(node.left), this.visitToken(node.operatorToken), this.visitNodeOrToken(node.right)); - }; - - SyntaxRewriter.prototype.visitConditionalExpression = function (node) { - return node.update(this.visitNodeOrToken(node.condition), this.visitToken(node.questionToken), this.visitNodeOrToken(node.whenTrue), this.visitToken(node.colonToken), this.visitNodeOrToken(node.whenFalse)); - }; - - SyntaxRewriter.prototype.visitConstructSignature = function (node) { - return node.update(this.visitToken(node.newKeyword), this.visitNode(node.callSignature)); - }; - - SyntaxRewriter.prototype.visitMethodSignature = function (node) { - return node.update(this.visitToken(node.propertyName), node.questionToken === null ? null : this.visitToken(node.questionToken), this.visitNode(node.callSignature)); - }; - - SyntaxRewriter.prototype.visitIndexSignature = function (node) { - return node.update(this.visitToken(node.openBracketToken), this.visitNode(node.parameter), this.visitToken(node.closeBracketToken), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation)); - }; - - SyntaxRewriter.prototype.visitPropertySignature = function (node) { - return node.update(this.visitToken(node.propertyName), node.questionToken === null ? null : this.visitToken(node.questionToken), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation)); - }; - - SyntaxRewriter.prototype.visitCallSignature = function (node) { - return node.update(node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitNode(node.parameterList), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation)); - }; - - SyntaxRewriter.prototype.visitParameterList = function (node) { - return node.update(this.visitToken(node.openParenToken), this.visitSeparatedList(node.parameters), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitTypeParameterList = function (node) { - return node.update(this.visitToken(node.lessThanToken), this.visitSeparatedList(node.typeParameters), this.visitToken(node.greaterThanToken)); - }; - - SyntaxRewriter.prototype.visitTypeParameter = function (node) { - return node.update(this.visitToken(node.identifier), node.constraint === null ? null : this.visitNode(node.constraint)); - }; - - SyntaxRewriter.prototype.visitConstraint = function (node) { - return node.update(this.visitToken(node.extendsKeyword), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitElseClause = function (node) { - return node.update(this.visitToken(node.elseKeyword), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitIfStatement = function (node) { - return node.update(this.visitToken(node.ifKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement), node.elseClause === null ? null : this.visitNode(node.elseClause)); - }; - - SyntaxRewriter.prototype.visitExpressionStatement = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitConstructorDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.constructorKeyword), this.visitNode(node.callSignature), node.block === null ? null : this.visitNode(node.block), node.semicolonToken === null ? null : this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitMemberFunctionDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.propertyName), this.visitNode(node.callSignature), node.block === null ? null : this.visitNode(node.block), node.semicolonToken === null ? null : this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitGetAccessor = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.getKeyword), this.visitToken(node.propertyName), this.visitNode(node.parameterList), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitSetAccessor = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.setKeyword), this.visitToken(node.propertyName), this.visitNode(node.parameterList), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitMemberVariableDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitNode(node.variableDeclarator), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitIndexMemberDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitNode(node.indexSignature), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitThrowStatement = function (node) { - return node.update(this.visitToken(node.throwKeyword), this.visitNodeOrToken(node.expression), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitReturnStatement = function (node) { - return node.update(this.visitToken(node.returnKeyword), node.expression === null ? null : this.visitNodeOrToken(node.expression), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitObjectCreationExpression = function (node) { - return node.update(this.visitToken(node.newKeyword), this.visitNodeOrToken(node.expression), node.argumentList === null ? null : this.visitNode(node.argumentList)); - }; - - SyntaxRewriter.prototype.visitSwitchStatement = function (node) { - return node.update(this.visitToken(node.switchKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.expression), this.visitToken(node.closeParenToken), this.visitToken(node.openBraceToken), this.visitList(node.switchClauses), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitCaseSwitchClause = function (node) { - return node.update(this.visitToken(node.caseKeyword), this.visitNodeOrToken(node.expression), this.visitToken(node.colonToken), this.visitList(node.statements)); - }; - - SyntaxRewriter.prototype.visitDefaultSwitchClause = function (node) { - return node.update(this.visitToken(node.defaultKeyword), this.visitToken(node.colonToken), this.visitList(node.statements)); - }; - - SyntaxRewriter.prototype.visitBreakStatement = function (node) { - return node.update(this.visitToken(node.breakKeyword), node.identifier === null ? null : this.visitToken(node.identifier), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitContinueStatement = function (node) { - return node.update(this.visitToken(node.continueKeyword), node.identifier === null ? null : this.visitToken(node.identifier), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitForStatement = function (node) { - return node.update(this.visitToken(node.forKeyword), this.visitToken(node.openParenToken), node.variableDeclaration === null ? null : this.visitNode(node.variableDeclaration), node.initializer === null ? null : this.visitNodeOrToken(node.initializer), this.visitToken(node.firstSemicolonToken), node.condition === null ? null : this.visitNodeOrToken(node.condition), this.visitToken(node.secondSemicolonToken), node.incrementor === null ? null : this.visitNodeOrToken(node.incrementor), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitForInStatement = function (node) { - return node.update(this.visitToken(node.forKeyword), this.visitToken(node.openParenToken), node.variableDeclaration === null ? null : this.visitNode(node.variableDeclaration), node.left === null ? null : this.visitNodeOrToken(node.left), this.visitToken(node.inKeyword), this.visitNodeOrToken(node.expression), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitWhileStatement = function (node) { - return node.update(this.visitToken(node.whileKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitWithStatement = function (node) { - return node.update(this.visitToken(node.withKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitEnumDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.enumKeyword), this.visitToken(node.identifier), this.visitToken(node.openBraceToken), this.visitSeparatedList(node.enumElements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitEnumElement = function (node) { - return node.update(this.visitToken(node.propertyName), node.equalsValueClause === null ? null : this.visitNode(node.equalsValueClause)); - }; - - SyntaxRewriter.prototype.visitCastExpression = function (node) { - return node.update(this.visitToken(node.lessThanToken), this.visitNodeOrToken(node.type), this.visitToken(node.greaterThanToken), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitObjectLiteralExpression = function (node) { - return node.update(this.visitToken(node.openBraceToken), this.visitSeparatedList(node.propertyAssignments), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitSimplePropertyAssignment = function (node) { - return node.update(this.visitToken(node.propertyName), this.visitToken(node.colonToken), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitFunctionPropertyAssignment = function (node) { - return node.update(this.visitToken(node.propertyName), this.visitNode(node.callSignature), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitFunctionExpression = function (node) { - return node.update(this.visitToken(node.functionKeyword), node.identifier === null ? null : this.visitToken(node.identifier), this.visitNode(node.callSignature), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitEmptyStatement = function (node) { - return node.update(this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitTryStatement = function (node) { - return node.update(this.visitToken(node.tryKeyword), this.visitNode(node.block), node.catchClause === null ? null : this.visitNode(node.catchClause), node.finallyClause === null ? null : this.visitNode(node.finallyClause)); - }; - - SyntaxRewriter.prototype.visitCatchClause = function (node) { - return node.update(this.visitToken(node.catchKeyword), this.visitToken(node.openParenToken), this.visitToken(node.identifier), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), this.visitToken(node.closeParenToken), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitFinallyClause = function (node) { - return node.update(this.visitToken(node.finallyKeyword), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitLabeledStatement = function (node) { - return node.update(this.visitToken(node.identifier), this.visitToken(node.colonToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitDoStatement = function (node) { - return node.update(this.visitToken(node.doKeyword), this.visitNodeOrToken(node.statement), this.visitToken(node.whileKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitTypeOfExpression = function (node) { - return node.update(this.visitToken(node.typeOfKeyword), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitDeleteExpression = function (node) { - return node.update(this.visitToken(node.deleteKeyword), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitVoidExpression = function (node) { - return node.update(this.visitToken(node.voidKeyword), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitDebuggerStatement = function (node) { - return node.update(this.visitToken(node.debuggerKeyword), this.visitToken(node.semicolonToken)); - }; - return SyntaxRewriter; - })(); - TypeScript.SyntaxRewriter = SyntaxRewriter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxDedenter = (function (_super) { - __extends(SyntaxDedenter, _super); - function SyntaxDedenter(dedentFirstToken, dedentationAmount, minimumIndent, options) { - _super.call(this); - this.dedentationAmount = dedentationAmount; - this.minimumIndent = minimumIndent; - this.options = options; - this.lastTriviaWasNewLine = dedentFirstToken; - } - SyntaxDedenter.prototype.abort = function () { - this.lastTriviaWasNewLine = false; - this.dedentationAmount = 0; - }; - - SyntaxDedenter.prototype.isAborted = function () { - return this.dedentationAmount === 0; - }; - - SyntaxDedenter.prototype.visitToken = function (token) { - if (token.width() === 0) { - return token; - } - - var result = token; - if (this.lastTriviaWasNewLine) { - result = token.withLeadingTrivia(this.dedentTriviaList(token.leadingTrivia())); - } - - if (this.isAborted()) { - return token; - } - - this.lastTriviaWasNewLine = token.hasTrailingNewLine(); - return result; - }; - - SyntaxDedenter.prototype.dedentTriviaList = function (triviaList) { - var result = []; - var dedentNextWhitespace = true; - - for (var i = 0, n = triviaList.count(); i < n && !this.isAborted(); i++) { - var trivia = triviaList.syntaxTriviaAt(i); - - var dedentThisTrivia = dedentNextWhitespace; - dedentNextWhitespace = false; - - if (dedentThisTrivia) { - if (trivia.kind() === 4 /* WhitespaceTrivia */) { - var hasFollowingNewLine = (i < triviaList.count() - 1) && triviaList.syntaxTriviaAt(i + 1).kind() === 5 /* NewLineTrivia */; - result.push(this.dedentWhitespace(trivia, hasFollowingNewLine)); - continue; - } else if (trivia.kind() !== 5 /* NewLineTrivia */) { - this.abort(); - break; - } - } - - if (trivia.kind() === 6 /* MultiLineCommentTrivia */) { - result.push(this.dedentMultiLineComment(trivia)); - continue; - } - - result.push(trivia); - if (trivia.kind() === 5 /* NewLineTrivia */) { - dedentNextWhitespace = true; - } - } - - if (dedentNextWhitespace) { - this.abort(); - } - - if (this.isAborted()) { - return triviaList; - } - - return TypeScript.Syntax.triviaList(result); - }; - - SyntaxDedenter.prototype.dedentSegment = function (segment, hasFollowingNewLineTrivia) { - var firstNonWhitespacePosition = TypeScript.Indentation.firstNonWhitespacePosition(segment); - - if (firstNonWhitespacePosition === segment.length) { - if (hasFollowingNewLineTrivia) { - return ""; - } - } else if (TypeScript.CharacterInfo.isLineTerminator(segment.charCodeAt(firstNonWhitespacePosition))) { - return segment.substring(firstNonWhitespacePosition); - } - - var firstNonWhitespaceColumn = TypeScript.Indentation.columnForPositionInString(segment, firstNonWhitespacePosition, this.options); - - var newFirstNonWhitespaceColumn = TypeScript.MathPrototype.min(firstNonWhitespaceColumn, TypeScript.MathPrototype.max(firstNonWhitespaceColumn - this.dedentationAmount, this.minimumIndent)); - - if (newFirstNonWhitespaceColumn === firstNonWhitespaceColumn) { - this.abort(); - return segment; - } - - this.dedentationAmount = firstNonWhitespaceColumn - newFirstNonWhitespaceColumn; - TypeScript.Debug.assert(this.dedentationAmount >= 0); - - var indentationString = TypeScript.Indentation.indentationString(newFirstNonWhitespaceColumn, this.options); - - return indentationString + segment.substring(firstNonWhitespacePosition); - }; - - SyntaxDedenter.prototype.dedentWhitespace = function (trivia, hasFollowingNewLineTrivia) { - var newIndentation = this.dedentSegment(trivia.fullText(), hasFollowingNewLineTrivia); - return TypeScript.Syntax.whitespace(newIndentation); - }; - - SyntaxDedenter.prototype.dedentMultiLineComment = function (trivia) { - var segments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - if (segments.length === 1) { - return trivia; - } - - for (var i = 1; i < segments.length; i++) { - var segment = segments[i]; - segments[i] = this.dedentSegment(segment, false); - } - - var result = segments.join(""); - - return TypeScript.Syntax.multiLineComment(result); - }; - - SyntaxDedenter.dedentNode = function (node, dedentFirstToken, dedentAmount, minimumIndent, options) { - var dedenter = new SyntaxDedenter(dedentFirstToken, dedentAmount, minimumIndent, options); - var result = node.accept(dedenter); - - if (dedenter.isAborted()) { - return node; - } - - return result; - }; - return SyntaxDedenter; - })(TypeScript.SyntaxRewriter); - TypeScript.SyntaxDedenter = SyntaxDedenter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxIndenter = (function (_super) { - __extends(SyntaxIndenter, _super); - function SyntaxIndenter(indentFirstToken, indentationAmount, options) { - _super.call(this); - this.indentationAmount = indentationAmount; - this.options = options; - this.lastTriviaWasNewLine = indentFirstToken; - this.indentationTrivia = TypeScript.Indentation.indentationTrivia(this.indentationAmount, this.options); - } - SyntaxIndenter.prototype.visitToken = function (token) { - if (token.width() === 0) { - return token; - } - - var result = token; - if (this.lastTriviaWasNewLine) { - result = token.withLeadingTrivia(this.indentTriviaList(token.leadingTrivia())); - } - - this.lastTriviaWasNewLine = token.hasTrailingNewLine(); - return result; - }; - - SyntaxIndenter.prototype.indentTriviaList = function (triviaList) { - var result = []; - - var indentNextTrivia = true; - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - - var indentThisTrivia = indentNextTrivia; - indentNextTrivia = false; - - switch (trivia.kind()) { - case 6 /* MultiLineCommentTrivia */: - this.indentMultiLineComment(trivia, indentThisTrivia, result); - continue; - - case 7 /* SingleLineCommentTrivia */: - case 8 /* SkippedTokenTrivia */: - this.indentSingleLineOrSkippedText(trivia, indentThisTrivia, result); - continue; - - case 4 /* WhitespaceTrivia */: - this.indentWhitespace(trivia, indentThisTrivia, result); - continue; - - case 5 /* NewLineTrivia */: - result.push(trivia); - indentNextTrivia = true; - continue; - - default: - throw TypeScript.Errors.invalidOperation(); - } - } - - if (indentNextTrivia) { - result.push(this.indentationTrivia); - } - - return TypeScript.Syntax.triviaList(result); - }; - - SyntaxIndenter.prototype.indentSegment = function (segment) { - var firstNonWhitespacePosition = TypeScript.Indentation.firstNonWhitespacePosition(segment); - - if (firstNonWhitespacePosition < segment.length && TypeScript.CharacterInfo.isLineTerminator(segment.charCodeAt(firstNonWhitespacePosition))) { - return segment; - } - - var firstNonWhitespaceColumn = TypeScript.Indentation.columnForPositionInString(segment, firstNonWhitespacePosition, this.options); - - var newFirstNonWhitespaceColumn = firstNonWhitespaceColumn + this.indentationAmount; - - var indentationString = TypeScript.Indentation.indentationString(newFirstNonWhitespaceColumn, this.options); - - return indentationString + segment.substring(firstNonWhitespacePosition); - }; - - SyntaxIndenter.prototype.indentWhitespace = function (trivia, indentThisTrivia, result) { - if (!indentThisTrivia) { - result.push(trivia); - return; - } - - var newIndentation = this.indentSegment(trivia.fullText()); - result.push(TypeScript.Syntax.whitespace(newIndentation)); - }; - - SyntaxIndenter.prototype.indentSingleLineOrSkippedText = function (trivia, indentThisTrivia, result) { - if (indentThisTrivia) { - result.push(this.indentationTrivia); - } - - result.push(trivia); - }; - - SyntaxIndenter.prototype.indentMultiLineComment = function (trivia, indentThisTrivia, result) { - if (indentThisTrivia) { - result.push(this.indentationTrivia); - } - - var segments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - - for (var i = 1; i < segments.length; i++) { - segments[i] = this.indentSegment(segments[i]); - } - - var newText = segments.join(""); - result.push(TypeScript.Syntax.multiLineComment(newText)); - }; - - SyntaxIndenter.indentNode = function (node, indentFirstToken, indentAmount, options) { - var indenter = new SyntaxIndenter(indentFirstToken, indentAmount, options); - return node.accept(indenter); - }; - - SyntaxIndenter.indentNodes = function (nodes, indentFirstToken, indentAmount, options) { - var indenter = new SyntaxIndenter(indentFirstToken, indentAmount, options); - var result = TypeScript.ArrayUtilities.select(nodes, function (n) { - return n.accept(indenter); - }); - - return result; - }; - return SyntaxIndenter; - })(TypeScript.SyntaxRewriter); - TypeScript.SyntaxIndenter = SyntaxIndenter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var VariableWidthTokenWithNoTrivia = (function () { - function VariableWidthTokenWithNoTrivia(fullText, kind) { - this._fullText = fullText; - this.tokenKind = kind; - } - VariableWidthTokenWithNoTrivia.prototype.clone = function () { - return new VariableWidthTokenWithNoTrivia(this._fullText, this.tokenKind); - }; - - VariableWidthTokenWithNoTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithNoTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithNoTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithNoTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithNoTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithNoTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithNoTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithNoTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithNoTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithNoTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithNoTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithNoTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasLeadingComment = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithNoTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithNoTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasTrailingComment = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithNoTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithNoTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithNoTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithNoTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithNoTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithNoTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithNoTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithNoTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithNoTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithNoTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithNoTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithNoTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithNoTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithNoTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithNoTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithNoTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithNoTrivia; - })(); - Syntax.VariableWidthTokenWithNoTrivia = VariableWidthTokenWithNoTrivia; - - var VariableWidthTokenWithLeadingTrivia = (function () { - function VariableWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - } - VariableWidthTokenWithLeadingTrivia.prototype.clone = function () { - return new VariableWidthTokenWithLeadingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithLeadingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithLeadingTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithLeadingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingComment = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithLeadingTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithLeadingTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithLeadingTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithLeadingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithLeadingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithLeadingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithLeadingTrivia; - })(); - Syntax.VariableWidthTokenWithLeadingTrivia = VariableWidthTokenWithLeadingTrivia; - - var VariableWidthTokenWithTrailingTrivia = (function () { - function VariableWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._trailingTriviaInfo = trailingTriviaInfo; - } - VariableWidthTokenWithTrailingTrivia.prototype.clone = function () { - return new VariableWidthTokenWithTrailingTrivia(this._fullText, this.tokenKind, this._trailingTriviaInfo); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithTrailingTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingComment = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithTrailingTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - VariableWidthTokenWithTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithTrailingTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithTrailingTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithTrailingTrivia; - })(); - Syntax.VariableWidthTokenWithTrailingTrivia = VariableWidthTokenWithTrailingTrivia; - - var VariableWidthTokenWithLeadingAndTrailingTrivia = (function () { - function VariableWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - this._trailingTriviaInfo = trailingTriviaInfo; - } - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.clone = function () { - return new VariableWidthTokenWithLeadingAndTrailingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo, this._trailingTriviaInfo); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithLeadingAndTrailingTrivia; - })(); - Syntax.VariableWidthTokenWithLeadingAndTrailingTrivia = VariableWidthTokenWithLeadingAndTrailingTrivia; - - var FixedWidthTokenWithNoTrivia = (function () { - function FixedWidthTokenWithNoTrivia(kind) { - this.tokenKind = kind; - } - FixedWidthTokenWithNoTrivia.prototype.clone = function () { - return new FixedWidthTokenWithNoTrivia(this.tokenKind); - }; - - FixedWidthTokenWithNoTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithNoTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithNoTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithNoTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithNoTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithNoTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithNoTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithNoTrivia.prototype.fullText = function () { - return this.text(); - }; - - FixedWidthTokenWithNoTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithNoTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingComment = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithNoTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingComment = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithNoTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithNoTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithNoTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithNoTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithNoTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithNoTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithNoTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithNoTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithNoTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithNoTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithNoTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithNoTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithNoTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithNoTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithNoTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithNoTrivia; - })(); - Syntax.FixedWidthTokenWithNoTrivia = FixedWidthTokenWithNoTrivia; - - var FixedWidthTokenWithLeadingTrivia = (function () { - function FixedWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - } - FixedWidthTokenWithLeadingTrivia.prototype.clone = function () { - return new FixedWidthTokenWithLeadingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithLeadingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithLeadingTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithLeadingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingComment = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithLeadingTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithLeadingTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithLeadingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithLeadingTrivia; - })(); - Syntax.FixedWidthTokenWithLeadingTrivia = FixedWidthTokenWithLeadingTrivia; - - var FixedWidthTokenWithTrailingTrivia = (function () { - function FixedWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._trailingTriviaInfo = trailingTriviaInfo; - } - FixedWidthTokenWithTrailingTrivia.prototype.clone = function () { - return new FixedWidthTokenWithTrailingTrivia(this._fullText, this.tokenKind, this._trailingTriviaInfo); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithTrailingTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingComment = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithTrailingTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - FixedWidthTokenWithTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithTrailingTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithTrailingTrivia; - })(); - Syntax.FixedWidthTokenWithTrailingTrivia = FixedWidthTokenWithTrailingTrivia; - - var FixedWidthTokenWithLeadingAndTrailingTrivia = (function () { - function FixedWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - this._trailingTriviaInfo = trailingTriviaInfo; - } - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.clone = function () { - return new FixedWidthTokenWithLeadingAndTrailingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo, this._trailingTriviaInfo); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithLeadingAndTrailingTrivia; - })(); - Syntax.FixedWidthTokenWithLeadingAndTrailingTrivia = FixedWidthTokenWithLeadingAndTrailingTrivia; - - function collectTokenTextElements(token, elements) { - token.leadingTrivia().collectTextElements(elements); - elements.push(token.text()); - token.trailingTrivia().collectTextElements(elements); - } - - function getTriviaWidth(value) { - return value >>> 2 /* TriviaFullWidthShift */; - } - - function hasTriviaComment(value) { - return (value & 2 /* TriviaCommentMask */) !== 0; - } - - function hasTriviaNewLine(value) { - return (value & 1 /* TriviaNewLineMask */) !== 0; - } - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - function isExpression(token) { - switch (token.tokenKind) { - case 11 /* IdentifierName */: - case 12 /* RegularExpressionLiteral */: - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 50 /* SuperKeyword */: - return true; - } - - return false; - } - Syntax.isExpression = isExpression; - - function realizeToken(token) { - return new RealizedToken(token.tokenKind, token.leadingTrivia(), token.text(), token.value(), token.valueText(), token.trailingTrivia()); - } - Syntax.realizeToken = realizeToken; - - function convertToIdentifierName(token) { - TypeScript.Debug.assert(TypeScript.SyntaxFacts.isAnyKeyword(token.tokenKind)); - return new RealizedToken(11 /* IdentifierName */, token.leadingTrivia(), token.text(), token.text(), token.text(), token.trailingTrivia()); - } - Syntax.convertToIdentifierName = convertToIdentifierName; - - function tokenToJSON(token) { - var result = {}; - - for (var name in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind[name] === token.kind()) { - result.kind = name; - break; - } - } - - result.width = token.width(); - if (token.fullWidth() !== token.width()) { - result.fullWidth = token.fullWidth(); - } - - result.text = token.text(); - - var value = token.value(); - if (value !== null) { - result.value = value; - result.valueText = token.valueText(); - } - - if (token.hasLeadingTrivia()) { - result.hasLeadingTrivia = true; - } - - if (token.hasLeadingComment()) { - result.hasLeadingComment = true; - } - - if (token.hasLeadingNewLine()) { - result.hasLeadingNewLine = true; - } - - if (token.hasLeadingSkippedText()) { - result.hasLeadingSkippedText = true; - } - - if (token.hasTrailingTrivia()) { - result.hasTrailingTrivia = true; - } - - if (token.hasTrailingComment()) { - result.hasTrailingComment = true; - } - - if (token.hasTrailingNewLine()) { - result.hasTrailingNewLine = true; - } - - if (token.hasTrailingSkippedText()) { - result.hasTrailingSkippedText = true; - } - - var trivia = token.leadingTrivia(); - if (trivia.count() > 0) { - result.leadingTrivia = trivia; - } - - trivia = token.trailingTrivia(); - if (trivia.count() > 0) { - result.trailingTrivia = trivia; - } - - return result; - } - Syntax.tokenToJSON = tokenToJSON; - - function value(token) { - return value1(token.tokenKind, token.text()); - } - Syntax.value = value; - - function hexValue(text, start, length) { - var intChar = 0; - for (var i = 0; i < length; i++) { - var ch2 = text.charCodeAt(start + i); - if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { - break; - } - - intChar = (intChar << 4) + TypeScript.CharacterInfo.hexValue(ch2); - } - - return intChar; - } - - var characterArray = []; - - function convertEscapes(text) { - characterArray.length = 0; - var result = ""; - - for (var i = 0, n = text.length; i < n; i++) { - var ch = text.charCodeAt(i); - - if (ch === 92 /* backslash */) { - i++; - if (i < n) { - ch = text.charCodeAt(i); - switch (ch) { - case 48 /* _0 */: - characterArray.push(0 /* nullCharacter */); - continue; - - case 98 /* b */: - characterArray.push(8 /* backspace */); - continue; - - case 102 /* f */: - characterArray.push(12 /* formFeed */); - continue; - - case 110 /* n */: - characterArray.push(10 /* lineFeed */); - continue; - - case 114 /* r */: - characterArray.push(13 /* carriageReturn */); - continue; - - case 116 /* t */: - characterArray.push(9 /* tab */); - continue; - - case 118 /* v */: - characterArray.push(11 /* verticalTab */); - continue; - - case 120 /* x */: - characterArray.push(hexValue(text, i + 1, 2)); - i += 2; - continue; - - case 117 /* u */: - characterArray.push(hexValue(text, i + 1, 4)); - i += 4; - continue; - - case 13 /* carriageReturn */: - var nextIndex = i + 1; - if (nextIndex < text.length && text.charCodeAt(nextIndex) === 10 /* lineFeed */) { - i++; - } - continue; - - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - continue; - - default: - } - } - } - - characterArray.push(ch); - - if (i && !(i % 1024)) { - result = result.concat(String.fromCharCode.apply(null, characterArray)); - characterArray.length = 0; - } - } - - if (characterArray.length) { - result = result.concat(String.fromCharCode.apply(null, characterArray)); - } - - return result; - } - - function massageEscapes(text) { - return text.indexOf("\\") >= 0 ? convertEscapes(text) : text; - } - Syntax.massageEscapes = massageEscapes; - - function value1(kind, text) { - if (kind === 11 /* IdentifierName */) { - return massageEscapes(text); - } - - switch (kind) { - case 37 /* TrueKeyword */: - return true; - case 24 /* FalseKeyword */: - return false; - case 32 /* NullKeyword */: - return null; - } - - if (TypeScript.SyntaxFacts.isAnyKeyword(kind) || TypeScript.SyntaxFacts.isAnyPunctuation(kind)) { - return TypeScript.SyntaxFacts.getText(kind); - } - - if (kind === 13 /* NumericLiteral */) { - return TypeScript.IntegerUtilities.isHexInteger(text) ? parseInt(text, 16) : parseFloat(text); - } else if (kind === 14 /* StringLiteral */) { - if (text.length > 1 && text.charCodeAt(text.length - 1) === text.charCodeAt(0)) { - return massageEscapes(text.substr(1, text.length - 2)); - } else { - return massageEscapes(text.substr(1)); - } - } else if (kind === 12 /* RegularExpressionLiteral */) { - return regularExpressionValue(text); - } else if (kind === 10 /* EndOfFileToken */ || kind === 9 /* ErrorToken */) { - return null; - } else { - throw TypeScript.Errors.invalidOperation(); - } - } - - function regularExpressionValue(text) { - try { - var lastSlash = text.lastIndexOf("/"); - var body = text.substring(1, lastSlash); - var flags = text.substring(lastSlash + 1); - return new RegExp(body, flags); - } catch (e) { - return null; - } - } - - function valueText1(kind, text) { - var value = value1(kind, text); - return value === null ? "" : value.toString(); - } - - function valueText(token) { - var value = token.value(); - return value === null ? "" : value.toString(); - } - Syntax.valueText = valueText; - - var EmptyToken = (function () { - function EmptyToken(kind) { - this.tokenKind = kind; - } - EmptyToken.prototype.clone = function () { - return new EmptyToken(this.tokenKind); - }; - - EmptyToken.prototype.kind = function () { - return this.tokenKind; - }; - - EmptyToken.prototype.isToken = function () { - return true; - }; - EmptyToken.prototype.isNode = function () { - return false; - }; - EmptyToken.prototype.isList = function () { - return false; - }; - EmptyToken.prototype.isSeparatedList = function () { - return false; - }; - - EmptyToken.prototype.childCount = function () { - return 0; - }; - - EmptyToken.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptyToken.prototype.toJSON = function (key) { - return tokenToJSON(this); - }; - EmptyToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - - EmptyToken.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - EmptyToken.prototype.firstToken = function () { - return this; - }; - EmptyToken.prototype.lastToken = function () { - return this; - }; - EmptyToken.prototype.isTypeScriptSpecific = function () { - return false; - }; - - EmptyToken.prototype.isIncrementallyUnusable = function () { - return true; - }; - - EmptyToken.prototype.fullWidth = function () { - return 0; - }; - EmptyToken.prototype.width = function () { - return 0; - }; - EmptyToken.prototype.text = function () { - return ""; - }; - EmptyToken.prototype.fullText = function () { - return ""; - }; - EmptyToken.prototype.value = function () { - return null; - }; - EmptyToken.prototype.valueText = function () { - return ""; - }; - - EmptyToken.prototype.hasLeadingTrivia = function () { - return false; - }; - EmptyToken.prototype.hasLeadingComment = function () { - return false; - }; - EmptyToken.prototype.hasLeadingNewLine = function () { - return false; - }; - EmptyToken.prototype.hasLeadingSkippedText = function () { - return false; - }; - EmptyToken.prototype.leadingTriviaWidth = function () { - return 0; - }; - EmptyToken.prototype.hasTrailingTrivia = function () { - return false; - }; - EmptyToken.prototype.hasTrailingComment = function () { - return false; - }; - EmptyToken.prototype.hasTrailingNewLine = function () { - return false; - }; - EmptyToken.prototype.hasTrailingSkippedText = function () { - return false; - }; - EmptyToken.prototype.hasSkippedToken = function () { - return false; - }; - - EmptyToken.prototype.trailingTriviaWidth = function () { - return 0; - }; - EmptyToken.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - EmptyToken.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - EmptyToken.prototype.realize = function () { - return realizeToken(this); - }; - EmptyToken.prototype.collectTextElements = function (elements) { - }; - - EmptyToken.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - EmptyToken.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - EmptyToken.prototype.isExpression = function () { - return isExpression(this); - }; - - EmptyToken.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - EmptyToken.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - EmptyToken.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - EmptyToken.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return EmptyToken; - })(); - - function emptyToken(kind) { - return new EmptyToken(kind); - } - Syntax.emptyToken = emptyToken; - - var RealizedToken = (function () { - function RealizedToken(tokenKind, leadingTrivia, text, value, valueText, trailingTrivia) { - this.tokenKind = tokenKind; - this._leadingTrivia = leadingTrivia; - this._text = text; - this._value = value; - this._valueText = valueText; - this._trailingTrivia = trailingTrivia; - } - RealizedToken.prototype.clone = function () { - return new RealizedToken(this.tokenKind, this._leadingTrivia, this._text, this._value, this._valueText, this._trailingTrivia); - }; - - RealizedToken.prototype.kind = function () { - return this.tokenKind; - }; - RealizedToken.prototype.toJSON = function (key) { - return tokenToJSON(this); - }; - RealizedToken.prototype.firstToken = function () { - return this; - }; - RealizedToken.prototype.lastToken = function () { - return this; - }; - RealizedToken.prototype.isTypeScriptSpecific = function () { - return false; - }; - - RealizedToken.prototype.isIncrementallyUnusable = function () { - return true; - }; - - RealizedToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - - RealizedToken.prototype.childCount = function () { - return 0; - }; - - RealizedToken.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - RealizedToken.prototype.isToken = function () { - return true; - }; - RealizedToken.prototype.isNode = function () { - return false; - }; - RealizedToken.prototype.isList = function () { - return false; - }; - RealizedToken.prototype.isSeparatedList = function () { - return false; - }; - RealizedToken.prototype.isTrivia = function () { - return false; - }; - RealizedToken.prototype.isTriviaList = function () { - return false; - }; - - RealizedToken.prototype.fullWidth = function () { - return this._leadingTrivia.fullWidth() + this.width() + this._trailingTrivia.fullWidth(); - }; - RealizedToken.prototype.width = function () { - return this.text().length; - }; - - RealizedToken.prototype.text = function () { - return this._text; - }; - RealizedToken.prototype.fullText = function () { - return this._leadingTrivia.fullText() + this.text() + this._trailingTrivia.fullText(); - }; - - RealizedToken.prototype.value = function () { - return this._value; - }; - RealizedToken.prototype.valueText = function () { - return this._valueText; - }; - - RealizedToken.prototype.hasLeadingTrivia = function () { - return this._leadingTrivia.count() > 0; - }; - RealizedToken.prototype.hasLeadingComment = function () { - return this._leadingTrivia.hasComment(); - }; - RealizedToken.prototype.hasLeadingNewLine = function () { - return this._leadingTrivia.hasNewLine(); - }; - RealizedToken.prototype.hasLeadingSkippedText = function () { - return this._leadingTrivia.hasSkippedToken(); - }; - RealizedToken.prototype.leadingTriviaWidth = function () { - return this._leadingTrivia.fullWidth(); - }; - - RealizedToken.prototype.hasTrailingTrivia = function () { - return this._trailingTrivia.count() > 0; - }; - RealizedToken.prototype.hasTrailingComment = function () { - return this._trailingTrivia.hasComment(); - }; - RealizedToken.prototype.hasTrailingNewLine = function () { - return this._trailingTrivia.hasNewLine(); - }; - RealizedToken.prototype.hasTrailingSkippedText = function () { - return this._trailingTrivia.hasSkippedToken(); - }; - RealizedToken.prototype.trailingTriviaWidth = function () { - return this._trailingTrivia.fullWidth(); - }; - - RealizedToken.prototype.hasSkippedToken = function () { - return this.hasLeadingSkippedText() || this.hasTrailingSkippedText(); - }; - - RealizedToken.prototype.leadingTrivia = function () { - return this._leadingTrivia; - }; - RealizedToken.prototype.trailingTrivia = function () { - return this._trailingTrivia; - }; - - RealizedToken.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - RealizedToken.prototype.collectTextElements = function (elements) { - this.leadingTrivia().collectTextElements(elements); - elements.push(this.text()); - this.trailingTrivia().collectTextElements(elements); - }; - - RealizedToken.prototype.withLeadingTrivia = function (leadingTrivia) { - return new RealizedToken(this.tokenKind, leadingTrivia, this._text, this._value, this._valueText, this._trailingTrivia); - }; - - RealizedToken.prototype.withTrailingTrivia = function (trailingTrivia) { - return new RealizedToken(this.tokenKind, this._leadingTrivia, this._text, this._value, this._valueText, trailingTrivia); - }; - - RealizedToken.prototype.isExpression = function () { - return isExpression(this); - }; - - RealizedToken.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - RealizedToken.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - RealizedToken.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - RealizedToken.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return RealizedToken; - })(); - - function token(kind, info) { - if (typeof info === "undefined") { info = null; } - var text = (info !== null && info.text !== undefined) ? info.text : TypeScript.SyntaxFacts.getText(kind); - - return new RealizedToken(kind, Syntax.triviaList(info === null ? null : info.leadingTrivia), text, value1(kind, text), valueText1(kind, text), Syntax.triviaList(info === null ? null : info.trailingTrivia)); - } - Syntax.token = token; - - function identifier(text, info) { - if (typeof info === "undefined") { info = null; } - info = info || {}; - info.text = text; - return token(11 /* IdentifierName */, info); - } - Syntax.identifier = identifier; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxTokenReplacer = (function (_super) { - __extends(SyntaxTokenReplacer, _super); - function SyntaxTokenReplacer(token1, token2) { - _super.call(this); - this.token1 = token1; - this.token2 = token2; - } - SyntaxTokenReplacer.prototype.visitToken = function (token) { - if (token === this.token1) { - var result = this.token2; - this.token1 = null; - this.token2 = null; - - return result; - } - - return token; - }; - - SyntaxTokenReplacer.prototype.visitNode = function (node) { - if (this.token1 === null) { - return node; - } - - return _super.prototype.visitNode.call(this, node); - }; - - SyntaxTokenReplacer.prototype.visitList = function (list) { - if (this.token1 === null) { - return list; - } - - return _super.prototype.visitList.call(this, list); - }; - - SyntaxTokenReplacer.prototype.visitSeparatedList = function (list) { - if (this.token1 === null) { - return list; - } - - return _super.prototype.visitSeparatedList.call(this, list); - }; - return SyntaxTokenReplacer; - })(TypeScript.SyntaxRewriter); - TypeScript.SyntaxTokenReplacer = SyntaxTokenReplacer; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var AbstractTrivia = (function () { - function AbstractTrivia(_kind) { - this._kind = _kind; - } - AbstractTrivia.prototype.fullWidth = function () { - throw TypeScript.Errors.abstract(); - }; - - AbstractTrivia.prototype.fullText = function () { - throw TypeScript.Errors.abstract(); - }; - - AbstractTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.abstract(); - }; - - AbstractTrivia.prototype.toJSON = function (key) { - var result = {}; - - for (var name in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind[name] === this._kind) { - result.kind = name; - break; - } - } - - if (this.isSkippedToken()) { - result.skippedToken = this.skippedToken(); - } else { - result.text = this.fullText(); - } - return result; - }; - - AbstractTrivia.prototype.kind = function () { - return this._kind; - }; - - AbstractTrivia.prototype.isWhitespace = function () { - return this.kind() === 4 /* WhitespaceTrivia */; - }; - - AbstractTrivia.prototype.isComment = function () { - return this.kind() === 7 /* SingleLineCommentTrivia */ || this.kind() === 6 /* MultiLineCommentTrivia */; - }; - - AbstractTrivia.prototype.isNewLine = function () { - return this.kind() === 5 /* NewLineTrivia */; - }; - - AbstractTrivia.prototype.isSkippedToken = function () { - return this.kind() === 8 /* SkippedTokenTrivia */; - }; - - AbstractTrivia.prototype.collectTextElements = function (elements) { - elements.push(this.fullText()); - }; - return AbstractTrivia; - })(); - - var NormalTrivia = (function (_super) { - __extends(NormalTrivia, _super); - function NormalTrivia(kind, _text) { - _super.call(this, kind); - this._text = _text; - } - NormalTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - - NormalTrivia.prototype.fullText = function () { - return this._text; - }; - - NormalTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.invalidOperation(); - }; - return NormalTrivia; - })(AbstractTrivia); - - var SkippedTokenTrivia = (function (_super) { - __extends(SkippedTokenTrivia, _super); - function SkippedTokenTrivia(_skippedToken) { - _super.call(this, 8 /* SkippedTokenTrivia */); - this._skippedToken = _skippedToken; - } - SkippedTokenTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - - SkippedTokenTrivia.prototype.fullText = function () { - return this.skippedToken().fullText(); - }; - - SkippedTokenTrivia.prototype.skippedToken = function () { - return this._skippedToken; - }; - return SkippedTokenTrivia; - })(AbstractTrivia); - - var DeferredTrivia = (function (_super) { - __extends(DeferredTrivia, _super); - function DeferredTrivia(kind, _text, _fullStart, _fullWidth) { - _super.call(this, kind); - this._text = _text; - this._fullStart = _fullStart; - this._fullWidth = _fullWidth; - this._fullText = null; - } - DeferredTrivia.prototype.fullWidth = function () { - return this._fullWidth; - }; - - DeferredTrivia.prototype.fullText = function () { - if (!this._fullText) { - this._fullText = this._text.substr(this._fullStart, this._fullWidth, false); - this._text = null; - } - - return this._fullText; - }; - - DeferredTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.invalidOperation(); - }; - return DeferredTrivia; - })(AbstractTrivia); - - function deferredTrivia(kind, text, fullStart, fullWidth) { - return new DeferredTrivia(kind, text, fullStart, fullWidth); - } - Syntax.deferredTrivia = deferredTrivia; - - function trivia(kind, text) { - return new NormalTrivia(kind, text); - } - Syntax.trivia = trivia; - - function skippedTokenTrivia(token) { - TypeScript.Debug.assert(!token.hasLeadingTrivia()); - TypeScript.Debug.assert(!token.hasTrailingTrivia()); - TypeScript.Debug.assert(token.fullWidth() > 0); - return new SkippedTokenTrivia(token); - } - Syntax.skippedTokenTrivia = skippedTokenTrivia; - - function spaces(count) { - return trivia(4 /* WhitespaceTrivia */, TypeScript.StringUtilities.repeat(" ", count)); - } - Syntax.spaces = spaces; - - function whitespace(text) { - return trivia(4 /* WhitespaceTrivia */, text); - } - Syntax.whitespace = whitespace; - - function multiLineComment(text) { - return trivia(6 /* MultiLineCommentTrivia */, text); - } - Syntax.multiLineComment = multiLineComment; - - function singleLineComment(text) { - return trivia(7 /* SingleLineCommentTrivia */, text); - } - Syntax.singleLineComment = singleLineComment; - - Syntax.spaceTrivia = spaces(1); - Syntax.lineFeedTrivia = trivia(5 /* NewLineTrivia */, "\n"); - Syntax.carriageReturnTrivia = trivia(5 /* NewLineTrivia */, "\r"); - Syntax.carriageReturnLineFeedTrivia = trivia(5 /* NewLineTrivia */, "\r\n"); - - function splitMultiLineCommentTriviaIntoMultipleLines(trivia) { - var result = []; - - var triviaText = trivia.fullText(); - var currentIndex = 0; - - for (var i = 0; i < triviaText.length; i++) { - var ch = triviaText.charCodeAt(i); - - var isCarriageReturnLineFeed = false; - switch (ch) { - case 13 /* carriageReturn */: - if (i < triviaText.length - 1 && triviaText.charCodeAt(i + 1) === 10 /* lineFeed */) { - i++; - } - - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - result.push(triviaText.substring(currentIndex, i + 1)); - - currentIndex = i + 1; - continue; - } - } - - result.push(triviaText.substring(currentIndex)); - return result; - } - Syntax.splitMultiLineCommentTriviaIntoMultipleLines = splitMultiLineCommentTriviaIntoMultipleLines; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - Syntax.emptyTriviaList = { - kind: function () { - return 3 /* TriviaList */; - }, - count: function () { - return 0; - }, - syntaxTriviaAt: function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }, - last: function () { - throw TypeScript.Errors.argumentOutOfRange("index"); - }, - fullWidth: function () { - return 0; - }, - fullText: function () { - return ""; - }, - hasComment: function () { - return false; - }, - hasNewLine: function () { - return false; - }, - hasSkippedToken: function () { - return false; - }, - toJSON: function (key) { - return []; - }, - collectTextElements: function (elements) { - }, - toArray: function () { - return []; - }, - concat: function (trivia) { - return trivia; - } - }; - - function concatTrivia(list1, list2) { - if (list1.count() === 0) { - return list2; - } - - if (list2.count() === 0) { - return list1; - } - - var trivia = list1.toArray(); - trivia.push.apply(trivia, list2.toArray()); - - return triviaList(trivia); - } - - function isComment(trivia) { - return trivia.kind() === 6 /* MultiLineCommentTrivia */ || trivia.kind() === 7 /* SingleLineCommentTrivia */; - } - - var SingletonSyntaxTriviaList = (function () { - function SingletonSyntaxTriviaList(item) { - this.item = item; - } - SingletonSyntaxTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; - - SingletonSyntaxTriviaList.prototype.count = function () { - return 1; - }; - - SingletonSyntaxTriviaList.prototype.syntaxTriviaAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSyntaxTriviaList.prototype.last = function () { - return this.item; - }; - - SingletonSyntaxTriviaList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - - SingletonSyntaxTriviaList.prototype.fullText = function () { - return this.item.fullText(); - }; - - SingletonSyntaxTriviaList.prototype.hasComment = function () { - return isComment(this.item); - }; - - SingletonSyntaxTriviaList.prototype.hasNewLine = function () { - return this.item.kind() === 5 /* NewLineTrivia */; - }; - - SingletonSyntaxTriviaList.prototype.hasSkippedToken = function () { - return this.item.kind() === 8 /* SkippedTokenTrivia */; - }; - - SingletonSyntaxTriviaList.prototype.toJSON = function (key) { - return [this.item]; - }; - - SingletonSyntaxTriviaList.prototype.collectTextElements = function (elements) { - this.item.collectTextElements(elements); - }; - - SingletonSyntaxTriviaList.prototype.toArray = function () { - return [this.item]; - }; - - SingletonSyntaxTriviaList.prototype.concat = function (trivia) { - return concatTrivia(this, trivia); - }; - return SingletonSyntaxTriviaList; - })(); - - var NormalSyntaxTriviaList = (function () { - function NormalSyntaxTriviaList(trivia) { - this.trivia = trivia; - } - NormalSyntaxTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; - - NormalSyntaxTriviaList.prototype.count = function () { - return this.trivia.length; - }; - - NormalSyntaxTriviaList.prototype.syntaxTriviaAt = function (index) { - if (index < 0 || index >= this.trivia.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.trivia[index]; - }; - - NormalSyntaxTriviaList.prototype.last = function () { - return this.trivia[this.trivia.length - 1]; - }; - - NormalSyntaxTriviaList.prototype.fullWidth = function () { - return TypeScript.ArrayUtilities.sum(this.trivia, function (t) { - return t.fullWidth(); - }); - }; - - NormalSyntaxTriviaList.prototype.fullText = function () { - var result = ""; - - for (var i = 0, n = this.trivia.length; i < n; i++) { - result += this.trivia[i].fullText(); - } - - return result; - }; - - NormalSyntaxTriviaList.prototype.hasComment = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (isComment(this.trivia[i])) { - return true; - } - } - - return false; - }; - - NormalSyntaxTriviaList.prototype.hasNewLine = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 5 /* NewLineTrivia */) { - return true; - } - } - - return false; - }; - - NormalSyntaxTriviaList.prototype.hasSkippedToken = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 8 /* SkippedTokenTrivia */) { - return true; - } - } - - return false; - }; - - NormalSyntaxTriviaList.prototype.toJSON = function (key) { - return this.trivia; - }; - - NormalSyntaxTriviaList.prototype.collectTextElements = function (elements) { - for (var i = 0; i < this.trivia.length; i++) { - this.trivia[i].collectTextElements(elements); - } - }; - - NormalSyntaxTriviaList.prototype.toArray = function () { - return this.trivia.slice(0); - }; - - NormalSyntaxTriviaList.prototype.concat = function (trivia) { - return concatTrivia(this, trivia); - }; - return NormalSyntaxTriviaList; - })(); - - function triviaList(trivia) { - if (trivia === undefined || trivia === null || trivia.length === 0) { - return Syntax.emptyTriviaList; - } - - if (trivia.length === 1) { - return new SingletonSyntaxTriviaList(trivia[0]); - } - - return new NormalSyntaxTriviaList(trivia); - } - Syntax.triviaList = triviaList; - - Syntax.spaceTriviaList = triviaList([Syntax.spaceTrivia]); - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxUtilities = (function () { - function SyntaxUtilities() { - } - SyntaxUtilities.isAngleBracket = function (positionedElement) { - var element = positionedElement.element(); - var parent = positionedElement.parentElement(); - if (parent !== null && (element.kind() === 80 /* LessThanToken */ || element.kind() === 81 /* GreaterThanToken */)) { - switch (parent.kind()) { - case 228 /* TypeArgumentList */: - case 229 /* TypeParameterList */: - case 220 /* CastExpression */: - return true; - } - } - - return false; - }; - - SyntaxUtilities.getToken = function (list, kind) { - for (var i = 0, n = list.childCount(); i < n; i++) { - var token = list.childAt(i); - if (token.tokenKind === kind) { - return token; - } - } - - return null; - }; - - SyntaxUtilities.containsToken = function (list, kind) { - return SyntaxUtilities.getToken(list, kind) !== null; - }; - - SyntaxUtilities.hasExportKeyword = function (moduleElement) { - return SyntaxUtilities.getExportKeyword(moduleElement) !== null; - }; - - SyntaxUtilities.getExportKeyword = function (moduleElement) { - switch (moduleElement.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 132 /* EnumDeclaration */: - case 128 /* InterfaceDeclaration */: - case 133 /* ImportDeclaration */: - return SyntaxUtilities.getToken(moduleElement.modifiers, 47 /* ExportKeyword */); - default: - return null; - } - }; - - SyntaxUtilities.isAmbientDeclarationSyntax = function (positionNode) { - if (!positionNode) { - return false; - } - - var node = positionNode.node(); - switch (node.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 132 /* EnumDeclaration */: - if (SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { - return true; - } - - case 133 /* ImportDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 136 /* MemberVariableDeclaration */: - if (node.isClassElement() || node.isModuleElement()) { - return SyntaxUtilities.isAmbientDeclarationSyntax(positionNode.containingNode()); - } - - case 243 /* EnumElement */: - return SyntaxUtilities.isAmbientDeclarationSyntax(positionNode.containingNode().containingNode()); - - default: - return SyntaxUtilities.isAmbientDeclarationSyntax(positionNode.containingNode()); - } - }; - return SyntaxUtilities; - })(); - TypeScript.SyntaxUtilities = SyntaxUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxVisitor = (function () { - function SyntaxVisitor() { - } - SyntaxVisitor.prototype.defaultVisit = function (node) { - return null; - }; - - SyntaxVisitor.prototype.visitToken = function (token) { - return this.defaultVisit(token); - }; - - SyntaxVisitor.prototype.visitSourceUnit = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitExternalModuleReference = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitModuleNameModuleReference = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitImportDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitExportAssignment = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitClassDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitInterfaceDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitHeritageClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitModuleDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVariableStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVariableDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVariableDeclarator = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEqualsValueClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitPrefixUnaryExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitArrayLiteralExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitOmittedExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParenthesizedExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSimpleArrowFunctionExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitQualifiedName = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeArgumentList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstructorType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitObjectType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitArrayType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitGenericType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeQuery = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeAnnotation = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitBlock = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParameter = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMemberAccessExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitPostfixUnaryExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitElementAccessExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitInvocationExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitArgumentList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitBinaryExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConditionalExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstructSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMethodSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitIndexSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitPropertySignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCallSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParameterList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeParameterList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeParameter = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstraint = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitElseClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitIfStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitExpressionStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstructorDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMemberFunctionDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitGetAccessor = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSetAccessor = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMemberVariableDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitIndexMemberDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitThrowStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitReturnStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitObjectCreationExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSwitchStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCaseSwitchClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDefaultSwitchClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitBreakStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitContinueStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitForStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitForInStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitWhileStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitWithStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEnumDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEnumElement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCastExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitObjectLiteralExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSimplePropertyAssignment = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionPropertyAssignment = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEmptyStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTryStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCatchClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFinallyClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitLabeledStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDoStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeOfExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDeleteExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVoidExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDebuggerStatement = function (node) { - return this.defaultVisit(node); - }; - return SyntaxVisitor; - })(); - TypeScript.SyntaxVisitor = SyntaxVisitor; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxWalker = (function () { - function SyntaxWalker() { - } - SyntaxWalker.prototype.visitToken = function (token) { - }; - - SyntaxWalker.prototype.visitNode = function (node) { - node.accept(this); - }; - - SyntaxWalker.prototype.visitNodeOrToken = function (nodeOrToken) { - if (nodeOrToken.isToken()) { - this.visitToken(nodeOrToken); - } else { - this.visitNode(nodeOrToken); - } - }; - - SyntaxWalker.prototype.visitOptionalToken = function (token) { - if (token === null) { - return; - } - - this.visitToken(token); - }; - - SyntaxWalker.prototype.visitOptionalNode = function (node) { - if (node === null) { - return; - } - - this.visitNode(node); - }; - - SyntaxWalker.prototype.visitOptionalNodeOrToken = function (nodeOrToken) { - if (nodeOrToken === null) { - return; - } - - this.visitNodeOrToken(nodeOrToken); - }; - - SyntaxWalker.prototype.visitList = function (list) { - for (var i = 0, n = list.childCount(); i < n; i++) { - this.visitNodeOrToken(list.childAt(i)); - } - }; - - SyntaxWalker.prototype.visitSeparatedList = function (list) { - for (var i = 0, n = list.childCount(); i < n; i++) { - var item = list.childAt(i); - this.visitNodeOrToken(item); - } - }; - - SyntaxWalker.prototype.visitSourceUnit = function (node) { - this.visitList(node.moduleElements); - this.visitToken(node.endOfFileToken); - }; - - SyntaxWalker.prototype.visitExternalModuleReference = function (node) { - this.visitToken(node.requireKeyword); - this.visitToken(node.openParenToken); - this.visitToken(node.stringLiteral); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitModuleNameModuleReference = function (node) { - this.visitNodeOrToken(node.moduleName); - }; - - SyntaxWalker.prototype.visitImportDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.importKeyword); - this.visitToken(node.identifier); - this.visitToken(node.equalsToken); - this.visitNodeOrToken(node.moduleReference); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitExportAssignment = function (node) { - this.visitToken(node.exportKeyword); - this.visitToken(node.equalsToken); - this.visitToken(node.identifier); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitClassDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.classKeyword); - this.visitToken(node.identifier); - this.visitOptionalNode(node.typeParameterList); - this.visitList(node.heritageClauses); - this.visitToken(node.openBraceToken); - this.visitList(node.classElements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.interfaceKeyword); - this.visitToken(node.identifier); - this.visitOptionalNode(node.typeParameterList); - this.visitList(node.heritageClauses); - this.visitNode(node.body); - }; - - SyntaxWalker.prototype.visitHeritageClause = function (node) { - this.visitToken(node.extendsOrImplementsKeyword); - this.visitSeparatedList(node.typeNames); - }; - - SyntaxWalker.prototype.visitModuleDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.moduleKeyword); - this.visitOptionalNodeOrToken(node.name); - this.visitOptionalToken(node.stringLiteral); - this.visitToken(node.openBraceToken); - this.visitList(node.moduleElements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitFunctionDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.functionKeyword); - this.visitToken(node.identifier); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); - this.visitOptionalToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitVariableStatement = function (node) { - this.visitList(node.modifiers); - this.visitNode(node.variableDeclaration); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitVariableDeclaration = function (node) { - this.visitToken(node.varKeyword); - this.visitSeparatedList(node.variableDeclarators); - }; - - SyntaxWalker.prototype.visitVariableDeclarator = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalNode(node.typeAnnotation); - this.visitOptionalNode(node.equalsValueClause); - }; - - SyntaxWalker.prototype.visitEqualsValueClause = function (node) { - this.visitToken(node.equalsToken); - this.visitNodeOrToken(node.value); - }; - - SyntaxWalker.prototype.visitPrefixUnaryExpression = function (node) { - this.visitToken(node.operatorToken); - this.visitNodeOrToken(node.operand); - }; - - SyntaxWalker.prototype.visitArrayLiteralExpression = function (node) { - this.visitToken(node.openBracketToken); - this.visitSeparatedList(node.expressions); - this.visitToken(node.closeBracketToken); - }; - - SyntaxWalker.prototype.visitOmittedExpression = function (node) { - }; - - SyntaxWalker.prototype.visitParenthesizedExpression = function (node) { - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.expression); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitSimpleArrowFunctionExpression = function (node) { - this.visitToken(node.identifier); - this.visitToken(node.equalsGreaterThanToken); - this.visitOptionalNode(node.block); - this.visitOptionalNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - this.visitNode(node.callSignature); - this.visitToken(node.equalsGreaterThanToken); - this.visitOptionalNode(node.block); - this.visitOptionalNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitQualifiedName = function (node) { - this.visitNodeOrToken(node.left); - this.visitToken(node.dotToken); - this.visitToken(node.right); - }; - - SyntaxWalker.prototype.visitTypeArgumentList = function (node) { - this.visitToken(node.lessThanToken); - this.visitSeparatedList(node.typeArguments); - this.visitToken(node.greaterThanToken); - }; - - SyntaxWalker.prototype.visitConstructorType = function (node) { - this.visitToken(node.newKeyword); - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitToken(node.equalsGreaterThanToken); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitFunctionType = function (node) { - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitToken(node.equalsGreaterThanToken); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitObjectType = function (node) { - this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.typeMembers); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitArrayType = function (node) { - this.visitNodeOrToken(node.type); - this.visitToken(node.openBracketToken); - this.visitToken(node.closeBracketToken); - }; - - SyntaxWalker.prototype.visitGenericType = function (node) { - this.visitNodeOrToken(node.name); - this.visitNode(node.typeArgumentList); - }; - - SyntaxWalker.prototype.visitTypeQuery = function (node) { - this.visitToken(node.typeOfKeyword); - this.visitNodeOrToken(node.name); - }; - - SyntaxWalker.prototype.visitTypeAnnotation = function (node) { - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitBlock = function (node) { - this.visitToken(node.openBraceToken); - this.visitList(node.statements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitParameter = function (node) { - this.visitOptionalToken(node.dotDotDotToken); - this.visitList(node.modifiers); - this.visitToken(node.identifier); - this.visitOptionalToken(node.questionToken); - this.visitOptionalNode(node.typeAnnotation); - this.visitOptionalNode(node.equalsValueClause); - }; - - SyntaxWalker.prototype.visitMemberAccessExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitToken(node.dotToken); - this.visitToken(node.name); - }; - - SyntaxWalker.prototype.visitPostfixUnaryExpression = function (node) { - this.visitNodeOrToken(node.operand); - this.visitToken(node.operatorToken); - }; - - SyntaxWalker.prototype.visitElementAccessExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitToken(node.openBracketToken); - this.visitNodeOrToken(node.argumentExpression); - this.visitToken(node.closeBracketToken); - }; - - SyntaxWalker.prototype.visitInvocationExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitNode(node.argumentList); - }; - - SyntaxWalker.prototype.visitArgumentList = function (node) { - this.visitOptionalNode(node.typeArgumentList); - this.visitToken(node.openParenToken); - this.visitSeparatedList(node.arguments); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitBinaryExpression = function (node) { - this.visitNodeOrToken(node.left); - this.visitToken(node.operatorToken); - this.visitNodeOrToken(node.right); - }; - - SyntaxWalker.prototype.visitConditionalExpression = function (node) { - this.visitNodeOrToken(node.condition); - this.visitToken(node.questionToken); - this.visitNodeOrToken(node.whenTrue); - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.whenFalse); - }; - - SyntaxWalker.prototype.visitConstructSignature = function (node) { - this.visitToken(node.newKeyword); - this.visitNode(node.callSignature); - }; - - SyntaxWalker.prototype.visitMethodSignature = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalToken(node.questionToken); - this.visitNode(node.callSignature); - }; - - SyntaxWalker.prototype.visitIndexSignature = function (node) { - this.visitToken(node.openBracketToken); - this.visitNode(node.parameter); - this.visitToken(node.closeBracketToken); - this.visitOptionalNode(node.typeAnnotation); - }; - - SyntaxWalker.prototype.visitPropertySignature = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalToken(node.questionToken); - this.visitOptionalNode(node.typeAnnotation); - }; - - SyntaxWalker.prototype.visitCallSignature = function (node) { - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitOptionalNode(node.typeAnnotation); - }; - - SyntaxWalker.prototype.visitParameterList = function (node) { - this.visitToken(node.openParenToken); - this.visitSeparatedList(node.parameters); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitTypeParameterList = function (node) { - this.visitToken(node.lessThanToken); - this.visitSeparatedList(node.typeParameters); - this.visitToken(node.greaterThanToken); - }; - - SyntaxWalker.prototype.visitTypeParameter = function (node) { - this.visitToken(node.identifier); - this.visitOptionalNode(node.constraint); - }; - - SyntaxWalker.prototype.visitConstraint = function (node) { - this.visitToken(node.extendsKeyword); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitElseClause = function (node) { - this.visitToken(node.elseKeyword); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitIfStatement = function (node) { - this.visitToken(node.ifKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - this.visitOptionalNode(node.elseClause); - }; - - SyntaxWalker.prototype.visitExpressionStatement = function (node) { - this.visitNodeOrToken(node.expression); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitConstructorDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.constructorKeyword); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); - this.visitOptionalToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitMemberFunctionDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); - this.visitOptionalToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitGetAccessor = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.getKeyword); - this.visitToken(node.propertyName); - this.visitNode(node.parameterList); - this.visitOptionalNode(node.typeAnnotation); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitSetAccessor = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.setKeyword); - this.visitToken(node.propertyName); - this.visitNode(node.parameterList); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitMemberVariableDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitNode(node.variableDeclarator); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitIndexMemberDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitNode(node.indexSignature); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitThrowStatement = function (node) { - this.visitToken(node.throwKeyword); - this.visitNodeOrToken(node.expression); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitReturnStatement = function (node) { - this.visitToken(node.returnKeyword); - this.visitOptionalNodeOrToken(node.expression); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitObjectCreationExpression = function (node) { - this.visitToken(node.newKeyword); - this.visitNodeOrToken(node.expression); - this.visitOptionalNode(node.argumentList); - }; - - SyntaxWalker.prototype.visitSwitchStatement = function (node) { - this.visitToken(node.switchKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.expression); - this.visitToken(node.closeParenToken); - this.visitToken(node.openBraceToken); - this.visitList(node.switchClauses); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitCaseSwitchClause = function (node) { - this.visitToken(node.caseKeyword); - this.visitNodeOrToken(node.expression); - this.visitToken(node.colonToken); - this.visitList(node.statements); - }; - - SyntaxWalker.prototype.visitDefaultSwitchClause = function (node) { - this.visitToken(node.defaultKeyword); - this.visitToken(node.colonToken); - this.visitList(node.statements); - }; - - SyntaxWalker.prototype.visitBreakStatement = function (node) { - this.visitToken(node.breakKeyword); - this.visitOptionalToken(node.identifier); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitContinueStatement = function (node) { - this.visitToken(node.continueKeyword); - this.visitOptionalToken(node.identifier); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitForStatement = function (node) { - this.visitToken(node.forKeyword); - this.visitToken(node.openParenToken); - this.visitOptionalNode(node.variableDeclaration); - this.visitOptionalNodeOrToken(node.initializer); - this.visitToken(node.firstSemicolonToken); - this.visitOptionalNodeOrToken(node.condition); - this.visitToken(node.secondSemicolonToken); - this.visitOptionalNodeOrToken(node.incrementor); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitForInStatement = function (node) { - this.visitToken(node.forKeyword); - this.visitToken(node.openParenToken); - this.visitOptionalNode(node.variableDeclaration); - this.visitOptionalNodeOrToken(node.left); - this.visitToken(node.inKeyword); - this.visitNodeOrToken(node.expression); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitWhileStatement = function (node) { - this.visitToken(node.whileKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitWithStatement = function (node) { - this.visitToken(node.withKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitEnumDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.enumKeyword); - this.visitToken(node.identifier); - this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.enumElements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitEnumElement = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalNode(node.equalsValueClause); - }; - - SyntaxWalker.prototype.visitCastExpression = function (node) { - this.visitToken(node.lessThanToken); - this.visitNodeOrToken(node.type); - this.visitToken(node.greaterThanToken); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitObjectLiteralExpression = function (node) { - this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.propertyAssignments); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitSimplePropertyAssignment = function (node) { - this.visitToken(node.propertyName); - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitFunctionPropertyAssignment = function (node) { - this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitFunctionExpression = function (node) { - this.visitToken(node.functionKeyword); - this.visitOptionalToken(node.identifier); - this.visitNode(node.callSignature); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitEmptyStatement = function (node) { - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitTryStatement = function (node) { - this.visitToken(node.tryKeyword); - this.visitNode(node.block); - this.visitOptionalNode(node.catchClause); - this.visitOptionalNode(node.finallyClause); - }; - - SyntaxWalker.prototype.visitCatchClause = function (node) { - this.visitToken(node.catchKeyword); - this.visitToken(node.openParenToken); - this.visitToken(node.identifier); - this.visitOptionalNode(node.typeAnnotation); - this.visitToken(node.closeParenToken); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitFinallyClause = function (node) { - this.visitToken(node.finallyKeyword); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitLabeledStatement = function (node) { - this.visitToken(node.identifier); - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitDoStatement = function (node) { - this.visitToken(node.doKeyword); - this.visitNodeOrToken(node.statement); - this.visitToken(node.whileKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitTypeOfExpression = function (node) { - this.visitToken(node.typeOfKeyword); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitDeleteExpression = function (node) { - this.visitToken(node.deleteKeyword); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitVoidExpression = function (node) { - this.visitToken(node.voidKeyword); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitDebuggerStatement = function (node) { - this.visitToken(node.debuggerKeyword); - this.visitToken(node.semicolonToken); - }; - return SyntaxWalker; - })(); - TypeScript.SyntaxWalker = SyntaxWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var PositionTrackingWalker = (function (_super) { - __extends(PositionTrackingWalker, _super); - function PositionTrackingWalker() { - _super.apply(this, arguments); - this._position = 0; - } - PositionTrackingWalker.prototype.visitToken = function (token) { - this._position += token.fullWidth(); - }; - - PositionTrackingWalker.prototype.position = function () { - return this._position; - }; - - PositionTrackingWalker.prototype.skip = function (element) { - this._position += element.fullWidth(); - }; - return PositionTrackingWalker; - })(TypeScript.SyntaxWalker); - TypeScript.PositionTrackingWalker = PositionTrackingWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxInformationMap = (function (_super) { - __extends(SyntaxInformationMap, _super); - function SyntaxInformationMap(trackParents, trackPreviousToken) { - _super.call(this); - this.trackParents = trackParents; - this.trackPreviousToken = trackPreviousToken; - this.tokenToInformation = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - this.elementToPosition = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - this._previousToken = null; - this._previousTokenInformation = null; - this._currentPosition = 0; - this._elementToParent = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - this._parentStack = []; - this._parentStack.push(null); - } - SyntaxInformationMap.create = function (node, trackParents, trackPreviousToken) { - var map = new SyntaxInformationMap(trackParents, trackPreviousToken); - map.visitNode(node); - return map; - }; - - SyntaxInformationMap.prototype.visitNode = function (node) { - this.trackParents && this._elementToParent.add(node, TypeScript.ArrayUtilities.last(this._parentStack)); - this.elementToPosition.add(node, this._currentPosition); - - this.trackParents && this._parentStack.push(node); - _super.prototype.visitNode.call(this, node); - this.trackParents && this._parentStack.pop(); - }; - - SyntaxInformationMap.prototype.visitToken = function (token) { - this.trackParents && this._elementToParent.add(token, TypeScript.ArrayUtilities.last(this._parentStack)); - - if (this.trackPreviousToken) { - var tokenInformation = { - previousToken: this._previousToken, - nextToken: null - }; - - if (this._previousTokenInformation !== null) { - this._previousTokenInformation.nextToken = token; - } - - this._previousToken = token; - this._previousTokenInformation = tokenInformation; - - this.tokenToInformation.add(token, tokenInformation); - } - - this.elementToPosition.add(token, this._currentPosition); - this._currentPosition += token.fullWidth(); - }; - - SyntaxInformationMap.prototype.parent = function (element) { - return this._elementToParent.get(element); - }; - - SyntaxInformationMap.prototype.fullStart = function (element) { - return this.elementToPosition.get(element); - }; - - SyntaxInformationMap.prototype.start = function (element) { - return this.fullStart(element) + element.leadingTriviaWidth(); - }; - - SyntaxInformationMap.prototype.end = function (element) { - return this.start(element) + element.width(); - }; - - SyntaxInformationMap.prototype.previousToken = function (token) { - return this.tokenInformation(token).previousToken; - }; - - SyntaxInformationMap.prototype.tokenInformation = function (token) { - return this.tokenToInformation.get(token); - }; - - SyntaxInformationMap.prototype.firstTokenInLineContainingToken = function (token) { - var current = token; - while (true) { - var information = this.tokenInformation(current); - if (this.isFirstTokenInLineWorker(information)) { - break; - } - - current = information.previousToken; - } - - return current; - }; - - SyntaxInformationMap.prototype.isFirstTokenInLine = function (token) { - var information = this.tokenInformation(token); - return this.isFirstTokenInLineWorker(information); - }; - - SyntaxInformationMap.prototype.isFirstTokenInLineWorker = function (information) { - return information.previousToken === null || information.previousToken.hasTrailingNewLine(); - }; - return SyntaxInformationMap; - })(TypeScript.SyntaxWalker); - TypeScript.SyntaxInformationMap = SyntaxInformationMap; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxNodeInvariantsChecker = (function (_super) { - __extends(SyntaxNodeInvariantsChecker, _super); - function SyntaxNodeInvariantsChecker() { - _super.apply(this, arguments); - this.tokenTable = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - } - SyntaxNodeInvariantsChecker.checkInvariants = function (node) { - node.accept(new SyntaxNodeInvariantsChecker()); - }; - - SyntaxNodeInvariantsChecker.prototype.visitToken = function (token) { - this.tokenTable.add(token, token); - }; - return SyntaxNodeInvariantsChecker; - })(TypeScript.SyntaxWalker); - TypeScript.SyntaxNodeInvariantsChecker = SyntaxNodeInvariantsChecker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var DepthLimitedWalker = (function (_super) { - __extends(DepthLimitedWalker, _super); - function DepthLimitedWalker(maximumDepth) { - _super.call(this); - this._depth = 0; - this._maximumDepth = 0; - this._maximumDepth = maximumDepth; - } - DepthLimitedWalker.prototype.visitNode = function (node) { - if (this._depth < this._maximumDepth) { - this._depth++; - _super.prototype.visitNode.call(this, node); - this._depth--; - } else { - this.skip(node); - } - }; - return DepthLimitedWalker; - })(TypeScript.PositionTrackingWalker); - TypeScript.DepthLimitedWalker = DepthLimitedWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Parser) { - - - var ExpressionPrecedence; - (function (ExpressionPrecedence) { - ExpressionPrecedence[ExpressionPrecedence["CommaExpressionPrecedence"] = 1] = "CommaExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["AssignmentExpressionPrecedence"] = 2] = "AssignmentExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["ConditionalExpressionPrecedence"] = 3] = "ConditionalExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["ArrowFunctionPrecedence"] = 4] = "ArrowFunctionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["LogicalOrExpressionPrecedence"] = 5] = "LogicalOrExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["LogicalAndExpressionPrecedence"] = 6] = "LogicalAndExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["BitwiseOrExpressionPrecedence"] = 7] = "BitwiseOrExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["BitwiseExclusiveOrExpressionPrecedence"] = 8] = "BitwiseExclusiveOrExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["BitwiseAndExpressionPrecedence"] = 9] = "BitwiseAndExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["EqualityExpressionPrecedence"] = 10] = "EqualityExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["RelationalExpressionPrecedence"] = 11] = "RelationalExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["ShiftExpressionPrecdence"] = 12] = "ShiftExpressionPrecdence"; - ExpressionPrecedence[ExpressionPrecedence["AdditiveExpressionPrecedence"] = 13] = "AdditiveExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["MultiplicativeExpressionPrecedence"] = 14] = "MultiplicativeExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["UnaryExpressionPrecedence"] = 15] = "UnaryExpressionPrecedence"; - })(ExpressionPrecedence || (ExpressionPrecedence = {})); - - var ListParsingState; - (function (ListParsingState) { - ListParsingState[ListParsingState["SourceUnit_ModuleElements"] = 1 << 0] = "SourceUnit_ModuleElements"; - ListParsingState[ListParsingState["ClassDeclaration_ClassElements"] = 1 << 1] = "ClassDeclaration_ClassElements"; - ListParsingState[ListParsingState["ModuleDeclaration_ModuleElements"] = 1 << 2] = "ModuleDeclaration_ModuleElements"; - ListParsingState[ListParsingState["SwitchStatement_SwitchClauses"] = 1 << 3] = "SwitchStatement_SwitchClauses"; - ListParsingState[ListParsingState["SwitchClause_Statements"] = 1 << 4] = "SwitchClause_Statements"; - ListParsingState[ListParsingState["Block_Statements"] = 1 << 5] = "Block_Statements"; - ListParsingState[ListParsingState["TryBlock_Statements"] = 1 << 6] = "TryBlock_Statements"; - ListParsingState[ListParsingState["CatchBlock_Statements"] = 1 << 7] = "CatchBlock_Statements"; - ListParsingState[ListParsingState["EnumDeclaration_EnumElements"] = 1 << 8] = "EnumDeclaration_EnumElements"; - ListParsingState[ListParsingState["ObjectType_TypeMembers"] = 1 << 9] = "ObjectType_TypeMembers"; - ListParsingState[ListParsingState["ClassOrInterfaceDeclaration_HeritageClauses"] = 1 << 10] = "ClassOrInterfaceDeclaration_HeritageClauses"; - ListParsingState[ListParsingState["HeritageClause_TypeNameList"] = 1 << 11] = "HeritageClause_TypeNameList"; - ListParsingState[ListParsingState["VariableDeclaration_VariableDeclarators_AllowIn"] = 1 << 12] = "VariableDeclaration_VariableDeclarators_AllowIn"; - ListParsingState[ListParsingState["VariableDeclaration_VariableDeclarators_DisallowIn"] = 1 << 13] = "VariableDeclaration_VariableDeclarators_DisallowIn"; - ListParsingState[ListParsingState["ArgumentList_AssignmentExpressions"] = 1 << 14] = "ArgumentList_AssignmentExpressions"; - ListParsingState[ListParsingState["ObjectLiteralExpression_PropertyAssignments"] = 1 << 15] = "ObjectLiteralExpression_PropertyAssignments"; - ListParsingState[ListParsingState["ArrayLiteralExpression_AssignmentExpressions"] = 1 << 16] = "ArrayLiteralExpression_AssignmentExpressions"; - ListParsingState[ListParsingState["ParameterList_Parameters"] = 1 << 17] = "ParameterList_Parameters"; - ListParsingState[ListParsingState["TypeArgumentList_Types"] = 1 << 18] = "TypeArgumentList_Types"; - ListParsingState[ListParsingState["TypeParameterList_TypeParameters"] = 1 << 19] = "TypeParameterList_TypeParameters"; - - ListParsingState[ListParsingState["FirstListParsingState"] = ListParsingState.SourceUnit_ModuleElements] = "FirstListParsingState"; - ListParsingState[ListParsingState["LastListParsingState"] = ListParsingState.TypeParameterList_TypeParameters] = "LastListParsingState"; - })(ListParsingState || (ListParsingState = {})); - - var SyntaxCursor = (function () { - function SyntaxCursor(sourceUnit) { - this._elements = []; - this._index = 0; - this._pinCount = 0; - sourceUnit.insertChildrenInto(this._elements, 0); - } - SyntaxCursor.prototype.isFinished = function () { - return this._index === this._elements.length; - }; - - SyntaxCursor.prototype.currentElement = function () { - if (this.isFinished()) { - return null; - } - - return this._elements[this._index]; - }; - - SyntaxCursor.prototype.currentNode = function () { - var element = this.currentElement(); - return element !== null && element.isNode() ? element : null; - }; - - SyntaxCursor.prototype.moveToFirstChild = function () { - if (this.isFinished()) { - return; - } - - var element = this._elements[this._index]; - if (element.isToken()) { - return; - } - - var node = element; - - this._elements.splice(this._index, 1); - - node.insertChildrenInto(this._elements, this._index); - }; - - SyntaxCursor.prototype.moveToNextSibling = function () { - if (this.isFinished()) { - return; - } - - if (this._pinCount > 0) { - this._index++; - return; - } - - this._elements.shift(); - }; - - SyntaxCursor.prototype.getAndPinCursorIndex = function () { - this._pinCount++; - return this._index; - }; - - SyntaxCursor.prototype.releaseAndUnpinCursorIndex = function (index) { - this._pinCount--; - if (this._pinCount === 0) { - } - }; - - SyntaxCursor.prototype.rewindToPinnedCursorIndex = function (index) { - this._index = index; - }; - - SyntaxCursor.prototype.pinCount = function () { - return this._pinCount; - }; - - SyntaxCursor.prototype.moveToFirstToken = function () { - var element; - - while (!this.isFinished()) { - element = this.currentElement(); - if (element.isNode()) { - this.moveToFirstChild(); - continue; - } - - return; - } - }; - - SyntaxCursor.prototype.currentToken = function () { - this.moveToFirstToken(); - if (this.isFinished()) { - return null; - } - - var element = this.currentElement(); - - return element; - }; - - SyntaxCursor.prototype.peekToken = function (n) { - this.moveToFirstToken(); - var pin = this.getAndPinCursorIndex(); - - for (var i = 0; i < n; i++) { - this.moveToNextSibling(); - this.moveToFirstToken(); - } - - var result = this.currentToken(); - this.rewindToPinnedCursorIndex(pin); - this.releaseAndUnpinCursorIndex(pin); - - return result; - }; - return SyntaxCursor; - })(); - - - - var NormalParserSource = (function () { - function NormalParserSource(fileName, text, languageVersion) { - this._previousToken = null; - this._absolutePosition = 0; - this._tokenDiagnostics = []; - this.rewindPointPool = []; - this.rewindPointPoolCount = 0; - this.slidingWindow = new TypeScript.SlidingWindow(this, TypeScript.ArrayUtilities.createArray(32, null), null); - this.scanner = new TypeScript.Scanner(fileName, text, languageVersion); - } - NormalParserSource.prototype.currentNode = function () { - return null; - }; - - NormalParserSource.prototype.moveToNextNode = function () { - throw TypeScript.Errors.invalidOperation(); - }; - - NormalParserSource.prototype.absolutePosition = function () { - return this._absolutePosition; - }; - - NormalParserSource.prototype.previousToken = function () { - return this._previousToken; - }; - - NormalParserSource.prototype.tokenDiagnostics = function () { - return this._tokenDiagnostics; - }; - - NormalParserSource.prototype.getOrCreateRewindPoint = function () { - if (this.rewindPointPoolCount === 0) { - return {}; - } - - this.rewindPointPoolCount--; - var result = this.rewindPointPool[this.rewindPointPoolCount]; - this.rewindPointPool[this.rewindPointPoolCount] = null; - return result; - }; - - NormalParserSource.prototype.getRewindPoint = function () { - var slidingWindowIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - - var rewindPoint = this.getOrCreateRewindPoint(); - - rewindPoint.slidingWindowIndex = slidingWindowIndex; - rewindPoint.previousToken = this._previousToken; - rewindPoint.absolutePosition = this._absolutePosition; - - rewindPoint.pinCount = this.slidingWindow.pinCount(); - - return rewindPoint; - }; - - NormalParserSource.prototype.isPinned = function () { - return this.slidingWindow.pinCount() > 0; - }; - - NormalParserSource.prototype.rewind = function (rewindPoint) { - this.slidingWindow.rewindToPinnedIndex(rewindPoint.slidingWindowIndex); - - this._previousToken = rewindPoint.previousToken; - this._absolutePosition = rewindPoint.absolutePosition; - }; - - NormalParserSource.prototype.releaseRewindPoint = function (rewindPoint) { - this.slidingWindow.releaseAndUnpinAbsoluteIndex(rewindPoint.absoluteIndex); - - this.rewindPointPool[this.rewindPointPoolCount] = rewindPoint; - this.rewindPointPoolCount++; - }; - - NormalParserSource.prototype.fetchMoreItems = function (allowRegularExpression, sourceIndex, window, destinationIndex, spaceAvailable) { - window[destinationIndex] = this.scanner.scan(this._tokenDiagnostics, allowRegularExpression); - return 1; - }; - - NormalParserSource.prototype.peekToken = function (n) { - return this.slidingWindow.peekItemN(n); - }; - - NormalParserSource.prototype.moveToNextToken = function () { - var currentToken = this.currentToken(); - this._absolutePosition += currentToken.fullWidth(); - this._previousToken = currentToken; - - this.slidingWindow.moveToNextItem(); - }; - - NormalParserSource.prototype.currentToken = function () { - return this.slidingWindow.currentItem(false); - }; - - NormalParserSource.prototype.removeDiagnosticsOnOrAfterPosition = function (position) { - var tokenDiagnosticsLength = this._tokenDiagnostics.length; - while (tokenDiagnosticsLength > 0) { - var diagnostic = this._tokenDiagnostics[tokenDiagnosticsLength - 1]; - if (diagnostic.start() >= position) { - tokenDiagnosticsLength--; - } else { - break; - } - } - - this._tokenDiagnostics.length = tokenDiagnosticsLength; - }; - - NormalParserSource.prototype.resetToPosition = function (absolutePosition, previousToken) { - this._absolutePosition = absolutePosition; - this._previousToken = previousToken; - - this.removeDiagnosticsOnOrAfterPosition(absolutePosition); - - this.slidingWindow.disgardAllItemsFromCurrentIndexOnwards(); - - this.scanner.setAbsoluteIndex(absolutePosition); - }; - - NormalParserSource.prototype.currentTokenAllowingRegularExpression = function () { - this.resetToPosition(this._absolutePosition, this._previousToken); - - var token = this.slidingWindow.currentItem(true); - - return token; - }; - return NormalParserSource; - })(); - - var IncrementalParserSource = (function () { - function IncrementalParserSource(oldSyntaxTree, textChangeRange, newText) { - this._changeDelta = 0; - var oldSourceUnit = oldSyntaxTree.sourceUnit(); - this._oldSourceUnitCursor = new SyntaxCursor(oldSourceUnit); - - this._changeRange = IncrementalParserSource.extendToAffectedRange(textChangeRange, oldSourceUnit); - - if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { - TypeScript.Debug.assert((oldSourceUnit.fullWidth() - this._changeRange.span().length() + this._changeRange.newLength()) === newText.length()); - } - - this._normalParserSource = new NormalParserSource(oldSyntaxTree.fileName(), newText, oldSyntaxTree.parseOptions().languageVersion()); - } - IncrementalParserSource.extendToAffectedRange = function (changeRange, sourceUnit) { - var maxLookahead = 1; - - var start = changeRange.span().start(); - - for (var i = 0; start > 0 && i <= maxLookahead; i++) { - var token = sourceUnit.findToken(start); - - var position = token.fullStart(); - - start = TypeScript.MathPrototype.max(0, position - 1); - } - - var finalSpan = TypeScript.TextSpan.fromBounds(start, changeRange.span().end()); - var finalLength = changeRange.newLength() + (changeRange.span().start() - start); - - return new TypeScript.TextChangeRange(finalSpan, finalLength); - }; - - IncrementalParserSource.prototype.absolutePosition = function () { - return this._normalParserSource.absolutePosition(); - }; - - IncrementalParserSource.prototype.previousToken = function () { - return this._normalParserSource.previousToken(); - }; - - IncrementalParserSource.prototype.tokenDiagnostics = function () { - return this._normalParserSource.tokenDiagnostics(); - }; - - IncrementalParserSource.prototype.getRewindPoint = function () { - var rewindPoint = this._normalParserSource.getRewindPoint(); - var oldSourceUnitCursorIndex = this._oldSourceUnitCursor.getAndPinCursorIndex(); - - rewindPoint.changeDelta = this._changeDelta; - rewindPoint.changeRange = this._changeRange; - rewindPoint.oldSourceUnitCursorIndex = oldSourceUnitCursorIndex; - - return rewindPoint; - }; - - IncrementalParserSource.prototype.rewind = function (rewindPoint) { - this._changeRange = rewindPoint.changeRange; - this._changeDelta = rewindPoint.changeDelta; - this._oldSourceUnitCursor.rewindToPinnedCursorIndex(rewindPoint.oldSourceUnitCursorIndex); - - this._normalParserSource.rewind(rewindPoint); - }; - - IncrementalParserSource.prototype.releaseRewindPoint = function (rewindPoint) { - this._oldSourceUnitCursor.releaseAndUnpinCursorIndex(rewindPoint.oldSourceUnitCursorIndex); - this._normalParserSource.releaseRewindPoint(rewindPoint); - }; - - IncrementalParserSource.prototype.canReadFromOldSourceUnit = function () { - if (this._normalParserSource.isPinned()) { - return false; - } - - if (this._changeRange !== null && this._changeRange.newSpan().intersectsWithPosition(this.absolutePosition())) { - return false; - } - - this.syncCursorToNewTextIfBehind(); - - return this._changeDelta === 0 && !this._oldSourceUnitCursor.isFinished(); - }; - - IncrementalParserSource.prototype.currentNode = function () { - if (this.canReadFromOldSourceUnit()) { - return this.tryGetNodeFromOldSourceUnit(); - } - - return null; - }; - - IncrementalParserSource.prototype.currentToken = function () { - if (this.canReadFromOldSourceUnit()) { - var token = this.tryGetTokenFromOldSourceUnit(); - if (token !== null) { - return token; - } - } - - return this._normalParserSource.currentToken(); - }; - - IncrementalParserSource.prototype.currentTokenAllowingRegularExpression = function () { - return this._normalParserSource.currentTokenAllowingRegularExpression(); - }; - - IncrementalParserSource.prototype.syncCursorToNewTextIfBehind = function () { - while (true) { - if (this._oldSourceUnitCursor.isFinished()) { - break; - } - - if (this._changeDelta >= 0) { - break; - } - - var currentElement = this._oldSourceUnitCursor.currentElement(); - - if (currentElement.isNode() && (currentElement.fullWidth() > Math.abs(this._changeDelta))) { - this._oldSourceUnitCursor.moveToFirstChild(); - } else { - this._oldSourceUnitCursor.moveToNextSibling(); - - this._changeDelta += currentElement.fullWidth(); - } - } - }; - - IncrementalParserSource.prototype.intersectsWithChangeRangeSpanInOriginalText = function (start, length) { - return this._changeRange !== null && this._changeRange.span().intersectsWith(start, length); - }; - - IncrementalParserSource.prototype.tryGetNodeFromOldSourceUnit = function () { - while (true) { - var node = this._oldSourceUnitCursor.currentNode(); - if (node === null) { - return null; - } - - if (!this.intersectsWithChangeRangeSpanInOriginalText(this.absolutePosition(), node.fullWidth())) { - if (!node.isIncrementallyUnusable()) { - return node; - } - } - - this._oldSourceUnitCursor.moveToFirstChild(); - } - }; - - IncrementalParserSource.prototype.canReuseTokenFromOldSourceUnit = function (position, token) { - if (token !== null) { - if (!this.intersectsWithChangeRangeSpanInOriginalText(position, token.fullWidth())) { - if (!token.isIncrementallyUnusable()) { - return true; - } - } - } - - return false; - }; - - IncrementalParserSource.prototype.tryGetTokenFromOldSourceUnit = function () { - var token = this._oldSourceUnitCursor.currentToken(); - - return this.canReuseTokenFromOldSourceUnit(this.absolutePosition(), token) ? token : null; - }; - - IncrementalParserSource.prototype.peekToken = function (n) { - if (this.canReadFromOldSourceUnit()) { - var token = this.tryPeekTokenFromOldSourceUnit(n); - if (token !== null) { - return token; - } - } - - return this._normalParserSource.peekToken(n); - }; - - IncrementalParserSource.prototype.tryPeekTokenFromOldSourceUnit = function (n) { - var currentPosition = this.absolutePosition(); - for (var i = 0; i < n; i++) { - var interimToken = this._oldSourceUnitCursor.peekToken(i); - if (!this.canReuseTokenFromOldSourceUnit(currentPosition, interimToken)) { - return null; - } - - currentPosition += interimToken.fullWidth(); - } - - var token = this._oldSourceUnitCursor.peekToken(n); - return this.canReuseTokenFromOldSourceUnit(currentPosition, token) ? token : null; - }; - - IncrementalParserSource.prototype.moveToNextNode = function () { - var currentElement = this._oldSourceUnitCursor.currentElement(); - var currentNode = this._oldSourceUnitCursor.currentNode(); - - this._oldSourceUnitCursor.moveToNextSibling(); - - var absolutePosition = this.absolutePosition() + currentNode.fullWidth(); - var previousToken = currentNode.lastToken(); - this._normalParserSource.resetToPosition(absolutePosition, previousToken); - - if (this._changeRange !== null) { - } - }; - - IncrementalParserSource.prototype.moveToNextToken = function () { - var currentToken = this.currentToken(); - - if (this._oldSourceUnitCursor.currentToken() === currentToken) { - this._oldSourceUnitCursor.moveToNextSibling(); - - var absolutePosition = this.absolutePosition() + currentToken.fullWidth(); - var previousToken = currentToken; - this._normalParserSource.resetToPosition(absolutePosition, previousToken); - - if (this._changeRange !== null) { - } - } else { - this._changeDelta -= currentToken.fullWidth(); - - this._normalParserSource.moveToNextToken(); - - if (this._changeRange !== null) { - var changeRangeSpanInNewText = this._changeRange.newSpan(); - if (this.absolutePosition() >= changeRangeSpanInNewText.end()) { - this._changeDelta += this._changeRange.newLength() - this._changeRange.span().length(); - this._changeRange = null; - } - } - } - }; - return IncrementalParserSource; - })(); - - var ParserImpl = (function () { - function ParserImpl(fileName, lineMap, source, parseOptions, newText_forDebuggingPurposesOnly) { - this.newText_forDebuggingPurposesOnly = newText_forDebuggingPurposesOnly; - this.listParsingState = 0; - this.isInStrictMode = false; - this.diagnostics = []; - this.factory = TypeScript.Syntax.normalModeFactory; - this.mergeTokensStorage = []; - this.arrayPool = []; - this.fileName = fileName; - this.lineMap = lineMap; - this.source = source; - this.parseOptions = parseOptions; - } - ParserImpl.prototype.getRewindPoint = function () { - var rewindPoint = this.source.getRewindPoint(); - - rewindPoint.diagnosticsCount = this.diagnostics.length; - - rewindPoint.isInStrictMode = this.isInStrictMode; - rewindPoint.listParsingState = this.listParsingState; - - return rewindPoint; - }; - - ParserImpl.prototype.rewind = function (rewindPoint) { - this.source.rewind(rewindPoint); - - this.diagnostics.length = rewindPoint.diagnosticsCount; - }; - - ParserImpl.prototype.releaseRewindPoint = function (rewindPoint) { - this.source.releaseRewindPoint(rewindPoint); - }; - - ParserImpl.prototype.currentTokenStart = function () { - return this.source.absolutePosition() + this.currentToken().leadingTriviaWidth(); - }; - - ParserImpl.prototype.previousTokenStart = function () { - if (this.previousToken() === null) { - return 0; - } - - return this.source.absolutePosition() - this.previousToken().fullWidth() + this.previousToken().leadingTriviaWidth(); - }; - - ParserImpl.prototype.previousTokenEnd = function () { - if (this.previousToken() === null) { - return 0; - } - - return this.previousTokenStart() + this.previousToken().width(); - }; - - ParserImpl.prototype.currentNode = function () { - var node = this.source.currentNode(); - - if (node === null || node.parsedInStrictMode() !== this.isInStrictMode) { - return null; - } - - return node; - }; - - ParserImpl.prototype.currentToken = function () { - return this.source.currentToken(); - }; - - ParserImpl.prototype.currentTokenAllowingRegularExpression = function () { - return this.source.currentTokenAllowingRegularExpression(); - }; - - ParserImpl.prototype.peekToken = function (n) { - return this.source.peekToken(n); - }; - - ParserImpl.prototype.eatAnyToken = function () { - var token = this.currentToken(); - this.moveToNextToken(); - return token; - }; - - ParserImpl.prototype.moveToNextToken = function () { - this.source.moveToNextToken(); - }; - - ParserImpl.prototype.previousToken = function () { - return this.source.previousToken(); - }; - - ParserImpl.prototype.eatNode = function () { - var node = this.source.currentNode(); - this.source.moveToNextNode(); - return node; - }; - - ParserImpl.prototype.eatToken = function (kind) { - var token = this.currentToken(); - if (token.tokenKind === kind) { - this.moveToNextToken(); - return token; - } - - return this.createMissingToken(kind, token); - }; - - ParserImpl.prototype.tryEatToken = function (kind) { - if (this.currentToken().tokenKind === kind) { - return this.eatToken(kind); - } - - return null; - }; - - ParserImpl.prototype.eatKeyword = function (kind) { - var token = this.currentToken(); - if (token.tokenKind === kind) { - this.moveToNextToken(); - return token; - } - - return this.createMissingToken(kind, token); - }; - - ParserImpl.prototype.isIdentifier = function (token) { - var tokenKind = token.tokenKind; - - if (tokenKind === 11 /* IdentifierName */) { - return true; - } - - if (tokenKind >= 51 /* FirstFutureReservedStrictKeyword */) { - if (tokenKind <= 59 /* LastFutureReservedStrictKeyword */) { - return !this.isInStrictMode; - } - - return tokenKind <= 69 /* LastTypeScriptKeyword */; - } - - return false; - }; - - ParserImpl.prototype.eatIdentifierNameToken = function () { - var token = this.currentToken(); - - if (token.tokenKind === 11 /* IdentifierName */) { - this.moveToNextToken(); - return token; - } - - if (TypeScript.SyntaxFacts.isAnyKeyword(token.tokenKind)) { - this.moveToNextToken(); - return TypeScript.Syntax.convertToIdentifierName(token); - } - - return this.createMissingToken(11 /* IdentifierName */, token); - }; - - ParserImpl.prototype.eatIdentifierToken = function () { - var token = this.currentToken(); - if (this.isIdentifier(token)) { - this.moveToNextToken(); - - if (token.tokenKind === 11 /* IdentifierName */) { - return token; - } - - return TypeScript.Syntax.convertToIdentifierName(token); - } - - return this.createMissingToken(11 /* IdentifierName */, token); - }; - - ParserImpl.prototype.canEatAutomaticSemicolon = function (allowWithoutNewLine) { - var token = this.currentToken(); - - if (token.tokenKind === 10 /* EndOfFileToken */) { - return true; - } - - if (token.tokenKind === 71 /* CloseBraceToken */) { - return true; - } - - if (allowWithoutNewLine) { - return true; - } - - if (this.previousToken() !== null && this.previousToken().hasTrailingNewLine()) { - return true; - } - - return false; - }; - - ParserImpl.prototype.canEatExplicitOrAutomaticSemicolon = function (allowWithoutNewline) { - var token = this.currentToken(); - - if (token.tokenKind === 78 /* SemicolonToken */) { - return true; - } - - return this.canEatAutomaticSemicolon(allowWithoutNewline); - }; - - ParserImpl.prototype.eatExplicitOrAutomaticSemicolon = function (allowWithoutNewline) { - var token = this.currentToken(); - - if (token.tokenKind === 78 /* SemicolonToken */) { - return this.eatToken(78 /* SemicolonToken */); - } - - if (this.canEatAutomaticSemicolon(allowWithoutNewline)) { - var semicolonToken = TypeScript.Syntax.emptyToken(78 /* SemicolonToken */); - - if (!this.parseOptions.allowAutomaticSemicolonInsertion()) { - this.addDiagnostic(new TypeScript.Diagnostic(this.fileName, this.lineMap, this.previousTokenEnd(), 0, TypeScript.DiagnosticCode.Automatic_semicolon_insertion_not_allowed, null)); - } - - return semicolonToken; - } - - return this.eatToken(78 /* SemicolonToken */); - }; - - ParserImpl.prototype.isKeyword = function (kind) { - if (kind >= 15 /* FirstKeyword */) { - if (kind <= 50 /* LastFutureReservedKeyword */) { - return true; - } - - if (this.isInStrictMode) { - return kind <= 59 /* LastFutureReservedStrictKeyword */; - } - } - - return false; - }; - - ParserImpl.prototype.createMissingToken = function (expectedKind, actual) { - var diagnostic = this.getExpectedTokenDiagnostic(expectedKind, actual); - this.addDiagnostic(diagnostic); - - return TypeScript.Syntax.emptyToken(expectedKind); - }; - - ParserImpl.prototype.getExpectedTokenDiagnostic = function (expectedKind, actual) { - var token = this.currentToken(); - - if (TypeScript.SyntaxFacts.isAnyKeyword(expectedKind) || TypeScript.SyntaxFacts.isAnyPunctuation(expectedKind)) { - return new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode._0_expected, [TypeScript.SyntaxFacts.getText(expectedKind)]); - } else { - if (actual !== null && TypeScript.SyntaxFacts.isAnyKeyword(actual.tokenKind)) { - return new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode.Identifier_expected_0_is_a_keyword, [TypeScript.SyntaxFacts.getText(actual.tokenKind)]); - } else { - return new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode.Identifier_expected, null); - } - } - }; - - ParserImpl.getPrecedence = function (expressionKind) { - switch (expressionKind) { - case 173 /* CommaExpression */: - return 1 /* CommaExpressionPrecedence */; - - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - return 2 /* AssignmentExpressionPrecedence */; - - case 186 /* ConditionalExpression */: - return 3 /* ConditionalExpressionPrecedence */; - - case 187 /* LogicalOrExpression */: - return 5 /* LogicalOrExpressionPrecedence */; - - case 188 /* LogicalAndExpression */: - return 6 /* LogicalAndExpressionPrecedence */; - - case 189 /* BitwiseOrExpression */: - return 7 /* BitwiseOrExpressionPrecedence */; - - case 190 /* BitwiseExclusiveOrExpression */: - return 8 /* BitwiseExclusiveOrExpressionPrecedence */; - - case 191 /* BitwiseAndExpression */: - return 9 /* BitwiseAndExpressionPrecedence */; - - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - return 10 /* EqualityExpressionPrecedence */; - - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - return 11 /* RelationalExpressionPrecedence */; - - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - return 12 /* ShiftExpressionPrecdence */; - - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: - return 13 /* AdditiveExpressionPrecedence */; - - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - return 14 /* MultiplicativeExpressionPrecedence */; - - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - case 166 /* BitwiseNotExpression */: - case 167 /* LogicalNotExpression */: - case 170 /* DeleteExpression */: - case 171 /* TypeOfExpression */: - case 172 /* VoidExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - return 15 /* UnaryExpressionPrecedence */; - } - - throw TypeScript.Errors.invalidOperation(); - }; - - ParserImpl.prototype.addSkippedTokenAfterNodeOrToken = function (nodeOrToken, skippedToken) { - if (nodeOrToken.isToken()) { - return this.addSkippedTokenAfterToken(nodeOrToken, skippedToken); - } else if (nodeOrToken.isNode()) { - return this.addSkippedTokenAfterNode(nodeOrToken, skippedToken); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.addSkippedTokenAfterNode = function (node, skippedToken) { - var oldToken = node.lastToken(); - var newToken = this.addSkippedTokenAfterToken(oldToken, skippedToken); - - return node.replaceToken(oldToken, newToken); - }; - - ParserImpl.prototype.addSkippedTokensBeforeNode = function (node, skippedTokens) { - if (skippedTokens.length > 0) { - var oldToken = node.firstToken(); - var newToken = this.addSkippedTokensBeforeToken(oldToken, skippedTokens); - - return node.replaceToken(oldToken, newToken); - } - - return node; - }; - - ParserImpl.prototype.addSkippedTokensBeforeToken = function (token, skippedTokens) { - var leadingTrivia = []; - for (var i = 0, n = skippedTokens.length; i < n; i++) { - this.addSkippedTokenToTriviaArray(leadingTrivia, skippedTokens[i]); - } - - this.addTriviaTo(token.leadingTrivia(), leadingTrivia); - - this.returnArray(skippedTokens); - return token.withLeadingTrivia(TypeScript.Syntax.triviaList(leadingTrivia)); - }; - - ParserImpl.prototype.addSkippedTokensAfterToken = function (token, skippedTokens) { - if (skippedTokens.length === 0) { - this.returnArray(skippedTokens); - return token; - } - - var trailingTrivia = token.trailingTrivia().toArray(); - - for (var i = 0, n = skippedTokens.length; i < n; i++) { - this.addSkippedTokenToTriviaArray(trailingTrivia, skippedTokens[i]); - } - - this.returnArray(skippedTokens); - return token.withTrailingTrivia(TypeScript.Syntax.triviaList(trailingTrivia)); - }; - - ParserImpl.prototype.addSkippedTokenAfterToken = function (token, skippedToken) { - var trailingTrivia = token.trailingTrivia().toArray(); - this.addSkippedTokenToTriviaArray(trailingTrivia, skippedToken); - - return token.withTrailingTrivia(TypeScript.Syntax.triviaList(trailingTrivia)); - }; - - ParserImpl.prototype.addSkippedTokenToTriviaArray = function (array, skippedToken) { - this.addTriviaTo(skippedToken.leadingTrivia(), array); - - var trimmedToken = skippedToken.withLeadingTrivia(TypeScript.Syntax.emptyTriviaList).withTrailingTrivia(TypeScript.Syntax.emptyTriviaList); - array.push(TypeScript.Syntax.skippedTokenTrivia(trimmedToken)); - - this.addTriviaTo(skippedToken.trailingTrivia(), array); - }; - - ParserImpl.prototype.addTriviaTo = function (list, array) { - for (var i = 0, n = list.count(); i < n; i++) { - array.push(list.syntaxTriviaAt(i)); - } - }; - - ParserImpl.prototype.parseSyntaxTree = function (isDeclaration) { - var sourceUnit = this.parseSourceUnit(); - - var allDiagnostics = this.source.tokenDiagnostics().concat(this.diagnostics); - allDiagnostics.sort(function (a, b) { - return a.start() - b.start(); - }); - - return new TypeScript.SyntaxTree(sourceUnit, isDeclaration, allDiagnostics, this.fileName, this.lineMap, this.parseOptions); - }; - - ParserImpl.prototype.setStrictMode = function (isInStrictMode) { - this.isInStrictMode = isInStrictMode; - this.factory = isInStrictMode ? TypeScript.Syntax.strictModeFactory : TypeScript.Syntax.normalModeFactory; - }; - - ParserImpl.prototype.parseSourceUnit = function () { - var savedIsInStrictMode = this.isInStrictMode; - - var result = this.parseSyntaxList(1 /* SourceUnit_ModuleElements */, ParserImpl.updateStrictModeState); - var moduleElements = result.list; - - this.setStrictMode(savedIsInStrictMode); - - var sourceUnit = this.factory.sourceUnit(moduleElements, this.currentToken()); - sourceUnit = this.addSkippedTokensBeforeNode(sourceUnit, result.skippedTokens); - - if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { - TypeScript.Debug.assert(sourceUnit.fullWidth() === this.newText_forDebuggingPurposesOnly.length()); - - if (TypeScript.Debug.shouldAssert(3 /* VeryAggressive */)) { - TypeScript.Debug.assert(sourceUnit.fullText() === this.newText_forDebuggingPurposesOnly.substr(0, this.newText_forDebuggingPurposesOnly.length(), false)); - } - } - - return sourceUnit; - }; - - ParserImpl.updateStrictModeState = function (parser, items) { - if (!parser.isInStrictMode) { - for (var i = 0; i < items.length; i++) { - var item = items[i]; - if (!TypeScript.SyntaxFacts.isDirectivePrologueElement(item)) { - return; - } - } - - parser.setStrictMode(TypeScript.SyntaxFacts.isUseStrictDirective(items[items.length - 1])); - } - }; - - ParserImpl.prototype.isModuleElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isModuleElement()) { - return true; - } - - var modifierCount = this.modifierCount(); - return this.isImportDeclaration(modifierCount) || this.isExportAssignment() || this.isModuleDeclaration(modifierCount) || this.isInterfaceDeclaration(modifierCount) || this.isClassDeclaration(modifierCount) || this.isEnumDeclaration(modifierCount) || this.isStatement(inErrorRecovery); - }; - - ParserImpl.prototype.parseModuleElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isModuleElement()) { - return this.eatNode(); - } - - var modifierCount = this.modifierCount(); - if (this.isImportDeclaration(modifierCount)) { - return this.parseImportDeclaration(); - } else if (this.isExportAssignment()) { - return this.parseExportAssignment(); - } else if (this.isModuleDeclaration(modifierCount)) { - return this.parseModuleDeclaration(); - } else if (this.isInterfaceDeclaration(modifierCount)) { - return this.parseInterfaceDeclaration(); - } else if (this.isClassDeclaration(modifierCount)) { - return this.parseClassDeclaration(); - } else if (this.isEnumDeclaration(modifierCount)) { - return this.parseEnumDeclaration(); - } else if (this.isStatement(inErrorRecovery)) { - return this.parseStatement(inErrorRecovery); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isImportDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 49 /* ImportKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 49 /* ImportKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseImportDeclaration = function () { - var modifiers = this.parseModifiers(); - var importKeyword = this.eatKeyword(49 /* ImportKeyword */); - var identifier = this.eatIdentifierToken(); - var equalsToken = this.eatToken(107 /* EqualsToken */); - var moduleReference = this.parseModuleReference(); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.importDeclaration(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken); - }; - - ParserImpl.prototype.isExportAssignment = function () { - return this.currentToken().tokenKind === 47 /* ExportKeyword */ && this.peekToken(1).tokenKind === 107 /* EqualsToken */; - }; - - ParserImpl.prototype.parseExportAssignment = function () { - var exportKeyword = this.eatKeyword(47 /* ExportKeyword */); - var equalsToken = this.eatToken(107 /* EqualsToken */); - var identifier = this.eatIdentifierToken(); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.exportAssignment(exportKeyword, equalsToken, identifier, semicolonToken); - }; - - ParserImpl.prototype.parseModuleReference = function () { - if (this.isExternalModuleReference()) { - return this.parseExternalModuleReference(); - } else { - return this.parseModuleNameModuleReference(); - } - }; - - ParserImpl.prototype.isExternalModuleReference = function () { - var token0 = this.currentToken(); - if (token0.tokenKind === 66 /* RequireKeyword */) { - return this.peekToken(1).tokenKind === 72 /* OpenParenToken */; - } - - return false; - }; - - ParserImpl.prototype.parseExternalModuleReference = function () { - var requireKeyword = this.eatKeyword(66 /* RequireKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var stringLiteral = this.eatToken(14 /* StringLiteral */); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - return this.factory.externalModuleReference(requireKeyword, openParenToken, stringLiteral, closeParenToken); - }; - - ParserImpl.prototype.parseModuleNameModuleReference = function () { - var name = this.parseName(); - return this.factory.moduleNameModuleReference(name); - }; - - ParserImpl.prototype.parseIdentifierName = function () { - var identifierName = this.eatIdentifierNameToken(); - return identifierName; - }; - - ParserImpl.prototype.tryParseTypeArgumentList = function (inExpression) { - if (this.currentToken().kind() !== 80 /* LessThanToken */) { - return null; - } - - var lessThanToken; - var greaterThanToken; - var result; - var typeArguments; - - if (!inExpression) { - lessThanToken = this.eatToken(80 /* LessThanToken */); - - result = this.parseSeparatedSyntaxList(262144 /* TypeArgumentList_Types */); - typeArguments = result.list; - lessThanToken = this.addSkippedTokensAfterToken(lessThanToken, result.skippedTokens); - - greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - - return this.factory.typeArgumentList(lessThanToken, typeArguments, greaterThanToken); - } - - var rewindPoint = this.getRewindPoint(); - - lessThanToken = this.eatToken(80 /* LessThanToken */); - - result = this.parseSeparatedSyntaxList(262144 /* TypeArgumentList_Types */); - typeArguments = result.list; - lessThanToken = this.addSkippedTokensAfterToken(lessThanToken, result.skippedTokens); - - greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - - if (greaterThanToken.fullWidth() === 0 || !this.canFollowTypeArgumentListInExpression(this.currentToken().kind())) { - this.rewind(rewindPoint); - - this.releaseRewindPoint(rewindPoint); - return null; - } else { - this.releaseRewindPoint(rewindPoint); - var typeArgumentList = this.factory.typeArgumentList(lessThanToken, typeArguments, greaterThanToken); - - return typeArgumentList; - } - }; - - ParserImpl.prototype.canFollowTypeArgumentListInExpression = function (kind) { - switch (kind) { - case 72 /* OpenParenToken */: - case 76 /* DotToken */: - - case 73 /* CloseParenToken */: - case 75 /* CloseBracketToken */: - case 106 /* ColonToken */: - case 78 /* SemicolonToken */: - case 79 /* CommaToken */: - case 105 /* QuestionToken */: - case 84 /* EqualsEqualsToken */: - case 87 /* EqualsEqualsEqualsToken */: - case 86 /* ExclamationEqualsToken */: - case 88 /* ExclamationEqualsEqualsToken */: - case 103 /* AmpersandAmpersandToken */: - case 104 /* BarBarToken */: - case 100 /* CaretToken */: - case 98 /* AmpersandToken */: - case 99 /* BarToken */: - case 71 /* CloseBraceToken */: - case 10 /* EndOfFileToken */: - return true; - - default: - return false; - } - }; - - ParserImpl.prototype.parseName = function () { - var shouldContinue = this.isIdentifier(this.currentToken()); - var current = this.eatIdentifierToken(); - - while (shouldContinue && this.currentToken().tokenKind === 76 /* DotToken */) { - var dotToken = this.eatToken(76 /* DotToken */); - - var currentToken = this.currentToken(); - var identifierName; - - if (TypeScript.SyntaxFacts.isAnyKeyword(currentToken.tokenKind) && this.previousToken().hasTrailingNewLine() && !currentToken.hasTrailingNewLine() && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(this.peekToken(1))) { - identifierName = this.createMissingToken(11 /* IdentifierName */, currentToken); - } else { - identifierName = this.eatIdentifierNameToken(); - } - - current = this.factory.qualifiedName(current, dotToken, identifierName); - - shouldContinue = identifierName.fullWidth() > 0; - } - - return current; - }; - - ParserImpl.prototype.isEnumDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 46 /* EnumKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 46 /* EnumKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseEnumDeclaration = function () { - var modifiers = this.parseModifiers(); - var enumKeyword = this.eatKeyword(46 /* EnumKeyword */); - var identifier = this.eatIdentifierToken(); - - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - var enumElements = TypeScript.Syntax.emptySeparatedList; - - if (openBraceToken.width() > 0) { - var result = this.parseSeparatedSyntaxList(256 /* EnumDeclaration_EnumElements */); - enumElements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.enumDeclaration(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken); - }; - - ParserImpl.prototype.isEnumElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().kind() === 243 /* EnumElement */) { - return true; - } - - return this.isPropertyName(this.currentToken(), inErrorRecovery); - }; - - ParserImpl.prototype.parseEnumElement = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 243 /* EnumElement */) { - return this.eatNode(); - } - - var propertyName = this.eatPropertyName(); - var equalsValueClause = null; - if (this.isEqualsValueClause(false)) { - equalsValueClause = this.parseEqualsValueClause(true); - } - - return this.factory.enumElement(propertyName, equalsValueClause); - }; - - ParserImpl.isModifier = function (token) { - switch (token.tokenKind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 58 /* StaticKeyword */: - case 47 /* ExportKeyword */: - case 63 /* DeclareKeyword */: - return true; - - default: - return false; - } - }; - - ParserImpl.prototype.modifierCount = function () { - var modifierCount = 0; - while (true) { - if (ParserImpl.isModifier(this.peekToken(modifierCount))) { - modifierCount++; - continue; - } - - break; - } - - return modifierCount; - }; - - ParserImpl.prototype.parseModifiers = function () { - var tokens = this.getArray(); - - while (true) { - if (ParserImpl.isModifier(this.currentToken())) { - tokens.push(this.eatAnyToken()); - continue; - } - - break; - } - - var result = TypeScript.Syntax.list(tokens); - - this.returnZeroOrOneLengthArray(tokens); - - return result; - }; - - ParserImpl.prototype.isClassDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 44 /* ClassKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 44 /* ClassKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseHeritageClauses = function () { - var heritageClauses = TypeScript.Syntax.emptyList; - - if (this.isHeritageClause()) { - var result = this.parseSyntaxList(1024 /* ClassOrInterfaceDeclaration_HeritageClauses */); - heritageClauses = result.list; - TypeScript.Debug.assert(result.skippedTokens.length === 0); - } - - return heritageClauses; - }; - - ParserImpl.prototype.parseClassDeclaration = function () { - var modifiers = this.parseModifiers(); - - var classKeyword = this.eatKeyword(44 /* ClassKeyword */); - var identifier = this.eatIdentifierToken(); - var typeParameterList = this.parseOptionalTypeParameterList(false); - var heritageClauses = this.parseHeritageClauses(); - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - var classElements = TypeScript.Syntax.emptyList; - - if (openBraceToken.width() > 0) { - var result = this.parseSyntaxList(2 /* ClassDeclaration_ClassElements */); - - classElements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - return this.factory.classDeclaration(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken); - }; - - ParserImpl.isPublicOrPrivateKeyword = function (token) { - return token.tokenKind === 57 /* PublicKeyword */ || token.tokenKind === 55 /* PrivateKeyword */; - }; - - ParserImpl.prototype.isAccessor = function (inErrorRecovery) { - var index = this.modifierCount(); - - if (this.peekToken(index).tokenKind !== 64 /* GetKeyword */ && this.peekToken(index).tokenKind !== 68 /* SetKeyword */) { - return false; - } - - index++; - return this.isPropertyName(this.peekToken(index), inErrorRecovery); - }; - - ParserImpl.prototype.parseAccessor = function (checkForStrictMode) { - var modifiers = this.parseModifiers(); - - if (this.currentToken().tokenKind === 64 /* GetKeyword */) { - return this.parseGetMemberAccessorDeclaration(modifiers, checkForStrictMode); - } else if (this.currentToken().tokenKind === 68 /* SetKeyword */) { - return this.parseSetMemberAccessorDeclaration(modifiers, checkForStrictMode); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseGetMemberAccessorDeclaration = function (modifiers, checkForStrictMode) { - var getKeyword = this.eatKeyword(64 /* GetKeyword */); - var propertyName = this.eatPropertyName(); - var parameterList = this.parseParameterList(); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - var block = this.parseBlock(false, checkForStrictMode); - - return this.factory.getAccessor(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block); - }; - - ParserImpl.prototype.parseSetMemberAccessorDeclaration = function (modifiers, checkForStrictMode) { - var setKeyword = this.eatKeyword(68 /* SetKeyword */); - var propertyName = this.eatPropertyName(); - var parameterList = this.parseParameterList(); - var block = this.parseBlock(false, checkForStrictMode); - - return this.factory.setAccessor(modifiers, setKeyword, propertyName, parameterList, block); - }; - - ParserImpl.prototype.isClassElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isClassElement()) { - return true; - } - - return this.isConstructorDeclaration() || this.isMemberFunctionDeclaration(inErrorRecovery) || this.isAccessor(inErrorRecovery) || this.isMemberVariableDeclaration(inErrorRecovery) || this.isIndexMemberDeclaration(); - }; - - ParserImpl.prototype.parseClassElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isClassElement()) { - return this.eatNode(); - } - - if (this.isConstructorDeclaration()) { - return this.parseConstructorDeclaration(); - } else if (this.isMemberFunctionDeclaration(inErrorRecovery)) { - return this.parseMemberFunctionDeclaration(); - } else if (this.isAccessor(inErrorRecovery)) { - return this.parseAccessor(false); - } else if (this.isMemberVariableDeclaration(inErrorRecovery)) { - return this.parseMemberVariableDeclaration(); - } else if (this.isIndexMemberDeclaration()) { - return this.parseIndexMemberDeclaration(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isConstructorDeclaration = function () { - var index = this.modifierCount(); - return this.peekToken(index).tokenKind === 62 /* ConstructorKeyword */; - }; - - ParserImpl.prototype.parseConstructorDeclaration = function () { - var modifiers = this.parseModifiers(); - var constructorKeyword = this.eatKeyword(62 /* ConstructorKeyword */); - var callSignature = this.parseCallSignature(false); - - var semicolonToken = null; - var block = null; - - if (this.isBlock()) { - block = this.parseBlock(false, true); - } else { - semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - } - - return this.factory.constructorDeclaration(modifiers, constructorKeyword, callSignature, block, semicolonToken); - }; - - ParserImpl.prototype.isMemberFunctionDeclaration = function (inErrorRecovery) { - var index = 0; - - while (true) { - var token = this.peekToken(index); - if (this.isPropertyName(token, inErrorRecovery) && this.isCallSignature(index + 1)) { - return true; - } - - if (ParserImpl.isModifier(token)) { - index++; - continue; - } - - return false; - } - }; - - ParserImpl.prototype.parseMemberFunctionDeclaration = function () { - var modifierArray = this.getArray(); - - while (true) { - var currentToken = this.currentToken(); - if (this.isPropertyName(currentToken, false) && this.isCallSignature(1)) { - break; - } - - TypeScript.Debug.assert(ParserImpl.isModifier(currentToken)); - modifierArray.push(this.eatAnyToken()); - } - - var modifiers = TypeScript.Syntax.list(modifierArray); - this.returnZeroOrOneLengthArray(modifierArray); - - var propertyName = this.eatPropertyName(); - var callSignature = this.parseCallSignature(false); - - var parseBlockEvenWithNoOpenBrace = false; - var newCallSignature = this.tryAddUnexpectedEqualsGreaterThanToken(callSignature); - if (newCallSignature !== callSignature) { - parseBlockEvenWithNoOpenBrace = true; - callSignature = newCallSignature; - } - - var block = null; - var semicolon = null; - - if (parseBlockEvenWithNoOpenBrace || this.isBlock()) { - block = this.parseBlock(parseBlockEvenWithNoOpenBrace, true); - } else { - semicolon = this.eatExplicitOrAutomaticSemicolon(false); - } - - return this.factory.memberFunctionDeclaration(modifiers, propertyName, callSignature, block, semicolon); - }; - - ParserImpl.prototype.isDefinitelyMemberVariablePropertyName = function (index) { - if (TypeScript.SyntaxFacts.isAnyKeyword(this.peekToken(index).tokenKind)) { - switch (this.peekToken(index + 1).tokenKind) { - case 78 /* SemicolonToken */: - case 107 /* EqualsToken */: - case 106 /* ColonToken */: - case 71 /* CloseBraceToken */: - case 10 /* EndOfFileToken */: - return true; - default: - return false; - } - } else { - return true; - } - }; - - ParserImpl.prototype.isMemberVariableDeclaration = function (inErrorRecovery) { - var index = 0; - - while (true) { - var token = this.peekToken(index); - if (this.isPropertyName(token, inErrorRecovery) && this.isDefinitelyMemberVariablePropertyName(index)) { - return true; - } - - if (ParserImpl.isModifier(this.peekToken(index))) { - index++; - continue; - } - - return false; - } - }; - - ParserImpl.prototype.parseMemberVariableDeclaration = function () { - var modifierArray = this.getArray(); - - while (true) { - var currentToken = this.currentToken(); - if (this.isPropertyName(currentToken, false) && this.isDefinitelyMemberVariablePropertyName(0)) { - break; - } - - TypeScript.Debug.assert(ParserImpl.isModifier(currentToken)); - modifierArray.push(this.eatAnyToken()); - } - - var modifiers = TypeScript.Syntax.list(modifierArray); - this.returnZeroOrOneLengthArray(modifierArray); - - var variableDeclarator = this.parseVariableDeclarator(true, true); - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.memberVariableDeclaration(modifiers, variableDeclarator, semicolon); - }; - - ParserImpl.prototype.isIndexMemberDeclaration = function () { - var index = this.modifierCount(); - return this.isIndexSignature(index); - }; - - ParserImpl.prototype.parseIndexMemberDeclaration = function () { - var modifiers = this.parseModifiers(); - var indexSignature = this.parseIndexSignature(); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.indexMemberDeclaration(modifiers, indexSignature, semicolonToken); - }; - - ParserImpl.prototype.tryAddUnexpectedEqualsGreaterThanToken = function (callSignature) { - var token0 = this.currentToken(); - - var hasEqualsGreaterThanToken = token0.tokenKind === 85 /* EqualsGreaterThanToken */; - if (hasEqualsGreaterThanToken) { - if (callSignature.lastToken()) { - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token0.width(), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [TypeScript.SyntaxFacts.getText(70 /* OpenBraceToken */)]); - this.addDiagnostic(diagnostic); - - var token = this.eatAnyToken(); - return this.addSkippedTokenAfterNode(callSignature, token0); - } - } - - return callSignature; - }; - - ParserImpl.prototype.isFunctionDeclaration = function () { - var index = this.modifierCount(); - return this.peekToken(index).tokenKind === 27 /* FunctionKeyword */; - }; - - ParserImpl.prototype.parseFunctionDeclaration = function () { - var modifiers = this.parseModifiers(); - var functionKeyword = this.eatKeyword(27 /* FunctionKeyword */); - var identifier = this.eatIdentifierToken(); - var callSignature = this.parseCallSignature(false); - - var parseBlockEvenWithNoOpenBrace = false; - var newCallSignature = this.tryAddUnexpectedEqualsGreaterThanToken(callSignature); - if (newCallSignature !== callSignature) { - parseBlockEvenWithNoOpenBrace = true; - callSignature = newCallSignature; - } - - var semicolonToken = null; - var block = null; - - if (parseBlockEvenWithNoOpenBrace || this.isBlock()) { - block = this.parseBlock(parseBlockEvenWithNoOpenBrace, true); - } else { - semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - } - - return this.factory.functionDeclaration(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken); - }; - - ParserImpl.prototype.isModuleDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 65 /* ModuleKeyword */) { - return true; - } - - if (this.currentToken().tokenKind === 65 /* ModuleKeyword */) { - var token1 = this.peekToken(1); - return this.isIdentifier(token1) || token1.tokenKind === 14 /* StringLiteral */; - } - - return false; - }; - - ParserImpl.prototype.parseModuleDeclaration = function () { - var modifiers = this.parseModifiers(); - var moduleKeyword = this.eatKeyword(65 /* ModuleKeyword */); - - var moduleName = null; - var stringLiteral = null; - - if (this.currentToken().tokenKind === 14 /* StringLiteral */) { - stringLiteral = this.eatToken(14 /* StringLiteral */); - } else { - moduleName = this.parseName(); - } - - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var moduleElements = TypeScript.Syntax.emptyList; - if (openBraceToken.width() > 0) { - var result = this.parseSyntaxList(4 /* ModuleDeclaration_ModuleElements */); - moduleElements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.moduleDeclaration(modifiers, moduleKeyword, moduleName, stringLiteral, openBraceToken, moduleElements, closeBraceToken); - }; - - ParserImpl.prototype.isInterfaceDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 52 /* InterfaceKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 52 /* InterfaceKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseInterfaceDeclaration = function () { - var modifiers = this.parseModifiers(); - var interfaceKeyword = this.eatKeyword(52 /* InterfaceKeyword */); - var identifier = this.eatIdentifierToken(); - var typeParameterList = this.parseOptionalTypeParameterList(false); - var heritageClauses = this.parseHeritageClauses(); - - var objectType = this.parseObjectType(); - return this.factory.interfaceDeclaration(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, objectType); - }; - - ParserImpl.prototype.parseObjectType = function () { - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var typeMembers = TypeScript.Syntax.emptySeparatedList; - if (openBraceToken.width() > 0) { - var result = this.parseSeparatedSyntaxList(512 /* ObjectType_TypeMembers */); - typeMembers = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - return this.factory.objectType(openBraceToken, typeMembers, closeBraceToken); - }; - - ParserImpl.prototype.isTypeMember = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isTypeMember()) { - return true; - } - - return this.isCallSignature(0) || this.isConstructSignature() || this.isIndexSignature(0) || this.isMethodSignature(inErrorRecovery) || this.isPropertySignature(inErrorRecovery); - }; - - ParserImpl.prototype.parseTypeMember = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isTypeMember()) { - return this.eatNode(); - } - - if (this.isCallSignature(0)) { - return this.parseCallSignature(false); - } else if (this.isConstructSignature()) { - return this.parseConstructSignature(); - } else if (this.isIndexSignature(0)) { - return this.parseIndexSignature(); - } else if (this.isMethodSignature(inErrorRecovery)) { - return this.parseMethodSignature(); - } else if (this.isPropertySignature(inErrorRecovery)) { - return this.parsePropertySignature(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseConstructSignature = function () { - var newKeyword = this.eatKeyword(31 /* NewKeyword */); - var callSignature = this.parseCallSignature(false); - - return this.factory.constructSignature(newKeyword, callSignature); - }; - - ParserImpl.prototype.parseIndexSignature = function () { - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - var parameter = this.parseParameter(); - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - - return this.factory.indexSignature(openBracketToken, parameter, closeBracketToken, typeAnnotation); - }; - - ParserImpl.prototype.parseMethodSignature = function () { - var propertyName = this.eatPropertyName(); - var questionToken = this.tryEatToken(105 /* QuestionToken */); - var callSignature = this.parseCallSignature(false); - - return this.factory.methodSignature(propertyName, questionToken, callSignature); - }; - - ParserImpl.prototype.parsePropertySignature = function () { - var propertyName = this.eatPropertyName(); - var questionToken = this.tryEatToken(105 /* QuestionToken */); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - - return this.factory.propertySignature(propertyName, questionToken, typeAnnotation); - }; - - ParserImpl.prototype.isCallSignature = function (tokenIndex) { - var tokenKind = this.peekToken(tokenIndex).tokenKind; - return tokenKind === 72 /* OpenParenToken */ || tokenKind === 80 /* LessThanToken */; - }; - - ParserImpl.prototype.isConstructSignature = function () { - if (this.currentToken().tokenKind !== 31 /* NewKeyword */) { - return false; - } - - var token1 = this.peekToken(1); - return token1.tokenKind === 80 /* LessThanToken */ || token1.tokenKind === 72 /* OpenParenToken */; - }; - - ParserImpl.prototype.isIndexSignature = function (tokenIndex) { - return this.peekToken(tokenIndex).tokenKind === 74 /* OpenBracketToken */; - }; - - ParserImpl.prototype.isMethodSignature = function (inErrorRecovery) { - if (this.isPropertyName(this.currentToken(), inErrorRecovery)) { - if (this.isCallSignature(1)) { - return true; - } - - if (this.peekToken(1).tokenKind === 105 /* QuestionToken */ && this.isCallSignature(2)) { - return true; - } - } - - return false; - }; - - ParserImpl.prototype.isPropertySignature = function (inErrorRecovery) { - var currentToken = this.currentToken(); - - if (ParserImpl.isModifier(currentToken) && !currentToken.hasTrailingNewLine() && this.isPropertyName(this.peekToken(1), inErrorRecovery)) { - return false; - } - - return this.isPropertyName(currentToken, inErrorRecovery); - }; - - ParserImpl.prototype.isHeritageClause = function () { - var token0 = this.currentToken(); - return token0.tokenKind === 48 /* ExtendsKeyword */ || token0.tokenKind === 51 /* ImplementsKeyword */; - }; - - ParserImpl.prototype.isNotHeritageClauseTypeName = function () { - if (this.currentToken().tokenKind === 51 /* ImplementsKeyword */ || this.currentToken().tokenKind === 48 /* ExtendsKeyword */) { - return this.isIdentifier(this.peekToken(1)); - } - - return false; - }; - - ParserImpl.prototype.isHeritageClauseTypeName = function () { - if (this.isIdentifier(this.currentToken())) { - return !this.isNotHeritageClauseTypeName(); - } - - return false; - }; - - ParserImpl.prototype.parseHeritageClause = function () { - var extendsOrImplementsKeyword = this.eatAnyToken(); - TypeScript.Debug.assert(extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */ || extendsOrImplementsKeyword.tokenKind === 51 /* ImplementsKeyword */); - - var result = this.parseSeparatedSyntaxList(2048 /* HeritageClause_TypeNameList */); - var typeNames = result.list; - extendsOrImplementsKeyword = this.addSkippedTokensAfterToken(extendsOrImplementsKeyword, result.skippedTokens); - - return this.factory.heritageClause(extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */ ? 230 /* ExtendsHeritageClause */ : 231 /* ImplementsHeritageClause */, extendsOrImplementsKeyword, typeNames); - }; - - ParserImpl.prototype.isStatement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isStatement()) { - return true; - } - - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - switch (currentTokenKind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 58 /* StaticKeyword */: - var token1 = this.peekToken(1); - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { - return false; - } - - break; - - case 28 /* IfKeyword */: - case 70 /* OpenBraceToken */: - case 33 /* ReturnKeyword */: - case 34 /* SwitchKeyword */: - case 36 /* ThrowKeyword */: - case 15 /* BreakKeyword */: - case 18 /* ContinueKeyword */: - case 26 /* ForKeyword */: - case 42 /* WhileKeyword */: - case 43 /* WithKeyword */: - case 22 /* DoKeyword */: - case 38 /* TryKeyword */: - case 19 /* DebuggerKeyword */: - return true; - } - - if (this.isInterfaceDeclaration(0) || this.isClassDeclaration(0) || this.isEnumDeclaration(0) || this.isModuleDeclaration(0)) { - return false; - } - - return this.isLabeledStatement(currentToken) || this.isVariableStatement() || this.isFunctionDeclaration() || this.isEmptyStatement(currentToken, inErrorRecovery) || this.isExpressionStatement(currentToken); - }; - - ParserImpl.prototype.parseStatement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isStatement()) { - return this.eatNode(); - } - - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - - switch (currentTokenKind) { - case 28 /* IfKeyword */: - return this.parseIfStatement(); - case 70 /* OpenBraceToken */: - return this.parseBlock(false, false); - case 33 /* ReturnKeyword */: - return this.parseReturnStatement(); - case 34 /* SwitchKeyword */: - return this.parseSwitchStatement(); - case 36 /* ThrowKeyword */: - return this.parseThrowStatement(); - case 15 /* BreakKeyword */: - return this.parseBreakStatement(); - case 18 /* ContinueKeyword */: - return this.parseContinueStatement(); - case 26 /* ForKeyword */: - return this.parseForOrForInStatement(); - case 42 /* WhileKeyword */: - return this.parseWhileStatement(); - case 43 /* WithKeyword */: - return this.parseWithStatement(); - case 22 /* DoKeyword */: - return this.parseDoStatement(); - case 38 /* TryKeyword */: - return this.parseTryStatement(); - case 19 /* DebuggerKeyword */: - return this.parseDebuggerStatement(); - } - - if (this.isVariableStatement()) { - return this.parseVariableStatement(); - } else if (this.isLabeledStatement(currentToken)) { - return this.parseLabeledStatement(); - } else if (this.isFunctionDeclaration()) { - return this.parseFunctionDeclaration(); - } else if (this.isEmptyStatement(currentToken, inErrorRecovery)) { - return this.parseEmptyStatement(); - } else { - return this.parseExpressionStatement(); - } - }; - - ParserImpl.prototype.parseDebuggerStatement = function () { - var debuggerKeyword = this.eatKeyword(19 /* DebuggerKeyword */); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.debuggerStatement(debuggerKeyword, semicolonToken); - }; - - ParserImpl.prototype.parseDoStatement = function () { - var doKeyword = this.eatKeyword(22 /* DoKeyword */); - var statement = this.parseStatement(false); - var whileKeyword = this.eatKeyword(42 /* WhileKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(true); - - return this.factory.doStatement(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - }; - - ParserImpl.prototype.isLabeledStatement = function (currentToken) { - return this.isIdentifier(currentToken) && this.peekToken(1).tokenKind === 106 /* ColonToken */; - }; - - ParserImpl.prototype.parseLabeledStatement = function () { - var identifier = this.eatIdentifierToken(); - var colonToken = this.eatToken(106 /* ColonToken */); - var statement = this.parseStatement(false); - - return this.factory.labeledStatement(identifier, colonToken, statement); - }; - - ParserImpl.prototype.parseTryStatement = function () { - var tryKeyword = this.eatKeyword(38 /* TryKeyword */); - - var savedListParsingState = this.listParsingState; - this.listParsingState |= 64 /* TryBlock_Statements */; - var block = this.parseBlock(false, false); - this.listParsingState = savedListParsingState; - - var catchClause = null; - if (this.isCatchClause()) { - catchClause = this.parseCatchClause(); - } - - var finallyClause = null; - if (catchClause === null || this.isFinallyClause()) { - finallyClause = this.parseFinallyClause(); - } - - return this.factory.tryStatement(tryKeyword, block, catchClause, finallyClause); - }; - - ParserImpl.prototype.isCatchClause = function () { - return this.currentToken().tokenKind === 17 /* CatchKeyword */; - }; - - ParserImpl.prototype.parseCatchClause = function () { - var catchKeyword = this.eatKeyword(17 /* CatchKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var identifier = this.eatIdentifierToken(); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - var savedListParsingState = this.listParsingState; - this.listParsingState |= 128 /* CatchBlock_Statements */; - var block = this.parseBlock(false, false); - this.listParsingState = savedListParsingState; - - return this.factory.catchClause(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block); - }; - - ParserImpl.prototype.isFinallyClause = function () { - return this.currentToken().tokenKind === 25 /* FinallyKeyword */; - }; - - ParserImpl.prototype.parseFinallyClause = function () { - var finallyKeyword = this.eatKeyword(25 /* FinallyKeyword */); - var block = this.parseBlock(false, false); - - return this.factory.finallyClause(finallyKeyword, block); - }; - - ParserImpl.prototype.parseWithStatement = function () { - var withKeyword = this.eatKeyword(43 /* WithKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.withStatement(withKeyword, openParenToken, condition, closeParenToken, statement); - }; - - ParserImpl.prototype.parseWhileStatement = function () { - var whileKeyword = this.eatKeyword(42 /* WhileKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.whileStatement(whileKeyword, openParenToken, condition, closeParenToken, statement); - }; - - ParserImpl.prototype.isEmptyStatement = function (currentToken, inErrorRecovery) { - if (inErrorRecovery) { - return false; - } - - return currentToken.tokenKind === 78 /* SemicolonToken */; - }; - - ParserImpl.prototype.parseEmptyStatement = function () { - var semicolonToken = this.eatToken(78 /* SemicolonToken */); - return this.factory.emptyStatement(semicolonToken); - }; - - ParserImpl.prototype.parseForOrForInStatement = function () { - var forKeyword = this.eatKeyword(26 /* ForKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - - var currentToken = this.currentToken(); - if (currentToken.tokenKind === 40 /* VarKeyword */) { - return this.parseForOrForInStatementWithVariableDeclaration(forKeyword, openParenToken); - } else if (currentToken.tokenKind === 78 /* SemicolonToken */) { - return this.parseForStatementWithNoVariableDeclarationOrInitializer(forKeyword, openParenToken); - } else { - return this.parseForOrForInStatementWithInitializer(forKeyword, openParenToken); - } - }; - - ParserImpl.prototype.parseForOrForInStatementWithVariableDeclaration = function (forKeyword, openParenToken) { - var variableDeclaration = this.parseVariableDeclaration(false); - - if (this.currentToken().tokenKind === 29 /* InKeyword */) { - return this.parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, null); - } - - return this.parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, null); - }; - - ParserImpl.prototype.parseForInStatementWithVariableDeclarationOrInitializer = function (forKeyword, openParenToken, variableDeclaration, initializer) { - var inKeyword = this.eatKeyword(29 /* InKeyword */); - var expression = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.forInStatement(forKeyword, openParenToken, variableDeclaration, initializer, inKeyword, expression, closeParenToken, statement); - }; - - ParserImpl.prototype.parseForOrForInStatementWithInitializer = function (forKeyword, openParenToken) { - var initializer = this.parseExpression(false); - if (this.currentToken().tokenKind === 29 /* InKeyword */) { - return this.parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, initializer); - } else { - return this.parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, initializer); - } - }; - - ParserImpl.prototype.parseForStatementWithNoVariableDeclarationOrInitializer = function (forKeyword, openParenToken) { - return this.parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, null); - }; - - ParserImpl.prototype.parseForStatementWithVariableDeclarationOrInitializer = function (forKeyword, openParenToken, variableDeclaration, initializer) { - var firstSemicolonToken = this.eatToken(78 /* SemicolonToken */); - - var condition = null; - if (this.currentToken().tokenKind !== 78 /* SemicolonToken */ && this.currentToken().tokenKind !== 73 /* CloseParenToken */ && this.currentToken().tokenKind !== 10 /* EndOfFileToken */) { - condition = this.parseExpression(true); - } - - var secondSemicolonToken = this.eatToken(78 /* SemicolonToken */); - - var incrementor = null; - if (this.currentToken().tokenKind !== 73 /* CloseParenToken */ && this.currentToken().tokenKind !== 10 /* EndOfFileToken */) { - incrementor = this.parseExpression(true); - } - - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.forStatement(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement); - }; - - ParserImpl.prototype.parseBreakStatement = function () { - var breakKeyword = this.eatKeyword(15 /* BreakKeyword */); - - var identifier = null; - if (!this.canEatExplicitOrAutomaticSemicolon(false)) { - if (this.isIdentifier(this.currentToken())) { - identifier = this.eatIdentifierToken(); - } - } - - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - return this.factory.breakStatement(breakKeyword, identifier, semicolon); - }; - - ParserImpl.prototype.parseContinueStatement = function () { - var continueKeyword = this.eatKeyword(18 /* ContinueKeyword */); - - var identifier = null; - if (!this.canEatExplicitOrAutomaticSemicolon(false)) { - if (this.isIdentifier(this.currentToken())) { - identifier = this.eatIdentifierToken(); - } - } - - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - return this.factory.continueStatement(continueKeyword, identifier, semicolon); - }; - - ParserImpl.prototype.parseSwitchStatement = function () { - var switchKeyword = this.eatKeyword(34 /* SwitchKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var expression = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var switchClauses = TypeScript.Syntax.emptyList; - if (openBraceToken.width() > 0) { - var result = this.parseSyntaxList(8 /* SwitchStatement_SwitchClauses */); - switchClauses = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - return this.factory.switchStatement(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken); - }; - - ParserImpl.prototype.isCaseSwitchClause = function () { - return this.currentToken().tokenKind === 16 /* CaseKeyword */; - }; - - ParserImpl.prototype.isDefaultSwitchClause = function () { - return this.currentToken().tokenKind === 20 /* DefaultKeyword */; - }; - - ParserImpl.prototype.isSwitchClause = function () { - if (this.currentNode() !== null && this.currentNode().isSwitchClause()) { - return true; - } - - return this.isCaseSwitchClause() || this.isDefaultSwitchClause(); - }; - - ParserImpl.prototype.parseSwitchClause = function () { - if (this.currentNode() !== null && this.currentNode().isSwitchClause()) { - return this.eatNode(); - } - - if (this.isCaseSwitchClause()) { - return this.parseCaseSwitchClause(); - } else if (this.isDefaultSwitchClause()) { - return this.parseDefaultSwitchClause(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseCaseSwitchClause = function () { - var caseKeyword = this.eatKeyword(16 /* CaseKeyword */); - var expression = this.parseExpression(true); - var colonToken = this.eatToken(106 /* ColonToken */); - var statements = TypeScript.Syntax.emptyList; - - if (colonToken.fullWidth() > 0) { - var result = this.parseSyntaxList(16 /* SwitchClause_Statements */); - statements = result.list; - colonToken = this.addSkippedTokensAfterToken(colonToken, result.skippedTokens); - } - - return this.factory.caseSwitchClause(caseKeyword, expression, colonToken, statements); - }; - - ParserImpl.prototype.parseDefaultSwitchClause = function () { - var defaultKeyword = this.eatKeyword(20 /* DefaultKeyword */); - var colonToken = this.eatToken(106 /* ColonToken */); - var statements = TypeScript.Syntax.emptyList; - - if (colonToken.fullWidth() > 0) { - var result = this.parseSyntaxList(16 /* SwitchClause_Statements */); - statements = result.list; - colonToken = this.addSkippedTokensAfterToken(colonToken, result.skippedTokens); - } - - return this.factory.defaultSwitchClause(defaultKeyword, colonToken, statements); - }; - - ParserImpl.prototype.parseThrowStatement = function () { - var throwKeyword = this.eatKeyword(36 /* ThrowKeyword */); - - var expression = null; - if (this.canEatExplicitOrAutomaticSemicolon(false)) { - var token = this.createMissingToken(11 /* IdentifierName */, null); - expression = token; - } else { - expression = this.parseExpression(true); - } - - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.throwStatement(throwKeyword, expression, semicolonToken); - }; - - ParserImpl.prototype.parseReturnStatement = function () { - var returnKeyword = this.eatKeyword(33 /* ReturnKeyword */); - - var expression = null; - if (!this.canEatExplicitOrAutomaticSemicolon(false)) { - expression = this.parseExpression(true); - } - - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.returnStatement(returnKeyword, expression, semicolonToken); - }; - - ParserImpl.prototype.isExpressionStatement = function (currentToken) { - var kind = currentToken.tokenKind; - if (kind === 70 /* OpenBraceToken */ || kind === 27 /* FunctionKeyword */) { - return false; - } - - return this.isExpression(currentToken); - }; - - ParserImpl.prototype.isAssignmentOrOmittedExpression = function () { - var currentToken = this.currentToken(); - if (currentToken.tokenKind === 79 /* CommaToken */) { - return true; - } - - return this.isExpression(currentToken); - }; - - ParserImpl.prototype.parseAssignmentOrOmittedExpression = function () { - if (this.currentToken().tokenKind === 79 /* CommaToken */) { - return this.factory.omittedExpression(); - } - - return this.parseAssignmentExpression(true); - }; - - ParserImpl.prototype.isExpression = function (currentToken) { - switch (currentToken.tokenKind) { - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 12 /* RegularExpressionLiteral */: - - case 74 /* OpenBracketToken */: - - case 72 /* OpenParenToken */: - - case 80 /* LessThanToken */: - - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - case 89 /* PlusToken */: - case 90 /* MinusToken */: - case 102 /* TildeToken */: - case 101 /* ExclamationToken */: - - case 70 /* OpenBraceToken */: - - case 85 /* EqualsGreaterThanToken */: - - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - - case 50 /* SuperKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - - case 31 /* NewKeyword */: - - case 21 /* DeleteKeyword */: - case 41 /* VoidKeyword */: - case 39 /* TypeOfKeyword */: - - case 27 /* FunctionKeyword */: - return true; - } - - return this.isIdentifier(currentToken); - }; - - ParserImpl.prototype.parseExpressionStatement = function () { - var expression = this.parseExpression(true); - - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.expressionStatement(expression, semicolon); - }; - - ParserImpl.prototype.parseIfStatement = function () { - var ifKeyword = this.eatKeyword(28 /* IfKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - var elseClause = null; - if (this.isElseClause()) { - elseClause = this.parseElseClause(); - } - - return this.factory.ifStatement(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause); - }; - - ParserImpl.prototype.isElseClause = function () { - return this.currentToken().tokenKind === 23 /* ElseKeyword */; - }; - - ParserImpl.prototype.parseElseClause = function () { - var elseKeyword = this.eatKeyword(23 /* ElseKeyword */); - var statement = this.parseStatement(false); - - return this.factory.elseClause(elseKeyword, statement); - }; - - ParserImpl.prototype.isVariableStatement = function () { - var index = this.modifierCount(); - return this.peekToken(index).tokenKind === 40 /* VarKeyword */; - }; - - ParserImpl.prototype.parseVariableStatement = function () { - var modifiers = this.parseModifiers(); - var variableDeclaration = this.parseVariableDeclaration(true); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.variableStatement(modifiers, variableDeclaration, semicolonToken); - }; - - ParserImpl.prototype.parseVariableDeclaration = function (allowIn) { - var varKeyword = this.eatKeyword(40 /* VarKeyword */); - - var listParsingState = allowIn ? 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */ : 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */; - - var result = this.parseSeparatedSyntaxList(listParsingState); - var variableDeclarators = result.list; - varKeyword = this.addSkippedTokensAfterToken(varKeyword, result.skippedTokens); - - return this.factory.variableDeclaration(varKeyword, variableDeclarators); - }; - - ParserImpl.prototype.isVariableDeclarator = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 225 /* VariableDeclarator */) { - return true; - } - - return this.isIdentifier(this.currentToken()); - }; - - ParserImpl.prototype.canReuseVariableDeclaratorNode = function (node) { - if (node === null || node.kind() !== 225 /* VariableDeclarator */) { - return false; - } - - var variableDeclarator = node; - return variableDeclarator.equalsValueClause === null; - }; - - ParserImpl.prototype.parseVariableDeclarator = function (allowIn, allowPropertyName) { - if (this.canReuseVariableDeclaratorNode(this.currentNode())) { - return this.eatNode(); - } - - var propertyName = allowPropertyName ? this.eatPropertyName() : this.eatIdentifierToken(); - var equalsValueClause = null; - var typeAnnotation = null; - - if (propertyName.width() > 0) { - typeAnnotation = this.parseOptionalTypeAnnotation(false); - - if (this.isEqualsValueClause(false)) { - equalsValueClause = this.parseEqualsValueClause(allowIn); - } - } - - return this.factory.variableDeclarator(propertyName, typeAnnotation, equalsValueClause); - }; - - ParserImpl.prototype.isColonValueClause = function () { - return this.currentToken().tokenKind === 106 /* ColonToken */; - }; - - ParserImpl.prototype.isEqualsValueClause = function (inParameter) { - var token0 = this.currentToken(); - if (token0.tokenKind === 107 /* EqualsToken */) { - return true; - } - - if (!this.previousToken().hasTrailingNewLine()) { - if (token0.tokenKind === 85 /* EqualsGreaterThanToken */) { - return false; - } - - if (token0.tokenKind === 70 /* OpenBraceToken */ && inParameter) { - return false; - } - - return this.isExpression(token0); - } - - return false; - }; - - ParserImpl.prototype.parseEqualsValueClause = function (allowIn) { - var equalsToken = this.eatToken(107 /* EqualsToken */); - var value = this.parseAssignmentExpression(allowIn); - - return this.factory.equalsValueClause(equalsToken, value); - }; - - ParserImpl.prototype.parseExpression = function (allowIn) { - return this.parseSubExpression(0, allowIn); - }; - - ParserImpl.prototype.parseAssignmentExpression = function (allowIn) { - return this.parseSubExpression(2 /* AssignmentExpressionPrecedence */, allowIn); - }; - - ParserImpl.prototype.parseUnaryExpressionOrLower = function () { - var currentTokenKind = this.currentToken().tokenKind; - if (TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(currentTokenKind)) { - var operatorKind = TypeScript.SyntaxFacts.getPrefixUnaryExpressionFromOperatorToken(currentTokenKind); - - var operatorToken = this.eatAnyToken(); - - var operand = this.parseUnaryExpressionOrLower(); - return this.factory.prefixUnaryExpression(operatorKind, operatorToken, operand); - } else if (currentTokenKind === 39 /* TypeOfKeyword */) { - return this.parseTypeOfExpression(); - } else if (currentTokenKind === 41 /* VoidKeyword */) { - return this.parseVoidExpression(); - } else if (currentTokenKind === 21 /* DeleteKeyword */) { - return this.parseDeleteExpression(); - } else if (currentTokenKind === 80 /* LessThanToken */) { - return this.parseCastExpression(); - } else { - return this.parsePostfixExpressionOrLower(); - } - }; - - ParserImpl.prototype.parseSubExpression = function (precedence, allowIn) { - if (precedence <= 2 /* AssignmentExpressionPrecedence */) { - if (this.isSimpleArrowFunctionExpression()) { - return this.parseSimpleArrowFunctionExpression(); - } - - var parethesizedArrowFunction = this.tryParseParenthesizedArrowFunctionExpression(); - if (parethesizedArrowFunction !== null) { - return parethesizedArrowFunction; - } - } - - var leftOperand = this.parseUnaryExpressionOrLower(); - return this.parseBinaryOrConditionalExpressions(precedence, allowIn, leftOperand); - }; - - ParserImpl.prototype.parseBinaryOrConditionalExpressions = function (precedence, allowIn, leftOperand) { - while (true) { - var token0 = this.currentToken(); - var token0Kind = token0.tokenKind; - - if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(token0Kind)) { - if (token0Kind === 29 /* InKeyword */ && !allowIn) { - break; - } - - var mergedToken = this.tryMergeBinaryExpressionTokens(); - var tokenKind = mergedToken === null ? token0Kind : mergedToken.syntaxKind; - - var binaryExpressionKind = TypeScript.SyntaxFacts.getBinaryExpressionFromOperatorToken(tokenKind); - var newPrecedence = ParserImpl.getPrecedence(binaryExpressionKind); - - if (newPrecedence < precedence) { - break; - } - - if (newPrecedence === precedence && !this.isRightAssociative(binaryExpressionKind)) { - break; - } - - var operatorToken = mergedToken === null ? token0 : TypeScript.Syntax.token(mergedToken.syntaxKind).withLeadingTrivia(token0.leadingTrivia()).withTrailingTrivia(this.peekToken(mergedToken.tokenCount - 1).trailingTrivia()); - - var skipCount = mergedToken === null ? 1 : mergedToken.tokenCount; - for (var i = 0; i < skipCount; i++) { - this.eatAnyToken(); - } - - leftOperand = this.factory.binaryExpression(binaryExpressionKind, leftOperand, operatorToken, this.parseSubExpression(newPrecedence, allowIn)); - continue; - } - - if (token0Kind === 105 /* QuestionToken */ && precedence <= 3 /* ConditionalExpressionPrecedence */) { - var questionToken = this.eatToken(105 /* QuestionToken */); - - var whenTrueExpression = this.parseAssignmentExpression(allowIn); - var colon = this.eatToken(106 /* ColonToken */); - - var whenFalseExpression = this.parseAssignmentExpression(allowIn); - leftOperand = this.factory.conditionalExpression(leftOperand, questionToken, whenTrueExpression, colon, whenFalseExpression); - continue; - } - - break; - } - - return leftOperand; - }; - - ParserImpl.prototype.tryMergeBinaryExpressionTokens = function () { - var token0 = this.currentToken(); - - if (token0.tokenKind === 81 /* GreaterThanToken */ && !token0.hasTrailingTrivia()) { - var storage = this.mergeTokensStorage; - storage[0] = 0 /* None */; - storage[1] = 0 /* None */; - storage[2] = 0 /* None */; - - for (var i = 0; i < storage.length; i++) { - var nextToken = this.peekToken(i + 1); - - if (!nextToken.hasLeadingTrivia()) { - storage[i] = nextToken.tokenKind; - } - - if (nextToken.hasTrailingTrivia()) { - break; - } - } - - if (storage[0] === 81 /* GreaterThanToken */) { - if (storage[1] === 81 /* GreaterThanToken */) { - if (storage[2] === 107 /* EqualsToken */) { - return { tokenCount: 4, syntaxKind: 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */ }; - } else { - return { tokenCount: 3, syntaxKind: 97 /* GreaterThanGreaterThanGreaterThanToken */ }; - } - } else if (storage[1] === 107 /* EqualsToken */) { - return { tokenCount: 3, syntaxKind: 113 /* GreaterThanGreaterThanEqualsToken */ }; - } else { - return { tokenCount: 2, syntaxKind: 96 /* GreaterThanGreaterThanToken */ }; - } - } else if (storage[0] === 107 /* EqualsToken */) { - return { tokenCount: 2, syntaxKind: 83 /* GreaterThanEqualsToken */ }; - } - } - - return null; - }; - - ParserImpl.prototype.isRightAssociative = function (expressionKind) { - switch (expressionKind) { - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - return true; - default: - return false; - } - }; - - ParserImpl.prototype.parseMemberExpressionOrLower = function (inObjectCreation) { - if (this.currentToken().tokenKind === 31 /* NewKeyword */) { - return this.parseObjectCreationExpression(); - } - - var expression = this.parsePrimaryExpression(); - if (expression === null) { - return this.eatIdentifierToken(); - } - - return this.parseMemberExpressionRest(expression, false, inObjectCreation); - }; - - ParserImpl.prototype.parseCallExpressionOrLower = function () { - var expression; - if (this.currentToken().tokenKind === 50 /* SuperKeyword */) { - expression = this.eatKeyword(50 /* SuperKeyword */); - - var currentTokenKind = this.currentToken().tokenKind; - if (currentTokenKind !== 72 /* OpenParenToken */ && currentTokenKind !== 76 /* DotToken */) { - expression = this.factory.memberAccessExpression(expression, this.eatToken(76 /* DotToken */), this.eatIdentifierNameToken()); - } - } else { - expression = this.parseMemberExpressionOrLower(false); - } - - return this.parseMemberExpressionRest(expression, true, false); - }; - - ParserImpl.prototype.parseMemberExpressionRest = function (expression, allowArguments, inObjectCreation) { - while (true) { - var currentTokenKind = this.currentToken().tokenKind; - - switch (currentTokenKind) { - case 72 /* OpenParenToken */: - if (!allowArguments) { - return expression; - } - - expression = this.factory.invocationExpression(expression, this.parseArgumentList(null)); - continue; - - case 80 /* LessThanToken */: - if (!allowArguments) { - return expression; - } - - var argumentList = this.tryParseArgumentList(); - if (argumentList !== null) { - expression = this.factory.invocationExpression(expression, argumentList); - continue; - } - - break; - - case 74 /* OpenBracketToken */: - expression = this.parseElementAccessExpression(expression, inObjectCreation); - continue; - - case 76 /* DotToken */: - expression = this.factory.memberAccessExpression(expression, this.eatToken(76 /* DotToken */), this.eatIdentifierNameToken()); - continue; - } - - return expression; - } - }; - - ParserImpl.prototype.parseLeftHandSideExpressionOrLower = function () { - if (this.currentToken().tokenKind === 31 /* NewKeyword */) { - return this.parseObjectCreationExpression(); - } else { - return this.parseCallExpressionOrLower(); - } - }; - - ParserImpl.prototype.parsePostfixExpressionOrLower = function () { - var expression = this.parseLeftHandSideExpressionOrLower(); - if (expression === null) { - return this.eatIdentifierToken(); - } - - var currentTokenKind = this.currentToken().tokenKind; - - switch (currentTokenKind) { - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - if (this.previousToken() !== null && this.previousToken().hasTrailingNewLine()) { - break; - } - - return this.factory.postfixUnaryExpression(TypeScript.SyntaxFacts.getPostfixUnaryExpressionFromOperatorToken(currentTokenKind), expression, this.eatAnyToken()); - } - - return expression; - }; - - ParserImpl.prototype.tryParseGenericArgumentList = function () { - var rewindPoint = this.getRewindPoint(); - - var typeArgumentList = this.tryParseTypeArgumentList(true); - var token0 = this.currentToken(); - - var isOpenParen = token0.tokenKind === 72 /* OpenParenToken */; - var isDot = token0.tokenKind === 76 /* DotToken */; - var isOpenParenOrDot = isOpenParen || isDot; - - var argumentList = null; - if (typeArgumentList === null || !isOpenParenOrDot) { - this.rewind(rewindPoint); - this.releaseRewindPoint(rewindPoint); - return null; - } else { - this.releaseRewindPoint(rewindPoint); - - if (isDot) { - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token0.width(), TypeScript.DiagnosticCode.A_parameter_list_must_follow_a_generic_type_argument_list_expected, null); - this.addDiagnostic(diagnostic); - - return this.factory.argumentList(typeArgumentList, TypeScript.Syntax.emptyToken(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.emptyToken(73 /* CloseParenToken */)); - } else { - return this.parseArgumentList(typeArgumentList); - } - } - }; - - ParserImpl.prototype.tryParseArgumentList = function () { - if (this.currentToken().tokenKind === 80 /* LessThanToken */) { - return this.tryParseGenericArgumentList(); - } - - if (this.currentToken().tokenKind === 72 /* OpenParenToken */) { - return this.parseArgumentList(null); - } - - return null; - }; - - ParserImpl.prototype.parseArgumentList = function (typeArgumentList) { - var openParenToken = this.eatToken(72 /* OpenParenToken */); - - var _arguments = TypeScript.Syntax.emptySeparatedList; - - if (openParenToken.fullWidth() > 0) { - var result = this.parseSeparatedSyntaxList(16384 /* ArgumentList_AssignmentExpressions */); - _arguments = result.list; - openParenToken = this.addSkippedTokensAfterToken(openParenToken, result.skippedTokens); - } - - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - return this.factory.argumentList(typeArgumentList, openParenToken, _arguments, closeParenToken); - }; - - ParserImpl.prototype.parseElementAccessExpression = function (expression, inObjectCreation) { - var start = this.currentTokenStart(); - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - var argumentExpression; - - if (this.currentToken().tokenKind === 75 /* CloseBracketToken */ && inObjectCreation) { - var end = this.currentTokenStart() + this.currentToken().width(); - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, start, end - start, TypeScript.DiagnosticCode.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead, null); - this.addDiagnostic(diagnostic); - - argumentExpression = TypeScript.Syntax.emptyToken(11 /* IdentifierName */); - } else { - argumentExpression = this.parseExpression(true); - } - - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - - return this.factory.elementAccessExpression(expression, openBracketToken, argumentExpression, closeBracketToken); - }; - - ParserImpl.prototype.parsePrimaryExpression = function () { - var currentToken = this.currentToken(); - - if (this.isIdentifier(currentToken)) { - return this.eatIdentifierToken(); - } - - var currentTokenKind = currentToken.tokenKind; - switch (currentTokenKind) { - case 35 /* ThisKeyword */: - return this.parseThisExpression(); - - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - return this.parseLiteralExpression(); - - case 32 /* NullKeyword */: - return this.parseLiteralExpression(); - - case 27 /* FunctionKeyword */: - return this.parseFunctionExpression(); - - case 13 /* NumericLiteral */: - return this.parseLiteralExpression(); - - case 12 /* RegularExpressionLiteral */: - return this.parseLiteralExpression(); - - case 14 /* StringLiteral */: - return this.parseLiteralExpression(); - - case 74 /* OpenBracketToken */: - return this.parseArrayLiteralExpression(); - - case 70 /* OpenBraceToken */: - return this.parseObjectLiteralExpression(); - - case 72 /* OpenParenToken */: - return this.parseParenthesizedExpression(); - - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - var result = this.tryReparseDivideAsRegularExpression(); - if (result !== null) { - return result; - } - break; - } - - return null; - }; - - ParserImpl.prototype.tryReparseDivideAsRegularExpression = function () { - var currentToken = this.currentToken(); - - if (this.previousToken() !== null) { - var previousTokenKind = this.previousToken().tokenKind; - switch (previousTokenKind) { - case 11 /* IdentifierName */: - return null; - - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - return null; - - case 14 /* StringLiteral */: - case 13 /* NumericLiteral */: - case 12 /* RegularExpressionLiteral */: - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - case 75 /* CloseBracketToken */: - return null; - } - } - - currentToken = this.currentTokenAllowingRegularExpression(); - - if (currentToken.tokenKind === 118 /* SlashToken */ || currentToken.tokenKind === 119 /* SlashEqualsToken */) { - return null; - } else if (currentToken.tokenKind === 12 /* RegularExpressionLiteral */) { - return this.parseLiteralExpression(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseTypeOfExpression = function () { - var typeOfKeyword = this.eatKeyword(39 /* TypeOfKeyword */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.typeOfExpression(typeOfKeyword, expression); - }; - - ParserImpl.prototype.parseDeleteExpression = function () { - var deleteKeyword = this.eatKeyword(21 /* DeleteKeyword */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.deleteExpression(deleteKeyword, expression); - }; - - ParserImpl.prototype.parseVoidExpression = function () { - var voidKeyword = this.eatKeyword(41 /* VoidKeyword */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.voidExpression(voidKeyword, expression); - }; - - ParserImpl.prototype.parseFunctionExpression = function () { - var functionKeyword = this.eatKeyword(27 /* FunctionKeyword */); - var identifier = null; - - if (this.isIdentifier(this.currentToken())) { - identifier = this.eatIdentifierToken(); - } - - var callSignature = this.parseCallSignature(false); - var block = this.parseBlock(false, true); - - return this.factory.functionExpression(functionKeyword, identifier, callSignature, block); - }; - - ParserImpl.prototype.parseObjectCreationExpression = function () { - var newKeyword = this.eatKeyword(31 /* NewKeyword */); - - var expression = this.parseObjectCreationExpressionOrLower(true); - var argumentList = this.tryParseArgumentList(); - - var result = this.factory.objectCreationExpression(newKeyword, expression, argumentList); - return this.parseMemberExpressionRest(result, true, false); - }; - - ParserImpl.prototype.parseObjectCreationExpressionOrLower = function (inObjectCreation) { - if (this.currentToken().tokenKind === 31 /* NewKeyword */) { - return this.parseObjectCreationExpression(); - } else { - return this.parseMemberExpressionOrLower(inObjectCreation); - } - }; - - ParserImpl.prototype.parseCastExpression = function () { - var lessThanToken = this.eatToken(80 /* LessThanToken */); - var type = this.parseType(); - var greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.castExpression(lessThanToken, type, greaterThanToken, expression); - }; - - ParserImpl.prototype.parseParenthesizedExpression = function () { - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var expression = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - return this.factory.parenthesizedExpression(openParenToken, expression, closeParenToken); - }; - - ParserImpl.prototype.tryParseParenthesizedArrowFunctionExpression = function () { - var tokenKind = this.currentToken().tokenKind; - if (tokenKind !== 72 /* OpenParenToken */ && tokenKind !== 80 /* LessThanToken */) { - return null; - } - - if (this.isDefinitelyArrowFunctionExpression()) { - return this.parseParenthesizedArrowFunctionExpression(false); - } - - if (!this.isPossiblyArrowFunctionExpression()) { - return null; - } - - var rewindPoint = this.getRewindPoint(); - - var arrowFunction = this.parseParenthesizedArrowFunctionExpression(true); - if (arrowFunction === null) { - this.rewind(rewindPoint); - } - - this.releaseRewindPoint(rewindPoint); - return arrowFunction; - }; - - ParserImpl.prototype.parseParenthesizedArrowFunctionExpression = function (requireArrow) { - var currentToken = this.currentToken(); - - var callSignature = this.parseCallSignature(true); - - if (requireArrow && this.currentToken().tokenKind !== 85 /* EqualsGreaterThanToken */) { - return null; - } - - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - - var block = this.tryParseArrowFunctionBlock(); - var expression = null; - if (block === null) { - expression = this.parseAssignmentExpression(true); - } - - return this.factory.parenthesizedArrowFunctionExpression(callSignature, equalsGreaterThanToken, block, expression); - }; - - ParserImpl.prototype.tryParseArrowFunctionBlock = function () { - if (this.isBlock()) { - return this.parseBlock(false, false); - } else { - if (this.isStatement(false) && !this.isExpressionStatement(this.currentToken()) && !this.isFunctionDeclaration()) { - return this.parseBlock(true, false); - } else { - return null; - } - } - }; - - ParserImpl.prototype.isSimpleArrowFunctionExpression = function () { - if (this.currentToken().tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - - return this.isIdentifier(this.currentToken()) && this.peekToken(1).tokenKind === 85 /* EqualsGreaterThanToken */; - }; - - ParserImpl.prototype.parseSimpleArrowFunctionExpression = function () { - var identifier = this.eatIdentifierToken(); - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - - var block = this.tryParseArrowFunctionBlock(); - var expression = null; - if (block === null) { - expression = this.parseAssignmentExpression(true); - } - - return this.factory.simpleArrowFunctionExpression(identifier, equalsGreaterThanToken, block, expression); - }; - - ParserImpl.prototype.isBlock = function () { - return this.currentToken().tokenKind === 70 /* OpenBraceToken */; - }; - - ParserImpl.prototype.isDefinitelyArrowFunctionExpression = function () { - var token0 = this.currentToken(); - if (token0.tokenKind !== 72 /* OpenParenToken */) { - return false; - } - - var token1 = this.peekToken(1); - var token2; - - if (token1.tokenKind === 73 /* CloseParenToken */) { - token2 = this.peekToken(2); - return token2.tokenKind === 106 /* ColonToken */ || token2.tokenKind === 85 /* EqualsGreaterThanToken */ || token2.tokenKind === 70 /* OpenBraceToken */; - } - - if (token1.tokenKind === 77 /* DotDotDotToken */) { - return true; - } - - token2 = this.peekToken(2); - if (token1.tokenKind === 57 /* PublicKeyword */ || token1.tokenKind === 55 /* PrivateKeyword */) { - if (this.isIdentifier(token2)) { - return true; - } - } - - if (!this.isIdentifier(token1)) { - return false; - } - - if (token2.tokenKind === 106 /* ColonToken */) { - return true; - } - - var token3 = this.peekToken(3); - if (token2.tokenKind === 105 /* QuestionToken */) { - if (token3.tokenKind === 106 /* ColonToken */ || token3.tokenKind === 73 /* CloseParenToken */ || token3.tokenKind === 79 /* CommaToken */) { - return true; - } - } - - if (token2.tokenKind === 73 /* CloseParenToken */) { - if (token3.tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - } - - return false; - }; - - ParserImpl.prototype.isPossiblyArrowFunctionExpression = function () { - var token0 = this.currentToken(); - if (token0.tokenKind !== 72 /* OpenParenToken */) { - return true; - } - - var token1 = this.peekToken(1); - - if (!this.isIdentifier(token1)) { - return false; - } - - var token2 = this.peekToken(2); - if (token2.tokenKind === 107 /* EqualsToken */) { - return true; - } - - if (token2.tokenKind === 79 /* CommaToken */) { - return true; - } - - if (token2.tokenKind === 73 /* CloseParenToken */) { - var token3 = this.peekToken(3); - if (token3.tokenKind === 106 /* ColonToken */) { - return true; - } - } - - return false; - }; - - ParserImpl.prototype.parseObjectLiteralExpression = function () { - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var result = this.parseSeparatedSyntaxList(32768 /* ObjectLiteralExpression_PropertyAssignments */); - var propertyAssignments = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.objectLiteralExpression(openBraceToken, propertyAssignments, closeBraceToken); - }; - - ParserImpl.prototype.parsePropertyAssignment = function (inErrorRecovery) { - if (this.isAccessor(inErrorRecovery)) { - return this.parseAccessor(true); - } else if (this.isFunctionPropertyAssignment(inErrorRecovery)) { - return this.parseFunctionPropertyAssignment(); - } else if (this.isSimplePropertyAssignment(inErrorRecovery)) { - return this.parseSimplePropertyAssignment(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isPropertyAssignment = function (inErrorRecovery) { - return this.isAccessor(inErrorRecovery) || this.isFunctionPropertyAssignment(inErrorRecovery) || this.isSimplePropertyAssignment(inErrorRecovery); - }; - - ParserImpl.prototype.eatPropertyName = function () { - return TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(this.currentToken()) ? this.eatIdentifierNameToken() : this.eatAnyToken(); - }; - - ParserImpl.prototype.isFunctionPropertyAssignment = function (inErrorRecovery) { - return this.isPropertyName(this.currentToken(), inErrorRecovery) && this.isCallSignature(1); - }; - - ParserImpl.prototype.parseFunctionPropertyAssignment = function () { - var propertyName = this.eatPropertyName(); - var callSignature = this.parseCallSignature(false); - var block = this.parseBlock(false, true); - - return this.factory.functionPropertyAssignment(propertyName, callSignature, block); - }; - - ParserImpl.prototype.isSimplePropertyAssignment = function (inErrorRecovery) { - return this.isPropertyName(this.currentToken(), inErrorRecovery); - }; - - ParserImpl.prototype.parseSimplePropertyAssignment = function () { - var propertyName = this.eatPropertyName(); - var colonToken = this.eatToken(106 /* ColonToken */); - var expression = this.parseAssignmentExpression(true); - - return this.factory.simplePropertyAssignment(propertyName, colonToken, expression); - }; - - ParserImpl.prototype.isPropertyName = function (token, inErrorRecovery) { - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { - if (inErrorRecovery) { - return this.isIdentifier(token); - } else { - return true; - } - } - - switch (token.tokenKind) { - case 14 /* StringLiteral */: - case 13 /* NumericLiteral */: - return true; - - default: - return false; - } - }; - - ParserImpl.prototype.parseArrayLiteralExpression = function () { - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - - var result = this.parseSeparatedSyntaxList(65536 /* ArrayLiteralExpression_AssignmentExpressions */); - var expressions = result.list; - openBracketToken = this.addSkippedTokensAfterToken(openBracketToken, result.skippedTokens); - - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - - return this.factory.arrayLiteralExpression(openBracketToken, expressions, closeBracketToken); - }; - - ParserImpl.prototype.parseLiteralExpression = function () { - return this.eatAnyToken(); - }; - - ParserImpl.prototype.parseThisExpression = function () { - return this.eatKeyword(35 /* ThisKeyword */); - }; - - ParserImpl.prototype.parseBlock = function (parseBlockEvenWithNoOpenBrace, checkForStrictMode) { - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var statements = TypeScript.Syntax.emptyList; - - if (parseBlockEvenWithNoOpenBrace || openBraceToken.width() > 0) { - var savedIsInStrictMode = this.isInStrictMode; - - var processItems = checkForStrictMode ? ParserImpl.updateStrictModeState : null; - var result = this.parseSyntaxList(32 /* Block_Statements */, processItems); - statements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - - this.setStrictMode(savedIsInStrictMode); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.block(openBraceToken, statements, closeBraceToken); - }; - - ParserImpl.prototype.parseCallSignature = function (requireCompleteTypeParameterList) { - var typeParameterList = this.parseOptionalTypeParameterList(requireCompleteTypeParameterList); - var parameterList = this.parseParameterList(); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - - return this.factory.callSignature(typeParameterList, parameterList, typeAnnotation); - }; - - ParserImpl.prototype.parseOptionalTypeParameterList = function (requireCompleteTypeParameterList) { - if (this.currentToken().tokenKind !== 80 /* LessThanToken */) { - return null; - } - - var rewindPoint = this.getRewindPoint(); - - var lessThanToken = this.eatToken(80 /* LessThanToken */); - - var result = this.parseSeparatedSyntaxList(524288 /* TypeParameterList_TypeParameters */); - var typeParameters = result.list; - lessThanToken = this.addSkippedTokensAfterToken(lessThanToken, result.skippedTokens); - - var greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - - if (requireCompleteTypeParameterList && greaterThanToken.fullWidth() === 0) { - this.rewind(rewindPoint); - this.releaseRewindPoint(rewindPoint); - return null; - } else { - this.releaseRewindPoint(rewindPoint); - var typeParameterList = this.factory.typeParameterList(lessThanToken, typeParameters, greaterThanToken); - - return typeParameterList; - } - }; - - ParserImpl.prototype.isTypeParameter = function () { - return this.isIdentifier(this.currentToken()); - }; - - ParserImpl.prototype.parseTypeParameter = function () { - var identifier = this.eatIdentifierToken(); - var constraint = this.parseOptionalConstraint(); - - return this.factory.typeParameter(identifier, constraint); - }; - - ParserImpl.prototype.parseOptionalConstraint = function () { - if (this.currentToken().kind() !== 48 /* ExtendsKeyword */) { - return null; - } - - var extendsKeyword = this.eatKeyword(48 /* ExtendsKeyword */); - var type = this.parseType(); - - return this.factory.constraint(extendsKeyword, type); - }; - - ParserImpl.prototype.parseParameterList = function () { - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var parameters = TypeScript.Syntax.emptySeparatedList; - - if (openParenToken.width() > 0) { - var result = this.parseSeparatedSyntaxList(131072 /* ParameterList_Parameters */); - parameters = result.list; - openParenToken = this.addSkippedTokensAfterToken(openParenToken, result.skippedTokens); - } - - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - return this.factory.parameterList(openParenToken, parameters, closeParenToken); - }; - - ParserImpl.prototype.isTypeAnnotation = function () { - return this.currentToken().tokenKind === 106 /* ColonToken */; - }; - - ParserImpl.prototype.parseOptionalTypeAnnotation = function (allowStringLiteral) { - return this.isTypeAnnotation() ? this.parseTypeAnnotation(allowStringLiteral) : null; - }; - - ParserImpl.prototype.parseTypeAnnotation = function (allowStringLiteral) { - var colonToken = this.eatToken(106 /* ColonToken */); - var type = allowStringLiteral && this.currentToken().tokenKind === 14 /* StringLiteral */ ? this.eatToken(14 /* StringLiteral */) : this.parseType(); - - return this.factory.typeAnnotation(colonToken, type); - }; - - ParserImpl.prototype.isType = function () { - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - - switch (currentTokenKind) { - case 39 /* TypeOfKeyword */: - - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - case 41 /* VoidKeyword */: - - case 70 /* OpenBraceToken */: - - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - - case 31 /* NewKeyword */: - return true; - } - - return this.isIdentifier(currentToken); - }; - - ParserImpl.prototype.parseType = function () { - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - - var type = this.parseNonArrayType(currentToken); - - while (this.currentToken().tokenKind === 74 /* OpenBracketToken */) { - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - - type = this.factory.arrayType(type, openBracketToken, closeBracketToken); - } - - return type; - }; - - ParserImpl.prototype.isTypeQuery = function () { - return this.currentToken().tokenKind === 39 /* TypeOfKeyword */; - }; - - ParserImpl.prototype.parseTypeQuery = function () { - var typeOfKeyword = this.eatToken(39 /* TypeOfKeyword */); - var name = this.parseName(); - - return this.factory.typeQuery(typeOfKeyword, name); - }; - - ParserImpl.prototype.parseNonArrayType = function (currentToken) { - var currentTokenKind = currentToken.tokenKind; - switch (currentTokenKind) { - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - case 41 /* VoidKeyword */: - return this.eatAnyToken(); - - case 70 /* OpenBraceToken */: - return this.parseObjectType(); - - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - return this.parseFunctionType(); - - case 31 /* NewKeyword */: - return this.parseConstructorType(); - - case 39 /* TypeOfKeyword */: - return this.parseTypeQuery(); - } - - return this.parseNameOrGenericType(); - }; - - ParserImpl.prototype.parseNameOrGenericType = function () { - var name = this.parseName(); - var typeArgumentList = this.tryParseTypeArgumentList(false); - - return typeArgumentList === null ? name : this.factory.genericType(name, typeArgumentList); - }; - - ParserImpl.prototype.parseFunctionType = function () { - var typeParameterList = this.parseOptionalTypeParameterList(false); - var parameterList = this.parseParameterList(); - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - var returnType = this.parseType(); - - return this.factory.functionType(typeParameterList, parameterList, equalsGreaterThanToken, returnType); - }; - - ParserImpl.prototype.parseConstructorType = function () { - var newKeyword = this.eatKeyword(31 /* NewKeyword */); - var typeParameterList = this.parseOptionalTypeParameterList(false); - var parameterList = this.parseParameterList(); - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - var type = this.parseType(); - - return this.factory.constructorType(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type); - }; - - ParserImpl.prototype.isParameter = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 242 /* Parameter */) { - return true; - } - - var token = this.currentToken(); - var tokenKind = token.tokenKind; - if (tokenKind === 77 /* DotDotDotToken */) { - return true; - } - - if (ParserImpl.isModifier(token) && !this.isModifierUsedAsParameterIdentifier(token)) { - return true; - } - - return this.isIdentifier(token); - }; - - ParserImpl.prototype.isModifierUsedAsParameterIdentifier = function (token) { - if (this.isIdentifier(token)) { - var nextTokenKind = this.peekToken(1).tokenKind; - switch (nextTokenKind) { - case 73 /* CloseParenToken */: - case 106 /* ColonToken */: - case 107 /* EqualsToken */: - case 79 /* CommaToken */: - case 105 /* QuestionToken */: - return true; - } - } - - return false; - }; - - ParserImpl.prototype.parseParameter = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 242 /* Parameter */) { - return this.eatNode(); - } - - var dotDotDotToken = this.tryEatToken(77 /* DotDotDotToken */); - - var modifierArray = this.getArray(); - - while (true) { - var currentToken = this.currentToken(); - if (ParserImpl.isModifier(currentToken) && !this.isModifierUsedAsParameterIdentifier(currentToken)) { - modifierArray.push(this.eatAnyToken()); - continue; - } - - break; - } - - var modifiers = TypeScript.Syntax.list(modifierArray); - this.returnZeroOrOneLengthArray(modifierArray); - - var identifier = this.eatIdentifierToken(); - var questionToken = this.tryEatToken(105 /* QuestionToken */); - var typeAnnotation = this.parseOptionalTypeAnnotation(true); - - var equalsValueClause = null; - if (this.isEqualsValueClause(true)) { - equalsValueClause = this.parseEqualsValueClause(true); - } - - return this.factory.parameter(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); - }; - - ParserImpl.prototype.parseSyntaxList = function (currentListType, processItems) { - if (typeof processItems === "undefined") { processItems = null; } - var savedListParsingState = this.listParsingState; - this.listParsingState |= currentListType; - - var result = this.parseSyntaxListWorker(currentListType, processItems); - - this.listParsingState = savedListParsingState; - - return result; - }; - - ParserImpl.prototype.parseSeparatedSyntaxList = function (currentListType) { - var savedListParsingState = this.listParsingState; - this.listParsingState |= currentListType; - - var result = this.parseSeparatedSyntaxListWorker(currentListType); - - this.listParsingState = savedListParsingState; - - return result; - }; - - ParserImpl.prototype.abortParsingListOrMoveToNextToken = function (currentListType, items, skippedTokens) { - this.reportUnexpectedTokenDiagnostic(currentListType); - - for (var state = 524288 /* LastListParsingState */; state >= 1 /* FirstListParsingState */; state >>= 1) { - if ((this.listParsingState & state) !== 0) { - if (this.isExpectedListTerminator(state) || this.isExpectedListItem(state, true)) { - return true; - } - } - } - - var skippedToken = this.currentToken(); - - this.moveToNextToken(); - - this.addSkippedTokenToList(items, skippedTokens, skippedToken); - - return false; - }; - - ParserImpl.prototype.addSkippedTokenToList = function (items, skippedTokens, skippedToken) { - for (var i = items.length - 1; i >= 0; i--) { - var item = items[i]; - var lastToken = item.lastToken(); - if (lastToken.fullWidth() > 0) { - items[i] = this.addSkippedTokenAfterNodeOrToken(item, skippedToken); - return; - } - } - - skippedTokens.push(skippedToken); - }; - - ParserImpl.prototype.tryParseExpectedListItem = function (currentListType, inErrorRecovery, items, processItems) { - if (this.isExpectedListItem(currentListType, inErrorRecovery)) { - var item = this.parseExpectedListItem(currentListType, inErrorRecovery); - - items.push(item); - - if (processItems !== null) { - processItems(this, items); - } - } - }; - - ParserImpl.prototype.listIsTerminated = function (currentListType) { - return this.isExpectedListTerminator(currentListType) || this.currentToken().tokenKind === 10 /* EndOfFileToken */; - }; - - ParserImpl.prototype.getArray = function () { - if (this.arrayPool.length > 0) { - return this.arrayPool.pop(); - } - - return []; - }; - - ParserImpl.prototype.returnZeroOrOneLengthArray = function (array) { - if (array.length <= 1) { - this.returnArray(array); - } - }; - - ParserImpl.prototype.returnArray = function (array) { - array.length = 0; - this.arrayPool.push(array); - }; - - ParserImpl.prototype.parseSyntaxListWorker = function (currentListType, processItems) { - var items = this.getArray(); - var skippedTokens = this.getArray(); - - while (true) { - var oldItemsCount = items.length; - this.tryParseExpectedListItem(currentListType, false, items, processItems); - - var newItemsCount = items.length; - if (newItemsCount === oldItemsCount) { - if (this.listIsTerminated(currentListType)) { - break; - } - - var abort = this.abortParsingListOrMoveToNextToken(currentListType, items, skippedTokens); - if (abort) { - break; - } - } - } - - var result = TypeScript.Syntax.list(items); - - this.returnZeroOrOneLengthArray(items); - - return { skippedTokens: skippedTokens, list: result }; - }; - - ParserImpl.prototype.parseSeparatedSyntaxListWorker = function (currentListType) { - var items = this.getArray(); - var skippedTokens = this.getArray(); - TypeScript.Debug.assert(items.length === 0); - TypeScript.Debug.assert(skippedTokens.length === 0); - TypeScript.Debug.assert(skippedTokens !== items); - - var separatorKind = this.separatorKind(currentListType); - var allowAutomaticSemicolonInsertion = separatorKind === 78 /* SemicolonToken */; - - var inErrorRecovery = false; - var listWasTerminated = false; - while (true) { - var oldItemsCount = items.length; - - this.tryParseExpectedListItem(currentListType, inErrorRecovery, items, null); - - var newItemsCount = items.length; - if (newItemsCount === oldItemsCount) { - if (this.listIsTerminated(currentListType)) { - listWasTerminated = true; - break; - } - - var abort = this.abortParsingListOrMoveToNextToken(currentListType, items, skippedTokens); - if (abort) { - break; - } else { - inErrorRecovery = true; - continue; - } - } - - inErrorRecovery = false; - - var currentToken = this.currentToken(); - if (currentToken.tokenKind === separatorKind || currentToken.tokenKind === 79 /* CommaToken */) { - items.push(this.eatAnyToken()); - continue; - } - - if (this.listIsTerminated(currentListType)) { - listWasTerminated = true; - break; - } - - if (allowAutomaticSemicolonInsertion && this.canEatAutomaticSemicolon(false)) { - items.push(this.eatExplicitOrAutomaticSemicolon(false)); - - continue; - } - - items.push(this.eatToken(separatorKind)); - - inErrorRecovery = true; - } - - var result = TypeScript.Syntax.separatedList(items); - - this.returnZeroOrOneLengthArray(items); - - return { skippedTokens: skippedTokens, list: result }; - }; - - ParserImpl.prototype.separatorKind = function (currentListType) { - switch (currentListType) { - case 2048 /* HeritageClause_TypeNameList */: - case 16384 /* ArgumentList_AssignmentExpressions */: - case 256 /* EnumDeclaration_EnumElements */: - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - case 131072 /* ParameterList_Parameters */: - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - case 262144 /* TypeArgumentList_Types */: - case 524288 /* TypeParameterList_TypeParameters */: - return 79 /* CommaToken */; - - case 512 /* ObjectType_TypeMembers */: - return 78 /* SemicolonToken */; - - case 1 /* SourceUnit_ModuleElements */: - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - case 2 /* ClassDeclaration_ClassElements */: - case 4 /* ModuleDeclaration_ModuleElements */: - case 8 /* SwitchStatement_SwitchClauses */: - case 16 /* SwitchClause_Statements */: - case 32 /* Block_Statements */: - default: - throw TypeScript.Errors.notYetImplemented(); - } - }; - - ParserImpl.prototype.reportUnexpectedTokenDiagnostic = function (listType) { - var token = this.currentToken(); - - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [this.getExpectedListElementType(listType)]); - this.addDiagnostic(diagnostic); - }; - - ParserImpl.prototype.addDiagnostic = function (diagnostic) { - if (this.diagnostics.length > 0 && this.diagnostics[this.diagnostics.length - 1].start() === diagnostic.start()) { - return; - } - - this.diagnostics.push(diagnostic); - }; - - ParserImpl.prototype.isExpectedListTerminator = function (currentListType) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return this.isExpectedSourceUnit_ModuleElementsTerminator(); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return this.isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator(); - - case 2 /* ClassDeclaration_ClassElements */: - return this.isExpectedClassDeclaration_ClassElementsTerminator(); - - case 4 /* ModuleDeclaration_ModuleElements */: - return this.isExpectedModuleDeclaration_ModuleElementsTerminator(); - - case 8 /* SwitchStatement_SwitchClauses */: - return this.isExpectedSwitchStatement_SwitchClausesTerminator(); - - case 16 /* SwitchClause_Statements */: - return this.isExpectedSwitchClause_StatementsTerminator(); - - case 32 /* Block_Statements */: - return this.isExpectedBlock_StatementsTerminator(); - - case 64 /* TryBlock_Statements */: - return this.isExpectedTryBlock_StatementsTerminator(); - - case 128 /* CatchBlock_Statements */: - return this.isExpectedCatchBlock_StatementsTerminator(); - - case 256 /* EnumDeclaration_EnumElements */: - return this.isExpectedEnumDeclaration_EnumElementsTerminator(); - - case 512 /* ObjectType_TypeMembers */: - return this.isExpectedObjectType_TypeMembersTerminator(); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return this.isExpectedArgumentList_AssignmentExpressionsTerminator(); - - case 2048 /* HeritageClause_TypeNameList */: - return this.isExpectedHeritageClause_TypeNameListTerminator(); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return this.isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator(); - - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return this.isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator(); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return this.isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator(); - - case 131072 /* ParameterList_Parameters */: - return this.isExpectedParameterList_ParametersTerminator(); - - case 262144 /* TypeArgumentList_Types */: - return this.isExpectedTypeArgumentList_TypesTerminator(); - - case 524288 /* TypeParameterList_TypeParameters */: - return this.isExpectedTypeParameterList_TypeParametersTerminator(); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return this.isExpectedLiteralExpression_AssignmentExpressionsTerminator(); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isExpectedSourceUnit_ModuleElementsTerminator = function () { - return this.currentToken().tokenKind === 10 /* EndOfFileToken */; - }; - - ParserImpl.prototype.isExpectedEnumDeclaration_EnumElementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedModuleDeclaration_ModuleElementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedObjectType_TypeMembersTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedLiteralExpression_AssignmentExpressionsTerminator = function () { - return this.currentToken().tokenKind === 75 /* CloseBracketToken */; - }; - - ParserImpl.prototype.isExpectedTypeArgumentList_TypesTerminator = function () { - var token = this.currentToken(); - if (token.tokenKind === 81 /* GreaterThanToken */) { - return true; - } - - if (this.canFollowTypeArgumentListInExpression(token.tokenKind)) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedTypeParameterList_TypeParametersTerminator = function () { - var token = this.currentToken(); - if (token.tokenKind === 81 /* GreaterThanToken */) { - return true; - } - - if (token.tokenKind === 72 /* OpenParenToken */ || token.tokenKind === 70 /* OpenBraceToken */ || token.tokenKind === 48 /* ExtendsKeyword */ || token.tokenKind === 51 /* ImplementsKeyword */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedParameterList_ParametersTerminator = function () { - var token = this.currentToken(); - if (token.tokenKind === 73 /* CloseParenToken */) { - return true; - } - - if (token.tokenKind === 70 /* OpenBraceToken */) { - return true; - } - - if (token.tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator = function () { - if (this.currentToken().tokenKind === 78 /* SemicolonToken */ || this.currentToken().tokenKind === 73 /* CloseParenToken */) { - return true; - } - - if (this.currentToken().tokenKind === 29 /* InKeyword */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator = function () { - if (this.previousToken().tokenKind === 79 /* CommaToken */) { - return false; - } - - if (this.currentToken().tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - - return this.canEatExplicitOrAutomaticSemicolon(false); - }; - - ParserImpl.prototype.isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator = function () { - var token0 = this.currentToken(); - if (token0.tokenKind === 70 /* OpenBraceToken */ || token0.tokenKind === 71 /* CloseBraceToken */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedHeritageClause_TypeNameListTerminator = function () { - var token0 = this.currentToken(); - if (token0.tokenKind === 48 /* ExtendsKeyword */ || token0.tokenKind === 51 /* ImplementsKeyword */) { - return true; - } - - if (this.isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator()) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedArgumentList_AssignmentExpressionsTerminator = function () { - var token0 = this.currentToken(); - return token0.tokenKind === 73 /* CloseParenToken */ || token0.tokenKind === 78 /* SemicolonToken */; - }; - - ParserImpl.prototype.isExpectedClassDeclaration_ClassElementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedSwitchStatement_SwitchClausesTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedSwitchClause_StatementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */ || this.isSwitchClause(); - }; - - ParserImpl.prototype.isExpectedBlock_StatementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedTryBlock_StatementsTerminator = function () { - return this.currentToken().tokenKind === 17 /* CatchKeyword */ || this.currentToken().tokenKind === 25 /* FinallyKeyword */; - }; - - ParserImpl.prototype.isExpectedCatchBlock_StatementsTerminator = function () { - return this.currentToken().tokenKind === 25 /* FinallyKeyword */; - }; - - ParserImpl.prototype.isExpectedListItem = function (currentListType, inErrorRecovery) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return this.isModuleElement(inErrorRecovery); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return this.isHeritageClause(); - - case 2 /* ClassDeclaration_ClassElements */: - return this.isClassElement(inErrorRecovery); - - case 4 /* ModuleDeclaration_ModuleElements */: - return this.isModuleElement(inErrorRecovery); - - case 8 /* SwitchStatement_SwitchClauses */: - return this.isSwitchClause(); - - case 16 /* SwitchClause_Statements */: - return this.isStatement(inErrorRecovery); - - case 32 /* Block_Statements */: - return this.isStatement(inErrorRecovery); - - case 64 /* TryBlock_Statements */: - case 128 /* CatchBlock_Statements */: - return false; - - case 256 /* EnumDeclaration_EnumElements */: - return this.isEnumElement(inErrorRecovery); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return this.isVariableDeclarator(); - - case 512 /* ObjectType_TypeMembers */: - return this.isTypeMember(inErrorRecovery); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return this.isExpectedArgumentList_AssignmentExpression(); - - case 2048 /* HeritageClause_TypeNameList */: - return this.isHeritageClauseTypeName(); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return this.isPropertyAssignment(inErrorRecovery); - - case 131072 /* ParameterList_Parameters */: - return this.isParameter(); - - case 262144 /* TypeArgumentList_Types */: - return this.isType(); - - case 524288 /* TypeParameterList_TypeParameters */: - return this.isTypeParameter(); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return this.isAssignmentOrOmittedExpression(); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isExpectedArgumentList_AssignmentExpression = function () { - var currentToken = this.currentToken(); - if (this.isExpression(currentToken)) { - return true; - } - - if (currentToken.tokenKind === 79 /* CommaToken */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.parseExpectedListItem = function (currentListType, inErrorRecovery) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return this.parseModuleElement(inErrorRecovery); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return this.parseHeritageClause(); - - case 2 /* ClassDeclaration_ClassElements */: - return this.parseClassElement(inErrorRecovery); - - case 4 /* ModuleDeclaration_ModuleElements */: - return this.parseModuleElement(inErrorRecovery); - - case 8 /* SwitchStatement_SwitchClauses */: - return this.parseSwitchClause(); - - case 16 /* SwitchClause_Statements */: - return this.parseStatement(inErrorRecovery); - - case 32 /* Block_Statements */: - return this.parseStatement(inErrorRecovery); - - case 256 /* EnumDeclaration_EnumElements */: - return this.parseEnumElement(); - - case 512 /* ObjectType_TypeMembers */: - return this.parseTypeMember(inErrorRecovery); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return this.parseAssignmentExpression(true); - - case 2048 /* HeritageClause_TypeNameList */: - return this.parseNameOrGenericType(); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return this.parseVariableDeclarator(true, false); - - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return this.parseVariableDeclarator(false, false); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return this.parsePropertyAssignment(inErrorRecovery); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return this.parseAssignmentOrOmittedExpression(); - - case 131072 /* ParameterList_Parameters */: - return this.parseParameter(); - - case 262144 /* TypeArgumentList_Types */: - return this.parseType(); - - case 524288 /* TypeParameterList_TypeParameters */: - return this.parseTypeParameter(); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.getExpectedListElementType = function (currentListType) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, null); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return '{'; - - case 2 /* ClassDeclaration_ClassElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.constructor_function_accessor_or_variable, null); - - case 4 /* ModuleDeclaration_ModuleElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, null); - - case 8 /* SwitchStatement_SwitchClauses */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.case_or_default_clause, null); - - case 16 /* SwitchClause_Statements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, null); - - case 32 /* Block_Statements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, null); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - - case 256 /* EnumDeclaration_EnumElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - - case 512 /* ObjectType_TypeMembers */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.call_construct_index_property_or_function_signature, null); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - - case 2048 /* HeritageClause_TypeNameList */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, null); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.property_or_accessor, null); - - case 131072 /* ParameterList_Parameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, null); - - case 262144 /* TypeArgumentList_Types */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null); - - case 524288 /* TypeParameterList_TypeParameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, null); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - return ParserImpl; - })(); - - function parse(fileName, text, isDeclaration, options) { - var source = new NormalParserSource(fileName, text, options.languageVersion()); - - return new ParserImpl(fileName, text.lineMap(), source, options, text).parseSyntaxTree(isDeclaration); - } - Parser.parse = parse; - - function incrementalParse(oldSyntaxTree, textChangeRange, newText) { - if (textChangeRange.isUnchanged()) { - return oldSyntaxTree; - } - - var source = new IncrementalParserSource(oldSyntaxTree, textChangeRange, newText); - - return new ParserImpl(oldSyntaxTree.fileName(), newText.lineMap(), source, oldSyntaxTree.parseOptions(), newText).parseSyntaxTree(oldSyntaxTree.isDeclaration()); - } - Parser.incrementalParse = incrementalParse; - })(TypeScript.Parser || (TypeScript.Parser = {})); - var Parser = TypeScript.Parser; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxTree = (function () { - function SyntaxTree(sourceUnit, isDeclaration, diagnostics, fileName, lineMap, parseOtions) { - this._allDiagnostics = null; - this._sourceUnit = sourceUnit; - this._isDeclaration = isDeclaration; - this._parserDiagnostics = diagnostics; - this._fileName = fileName; - this._lineMap = lineMap; - this._parseOptions = parseOtions; - } - SyntaxTree.prototype.toJSON = function (key) { - var result = {}; - - result.isDeclaration = this._isDeclaration; - result.languageVersion = TypeScript.LanguageVersion[this._parseOptions.languageVersion()]; - result.parseOptions = this._parseOptions; - - if (this.diagnostics().length > 0) { - result.diagnostics = this.diagnostics(); - } - - result.sourceUnit = this._sourceUnit; - result.lineMap = this._lineMap; - - return result; - }; - - SyntaxTree.prototype.sourceUnit = function () { - return this._sourceUnit; - }; - - SyntaxTree.prototype.isDeclaration = function () { - return this._isDeclaration; - }; - - SyntaxTree.prototype.computeDiagnostics = function () { - if (this._parserDiagnostics.length > 0) { - return this._parserDiagnostics; - } - - var diagnostics = []; - this.sourceUnit().accept(new GrammarCheckerWalker(this, diagnostics)); - - return diagnostics; - }; - - SyntaxTree.prototype.diagnostics = function () { - if (this._allDiagnostics === null) { - this._allDiagnostics = this.computeDiagnostics(); - } - - return this._allDiagnostics; - }; - - SyntaxTree.prototype.fileName = function () { - return this._fileName; - }; - - SyntaxTree.prototype.lineMap = function () { - return this._lineMap; - }; - - SyntaxTree.prototype.parseOptions = function () { - return this._parseOptions; - }; - - SyntaxTree.prototype.structuralEquals = function (tree) { - return TypeScript.ArrayUtilities.sequenceEquals(this.diagnostics(), tree.diagnostics(), TypeScript.Diagnostic.equals) && this.sourceUnit().structuralEquals(tree.sourceUnit()); - }; - return SyntaxTree; - })(); - TypeScript.SyntaxTree = SyntaxTree; - - var GrammarCheckerWalker = (function (_super) { - __extends(GrammarCheckerWalker, _super); - function GrammarCheckerWalker(syntaxTree, diagnostics) { - _super.call(this); - this.syntaxTree = syntaxTree; - this.diagnostics = diagnostics; - this.inAmbientDeclaration = false; - this.inBlock = false; - this.inObjectLiteralExpression = false; - this.currentConstructor = null; - } - GrammarCheckerWalker.prototype.childFullStart = function (parent, child) { - return this.position() + TypeScript.Syntax.childOffset(parent, child); - }; - - GrammarCheckerWalker.prototype.childStart = function (parent, child) { - return this.childFullStart(parent, child) + child.leadingTriviaWidth(); - }; - - GrammarCheckerWalker.prototype.pushDiagnostic = function (start, length, diagnosticKey, args) { - if (typeof args === "undefined") { args = null; } - this.diagnostics.push(new TypeScript.Diagnostic(this.syntaxTree.fileName(), this.syntaxTree.lineMap(), start, length, diagnosticKey, args)); - }; - - GrammarCheckerWalker.prototype.pushDiagnostic1 = function (elementFullStart, element, diagnosticKey, args) { - if (typeof args === "undefined") { args = null; } - this.diagnostics.push(new TypeScript.Diagnostic(this.syntaxTree.fileName(), this.syntaxTree.lineMap(), elementFullStart + element.leadingTriviaWidth(), element.width(), diagnosticKey, args)); - }; - - GrammarCheckerWalker.prototype.visitCatchClause = function (node) { - if (node.typeAnnotation) { - this.pushDiagnostic(this.childStart(node, node.typeAnnotation), node.typeAnnotation.width(), TypeScript.DiagnosticCode.Catch_clause_parameter_cannot_have_a_type_annotation); - } - - _super.prototype.visitCatchClause.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkParameterListOrder = function (node) { - var parameterFullStart = this.childFullStart(node, node.parameters); - - var seenOptionalParameter = false; - var parameterCount = node.parameters.nonSeparatorCount(); - - for (var i = 0, n = node.parameters.childCount(); i < n; i++) { - var nodeOrToken = node.parameters.childAt(i); - if (i % 2 === 0) { - var parameterIndex = i / 2; - var parameter = node.parameters.childAt(i); - - if (parameter.dotDotDotToken) { - if (parameterIndex !== (parameterCount - 1)) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Rest_parameter_must_be_last_in_list); - return true; - } - - if (parameter.questionToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Rest_parameter_cannot_be_optional); - return true; - } - - if (parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Rest_parameter_cannot_have_an_initializer); - return true; - } - } else if (parameter.questionToken || parameter.equalsValueClause) { - seenOptionalParameter = true; - - if (parameter.questionToken && parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer); - return true; - } - } else { - if (seenOptionalParameter) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Required_parameter_cannot_follow_optional_parameter); - return true; - } - } - } - - parameterFullStart += nodeOrToken.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkParameterListAcessibilityModifiers = function (node) { - var parameterFullStart = this.childFullStart(node, node.parameters); - - for (var i = 0, n = node.parameters.childCount(); i < n; i++) { - var nodeOrToken = node.parameters.childAt(i); - if (i % 2 === 0) { - var parameter = node.parameters.childAt(i); - - if (this.checkParameterAccessibilityModifiers(node, parameter, parameterFullStart)) { - return true; - } - } - - parameterFullStart += nodeOrToken.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkParameterAccessibilityModifiers = function (parameterList, parameter, parameterFullStart) { - if (parameter.modifiers.childCount() > 0) { - var modifiers = parameter.modifiers; - var modifierFullStart = parameterFullStart + TypeScript.Syntax.childOffset(parameter, modifiers); - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var modifier = modifiers.childAt(i); - - if (this.checkParameterAccessibilityModifier(parameterList, modifier, modifierFullStart, i)) { - return true; - } - - modifierFullStart += modifier.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkParameterAccessibilityModifier = function (parameterList, modifier, modifierFullStart, modifierIndex) { - if (modifier.tokenKind !== 57 /* PublicKeyword */ && modifier.tokenKind !== 55 /* PrivateKeyword */) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]); - return true; - } else { - if (modifierIndex > 0) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return true; - } - - if (!this.inAmbientDeclaration && this.currentConstructor && !this.currentConstructor.block && this.currentConstructor.callSignature.parameterList === parameterList) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Parameter_property_declarations_cannot_be_used_in_a_constructor_overload); - return true; - } else if (this.inAmbientDeclaration || this.currentConstructor === null || this.currentConstructor.callSignature.parameterList !== parameterList) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Parameter_property_declarations_can_only_be_used_in_a_non_ambient_constructor_declaration); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForTrailingSeparator = function (parent, list) { - if (list.childCount() === 0 || list.childCount() % 2 === 1) { - return false; - } - - var currentElementFullStart = this.childFullStart(parent, list); - - for (var i = 0, n = list.childCount(); i < n; i++) { - var child = list.childAt(i); - if (i === n - 1) { - this.pushDiagnostic1(currentElementFullStart, child, TypeScript.DiagnosticCode.Trailing_separator_not_allowed); - } - - currentElementFullStart += child.fullWidth(); - } - - return true; - }; - - GrammarCheckerWalker.prototype.checkForAtLeastOneElement = function (parent, list, expected) { - if (list.childCount() > 0) { - return false; - } - - var listFullStart = this.childFullStart(parent, list); - var tokenAtStart = this.syntaxTree.sourceUnit().findToken(listFullStart); - - this.pushDiagnostic1(listFullStart, tokenAtStart.token(), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [expected]); - - return true; - }; - - GrammarCheckerWalker.prototype.visitParameterList = function (node) { - if (this.checkParameterListAcessibilityModifiers(node) || this.checkParameterListOrder(node) || this.checkForTrailingSeparator(node, node.parameters)) { - this.skip(node); - return; - } - - _super.prototype.visitParameterList.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitHeritageClause = function (node) { - if (this.checkForTrailingSeparator(node, node.typeNames) || this.checkForAtLeastOneElement(node, node.typeNames, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, null))) { - this.skip(node); - return; - } - - _super.prototype.visitHeritageClause.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitArgumentList = function (node) { - if (this.checkForTrailingSeparator(node, node.arguments)) { - this.skip(node); - return; - } - - _super.prototype.visitArgumentList.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitVariableDeclaration = function (node) { - if (this.checkForTrailingSeparator(node, node.variableDeclarators) || this.checkForAtLeastOneElement(node, node.variableDeclarators, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null))) { - this.skip(node); - return; - } - - _super.prototype.visitVariableDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitTypeArgumentList = function (node) { - if (this.checkForTrailingSeparator(node, node.typeArguments) || this.checkForAtLeastOneElement(node, node.typeArguments, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null))) { - this.skip(node); - return; - } - - _super.prototype.visitTypeArgumentList.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitTypeParameterList = function (node) { - if (this.checkForTrailingSeparator(node, node.typeParameters) || this.checkForAtLeastOneElement(node, node.typeParameters, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null))) { - this.skip(node); - return; - } - - _super.prototype.visitTypeParameterList.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkIndexSignatureParameter = function (node) { - var parameterFullStart = this.childFullStart(node, node.parameter); - var parameter = node.parameter; - - if (parameter.dotDotDotToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signatures_cannot_have_rest_parameters); - return true; - } else if (parameter.modifiers.childCount() > 0) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_accessibility_modifiers); - return true; - } else if (parameter.questionToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_a_question_mark); - return true; - } else if (parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_an_initializer); - return true; - } else if (!parameter.typeAnnotation) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_must_have_a_type_annotation); - return true; - } else if (parameter.typeAnnotation.type.kind() !== 69 /* StringKeyword */ && parameter.typeAnnotation.type.kind() !== 67 /* NumberKeyword */) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_type_must_be_string_or_number); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitIndexSignature = function (node) { - if (this.checkIndexSignatureParameter(node)) { - this.skip(node); - return; - } - - if (!node.typeAnnotation) { - this.pushDiagnostic1(this.position(), node, TypeScript.DiagnosticCode.Index_signature_must_have_a_type_annotation); - this.skip(node); - return; - } - - _super.prototype.visitIndexSignature.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkClassDeclarationHeritageClauses = function (node) { - var heritageClauseFullStart = this.childFullStart(node, node.heritageClauses); - - var seenExtendsClause = false; - var seenImplementsClause = false; - - for (var i = 0, n = node.heritageClauses.childCount(); i < n; i++) { - TypeScript.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses.childAt(i); - - if (heritageClause.extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */) { - if (seenExtendsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); - return true; - } - - if (seenImplementsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.extends_clause_must_precede_implements_clause); - return true; - } - - if (heritageClause.typeNames.nonSeparatorCount() > 1) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.Classes_can_only_extend_a_single_class); - return true; - } - - seenExtendsClause = true; - } else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.tokenKind === 51 /* ImplementsKeyword */); - if (seenImplementsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.implements_clause_already_seen); - return true; - } - - seenImplementsClause = true; - } - - heritageClauseFullStart += heritageClause.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifier = function (modifiers) { - if (this.inAmbientDeclaration) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 63 /* DeclareKeyword */); - - if (declareToken) { - this.pushDiagnostic1(this.childFullStart(modifiers, declareToken), declareToken, TypeScript.DiagnosticCode.declare_modifier_not_allowed_for_code_already_in_an_ambient_context); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForRequiredDeclareModifier = function (moduleElement, typeKeyword, modifiers) { - if (!this.inAmbientDeclaration && this.syntaxTree.isDeclaration()) { - if (!TypeScript.SyntaxUtilities.containsToken(modifiers, 63 /* DeclareKeyword */)) { - this.pushDiagnostic1(this.childFullStart(moduleElement, typeKeyword), typeKeyword.firstToken(), TypeScript.DiagnosticCode.declare_modifier_required_for_top_level_element); - return true; - } - } - }; - - GrammarCheckerWalker.prototype.checkFunctionOverloads = function (node, moduleElements) { - if (!this.inAmbientDeclaration && !this.syntaxTree.isDeclaration()) { - var moduleElementFullStart = this.childFullStart(node, moduleElements); - - var inFunctionOverloadChain = false; - var functionOverloadChainName = null; - - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var moduleElement = moduleElements.childAt(i); - var lastElement = i === (n - 1); - - if (inFunctionOverloadChain) { - if (moduleElement.kind() !== 129 /* FunctionDeclaration */) { - this.pushDiagnostic1(moduleElementFullStart, moduleElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - - var functionDeclaration = moduleElement; - if (functionDeclaration.identifier.valueText() !== functionOverloadChainName) { - var identifierFullStart = moduleElementFullStart + TypeScript.Syntax.childOffset(moduleElement, functionDeclaration.identifier); - this.pushDiagnostic1(identifierFullStart, functionDeclaration.identifier, TypeScript.DiagnosticCode.Function_overload_name_must_be_0, [functionOverloadChainName]); - return true; - } - } - - if (moduleElement.kind() === 129 /* FunctionDeclaration */) { - functionDeclaration = moduleElement; - if (!TypeScript.SyntaxUtilities.containsToken(functionDeclaration.modifiers, 63 /* DeclareKeyword */)) { - inFunctionOverloadChain = functionDeclaration.block === null; - functionOverloadChainName = functionDeclaration.identifier.valueText(); - - if (inFunctionOverloadChain) { - if (lastElement) { - this.pushDiagnostic1(moduleElementFullStart, moduleElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } else { - var nextElement = moduleElements.childAt(i + 1); - if (nextElement.kind() === 129 /* FunctionDeclaration */) { - var nextFunction = nextElement; - - if (nextFunction.identifier.valueText() !== functionOverloadChainName && nextFunction.block === null) { - var identifierFullStart = moduleElementFullStart + TypeScript.Syntax.childOffset(moduleElement, functionDeclaration.identifier); - this.pushDiagnostic1(identifierFullStart, functionDeclaration.identifier, TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - } - } - } - } else { - inFunctionOverloadChain = false; - functionOverloadChainName = ""; - } - } - - moduleElementFullStart += moduleElement.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkClassOverloads = function (node) { - if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { - var classElementFullStart = this.childFullStart(node, node.classElements); - - var inFunctionOverloadChain = false; - var inConstructorOverloadChain = false; - - var functionOverloadChainName = null; - var isInStaticOverloadChain = null; - var memberFunctionDeclaration = null; - - for (var i = 0, n = node.classElements.childCount(); i < n; i++) { - var classElement = node.classElements.childAt(i); - var lastElement = i === (n - 1); - var isStaticOverload = null; - - if (inFunctionOverloadChain) { - if (classElement.kind() !== 135 /* MemberFunctionDeclaration */) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - - memberFunctionDeclaration = classElement; - if (memberFunctionDeclaration.propertyName.valueText() !== functionOverloadChainName) { - var propertyNameFullStart = classElementFullStart + TypeScript.Syntax.childOffset(classElement, memberFunctionDeclaration.propertyName); - this.pushDiagnostic1(propertyNameFullStart, memberFunctionDeclaration.propertyName, TypeScript.DiagnosticCode.Function_overload_name_must_be_0, [functionOverloadChainName]); - return true; - } - - isStaticOverload = TypeScript.SyntaxUtilities.containsToken(memberFunctionDeclaration.modifiers, 58 /* StaticKeyword */); - if (isStaticOverload !== isInStaticOverloadChain) { - var propertyNameFullStart = classElementFullStart + TypeScript.Syntax.childOffset(classElement, memberFunctionDeclaration.propertyName); - var diagnostic = isInStaticOverloadChain ? TypeScript.DiagnosticCode.Function_overload_must_be_static : TypeScript.DiagnosticCode.Function_overload_must_not_be_static; - this.pushDiagnostic1(propertyNameFullStart, memberFunctionDeclaration.propertyName, diagnostic, null); - return true; - } - } else if (inConstructorOverloadChain) { - if (classElement.kind() !== 137 /* ConstructorDeclaration */) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Constructor_implementation_expected); - return true; - } - } - - if (classElement.kind() === 135 /* MemberFunctionDeclaration */) { - memberFunctionDeclaration = classElement; - - inFunctionOverloadChain = memberFunctionDeclaration.block === null; - functionOverloadChainName = memberFunctionDeclaration.propertyName.valueText(); - isInStaticOverloadChain = TypeScript.SyntaxUtilities.containsToken(memberFunctionDeclaration.modifiers, 58 /* StaticKeyword */); - - if (inFunctionOverloadChain) { - if (lastElement) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } else { - var nextElement = node.classElements.childAt(i + 1); - if (nextElement.kind() === 135 /* MemberFunctionDeclaration */) { - var nextMemberFunction = nextElement; - - if (nextMemberFunction.propertyName.valueText() !== functionOverloadChainName && nextMemberFunction.block === null) { - var propertyNameFullStart = classElementFullStart + TypeScript.Syntax.childOffset(classElement, memberFunctionDeclaration.propertyName); - this.pushDiagnostic1(propertyNameFullStart, memberFunctionDeclaration.propertyName, TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - } - } - } - } else if (classElement.kind() === 137 /* ConstructorDeclaration */) { - var constructorDeclaration = classElement; - - inConstructorOverloadChain = constructorDeclaration.block === null; - if (lastElement && inConstructorOverloadChain) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Constructor_implementation_expected); - return true; - } - } - - classElementFullStart += classElement.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForReservedName = function (parent, name, diagnosticKey) { - var nameFullStart = this.childFullStart(parent, name); - var token; - var tokenFullStart; - - var current = name; - while (current !== null) { - if (current.kind() === 121 /* QualifiedName */) { - var qualifiedName = current; - token = qualifiedName.right; - tokenFullStart = nameFullStart + this.childFullStart(qualifiedName, token); - current = qualifiedName.left; - } else { - TypeScript.Debug.assert(current.kind() === 11 /* IdentifierName */); - token = current; - tokenFullStart = nameFullStart; - current = null; - } - - switch (token.valueText()) { - case "any": - case "number": - case "boolean": - case "string": - case "void": - this.pushDiagnostic(tokenFullStart + token.leadingTriviaWidth(), token.width(), diagnosticKey, [token.valueText()]); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitClassDeclaration = function (node) { - if (this.checkForReservedName(node, node.identifier, TypeScript.DiagnosticCode.Class_name_cannot_be_0) || this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.classKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkClassDeclarationHeritageClauses(node) || this.checkClassOverloads(node)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitClassDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkInterfaceDeclarationHeritageClauses = function (node) { - var heritageClauseFullStart = this.childFullStart(node, node.heritageClauses); - - var seenExtendsClause = false; - - for (var i = 0, n = node.heritageClauses.childCount(); i < n; i++) { - TypeScript.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses.childAt(i); - - if (heritageClause.extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */) { - if (seenExtendsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); - return true; - } - - seenExtendsClause = true; - } else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.tokenKind === 51 /* ImplementsKeyword */); - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.Interface_declaration_cannot_have_implements_clause); - return true; - } - - heritageClauseFullStart += heritageClause.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkInterfaceModifiers = function (modifiers) { - var modifierFullStart = this.position(); - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var modifier = modifiers.childAt(i); - if (modifier.tokenKind === 63 /* DeclareKeyword */) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.declare_modifier_cannot_appear_on_an_interface_declaration); - return true; - } - - modifierFullStart += modifier.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitInterfaceDeclaration = function (node) { - if (this.checkForReservedName(node, node.identifier, TypeScript.DiagnosticCode.Interface_name_cannot_be_0) || this.checkInterfaceModifiers(node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkInterfaceDeclarationHeritageClauses(node)) { - this.skip(node); - return; - } - - _super.prototype.visitInterfaceDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkClassElementModifiers = function (list) { - var modifierFullStart = this.position(); - - var seenAccessibilityModifier = false; - var seenStaticModifier = false; - - for (var i = 0, n = list.childCount(); i < n; i++) { - var modifier = list.childAt(i); - if (modifier.tokenKind === 57 /* PublicKeyword */ || modifier.tokenKind === 55 /* PrivateKeyword */) { - if (seenAccessibilityModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return true; - } - - if (seenStaticModifier) { - var previousToken = list.childAt(i - 1); - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [modifier.text(), previousToken.text()]); - return true; - } - - seenAccessibilityModifier = true; - } else if (modifier.tokenKind === 58 /* StaticKeyword */) { - if (seenStaticModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); - return true; - } - - seenStaticModifier = true; - } else { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_class_element, [modifier.text()]); - return true; - } - - modifierFullStart += modifier.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitMemberVariableDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - _super.prototype.visitMemberVariableDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitMemberFunctionDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - _super.prototype.visitMemberFunctionDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkGetAccessorParameter = function (node, getKeyword, parameterList) { - var getKeywordFullStart = this.childFullStart(node, getKeyword); - if (parameterList.parameters.childCount() !== 0) { - this.pushDiagnostic1(getKeywordFullStart, getKeyword, TypeScript.DiagnosticCode.get_accessor_cannot_have_parameters); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitIndexMemberDeclaration = function (node) { - if (this.checkIndexMemberModifiers(node)) { - this.skip(node); - return; - } - - _super.prototype.visitIndexMemberDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkIndexMemberModifiers = function (node) { - if (node.modifiers.childCount() > 0) { - var modifierFullStart = this.childFullStart(node, node.modifiers); - this.pushDiagnostic1(modifierFullStart, node.modifiers.childAt(0), TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkEcmaScriptVersionIsAtLeast = function (parent, node, languageVersion, diagnosticKey) { - if (this.syntaxTree.parseOptions().languageVersion() < languageVersion) { - var nodeFullStart = this.childFullStart(parent, node); - this.pushDiagnostic1(nodeFullStart, node, diagnosticKey); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitObjectLiteralExpression = function (node) { - var savedInObjectLiteralExpression = this.inObjectLiteralExpression; - this.inObjectLiteralExpression = true; - _super.prototype.visitObjectLiteralExpression.call(this, node); - this.inObjectLiteralExpression = savedInObjectLiteralExpression; - }; - - GrammarCheckerWalker.prototype.visitGetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node, node.getKeyword, 1 /* EcmaScript5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkGetAccessorParameter(node, node.getKeyword, node.parameterList)) { - this.skip(node); - return; - } - - _super.prototype.visitGetAccessor.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkForAccessorDeclarationInAmbientContext = function (accessor) { - if (this.inAmbientDeclaration) { - this.pushDiagnostic1(this.position(), accessor, TypeScript.DiagnosticCode.Accessors_are_not_allowed_in_ambient_contexts, null); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkSetAccessorParameter = function (node, setKeyword, parameterList) { - var setKeywordFullStart = this.childFullStart(node, setKeyword); - if (parameterList.parameters.childCount() !== 1) { - this.pushDiagnostic1(setKeywordFullStart, setKeyword, TypeScript.DiagnosticCode.set_accessor_must_have_one_and_only_one_parameter); - return true; - } - - var parameterListFullStart = this.childFullStart(node, parameterList); - var parameterFullStart = parameterListFullStart + TypeScript.Syntax.childOffset(parameterList, parameterList.openParenToken); - var parameter = parameterList.parameters.childAt(0); - - if (parameter.questionToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_be_optional); - return true; - } - - if (parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_have_an_initializer); - return true; - } - - if (parameter.dotDotDotToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.set_accessor_cannot_have_rest_parameter); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitSetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node, node.setKeyword, 1 /* EcmaScript5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkSetAccessorParameter(node, node.setKeyword, node.parameterList)) { - this.skip(node); - return; - } - - _super.prototype.visitSetAccessor.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitEnumDeclaration = function (node) { - if (this.checkForReservedName(node, node.identifier, TypeScript.DiagnosticCode.Enum_name_cannot_be_0) || this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.enumKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers), this.checkEnumElements(node)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitEnumDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkEnumElements = function (node) { - var enumElementFullStart = this.childFullStart(node, node.enumElements); - - var previousValueWasComputed = false; - for (var i = 0, n = node.enumElements.childCount(); i < n; i++) { - var child = node.enumElements.childAt(i); - - if (i % 2 === 0) { - var enumElement = child; - - if (!enumElement.equalsValueClause && previousValueWasComputed) { - this.pushDiagnostic1(enumElementFullStart, enumElement, TypeScript.DiagnosticCode.Enum_member_must_have_initializer, null); - return true; - } - - if (enumElement.equalsValueClause) { - var value = enumElement.equalsValueClause.value; - previousValueWasComputed = !TypeScript.Syntax.isIntegerLiteral(value); - } - } - - enumElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitEnumElement = function (node) { - if (this.inAmbientDeclaration && node.equalsValueClause) { - var expression = node.equalsValueClause.value; - if (!TypeScript.Syntax.isIntegerLiteral(expression)) { - this.pushDiagnostic1(this.childFullStart(node, node.equalsValueClause), node.equalsValueClause.firstToken(), TypeScript.DiagnosticCode.Ambient_enum_elements_can_only_have_integer_literal_initializers); - this.skip(node); - return; - } - } - - _super.prototype.visitEnumElement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitInvocationExpression = function (node) { - if (node.expression.kind() === 50 /* SuperKeyword */ && node.argumentList.typeArgumentList !== null) { - this.pushDiagnostic1(this.position(), node, TypeScript.DiagnosticCode.super_invocation_cannot_have_type_arguments); - } - - _super.prototype.visitInvocationExpression.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkModuleElementModifiers = function (modifiers) { - var modifierFullStart = this.position(); - var seenExportModifier = false; - var seenDeclareModifier = false; - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var modifier = modifiers.childAt(i); - if (modifier.tokenKind === 57 /* PublicKeyword */ || modifier.tokenKind === 55 /* PrivateKeyword */ || modifier.tokenKind === 58 /* StaticKeyword */) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); - return true; - } - - if (modifier.tokenKind === 63 /* DeclareKeyword */) { - if (seenDeclareModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return; - } - - seenDeclareModifier = true; - } else if (modifier.tokenKind === 47 /* ExportKeyword */) { - if (seenExportModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); - return; - } - - if (seenDeclareModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [TypeScript.SyntaxFacts.getText(47 /* ExportKeyword */), TypeScript.SyntaxFacts.getText(63 /* DeclareKeyword */)]); - return; - } - - seenExportModifier = true; - } - - modifierFullStart += modifier.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedImportDeclaration = function (node) { - var currentElementFullStart = this.childFullStart(node, node.moduleElements); - - for (var i = 0, n = node.moduleElements.childCount(); i < n; i++) { - var child = node.moduleElements.childAt(i); - if (child.kind() === 133 /* ImportDeclaration */) { - var importDeclaration = child; - if (importDeclaration.moduleReference.kind() === 245 /* ExternalModuleReference */) { - if (node.stringLiteral === null) { - this.pushDiagnostic1(currentElementFullStart, importDeclaration, TypeScript.DiagnosticCode.Import_declarations_in_an_internal_module_cannot_reference_an_external_module, null); - } - } - } - - currentElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifierOnImportDeclaration = function (modifiers) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 63 /* DeclareKeyword */); - - if (declareToken) { - this.pushDiagnostic1(this.childFullStart(modifiers, declareToken), declareToken, TypeScript.DiagnosticCode.declare_modifier_not_allowed_on_import_declaration); - return true; - } - }; - - GrammarCheckerWalker.prototype.visitImportDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifierOnImportDeclaration(node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - _super.prototype.visitImportDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitModuleDeclaration = function (node) { - if (this.checkForReservedName(node, node.name, TypeScript.DiagnosticCode.Module_name_cannot_be_0) || this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.moduleKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkForDisallowedImportDeclaration(node) || this.checkForDisallowedExports(node, node.moduleElements) || this.checkForMultipleExportAssignments(node, node.moduleElements)) { - this.skip(node); - return; - } - - if (!TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */) && this.checkFunctionOverloads(node, node.moduleElements)) { - this.skip(node); - return; - } - - if (node.stringLiteral) { - if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { - var stringLiteralFullStart = this.childFullStart(node, node.stringLiteral); - this.pushDiagnostic1(stringLiteralFullStart, node.stringLiteral, TypeScript.DiagnosticCode.Only_ambient_modules_can_use_quoted_names); - this.skip(node); - return; - } - } - - if (!node.stringLiteral && this.checkForDisallowedExportAssignment(node)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitModuleDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedExports = function (node, moduleElements) { - var seenExportedElement = false; - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var child = moduleElements.childAt(i); - - if (TypeScript.SyntaxUtilities.hasExportKeyword(child)) { - seenExportedElement = true; - break; - } - } - - var moduleElementFullStart = this.childFullStart(node, moduleElements); - if (seenExportedElement) { - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var child = moduleElements.childAt(i); - - if (child.kind() === 134 /* ExportAssignment */) { - this.pushDiagnostic1(moduleElementFullStart, child, TypeScript.DiagnosticCode.Export_assignment_not_allowed_in_module_with_exported_element); - return true; - } - - moduleElementFullStart += child.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForMultipleExportAssignments = function (node, moduleElements) { - var moduleElementFullStart = this.childFullStart(node, moduleElements); - var seenExportAssignment = false; - var errorFound = false; - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var child = moduleElements.childAt(i); - if (child.kind() === 134 /* ExportAssignment */) { - if (seenExportAssignment) { - this.pushDiagnostic1(moduleElementFullStart, child, TypeScript.DiagnosticCode.Module_cannot_have_multiple_export_assignments); - errorFound = true; - } - seenExportAssignment = true; - } - - moduleElementFullStart += child.fullWidth(); - } - - return errorFound; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedExportAssignment = function (node) { - var moduleElementFullStart = this.childFullStart(node, node.moduleElements); - - for (var i = 0, n = node.moduleElements.childCount(); i < n; i++) { - var child = node.moduleElements.childAt(i); - - if (child.kind() === 134 /* ExportAssignment */) { - this.pushDiagnostic1(moduleElementFullStart, child, TypeScript.DiagnosticCode.Export_assignment_cannot_be_used_in_internal_modules); - - return true; - } - - moduleElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitBlock = function (node) { - if (this.inAmbientDeclaration || this.syntaxTree.isDeclaration()) { - this.pushDiagnostic1(this.position(), node.firstToken(), TypeScript.DiagnosticCode.Implementations_are_not_allowed_in_ambient_contexts); - this.skip(node); - return; - } - - if (this.checkFunctionOverloads(node, node.statements)) { - this.skip(node); - return; - } - - var savedInBlock = this.inBlock; - this.inBlock = true; - _super.prototype.visitBlock.call(this, node); - this.inBlock = savedInBlock; - }; - - GrammarCheckerWalker.prototype.checkForStatementInAmbientContxt = function (node) { - if (this.inAmbientDeclaration || this.syntaxTree.isDeclaration()) { - this.pushDiagnostic1(this.position(), node.firstToken(), TypeScript.DiagnosticCode.Statements_are_not_allowed_in_ambient_contexts); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitBreakStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitBreakStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitContinueStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitContinueStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitDebuggerStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitDebuggerStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitDoStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitDoStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitEmptyStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitEmptyStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitExpressionStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitExpressionStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitForInStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkForInStatementVariableDeclaration(node)) { - this.skip(node); - return; - } - - _super.prototype.visitForInStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkForInStatementVariableDeclaration = function (node) { - if (node.variableDeclaration && node.variableDeclaration.variableDeclarators.nonSeparatorCount() > 1) { - var variableDeclarationFullStart = this.childFullStart(node, node.variableDeclaration); - - this.pushDiagnostic1(variableDeclarationFullStart, node.variableDeclaration, TypeScript.DiagnosticCode.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitForStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitForStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitIfStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitIfStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitLabeledStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitLabeledStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitReturnStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitReturnStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitSwitchStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitSwitchStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitThrowStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitThrowStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitTryStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitTryStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitWhileStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitWhileStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitWithStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitWithStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkForDisallowedModifiers = function (parent, modifiers) { - if (this.inBlock || this.inObjectLiteralExpression) { - if (modifiers.childCount() > 0) { - var modifierFullStart = this.childFullStart(parent, modifiers); - this.pushDiagnostic1(modifierFullStart, modifiers.childAt(0), TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitFunctionDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkForRequiredDeclareModifier(node, node.functionKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitFunctionDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitVariableStatement = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkForRequiredDeclareModifier(node, node.variableDeclaration, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitVariableStatement.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkListSeparators = function (parent, list, kind) { - var currentElementFullStart = this.childFullStart(parent, list); - - for (var i = 0, n = list.childCount(); i < n; i++) { - var child = list.childAt(i); - if (i % 2 === 1 && child.kind() !== kind) { - this.pushDiagnostic1(currentElementFullStart, child, TypeScript.DiagnosticCode._0_expected, [TypeScript.SyntaxFacts.getText(kind)]); - } - - currentElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitObjectType = function (node) { - if (this.checkListSeparators(node, node.typeMembers, 78 /* SemicolonToken */)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitObjectType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitArrayType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitArrayType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitFunctionType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitFunctionType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitConstructorType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitConstructorType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitVariableDeclarator = function (node) { - if (this.inAmbientDeclaration && node.equalsValueClause) { - this.pushDiagnostic1(this.childFullStart(node, node.equalsValueClause), node.equalsValueClause.firstToken(), TypeScript.DiagnosticCode.Initializers_are_not_allowed_in_ambient_contexts); - this.skip(node); - return; - } - - _super.prototype.visitVariableDeclarator.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitConstructorDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers) || this.checkConstructorModifiers(node.modifiers) || this.checkConstructorTypeParameterList(node) || this.checkConstructorTypeAnnotation(node)) { - this.skip(node); - return; - } - - var savedCurrentConstructor = this.currentConstructor; - this.currentConstructor = node; - _super.prototype.visitConstructorDeclaration.call(this, node); - this.currentConstructor = savedCurrentConstructor; - }; - - GrammarCheckerWalker.prototype.checkConstructorModifiers = function (modifiers) { - var currentElementFullStart = this.position(); - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var child = modifiers.childAt(i); - if (child.kind() !== 57 /* PublicKeyword */) { - this.pushDiagnostic1(currentElementFullStart, child, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_constructor_declaration, [TypeScript.SyntaxFacts.getText(child.kind())]); - return true; - } - - currentElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkConstructorTypeParameterList = function (node) { - var currentElementFullStart = this.position(); - - if (node.callSignature.typeParameterList) { - var callSignatureFullStart = this.childFullStart(node, node.callSignature); - var typeParameterListFullStart = callSignatureFullStart + TypeScript.Syntax.childOffset(node.callSignature, node.callSignature.typeAnnotation); - this.pushDiagnostic1(callSignatureFullStart, node.callSignature.typeParameterList, TypeScript.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkConstructorTypeAnnotation = function (node) { - var currentElementFullStart = this.position(); - - if (node.callSignature.typeAnnotation) { - var callSignatureFullStart = this.childFullStart(node, node.callSignature); - var typeAnnotationFullStart = callSignatureFullStart + TypeScript.Syntax.childOffset(node.callSignature, node.callSignature.typeAnnotation); - this.pushDiagnostic1(typeAnnotationFullStart, node.callSignature.typeAnnotation, TypeScript.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitSourceUnit = function (node) { - if (this.checkFunctionOverloads(node, node.moduleElements) || this.checkForDisallowedExports(node, node.moduleElements) || this.checkForMultipleExportAssignments(node, node.moduleElements)) { - this.skip(node); - return; - } - - _super.prototype.visitSourceUnit.call(this, node); - }; - return GrammarCheckerWalker; - })(TypeScript.PositionTrackingWalker); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Unicode = (function () { - function Unicode() { - } - Unicode.lookupInUnicodeMap = function (code, map) { - if (code < map[0]) { - return false; - } - - var lo = 0; - var hi = map.length; - var mid; - - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - - if (code < map[mid]) { - hi = mid; - } else { - lo = mid + 2; - } - } - - return false; - }; - - Unicode.isIdentifierStart = function (code, languageVersion) { - if (languageVersion === 0 /* EcmaScript3 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierStart); - } else if (languageVersion === 1 /* EcmaScript5 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierStart); - } else { - throw TypeScript.Errors.argumentOutOfRange("languageVersion"); - } - }; - - Unicode.isIdentifierPart = function (code, languageVersion) { - if (languageVersion === 0 /* EcmaScript3 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierPart); - } else if (languageVersion === 1 /* EcmaScript5 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierPart); - } else { - throw TypeScript.Errors.argumentOutOfRange("languageVersion"); - } - }; - Unicode.unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - Unicode.unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - - Unicode.unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - Unicode.unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - return Unicode; - })(); - TypeScript.Unicode = Unicode; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (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; - })(TypeScript.CompilerDiagnostics || (TypeScript.CompilerDiagnostics = {})); - var 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; - - function timeFunction(logger, funcDescription, func) { - var start = (new Date()).getTime(); - var result = func(); - var end = (new Date()).getTime(); - if (logger.information()) { - logger.log(funcDescription + " completed in " + (end - start) + " msec"); - } - return result; - } - TypeScript.timeFunction = timeFunction; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Document = (function () { - function Document(_compiler, _semanticInfoChain, fileName, referencedFiles, _scriptSnapshot, byteOrderMark, version, isOpen, _syntaxTree, _topLevelDecl) { - this._compiler = _compiler; - this._semanticInfoChain = _semanticInfoChain; - this.fileName = fileName; - this.referencedFiles = referencedFiles; - this._scriptSnapshot = _scriptSnapshot; - this.byteOrderMark = byteOrderMark; - this.version = version; - this.isOpen = isOpen; - this._syntaxTree = _syntaxTree; - this._topLevelDecl = _topLevelDecl; - this._diagnostics = null; - this._bloomFilter = null; - this._sourceUnit = null; - this._lineMap = null; - this._declASTMap = []; - this._astDeclMap = []; - this._amdDependencies = undefined; - this._externalModuleIndicatorSpan = undefined; - } - Document.prototype.invalidate = function () { - this._declASTMap.length = 0; - this._astDeclMap.length = 0; - this._topLevelDecl = null; - - this._syntaxTree = null; - this._sourceUnit = null; - this._diagnostics = null; - this._bloomFilter = null; - }; - - Document.prototype.isDeclareFile = function () { - return TypeScript.isDTSFile(this.fileName); - }; - - Document.prototype.cacheSyntaxTreeInfo = function (syntaxTree) { - var start = new Date().getTime(); - this._diagnostics = syntaxTree.diagnostics(); - TypeScript.syntaxDiagnosticsTime += new Date().getTime() - start; - - this._lineMap = syntaxTree.lineMap(); - - var sourceUnit = syntaxTree.sourceUnit(); - var leadingTrivia = sourceUnit.leadingTrivia(); - - this._externalModuleIndicatorSpan = this.getImplicitImportSpan(leadingTrivia) || this.getTopLevelImportOrExportSpan(sourceUnit); - - var amdDependencies = []; - for (var i = 0, n = leadingTrivia.count(); i < n; i++) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.isComment()) { - var amdDependency = this.getAmdDependency(trivia.fullText()); - if (amdDependency) { - amdDependencies.push(amdDependency); - } - } - } - - this._amdDependencies = amdDependencies; - }; - - Document.prototype.getAmdDependency = function (comment) { - var amdDependencyRegEx = /^\/\/\/\s*/gim; - var match = implicitImportRegEx.exec(trivia.fullText()); - - if (match) { - return new TypeScript.TextSpan(position, trivia.fullWidth()); - } - - return null; - }; - - Document.prototype.getTopLevelImportOrExportSpan = function (node) { - var firstToken; - var position = 0; - - for (var i = 0, n = node.moduleElements.childCount(); i < n; i++) { - var moduleElement = node.moduleElements.childAt(i); - - firstToken = moduleElement.firstToken(); - if (firstToken !== null && firstToken.tokenKind === 47 /* ExportKeyword */) { - return new TypeScript.TextSpan(position + firstToken.leadingTriviaWidth(), firstToken.width()); - } - - if (moduleElement.kind() === 133 /* ImportDeclaration */) { - var importDecl = moduleElement; - if (importDecl.moduleReference.kind() === 245 /* ExternalModuleReference */) { - return new TypeScript.TextSpan(position + importDecl.leadingTriviaWidth(), importDecl.width()); - } - } - - position += moduleElement.fullWidth(); - } - - return null; - ; - }; - - Document.prototype.sourceUnit = function () { - if (!this._sourceUnit) { - var start = new Date().getTime(); - var syntaxTree = this.syntaxTree(); - this._sourceUnit = TypeScript.SyntaxTreeToAstVisitor.visit(syntaxTree, this.fileName, this._compiler.compilationSettings(), this.isOpen); - TypeScript.astTranslationTime += new Date().getTime() - start; - - if (!this.isOpen) { - this._syntaxTree = null; - } - } - - return this._sourceUnit; - }; - - Document.prototype.diagnostics = function () { - if (this._diagnostics === null) { - this.syntaxTree(); - TypeScript.Debug.assert(this._diagnostics); - } - - return this._diagnostics; - }; - - Document.prototype.lineMap = function () { - if (this._lineMap === null) { - this.syntaxTree(); - TypeScript.Debug.assert(this._lineMap); - } - - return this._lineMap; - }; - - Document.prototype.isExternalModule = function () { - return this.externalModuleIndicatorSpan() !== null; - }; - - Document.prototype.externalModuleIndicatorSpan = function () { - if (this._externalModuleIndicatorSpan === undefined) { - this.syntaxTree(); - TypeScript.Debug.assert(this._externalModuleIndicatorSpan !== undefined); - } - - return this._externalModuleIndicatorSpan; - }; - - Document.prototype.amdDependencies = function () { - if (this._amdDependencies === undefined) { - this.syntaxTree(); - TypeScript.Debug.assert(this._amdDependencies !== undefined); - } - - return this._amdDependencies; - }; - - Document.prototype.syntaxTree = function () { - var result = this._syntaxTree; - if (!result) { - var start = new Date().getTime(); - - result = TypeScript.Parser.parse(this.fileName, TypeScript.SimpleText.fromScriptSnapshot(this._scriptSnapshot), TypeScript.isDTSFile(this.fileName), TypeScript.getParseOptions(this._compiler.compilationSettings())); - - TypeScript.syntaxTreeParseTime += new Date().getTime() - start; - - if (this.isOpen || !this._sourceUnit) { - this._syntaxTree = result; - } - } - - this.cacheSyntaxTreeInfo(result); - return result; - }; - - Document.prototype.bloomFilter = function () { - if (!this._bloomFilter) { - var identifiers = TypeScript.createIntrinsicsObject(); - var pre = function (cur) { - if (TypeScript.ASTHelpers.isValidAstNode(cur)) { - if (cur.kind() === 11 /* IdentifierName */) { - var nodeText = cur.valueText(); - - identifiers[nodeText] = true; - } - } - }; - - TypeScript.getAstWalkerFactory().simpleWalk(this.sourceUnit(), pre, null, identifiers); - - var identifierCount = 0; - for (var name in identifiers) { - if (identifiers[name]) { - identifierCount++; - } - } - - this._bloomFilter = new TypeScript.BloomFilter(identifierCount); - this._bloomFilter.addKeys(identifiers); - } - return this._bloomFilter; - }; - - Document.prototype.emitToOwnOutputFile = function () { - return !this._compiler.compilationSettings().outFileOption() || this.isExternalModule(); - }; - - Document.prototype.update = function (scriptSnapshot, version, isOpen, textChangeRange) { - var oldSyntaxTree = this._syntaxTree; - - if (textChangeRange !== null && TypeScript.Debug.shouldAssert(1 /* Normal */)) { - var oldText = this._scriptSnapshot; - var newText = scriptSnapshot; - - TypeScript.Debug.assert((oldText.getLength() - textChangeRange.span().length() + textChangeRange.newLength()) === newText.getLength()); - - if (TypeScript.Debug.shouldAssert(3 /* VeryAggressive */)) { - var oldTextPrefix = oldText.getText(0, textChangeRange.span().start()); - var newTextPrefix = newText.getText(0, textChangeRange.span().start()); - TypeScript.Debug.assert(oldTextPrefix === newTextPrefix); - - var oldTextSuffix = oldText.getText(textChangeRange.span().end(), oldText.getLength()); - var newTextSuffix = newText.getText(textChangeRange.newSpan().end(), newText.getLength()); - TypeScript.Debug.assert(oldTextSuffix === newTextSuffix); - } - } - - var text = TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot); - - var newSyntaxTree = textChangeRange === null || oldSyntaxTree === null ? TypeScript.Parser.parse(this.fileName, text, TypeScript.isDTSFile(this.fileName), TypeScript.getParseOptions(this._compiler.compilationSettings())) : TypeScript.Parser.incrementalParse(oldSyntaxTree, textChangeRange, text); - - return new Document(this._compiler, this._semanticInfoChain, this.fileName, this.referencedFiles, scriptSnapshot, this.byteOrderMark, version, isOpen, newSyntaxTree, null); - }; - - Document.create = function (compiler, semanticInfoChain, fileName, scriptSnapshot, byteOrderMark, version, isOpen, referencedFiles) { - return new Document(compiler, semanticInfoChain, fileName, referencedFiles, scriptSnapshot, byteOrderMark, version, isOpen, null, null); - }; - - Document.prototype.topLevelDecl = function () { - if (this._topLevelDecl === null) { - this._topLevelDecl = TypeScript.DeclarationCreator.create(this, this._semanticInfoChain, this._compiler.compilationSettings()); - } - - return this._topLevelDecl; - }; - - Document.prototype._getDeclForAST = function (ast) { - this.topLevelDecl(); - return this._astDeclMap[ast.syntaxID()]; - }; - - Document.prototype.getEnclosingDecl = function (ast) { - if (ast.kind() === 120 /* SourceUnit */) { - return this._getDeclForAST(ast); - } - - ast = ast.parent; - var decl = null; - while (ast) { - decl = this._getDeclForAST(ast); - - if (decl) { - break; - } - - ast = ast.parent; - } - - return decl._getEnclosingDeclFromParentDecl(); - }; - - Document.prototype._setDeclForAST = function (ast, decl) { - TypeScript.Debug.assert(decl.fileName() === this.fileName); - this._astDeclMap[ast.syntaxID()] = decl; - }; - - Document.prototype._getASTForDecl = function (decl) { - return this._declASTMap[decl.declID]; - }; - - Document.prototype._setASTForDecl = function (decl, ast) { - TypeScript.Debug.assert(decl.fileName() === this.fileName); - this._declASTMap[decl.declID] = ast; - }; - return Document; - })(); - TypeScript.Document = Document; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function hasFlag(val, flag) { - return (val & flag) !== 0; - } - TypeScript.hasFlag = hasFlag; - - (function (TypeRelationshipFlags) { - TypeRelationshipFlags[TypeRelationshipFlags["SuccessfulComparison"] = 0] = "SuccessfulComparison"; - 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"; - TypeRelationshipFlags[TypeRelationshipFlags["InconsistantPropertyAccesibility"] = 1 << 7] = "InconsistantPropertyAccesibility"; - })(TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {})); - var TypeRelationshipFlags = TypeScript.TypeRelationshipFlags; - - (function (ModuleGenTarget) { - ModuleGenTarget[ModuleGenTarget["Unspecified"] = 0] = "Unspecified"; - ModuleGenTarget[ModuleGenTarget["Synchronous"] = 1] = "Synchronous"; - ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 2] = "Asynchronous"; - })(TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {})); - var ModuleGenTarget = TypeScript.ModuleGenTarget; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var proto = "__proto__"; - - 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; - this["constructor"] = undefined; - - this[proto] = null; - this[proto] = undefined; - } - return BlockIntrinsics; - })(); - - function createIntrinsicsObject() { - return new BlockIntrinsics(); - } - TypeScript.createIntrinsicsObject = createIntrinsicsObject; - - var StringHashTable = (function () { - function StringHashTable() { - this.itemCount = 0; - this.table = createIntrinsicsObject(); - } - StringHashTable.prototype.getAllKeys = function () { - var result = []; - - for (var k in this.table) { - if (this.table[k] !== undefined) { - result.push(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]; - return data === undefined ? null : data; - }; - - StringHashTable.prototype.remove = function (key) { - if (this.table[key] !== undefined) { - this.table[key] = undefined; - this.itemCount--; - } - }; - return StringHashTable; - })(); - TypeScript.StringHashTable = StringHashTable; - - var IdentiferNameHashTable = (function (_super) { - __extends(IdentiferNameHashTable, _super); - function IdentiferNameHashTable() { - _super.apply(this, arguments); - } - IdentiferNameHashTable.prototype.getAllKeys = function () { - var result = []; - - _super.prototype.map.call(this, function (k, v, c) { - if (v !== undefined) { - result.push(k.substring(1)); - } - }, null); - - return result; - }; - - IdentiferNameHashTable.prototype.add = function (key, data) { - return _super.prototype.add.call(this, "#" + key, data); - }; - - IdentiferNameHashTable.prototype.addOrUpdate = function (key, data) { - return _super.prototype.addOrUpdate.call(this, "#" + key, data); - }; - - IdentiferNameHashTable.prototype.map = function (fn, context) { - return _super.prototype.map.call(this, function (k, v, c) { - return fn(k.substring(1), v, c); - }, context); - }; - - IdentiferNameHashTable.prototype.every = function (fn, context) { - return _super.prototype.every.call(this, function (k, v, c) { - return fn(k.substring(1), v, c); - }, context); - }; - - IdentiferNameHashTable.prototype.some = function (fn, context) { - return _super.prototype.some.call(this, function (k, v, c) { - return fn(k.substring(1), v, c); - }, context); - }; - - IdentiferNameHashTable.prototype.lookup = function (key) { - return _super.prototype.lookup.call(this, "#" + key); - }; - return IdentiferNameHashTable; - })(StringHashTable); - TypeScript.IdentiferNameHashTable = IdentiferNameHashTable; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (ASTHelpers) { - function scriptIsElided(sourceUnit) { - return TypeScript.isDTSFile(sourceUnit.fileName()) || moduleMembersAreElided(sourceUnit.moduleElements); - } - ASTHelpers.scriptIsElided = scriptIsElided; - - function moduleIsElided(declaration) { - return TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */) || moduleMembersAreElided(declaration.moduleElements); - } - ASTHelpers.moduleIsElided = moduleIsElided; - - function moduleMembersAreElided(members) { - for (var i = 0, n = members.childCount(); i < n; i++) { - var member = members.childAt(i); - - if (member.kind() === 130 /* ModuleDeclaration */) { - if (!moduleIsElided(member)) { - return false; - } - } else if (member.kind() !== 128 /* InterfaceDeclaration */) { - return false; - } - } - - return true; - } - - function enumIsElided(declaration) { - if (TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */)) { - return true; - } - - return false; - } - ASTHelpers.enumIsElided = enumIsElided; - - function isValidAstNode(ast) { - if (!ast) - return false; - - if (ast.start() === -1 || ast.end() === -1) - return false; - - return true; - } - ASTHelpers.isValidAstNode = isValidAstNode; - - function getAstAtPosition(script, pos, useTrailingTriviaAsLimChar, forceInclusive) { - if (typeof useTrailingTriviaAsLimChar === "undefined") { useTrailingTriviaAsLimChar = true; } - if (typeof forceInclusive === "undefined") { forceInclusive = false; } - var top = null; - - var pre = function (cur, walker) { - if (isValidAstNode(cur)) { - var isInvalid1 = cur.kind() === 149 /* ExpressionStatement */ && cur.width() === 0; - - if (isInvalid1) { - walker.options.goChildren = false; - } else { - var inclusive = forceInclusive || cur.kind() === 11 /* IdentifierName */ || cur.kind() === 212 /* MemberAccessExpression */ || cur.kind() === 121 /* QualifiedName */ || cur.kind() === 224 /* VariableDeclaration */ || cur.kind() === 225 /* VariableDeclarator */ || cur.kind() === 213 /* InvocationExpression */ || pos === script.end() + script.trailingTriviaWidth(); - - var minChar = cur.start(); - var limChar = cur.end() + (useTrailingTriviaAsLimChar ? cur.trailingTriviaWidth() : 0) + (inclusive ? 1 : 0); - if (pos >= minChar && pos < limChar) { - if ((cur.kind() !== 1 /* List */ && cur.kind() !== 2 /* SeparatedList */) || cur.end() > cur.start()) { - if (top === null) { - top = cur; - } else if (cur.start() >= top.start() && (cur.end() + (useTrailingTriviaAsLimChar ? cur.trailingTriviaWidth() : 0)) <= (top.end() + (useTrailingTriviaAsLimChar ? top.trailingTriviaWidth() : 0))) { - if (top.width() !== 0 || cur.width() !== 0) { - top = cur; - } - } - } - } - - walker.options.goChildren = (minChar <= pos && pos <= limChar); - } - } - }; - - TypeScript.getAstWalkerFactory().walk(script, pre); - return top; - } - ASTHelpers.getAstAtPosition = getAstAtPosition; - - function getExtendsHeritageClause(clauses) { - if (!clauses) { - return null; - } - - return clauses.firstOrDefault(function (c) { - return c.typeNames.nonSeparatorCount() > 0 && c.kind() === 230 /* ExtendsHeritageClause */; - }); - } - ASTHelpers.getExtendsHeritageClause = getExtendsHeritageClause; - - function getImplementsHeritageClause(clauses) { - if (!clauses) { - return null; - } - - return clauses.firstOrDefault(function (c) { - return c.typeNames.nonSeparatorCount() > 0 && c.kind() === 231 /* ImplementsHeritageClause */; - }); - } - ASTHelpers.getImplementsHeritageClause = getImplementsHeritageClause; - - function isCallExpression(ast) { - return (ast && ast.kind() === 213 /* InvocationExpression */) || (ast && ast.kind() === 216 /* ObjectCreationExpression */); - } - ASTHelpers.isCallExpression = isCallExpression; - - function isCallExpressionTarget(ast) { - if (!ast) { - return false; - } - - var current = ast; - - while (current && current.parent) { - if (current.parent.kind() === 212 /* MemberAccessExpression */ && current.parent.name === current) { - current = current.parent; - continue; - } - - break; - } - - if (current && current.parent) { - if (current.parent.kind() === 213 /* InvocationExpression */ || current.parent.kind() === 216 /* ObjectCreationExpression */) { - return current === current.parent.expression; - } - } - - return false; - } - ASTHelpers.isCallExpressionTarget = isCallExpressionTarget; - - function isNameOfSomeDeclaration(ast) { - if (ast === null || ast.parent === null) { - return false; - } - if (ast.kind() !== 11 /* IdentifierName */) { - return false; - } - - switch (ast.parent.kind()) { - case 131 /* ClassDeclaration */: - return ast.parent.identifier === ast; - case 128 /* InterfaceDeclaration */: - return ast.parent.identifier === ast; - case 132 /* EnumDeclaration */: - return ast.parent.identifier === ast; - case 130 /* ModuleDeclaration */: - return ast.parent.name === ast || ast.parent.stringLiteral === ast; - case 225 /* VariableDeclarator */: - return ast.parent.propertyName === ast; - case 129 /* FunctionDeclaration */: - return ast.parent.identifier === ast; - case 135 /* MemberFunctionDeclaration */: - return ast.parent.propertyName === ast; - case 242 /* Parameter */: - return ast.parent.identifier === ast; - case 238 /* TypeParameter */: - return ast.parent.identifier === ast; - case 240 /* SimplePropertyAssignment */: - return ast.parent.propertyName === ast; - case 241 /* FunctionPropertyAssignment */: - return ast.parent.propertyName === ast; - case 243 /* EnumElement */: - return ast.parent.propertyName === ast; - case 133 /* ImportDeclaration */: - return ast.parent.identifier === ast; - } - - return false; - } - - function isDeclarationASTOrDeclarationNameAST(ast) { - return isNameOfSomeDeclaration(ast) || isDeclarationAST(ast); - } - ASTHelpers.isDeclarationASTOrDeclarationNameAST = isDeclarationASTOrDeclarationNameAST; - - function getEnclosingParameterForInitializer(ast) { - var current = ast; - while (current) { - switch (current.kind()) { - case 232 /* EqualsValueClause */: - if (current.parent && current.parent.kind() === 242 /* Parameter */) { - return current.parent; - } - break; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - return null; - } - - current = current.parent; - } - return null; - } - ASTHelpers.getEnclosingParameterForInitializer = getEnclosingParameterForInitializer; - - function getEnclosingMemberVariableDeclaration(ast) { - var current = ast; - - while (current) { - switch (current.kind()) { - case 136 /* MemberVariableDeclaration */: - return current; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - return null; - } - current = current.parent; - } - - return null; - } - ASTHelpers.getEnclosingMemberVariableDeclaration = getEnclosingMemberVariableDeclaration; - - function isNameOfFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 129 /* FunctionDeclaration */ && ast.parent.identifier === ast; - } - ASTHelpers.isNameOfFunction = isNameOfFunction; - - function isNameOfMemberFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 135 /* MemberFunctionDeclaration */ && ast.parent.propertyName === ast; - } - ASTHelpers.isNameOfMemberFunction = isNameOfMemberFunction; - - function isNameOfMemberAccessExpression(ast) { - if (ast && ast.parent && ast.parent.kind() === 212 /* MemberAccessExpression */ && ast.parent.name === ast) { - return true; - } - - return false; - } - ASTHelpers.isNameOfMemberAccessExpression = isNameOfMemberAccessExpression; - - function isRightSideOfQualifiedName(ast) { - if (ast && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.right === ast) { - return true; - } - - return false; - } - ASTHelpers.isRightSideOfQualifiedName = isRightSideOfQualifiedName; - - function parentIsModuleDeclaration(ast) { - return ast.parent && ast.parent.kind() === 130 /* ModuleDeclaration */; - } - ASTHelpers.parentIsModuleDeclaration = parentIsModuleDeclaration; - - function parametersFromIdentifier(id) { - return { - length: 1, - lastParameterIsRest: function () { - return false; - }, - ast: id, - astAt: function (index) { - return id; - }, - identifierAt: function (index) { - return id; - }, - typeAt: function (index) { - return null; - }, - initializerAt: function (index) { - return null; - }, - isOptionalAt: function (index) { - return false; - } - }; - } - ASTHelpers.parametersFromIdentifier = parametersFromIdentifier; - - function parametersFromParameter(parameter) { - return { - length: 1, - lastParameterIsRest: function () { - return parameter.dotDotDotToken !== null; - }, - ast: parameter, - astAt: function (index) { - return parameter; - }, - identifierAt: function (index) { - return parameter.identifier; - }, - typeAt: function (index) { - return getType(parameter); - }, - initializerAt: function (index) { - return parameter.equalsValueClause; - }, - isOptionalAt: function (index) { - return parameterIsOptional(parameter); - } - }; - } - ASTHelpers.parametersFromParameter = parametersFromParameter; - - function parameterIsOptional(parameter) { - return parameter.questionToken !== null || parameter.equalsValueClause !== null; - } - - function parametersFromParameterList(list) { - return { - length: list.parameters.nonSeparatorCount(), - lastParameterIsRest: function () { - return TypeScript.lastParameterIsRest(list); - }, - ast: list.parameters, - astAt: function (index) { - return list.parameters.nonSeparatorAt(index); - }, - identifierAt: function (index) { - return list.parameters.nonSeparatorAt(index).identifier; - }, - typeAt: function (index) { - return getType(list.parameters.nonSeparatorAt(index)); - }, - initializerAt: function (index) { - return list.parameters.nonSeparatorAt(index).equalsValueClause; - }, - isOptionalAt: function (index) { - return parameterIsOptional(list.parameters.nonSeparatorAt(index)); - } - }; - } - ASTHelpers.parametersFromParameterList = parametersFromParameterList; - - function isDeclarationAST(ast) { - switch (ast.kind()) { - case 225 /* VariableDeclarator */: - return getVariableStatement(ast) !== null; - - case 133 /* ImportDeclaration */: - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 242 /* Parameter */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 144 /* IndexSignature */: - case 129 /* FunctionDeclaration */: - case 130 /* ModuleDeclaration */: - case 124 /* ArrayType */: - case 122 /* ObjectType */: - case 238 /* TypeParameter */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 136 /* MemberVariableDeclaration */: - case 138 /* IndexMemberDeclaration */: - case 132 /* EnumDeclaration */: - case 243 /* EnumElement */: - case 240 /* SimplePropertyAssignment */: - case 241 /* FunctionPropertyAssignment */: - case 222 /* FunctionExpression */: - case 142 /* CallSignature */: - case 143 /* ConstructSignature */: - case 145 /* MethodSignature */: - case 141 /* PropertySignature */: - return true; - default: - return false; - } - } - ASTHelpers.isDeclarationAST = isDeclarationAST; - - function docComments(ast) { - if (isDeclarationAST(ast)) { - var preComments = ast.kind() === 225 /* VariableDeclarator */ ? getVariableStatement(ast).preComments() : ast.preComments(); - - if (preComments && preComments.length > 0) { - var preCommentsLength = preComments.length; - var docComments = new Array(); - for (var i = preCommentsLength - 1; i >= 0; i--) { - if (isDocComment(preComments[i])) { - docComments.push(preComments[i]); - continue; - } - - break; - } - - return docComments.reverse(); - } - } - - return TypeScript.sentinelEmptyArray; - } - ASTHelpers.docComments = docComments; - - function isDocComment(comment) { - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - var fullText = comment.fullText(); - return fullText.charAt(2) === "*" && fullText.charAt(3) !== "/"; - } - - return false; - } - - function getParameterList(ast) { - if (ast) { - switch (ast.kind()) { - case 137 /* ConstructorDeclaration */: - return getParameterList(ast.callSignature); - case 129 /* FunctionDeclaration */: - return getParameterList(ast.callSignature); - case 218 /* ParenthesizedArrowFunctionExpression */: - return getParameterList(ast.callSignature); - case 143 /* ConstructSignature */: - return getParameterList(ast.callSignature); - case 135 /* MemberFunctionDeclaration */: - return getParameterList(ast.callSignature); - case 241 /* FunctionPropertyAssignment */: - return getParameterList(ast.callSignature); - case 222 /* FunctionExpression */: - return getParameterList(ast.callSignature); - case 145 /* MethodSignature */: - return getParameterList(ast.callSignature); - case 125 /* ConstructorType */: - return ast.parameterList; - case 123 /* FunctionType */: - return ast.parameterList; - case 142 /* CallSignature */: - return ast.parameterList; - case 139 /* GetAccessor */: - return ast.parameterList; - case 140 /* SetAccessor */: - return ast.parameterList; - } - } - - return null; - } - ASTHelpers.getParameterList = getParameterList; - - function getType(ast) { - if (ast) { - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - return getType(ast.callSignature); - case 218 /* ParenthesizedArrowFunctionExpression */: - return getType(ast.callSignature); - case 143 /* ConstructSignature */: - return getType(ast.callSignature); - case 135 /* MemberFunctionDeclaration */: - return getType(ast.callSignature); - case 241 /* FunctionPropertyAssignment */: - return getType(ast.callSignature); - case 222 /* FunctionExpression */: - return getType(ast.callSignature); - case 145 /* MethodSignature */: - return getType(ast.callSignature); - case 142 /* CallSignature */: - return getType(ast.typeAnnotation); - case 144 /* IndexSignature */: - return getType(ast.typeAnnotation); - case 141 /* PropertySignature */: - return getType(ast.typeAnnotation); - case 139 /* GetAccessor */: - return getType(ast.typeAnnotation); - case 242 /* Parameter */: - return getType(ast.typeAnnotation); - case 136 /* MemberVariableDeclaration */: - return getType(ast.variableDeclarator); - case 225 /* VariableDeclarator */: - return getType(ast.typeAnnotation); - case 236 /* CatchClause */: - return getType(ast.typeAnnotation); - case 125 /* ConstructorType */: - return ast.type; - case 123 /* FunctionType */: - return ast.type; - case 244 /* TypeAnnotation */: - return ast.type; - } - } - - return null; - } - ASTHelpers.getType = getType; - - function getVariableStatement(variableDeclarator) { - if (variableDeclarator && variableDeclarator.parent && variableDeclarator.parent.parent && variableDeclarator.parent.parent.parent && variableDeclarator.parent.kind() === 2 /* SeparatedList */ && variableDeclarator.parent.parent.kind() === 224 /* VariableDeclaration */ && variableDeclarator.parent.parent.parent.kind() === 148 /* VariableStatement */) { - return variableDeclarator.parent.parent.parent; - } - - return null; - } - - function getVariableDeclaratorModifiers(variableDeclarator) { - var variableStatement = getVariableStatement(variableDeclarator); - return variableStatement ? variableStatement.modifiers : TypeScript.sentinelEmptyArray; - } - ASTHelpers.getVariableDeclaratorModifiers = getVariableDeclaratorModifiers; - - function isIntegerLiteralAST(expression) { - if (expression) { - switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - expression = expression.operand; - return expression.kind() === 13 /* NumericLiteral */ && TypeScript.IntegerUtilities.isInteger(expression.text()); - - case 13 /* NumericLiteral */: - var text = expression.text(); - return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); - } - } - - return false; - } - ASTHelpers.isIntegerLiteralAST = isIntegerLiteralAST; - - function getEnclosingModuleDeclaration(ast) { - while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { - return ast; - } - - ast = ast.parent; - } - - return null; - } - ASTHelpers.getEnclosingModuleDeclaration = getEnclosingModuleDeclaration; - - function isEntireNameOfModuleDeclaration(nameAST) { - return parentIsModuleDeclaration(nameAST) && nameAST.parent.name === nameAST; - } - - function getModuleDeclarationFromNameAST(ast) { - if (ast) { - switch (ast.kind()) { - case 14 /* StringLiteral */: - if (parentIsModuleDeclaration(ast) && ast.parent.stringLiteral === ast) { - return ast.parent; - } - return null; - - case 11 /* IdentifierName */: - case 121 /* QualifiedName */: - if (isEntireNameOfModuleDeclaration(ast)) { - return ast.parent; - } - break; - - default: - return null; - } - - for (ast = ast.parent; ast && ast.kind() === 121 /* QualifiedName */; ast = ast.parent) { - if (isEntireNameOfModuleDeclaration(ast)) { - return ast.parent; - } - } - } - - return null; - } - ASTHelpers.getModuleDeclarationFromNameAST = getModuleDeclarationFromNameAST; - - function isLastNameOfModule(ast, astName) { - if (ast) { - if (ast.stringLiteral) { - return astName === ast.stringLiteral; - } else if (ast.name.kind() === 121 /* QualifiedName */) { - return astName === ast.name.right; - } else { - return astName === ast.name; - } - } - - return false; - } - ASTHelpers.isLastNameOfModule = isLastNameOfModule; - - function getNameOfIdenfierOrQualifiedName(name) { - if (name.kind() === 11 /* IdentifierName */) { - return name.text(); - } else { - TypeScript.Debug.assert(name.kind() == 121 /* QualifiedName */); - var dotExpr = name; - return getNameOfIdenfierOrQualifiedName(dotExpr.left) + "." + getNameOfIdenfierOrQualifiedName(dotExpr.right); - } - } - ASTHelpers.getNameOfIdenfierOrQualifiedName = getNameOfIdenfierOrQualifiedName; - - function getModuleNames(name, result) { - result = result || []; - - if (name.kind() === 121 /* QualifiedName */) { - getModuleNames(name.left, result); - result.push(name.right); - } else { - result.push(name); - } - - return result; - } - ASTHelpers.getModuleNames = getModuleNames; - })(TypeScript.ASTHelpers || (TypeScript.ASTHelpers = {})); - var ASTHelpers = TypeScript.ASTHelpers; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function walkListChildren(preAst, walker) { - for (var i = 0, n = preAst.childCount(); i < n; i++) { - walker.walk(preAst.childAt(i)); - } - } - - function walkThrowStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkPrefixUnaryExpressionChildren(preAst, walker) { - walker.walk(preAst.operand); - } - - function walkPostfixUnaryExpressionChildren(preAst, walker) { - walker.walk(preAst.operand); - } - - function walkDeleteExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkTypeArgumentListChildren(preAst, walker) { - walker.walk(preAst.typeArguments); - } - - function walkTypeOfExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkVoidExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkArgumentListChildren(preAst, walker) { - walker.walk(preAst.typeArgumentList); - walker.walk(preAst.arguments); - } - - function walkArrayLiteralExpressionChildren(preAst, walker) { - walker.walk(preAst.expressions); - } - - function walkSimplePropertyAssignmentChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.expression); - } - - function walkFunctionPropertyAssignmentChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkGetAccessorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.parameterList); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.block); - } - - function walkSeparatedListChildren(preAst, walker) { - for (var i = 0, n = preAst.nonSeparatorCount(); i < n; i++) { - walker.walk(preAst.nonSeparatorAt(i)); - } - } - - function walkSetAccessorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.parameterList); - walker.walk(preAst.block); - } - - function walkObjectLiteralExpressionChildren(preAst, walker) { - walker.walk(preAst.propertyAssignments); - } - - function walkCastExpressionChildren(preAst, walker) { - walker.walk(preAst.type); - walker.walk(preAst.expression); - } - - function walkParenthesizedExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkElementAccessExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentExpression); - } - - function walkMemberAccessExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.name); - } - - function walkQualifiedNameChildren(preAst, walker) { - walker.walk(preAst.left); - walker.walk(preAst.right); - } - - function walkBinaryExpressionChildren(preAst, walker) { - walker.walk(preAst.left); - walker.walk(preAst.right); - } - - function walkEqualsValueClauseChildren(preAst, walker) { - walker.walk(preAst.value); - } - - function walkTypeParameterChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.constraint); - } - - function walkTypeParameterListChildren(preAst, walker) { - walker.walk(preAst.typeParameters); - } - - function walkGenericTypeChildren(preAst, walker) { - walker.walk(preAst.name); - walker.walk(preAst.typeArgumentList); - } - - function walkTypeAnnotationChildren(preAst, walker) { - walker.walk(preAst.type); - } - - function walkTypeQueryChildren(preAst, walker) { - walker.walk(preAst.name); - } - - function walkInvocationExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentList); - } - - function walkObjectCreationExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentList); - } - - function walkTrinaryExpressionChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.whenTrue); - walker.walk(preAst.whenFalse); - } - - function walkFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkFunctionTypeChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.type); - } - - function walkParenthesizedArrowFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - walker.walk(preAst.expression); - } - - function walkSimpleArrowFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.block); - walker.walk(preAst.expression); - } - - function walkMemberFunctionDeclarationChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkFuncDeclChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkIndexMemberDeclarationChildren(preAst, walker) { - walker.walk(preAst.indexSignature); - } - - function walkIndexSignatureChildren(preAst, walker) { - walker.walk(preAst.parameter); - walker.walk(preAst.typeAnnotation); - } - - function walkCallSignatureChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.typeAnnotation); - } - - function walkConstraintChildren(preAst, walker) { - walker.walk(preAst.type); - } - - function walkConstructorDeclarationChildren(preAst, walker) { - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkConstructorTypeChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.type); - } - - function walkConstructSignatureChildren(preAst, walker) { - walker.walk(preAst.callSignature); - } - - function walkParameterChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.equalsValueClause); - } - - function walkParameterListChildren(preAst, walker) { - walker.walk(preAst.parameters); - } - - function walkPropertySignatureChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.typeAnnotation); - } - - function walkVariableDeclaratorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.equalsValueClause); - } - - function walkMemberVariableDeclarationChildren(preAst, walker) { - walker.walk(preAst.variableDeclarator); - } - - function walkMethodSignatureChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - } - - function walkReturnStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkForStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - walker.walk(preAst.initializer); - walker.walk(preAst.condition); - walker.walk(preAst.incrementor); - walker.walk(preAst.statement); - } - - function walkForInStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - walker.walk(preAst.left); - walker.walk(preAst.expression); - walker.walk(preAst.statement); - } - - function walkIfStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - walker.walk(preAst.elseClause); - } - - function walkElseClauseChildren(preAst, walker) { - walker.walk(preAst.statement); - } - - function walkWhileStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - - function walkDoStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - - function walkBlockChildren(preAst, walker) { - walker.walk(preAst.statements); - } - - function walkVariableDeclarationChildren(preAst, walker) { - walker.walk(preAst.declarators); - } - - function walkCaseSwitchClauseChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.statements); - } - - function walkDefaultSwitchClauseChildren(preAst, walker) { - walker.walk(preAst.statements); - } - - function walkSwitchStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.switchClauses); - } - - function walkTryStatementChildren(preAst, walker) { - walker.walk(preAst.block); - walker.walk(preAst.catchClause); - walker.walk(preAst.finallyClause); - } - - function walkCatchClauseChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.block); - } - - function walkExternalModuleReferenceChildren(preAst, walker) { - walker.walk(preAst.stringLiteral); - } - - function walkFinallyClauseChildren(preAst, walker) { - walker.walk(preAst.block); - } - - function walkClassDeclChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeParameterList); - walker.walk(preAst.heritageClauses); - walker.walk(preAst.classElements); - } - - function walkScriptChildren(preAst, walker) { - walker.walk(preAst.moduleElements); - } - - function walkHeritageClauseChildren(preAst, walker) { - walker.walk(preAst.typeNames); - } - - function walkInterfaceDeclerationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeParameterList); - walker.walk(preAst.heritageClauses); - walker.walk(preAst.body); - } - - function walkObjectTypeChildren(preAst, walker) { - walker.walk(preAst.typeMembers); - } - - function walkArrayTypeChildren(preAst, walker) { - walker.walk(preAst.type); - } - - function walkModuleDeclarationChildren(preAst, walker) { - walker.walk(preAst.name); - walker.walk(preAst.stringLiteral); - walker.walk(preAst.moduleElements); - } - - function walkModuleNameModuleReferenceChildren(preAst, walker) { - walker.walk(preAst.moduleName); - } - - function walkEnumDeclarationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.enumElements); - } - - function walkEnumElementChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.equalsValueClause); - } - - function walkImportDeclarationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.moduleReference); - } - - function walkExportAssignmentChildren(preAst, walker) { - walker.walk(preAst.identifier); - } - - function walkWithStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - - function walkExpressionStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkLabeledStatementChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.statement); - } - - function walkVariableStatementChildren(preAst, walker) { - walker.walk(preAst.declaration); - } - - var childrenWalkers = new Array(246 /* Last */ + 1); - - for (var i = 9 /* FirstToken */, n = 119 /* LastToken */; i <= n; i++) { - childrenWalkers[i] = null; - } - for (var i = 4 /* FirstTrivia */, n = 8 /* LastTrivia */; i <= n; i++) { - childrenWalkers[i] = null; - } - - childrenWalkers[175 /* AddAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[208 /* AddExpression */] = walkBinaryExpressionChildren; - childrenWalkers[180 /* AndAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[60 /* AnyKeyword */] = null; - childrenWalkers[226 /* ArgumentList */] = walkArgumentListChildren; - childrenWalkers[214 /* ArrayLiteralExpression */] = walkArrayLiteralExpressionChildren; - childrenWalkers[124 /* ArrayType */] = walkArrayTypeChildren; - childrenWalkers[219 /* SimpleArrowFunctionExpression */] = walkSimpleArrowFunctionExpressionChildren; - childrenWalkers[218 /* ParenthesizedArrowFunctionExpression */] = walkParenthesizedArrowFunctionExpressionChildren; - childrenWalkers[174 /* AssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[191 /* BitwiseAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[190 /* BitwiseExclusiveOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[166 /* BitwiseNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[189 /* BitwiseOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[146 /* Block */] = walkBlockChildren; - childrenWalkers[61 /* BooleanKeyword */] = null; - childrenWalkers[152 /* BreakStatement */] = null; - childrenWalkers[142 /* CallSignature */] = walkCallSignatureChildren; - childrenWalkers[233 /* CaseSwitchClause */] = walkCaseSwitchClauseChildren; - childrenWalkers[220 /* CastExpression */] = walkCastExpressionChildren; - childrenWalkers[236 /* CatchClause */] = walkCatchClauseChildren; - childrenWalkers[131 /* ClassDeclaration */] = walkClassDeclChildren; - childrenWalkers[173 /* CommaExpression */] = walkBinaryExpressionChildren; - childrenWalkers[186 /* ConditionalExpression */] = walkTrinaryExpressionChildren; - childrenWalkers[239 /* Constraint */] = walkConstraintChildren; - childrenWalkers[137 /* ConstructorDeclaration */] = walkConstructorDeclarationChildren; - childrenWalkers[143 /* ConstructSignature */] = walkConstructSignatureChildren; - childrenWalkers[153 /* ContinueStatement */] = null; - childrenWalkers[125 /* ConstructorType */] = walkConstructorTypeChildren; - childrenWalkers[162 /* DebuggerStatement */] = null; - childrenWalkers[234 /* DefaultSwitchClause */] = walkDefaultSwitchClauseChildren; - childrenWalkers[170 /* DeleteExpression */] = walkDeleteExpressionChildren; - childrenWalkers[178 /* DivideAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[206 /* DivideExpression */] = walkBinaryExpressionChildren; - childrenWalkers[161 /* DoStatement */] = walkDoStatementChildren; - childrenWalkers[221 /* ElementAccessExpression */] = walkElementAccessExpressionChildren; - childrenWalkers[235 /* ElseClause */] = walkElseClauseChildren; - childrenWalkers[156 /* EmptyStatement */] = null; - childrenWalkers[132 /* EnumDeclaration */] = walkEnumDeclarationChildren; - childrenWalkers[243 /* EnumElement */] = walkEnumElementChildren; - childrenWalkers[194 /* EqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[232 /* EqualsValueClause */] = walkEqualsValueClauseChildren; - childrenWalkers[192 /* EqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[181 /* ExclusiveOrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[134 /* ExportAssignment */] = walkExportAssignmentChildren; - childrenWalkers[149 /* ExpressionStatement */] = walkExpressionStatementChildren; - childrenWalkers[230 /* ExtendsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[245 /* ExternalModuleReference */] = walkExternalModuleReferenceChildren; - childrenWalkers[24 /* FalseKeyword */] = null; - childrenWalkers[237 /* FinallyClause */] = walkFinallyClauseChildren; - childrenWalkers[155 /* ForInStatement */] = walkForInStatementChildren; - childrenWalkers[154 /* ForStatement */] = walkForStatementChildren; - childrenWalkers[129 /* FunctionDeclaration */] = walkFuncDeclChildren; - childrenWalkers[222 /* FunctionExpression */] = walkFunctionExpressionChildren; - childrenWalkers[241 /* FunctionPropertyAssignment */] = walkFunctionPropertyAssignmentChildren; - childrenWalkers[123 /* FunctionType */] = walkFunctionTypeChildren; - childrenWalkers[126 /* GenericType */] = walkGenericTypeChildren; - childrenWalkers[139 /* GetAccessor */] = walkGetAccessorChildren; - childrenWalkers[197 /* GreaterThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[199 /* GreaterThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[147 /* IfStatement */] = walkIfStatementChildren; - childrenWalkers[231 /* ImplementsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[133 /* ImportDeclaration */] = walkImportDeclarationChildren; - childrenWalkers[138 /* IndexMemberDeclaration */] = walkIndexMemberDeclarationChildren; - childrenWalkers[144 /* IndexSignature */] = walkIndexSignatureChildren; - childrenWalkers[201 /* InExpression */] = walkBinaryExpressionChildren; - childrenWalkers[200 /* InstanceOfExpression */] = walkBinaryExpressionChildren; - childrenWalkers[128 /* InterfaceDeclaration */] = walkInterfaceDeclerationChildren; - childrenWalkers[213 /* InvocationExpression */] = walkInvocationExpressionChildren; - childrenWalkers[160 /* LabeledStatement */] = walkLabeledStatementChildren; - childrenWalkers[183 /* LeftShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[202 /* LeftShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[196 /* LessThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[198 /* LessThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[1 /* List */] = walkListChildren; - childrenWalkers[188 /* LogicalAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[167 /* LogicalNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[187 /* LogicalOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[212 /* MemberAccessExpression */] = walkMemberAccessExpressionChildren; - childrenWalkers[135 /* MemberFunctionDeclaration */] = walkMemberFunctionDeclarationChildren; - childrenWalkers[136 /* MemberVariableDeclaration */] = walkMemberVariableDeclarationChildren; - childrenWalkers[145 /* MethodSignature */] = walkMethodSignatureChildren; - childrenWalkers[130 /* ModuleDeclaration */] = walkModuleDeclarationChildren; - childrenWalkers[246 /* ModuleNameModuleReference */] = walkModuleNameModuleReferenceChildren; - childrenWalkers[179 /* ModuloAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[207 /* ModuloExpression */] = walkBinaryExpressionChildren; - childrenWalkers[177 /* MultiplyAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[205 /* MultiplyExpression */] = walkBinaryExpressionChildren; - childrenWalkers[11 /* IdentifierName */] = null; - childrenWalkers[165 /* NegateExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[0 /* None */] = null; - childrenWalkers[195 /* NotEqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[193 /* NotEqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[32 /* NullKeyword */] = null; - childrenWalkers[67 /* NumberKeyword */] = null; - childrenWalkers[13 /* NumericLiteral */] = null; - childrenWalkers[216 /* ObjectCreationExpression */] = walkObjectCreationExpressionChildren; - childrenWalkers[215 /* ObjectLiteralExpression */] = walkObjectLiteralExpressionChildren; - childrenWalkers[122 /* ObjectType */] = walkObjectTypeChildren; - childrenWalkers[223 /* OmittedExpression */] = null; - childrenWalkers[182 /* OrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[242 /* Parameter */] = walkParameterChildren; - childrenWalkers[227 /* ParameterList */] = walkParameterListChildren; - childrenWalkers[217 /* ParenthesizedExpression */] = walkParenthesizedExpressionChildren; - childrenWalkers[164 /* PlusExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[211 /* PostDecrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[210 /* PostIncrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[169 /* PreDecrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[168 /* PreIncrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[141 /* PropertySignature */] = walkPropertySignatureChildren; - childrenWalkers[121 /* QualifiedName */] = walkQualifiedNameChildren; - childrenWalkers[12 /* RegularExpressionLiteral */] = null; - childrenWalkers[150 /* ReturnStatement */] = walkReturnStatementChildren; - childrenWalkers[120 /* SourceUnit */] = walkScriptChildren; - childrenWalkers[2 /* SeparatedList */] = walkSeparatedListChildren; - childrenWalkers[140 /* SetAccessor */] = walkSetAccessorChildren; - childrenWalkers[184 /* SignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[203 /* SignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[240 /* SimplePropertyAssignment */] = walkSimplePropertyAssignmentChildren; - childrenWalkers[14 /* StringLiteral */] = null; - childrenWalkers[69 /* StringKeyword */] = null; - childrenWalkers[176 /* SubtractAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[209 /* SubtractExpression */] = walkBinaryExpressionChildren; - childrenWalkers[50 /* SuperKeyword */] = null; - childrenWalkers[151 /* SwitchStatement */] = walkSwitchStatementChildren; - childrenWalkers[35 /* ThisKeyword */] = null; - childrenWalkers[157 /* ThrowStatement */] = walkThrowStatementChildren; - childrenWalkers[3 /* TriviaList */] = null; - childrenWalkers[37 /* TrueKeyword */] = null; - childrenWalkers[159 /* TryStatement */] = walkTryStatementChildren; - childrenWalkers[244 /* TypeAnnotation */] = walkTypeAnnotationChildren; - childrenWalkers[228 /* TypeArgumentList */] = walkTypeArgumentListChildren; - childrenWalkers[171 /* TypeOfExpression */] = walkTypeOfExpressionChildren; - childrenWalkers[238 /* TypeParameter */] = walkTypeParameterChildren; - childrenWalkers[229 /* TypeParameterList */] = walkTypeParameterListChildren; - childrenWalkers[127 /* TypeQuery */] = walkTypeQueryChildren; - childrenWalkers[185 /* UnsignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[204 /* UnsignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[224 /* VariableDeclaration */] = walkVariableDeclarationChildren; - childrenWalkers[225 /* VariableDeclarator */] = walkVariableDeclaratorChildren; - childrenWalkers[148 /* VariableStatement */] = walkVariableStatementChildren; - childrenWalkers[172 /* VoidExpression */] = walkVoidExpressionChildren; - childrenWalkers[41 /* VoidKeyword */] = null; - childrenWalkers[158 /* WhileStatement */] = walkWhileStatementChildren; - childrenWalkers[163 /* WithStatement */] = walkWithStatementChildren; - - for (var e in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind.hasOwnProperty(e) && TypeScript.StringUtilities.isString(TypeScript.SyntaxKind[e])) { - TypeScript.Debug.assert(childrenWalkers[e] !== undefined, "Fix initWalkers: " + TypeScript.SyntaxKind[e]); - } - } - - var AstWalkOptions = (function () { - function AstWalkOptions() { - this.goChildren = true; - this.stopWalking = false; - } - return AstWalkOptions; - })(); - TypeScript.AstWalkOptions = AstWalkOptions; - - var SimplePreAstWalker = (function () { - function SimplePreAstWalker(pre, state) { - this.pre = pre; - this.state = state; - this.options = new AstWalkOptions(); - } - SimplePreAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - - this.pre(ast, this.state); - - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - }; - return SimplePreAstWalker; - })(); - - var SimplePrePostAstWalker = (function () { - function SimplePrePostAstWalker(pre, post, state) { - this.pre = pre; - this.post = post; - this.state = state; - this.options = new AstWalkOptions(); - } - SimplePrePostAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - - this.pre(ast, this.state); - - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - - this.post(ast, this.state); - }; - return SimplePrePostAstWalker; - })(); - - var NormalAstWalker = (function () { - function NormalAstWalker(pre, post, state) { - this.pre = pre; - this.post = post; - this.state = state; - this.options = new AstWalkOptions(); - } - NormalAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - - if (this.options.stopWalking) { - return; - } - - this.pre(ast, this); - - if (this.options.stopWalking) { - return; - } - - if (this.options.goChildren) { - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - } else { - this.options.goChildren = true; - } - - if (this.post) { - this.post(ast, this); - } - }; - return NormalAstWalker; - })(); - - var AstWalkerFactory = (function () { - function AstWalkerFactory() { - } - AstWalkerFactory.prototype.walk = function (ast, pre, post, state) { - new NormalAstWalker(pre, post, state).walk(ast); - }; - - AstWalkerFactory.prototype.simpleWalk = function (ast, pre, post, state) { - if (post) { - new SimplePrePostAstWalker(pre, post, state).walk(ast); - } else { - new SimplePreAstWalker(pre, state).walk(ast); - } - }; - return AstWalkerFactory; - })(); - TypeScript.AstWalkerFactory = AstWalkerFactory; - - var globalAstWalkerFactory = new AstWalkerFactory(); - - function getAstWalkerFactory() { - return globalAstWalkerFactory; - } - TypeScript.getAstWalkerFactory = getAstWalkerFactory; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Base64Format = (function () { - function Base64Format() { - } - Base64Format.encode = function (inValue) { - if (inValue < 64) { - return Base64Format.encodedValues.charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - }; - - Base64Format.decodeChar = function (inChar) { - if (inChar.length === 1) { - return Base64Format.encodedValues.indexOf(inChar); - } else { - throw TypeError('"' + inChar + '" must have length 1'); - } - }; - Base64Format.encodedValues = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - return Base64Format; - })(); - - var Base64VLQFormat = (function () { - function Base64VLQFormat() { - } - Base64VLQFormat.encode = function (inValue) { - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } else { - inValue = inValue << 1; - } - - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + Base64Format.encode(currentDigit); - } while(inValue > 0); - - return encodedStr; - }; - - Base64VLQFormat.decode = function (inString) { - var result = 0; - var negative = false; - - var shift = 0; - for (var i = 0; i < inString.length; i++) { - var byte = Base64Format.decodeChar(inString[i]); - if (i === 0) { - if ((byte & 1) === 1) { - negative = true; - } - result = (byte >> 1) & 15; - } else { - result = result | ((byte & 31) << shift); - } - - shift += (i === 0) ? 4 : 5; - - if ((byte & 32) === 32) { - } else { - return { value: negative ? -(result) : result, rest: inString.substr(i + 1) }; - } - } - - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Base64_value_0_finished_with_a_continuation_bit, [inString])); - }; - return Base64VLQFormat; - })(); - TypeScript.Base64VLQFormat = Base64VLQFormat; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SourceMapPosition = (function () { - function SourceMapPosition() { - } - return SourceMapPosition; - })(); - TypeScript.SourceMapPosition = SourceMapPosition; - - var SourceMapping = (function () { - function SourceMapping() { - this.start = new SourceMapPosition(); - this.end = new SourceMapPosition(); - this.nameIndex = -1; - this.childMappings = []; - } - return SourceMapping; - })(); - TypeScript.SourceMapping = SourceMapping; - - var SourceMapEntry = (function () { - function SourceMapEntry(emittedFile, emittedLine, emittedColumn, sourceFile, sourceLine, sourceColumn, sourceName) { - this.emittedFile = emittedFile; - this.emittedLine = emittedLine; - this.emittedColumn = emittedColumn; - this.sourceFile = sourceFile; - this.sourceLine = sourceLine; - this.sourceColumn = sourceColumn; - this.sourceName = sourceName; - TypeScript.Debug.assert(isFinite(emittedLine)); - TypeScript.Debug.assert(isFinite(emittedColumn)); - TypeScript.Debug.assert(isFinite(sourceColumn)); - TypeScript.Debug.assert(isFinite(sourceLine)); - } - return SourceMapEntry; - })(); - TypeScript.SourceMapEntry = SourceMapEntry; - - var SourceMapper = (function () { - function SourceMapper(jsFile, sourceMapOut, document, jsFilePath, emitOptions, resolvePath) { - this.jsFile = jsFile; - this.sourceMapOut = sourceMapOut; - this.names = []; - this.mappingLevel = []; - this.tsFilePaths = []; - this.allSourceMappings = []; - this.sourceMapEntries = []; - this.setSourceMapOptions(document, jsFilePath, emitOptions, resolvePath); - this.setNewSourceFile(document, emitOptions); - } - SourceMapper.prototype.getOutputFile = function () { - var result = this.sourceMapOut.getOutputFile(); - result.sourceMapEntries = this.sourceMapEntries; - - return result; - }; - - SourceMapper.prototype.increaseMappingLevel = function (ast) { - this.mappingLevel.push(ast); - }; - - SourceMapper.prototype.decreaseMappingLevel = function (ast) { - TypeScript.Debug.assert(this.mappingLevel.length > 0, "Mapping level should never be less than 0. This suggests a missing start call."); - var expectedAst = this.mappingLevel.pop(); - var expectedAstInfo = expectedAst.kind ? TypeScript.SyntaxKind[expectedAst.kind()] : [expectedAst.start(), expectedAst.end()]; - var astInfo = ast.kind ? TypeScript.SyntaxKind[ast.kind()] : [ast.start(), ast.end()]; - TypeScript.Debug.assert(ast === expectedAst, "Provided ast is not the expected AST, Expected: " + expectedAstInfo + " Given: " + astInfo); - }; - - SourceMapper.prototype.setNewSourceFile = function (document, emitOptions) { - var sourceMappings = []; - this.allSourceMappings.push(sourceMappings); - this.currentMappings = [sourceMappings]; - this.currentNameIndex = []; - - this.setNewSourceFilePath(document, emitOptions); - }; - - SourceMapper.prototype.setSourceMapOptions = function (document, jsFilePath, emitOptions, resolvePath) { - var prettyJsFileName = TypeScript.getPrettyName(jsFilePath, false, true); - var prettyMapFileName = prettyJsFileName + SourceMapper.MapFileExtension; - this.jsFileName = prettyJsFileName; - - if (emitOptions.sourceMapRootDirectory()) { - this.sourceMapDirectory = emitOptions.sourceMapRootDirectory(); - if (document.emitToOwnOutputFile()) { - this.sourceMapDirectory = this.sourceMapDirectory + TypeScript.switchToForwardSlashes(TypeScript.getRootFilePath((document.fileName)).replace(emitOptions.commonDirectoryPath(), "")); - } - - if (TypeScript.isRelative(this.sourceMapDirectory)) { - this.sourceMapDirectory = emitOptions.commonDirectoryPath() + this.sourceMapDirectory; - this.sourceMapDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(resolvePath(this.sourceMapDirectory))); - this.sourceMapPath = TypeScript.getRelativePathToFixedPath(TypeScript.getRootFilePath(jsFilePath), this.sourceMapDirectory + prettyMapFileName); - } else { - this.sourceMapPath = this.sourceMapDirectory + prettyMapFileName; - } - } else { - this.sourceMapPath = prettyMapFileName; - this.sourceMapDirectory = TypeScript.getRootFilePath(jsFilePath); - } - this.sourceRoot = emitOptions.sourceRootDirectory(); - }; - - SourceMapper.prototype.setNewSourceFilePath = function (document, emitOptions) { - var tsFilePath = TypeScript.switchToForwardSlashes(document.fileName); - if (emitOptions.sourceRootDirectory()) { - tsFilePath = TypeScript.getRelativePathToFixedPath(emitOptions.commonDirectoryPath(), tsFilePath); - } else { - tsFilePath = TypeScript.getRelativePathToFixedPath(this.sourceMapDirectory, tsFilePath); - } - this.tsFilePaths.push(tsFilePath); - }; - - SourceMapper.prototype.emitSourceMapping = function () { - var _this = this; - TypeScript.Debug.assert(this.mappingLevel.length === 0, "Mapping level is not 0. This suggest a missing end call. Value: " + this.mappingLevel.map(function (item) { - return ['Node of type', TypeScript.SyntaxKind[item.kind()], 'at', item.start(), 'to', item.end()].join(' '); - }).join(', ')); - - this.jsFile.WriteLine("//# sourceMappingURL=" + this.sourceMapPath); - - var mappingsString = ""; - - var prevEmittedColumn = 0; - var prevEmittedLine = 0; - var prevSourceColumn = 0; - var prevSourceLine = 0; - var prevSourceIndex = 0; - var prevNameIndex = 0; - var emitComma = false; - - var recordedPosition = null; - for (var sourceIndex = 0; sourceIndex < this.tsFilePaths.length; sourceIndex++) { - var recordSourceMapping = function (mappedPosition, nameIndex) { - if (recordedPosition !== null && recordedPosition.emittedColumn === mappedPosition.emittedColumn && recordedPosition.emittedLine === mappedPosition.emittedLine) { - return; - } - - if (prevEmittedLine !== mappedPosition.emittedLine) { - while (prevEmittedLine < mappedPosition.emittedLine) { - prevEmittedColumn = 0; - mappingsString = mappingsString + ";"; - prevEmittedLine++; - } - emitComma = false; - } else if (emitComma) { - mappingsString = mappingsString + ","; - } - - _this.sourceMapEntries.push(new SourceMapEntry(_this.jsFileName, mappedPosition.emittedLine + 1, mappedPosition.emittedColumn + 1, _this.tsFilePaths[sourceIndex], mappedPosition.sourceLine, mappedPosition.sourceColumn + 1, nameIndex >= 0 ? _this.names[nameIndex] : undefined)); - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(mappedPosition.emittedColumn - prevEmittedColumn); - prevEmittedColumn = mappedPosition.emittedColumn; - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(sourceIndex - prevSourceIndex); - prevSourceIndex = sourceIndex; - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(mappedPosition.sourceLine - 1 - prevSourceLine); - prevSourceLine = mappedPosition.sourceLine - 1; - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(mappedPosition.sourceColumn - prevSourceColumn); - prevSourceColumn = mappedPosition.sourceColumn; - - if (nameIndex >= 0) { - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(nameIndex - prevNameIndex); - prevNameIndex = nameIndex; - } - - emitComma = true; - recordedPosition = mappedPosition; - }; - - var recordSourceMappingSiblings = function (sourceMappings) { - for (var i = 0; i < sourceMappings.length; i++) { - var sourceMapping = sourceMappings[i]; - recordSourceMapping(sourceMapping.start, sourceMapping.nameIndex); - recordSourceMappingSiblings(sourceMapping.childMappings); - recordSourceMapping(sourceMapping.end, sourceMapping.nameIndex); - } - }; - - recordSourceMappingSiblings(this.allSourceMappings[sourceIndex]); - } - - this.sourceMapOut.Write(JSON.stringify({ - version: 3, - file: this.jsFileName, - sourceRoot: this.sourceRoot, - sources: this.tsFilePaths, - names: this.names, - mappings: mappingsString - })); - - this.sourceMapOut.Close(); - }; - SourceMapper.MapFileExtension = ".map"; - return SourceMapper; - })(); - TypeScript.SourceMapper = SourceMapper; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (EmitContainer) { - EmitContainer[EmitContainer["Prog"] = 0] = "Prog"; - EmitContainer[EmitContainer["Module"] = 1] = "Module"; - EmitContainer[EmitContainer["DynamicModule"] = 2] = "DynamicModule"; - EmitContainer[EmitContainer["Class"] = 3] = "Class"; - EmitContainer[EmitContainer["Constructor"] = 4] = "Constructor"; - EmitContainer[EmitContainer["Function"] = 5] = "Function"; - EmitContainer[EmitContainer["Args"] = 6] = "Args"; - EmitContainer[EmitContainer["Interface"] = 7] = "Interface"; - })(TypeScript.EmitContainer || (TypeScript.EmitContainer = {})); - var EmitContainer = TypeScript.EmitContainer; - - var EmitState = (function () { - function EmitState() { - this.column = 0; - this.line = 0; - this.container = 0 /* Prog */; - } - return EmitState; - })(); - TypeScript.EmitState = EmitState; - - var EmitOptions = (function () { - function EmitOptions(compiler, resolvePath) { - this.resolvePath = resolvePath; - this._diagnostic = null; - this._settings = null; - this._commonDirectoryPath = ""; - this._sharedOutputFile = ""; - this._sourceRootDirectory = ""; - this._sourceMapRootDirectory = ""; - this._outputDirectory = ""; - var settings = compiler.compilationSettings(); - this._settings = settings; - - if (settings.moduleGenTarget() === 0 /* 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.isExternalModule()) { - var errorSpan = document.externalModuleIndicatorSpan(); - this._diagnostic = new TypeScript.Diagnostic(document.fileName, document.lineMap(), errorSpan.start(), errorSpan.length(), TypeScript.DiagnosticCode.Cannot_compile_external_modules_unless_the_module_flag_is_provided); - - return; - } - } - } - - if (!settings.mapSourceFiles()) { - if (settings.mapRoot()) { - if (settings.sourceRoot()) { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Options_mapRoot_and_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } else { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - } else if (settings.sourceRoot()) { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - } - - this._sourceMapRootDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(settings.mapRoot())); - this._sourceRootDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(settings.sourceRoot())); - - if (settings.outFileOption() || settings.outDirOption() || settings.mapRoot() || settings.sourceRoot()) { - if (settings.outFileOption()) { - this._sharedOutputFile = TypeScript.switchToForwardSlashes(resolvePath(settings.outFileOption())); - } - - if (settings.outDirOption()) { - this._outputDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(resolvePath(settings.outDirOption()))); - } - - if (this._outputDirectory || this._sourceMapRootDirectory || this.sourceRootDirectory) { - this.determineCommonDirectoryPath(compiler); - } - } - } - EmitOptions.prototype.diagnostic = function () { - return this._diagnostic; - }; - - EmitOptions.prototype.commonDirectoryPath = function () { - return this._commonDirectoryPath; - }; - EmitOptions.prototype.sharedOutputFile = function () { - return this._sharedOutputFile; - }; - EmitOptions.prototype.sourceRootDirectory = function () { - return this._sourceRootDirectory; - }; - EmitOptions.prototype.sourceMapRootDirectory = function () { - return this._sourceMapRootDirectory; - }; - EmitOptions.prototype.outputDirectory = function () { - return this._outputDirectory; - }; - - EmitOptions.prototype.compilationSettings = function () { - return this._settings; - }; - - EmitOptions.prototype.determineCommonDirectoryPath = function (compiler) { - var commonComponents = []; - 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 = TypeScript.filePathComponents(fileName); - if (commonComponentsLength === -1) { - commonComponents = fileComponents; - commonComponentsLength = commonComponents.length; - } else { - var updatedPath = false; - for (var j = 0; j < commonComponentsLength && j < fileComponents.length; j++) { - if (commonComponents[j] !== fileComponents[j]) { - commonComponentsLength = j; - updatedPath = true; - - if (j === 0) { - var isDynamicModuleCompilation = TypeScript.ArrayUtilities.any(fileNames, function (fileName) { - document = compiler.getDocument(fileName); - return !document.isDeclareFile() && document.isExternalModule(); - }); - - if (this._outputDirectory || this._sourceRootDirectory || (this._sourceMapRootDirectory && (!this._sharedOutputFile || isDynamicModuleCompilation))) { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Cannot_find_the_common_subdirectory_path_for_the_input_files, null); - return; - } - - return; - } - - break; - } - } - - if (!updatedPath && fileComponents.length < commonComponentsLength) { - commonComponentsLength = fileComponents.length; - } - } - } - } - - this._commonDirectoryPath = commonComponents.slice(0, commonComponentsLength).join("/") + "/"; - }; - return EmitOptions; - })(); - TypeScript.EmitOptions = EmitOptions; - - var Indenter = (function () { - function Indenter() { - this.indentAmt = 0; - } - Indenter.prototype.increaseIndent = function () { - this.indentAmt += Indenter.indentStep; - }; - - Indenter.prototype.decreaseIndent = function () { - this.indentAmt -= Indenter.indentStep; - }; - - Indenter.prototype.getIndent = function () { - 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; - }; - Indenter.indentStep = 4; - Indenter.indentStepString = " "; - Indenter.indentStrings = []; - return Indenter; - })(); - TypeScript.Indenter = Indenter; - - function lastParameterIsRest(parameterList) { - var parameters = parameterList.parameters; - return parameters.nonSeparatorCount() > 0 && parameters.nonSeparatorAt(parameters.nonSeparatorCount() - 1).dotDotDotToken !== null; - } - TypeScript.lastParameterIsRest = lastParameterIsRest; - - var Emitter = (function () { - function Emitter(emittingFileName, outfile, emitOptions, semanticInfoChain) { - this.emittingFileName = emittingFileName; - this.outfile = outfile; - this.emitOptions = emitOptions; - this.semanticInfoChain = semanticInfoChain; - this.globalThisCapturePrologueEmitted = false; - this.extendsPrologueEmitted = false; - this.thisClassNode = null; - this.inArrowFunction = false; - this.moduleName = ""; - this.emitState = new EmitState(); - this.indenter = new Indenter(); - this.sourceMapper = null; - this.captureThisStmtString = "var _this = this;"; - this.declStack = []; - this.exportAssignment = null; - this.inWithBlock = false; - this.document = null; - this.detachedCommentsElement = null; - } - Emitter.prototype.pushDecl = function (decl) { - if (decl) { - this.declStack[this.declStack.length] = decl; - } - }; - - Emitter.prototype.popDecl = function (decl) { - if (decl) { - this.declStack.length--; - } - }; - - Emitter.prototype.getEnclosingDecl = function () { - var declStackLen = this.declStack.length; - var enclosingDecl = declStackLen > 0 ? this.declStack[declStackLen - 1] : null; - return enclosingDecl; - }; - - Emitter.prototype.setExportAssignment = function (exportAssignment) { - this.exportAssignment = exportAssignment; - }; - - Emitter.prototype.getExportAssignment = function () { - return this.exportAssignment; - }; - - Emitter.prototype.setDocument = function (document) { - this.document = document; - }; - - Emitter.prototype.shouldEmitImportDeclaration = function (importDeclAST) { - var isExternalModuleReference = importDeclAST.moduleReference.kind() === 245 /* ExternalModuleReference */; - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var isExported = TypeScript.hasFlag(importDecl.flags, 1 /* Exported */); - var isAmdCodeGen = this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */; - - if (isExternalModuleReference && !isExported && isAmdCodeGen) { - return false; - } - - var importSymbol = importDecl.getSymbol(); - if (importSymbol.isUsedAsValue()) { - return true; - } - - if (importDeclAST.moduleReference.kind() !== 245 /* ExternalModuleReference */) { - var canBeUsedExternally = isExported || importSymbol.typeUsedExternally() || importSymbol.isUsedInExportedAlias(); - if (!canBeUsedExternally && !this.document.isExternalModule()) { - canBeUsedExternally = TypeScript.hasFlag(importDecl.getParentDecl().kind, 1 /* Script */ | 32 /* DynamicModule */); - } - - if (canBeUsedExternally) { - if (importSymbol.getExportAssignedValueSymbol()) { - return true; - } - - var containerSymbol = importSymbol.getExportAssignedContainerSymbol(); - if (containerSymbol && containerSymbol.getInstanceSymbol()) { - return true; - } - } - } - - return false; - }; - - Emitter.prototype.emitImportDeclaration = function (importDeclAST) { - var isExternalModuleReference = importDeclAST.moduleReference.kind() === 245 /* ExternalModuleReference */; - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var isExported = TypeScript.hasFlag(importDecl.flags, 1 /* Exported */); - var isAmdCodeGen = this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */; - - this.emitComments(importDeclAST, true); - - var importSymbol = importDecl.getSymbol(); - - var parentSymbol = importSymbol.getContainer(); - var parentKind = parentSymbol ? parentSymbol.kind : 0 /* None */; - var associatedParentSymbol = parentSymbol ? parentSymbol.getAssociatedContainerType() : null; - var associatedParentSymbolKind = associatedParentSymbol ? associatedParentSymbol.kind : 0 /* None */; - - var needsPropertyAssignment = false; - var usePropertyAssignmentInsteadOfVarDecl = false; - var moduleNamePrefix; - - if (isExported && (parentKind === 4 /* Container */ || parentKind === 32 /* DynamicModule */ || associatedParentSymbolKind === 4 /* Container */ || associatedParentSymbolKind === 32 /* DynamicModule */)) { - if (importSymbol.getExportAssignedTypeSymbol() || importSymbol.getExportAssignedContainerSymbol()) { - needsPropertyAssignment = true; - } else { - var valueSymbol = importSymbol.getExportAssignedValueSymbol(); - if (valueSymbol && (valueSymbol.kind === 65536 /* Method */ || valueSymbol.kind === 16384 /* Function */)) { - needsPropertyAssignment = true; - } else { - usePropertyAssignmentInsteadOfVarDecl = true; - } - } - - if (this.emitState.container === 2 /* DynamicModule */) { - moduleNamePrefix = "exports."; - } else { - moduleNamePrefix = this.moduleName + "."; - } - } - - if (isAmdCodeGen && isExternalModuleReference) { - 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); - }; - - Emitter.prototype.createSourceMapper = function (document, jsFileName, jsFile, sourceMapOut, resolvePath) { - this.sourceMapper = new TypeScript.SourceMapper(jsFile, sourceMapOut, document, jsFileName, this.emitOptions, resolvePath); - }; - - Emitter.prototype.setSourceMapperNewSourceFile = function (document) { - this.sourceMapper.setNewSourceFile(document, this.emitOptions); - }; - - Emitter.prototype.updateLineAndColumn = function (s) { - var lineNumbers = TypeScript.TextUtilities.parseLineStarts(s); - if (lineNumbers.length > 1) { - this.emitState.line += lineNumbers.length - 1; - this.emitState.column = s.length - lineNumbers[lineNumbers.length - 1]; - } else { - this.emitState.column += s.length; - } - }; - - Emitter.prototype.writeToOutputWithSourceMapRecord = function (s, astSpan) { - this.recordSourceMappingStart(astSpan); - this.writeToOutput(s); - this.recordSourceMappingEnd(astSpan); - }; - - Emitter.prototype.writeToOutput = function (s) { - this.outfile.Write(s); - this.updateLineAndColumn(s); - }; - - Emitter.prototype.writeLineToOutput = function (s, force) { - if (typeof force === "undefined") { force = false; } - if (!force && s === "" && this.emitState.column === 0) { - return; - } - - this.outfile.WriteLine(s); - this.updateLineAndColumn(s); - this.emitState.column = 0; - this.emitState.line++; - }; - - Emitter.prototype.writeCaptureThisStatement = function (ast) { - this.emitIndent(); - this.writeToOutputWithSourceMapRecord(this.captureThisStmtString, ast); - this.writeLineToOutput(""); - }; - - Emitter.prototype.setContainer = function (c) { - var temp = this.emitState.container; - this.emitState.container = c; - return temp; - }; - - Emitter.prototype.getIndentString = function () { - return this.indenter.getIndent(); - }; - - Emitter.prototype.emitIndent = function () { - this.writeToOutput(this.getIndentString()); - }; - - Emitter.prototype.emitComment = function (comment, trailing, first) { - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var text = getTrimmedTextLines(comment); - var emitColumn = this.emitState.column; - - if (emitColumn === 0) { - this.emitIndent(); - } else if (trailing && first) { - this.writeToOutput(" "); - } - - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - this.recordSourceMappingStart(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.recordSourceMappingEnd(comment); - this.writeLineToOutput(""); - } else { - this.recordSourceMappingEnd(comment); - this.writeToOutput(" "); - return; - } - } else { - this.recordSourceMappingStart(comment); - this.writeToOutput(text[0]); - this.recordSourceMappingEnd(comment); - this.writeLineToOutput(""); - } - - if (!trailing && emitColumn !== 0) { - this.emitIndent(); - } - }; - - Emitter.prototype.emitComments = function (ast, pre, onlyPinnedOrTripleSlashComments) { - var _this = this; - if (typeof onlyPinnedOrTripleSlashComments === "undefined") { onlyPinnedOrTripleSlashComments = false; } - if (ast && ast.kind() !== 146 /* Block */) { - if (ast.parent.kind() === 219 /* SimpleArrowFunctionExpression */ || ast.parent.kind() === 218 /* ParenthesizedArrowFunctionExpression */) { - return; - } - } - - if (pre) { - var preComments = ast.preComments(); - - if (preComments && ast === this.detachedCommentsElement) { - var detachedComments = this.getDetachedComments(ast); - preComments = preComments.slice(detachedComments.length); - this.detachedCommentsElement = null; - } - - if (preComments && onlyPinnedOrTripleSlashComments) { - preComments = TypeScript.ArrayUtilities.where(preComments, function (c) { - return _this.isPinnedOrTripleSlash(c); - }); - } - - this.emitCommentsArray(preComments, false); - } else { - this.emitCommentsArray(ast.postComments(), true); - } - }; - - Emitter.prototype.isPinnedOrTripleSlash = function (comment) { - var fullText = comment.fullText(); - if (fullText.match(TypeScript.tripleSlashReferenceRegExp)) { - return true; - } else { - return fullText.indexOf("/*!") === 0; - } - }; - - Emitter.prototype.emitCommentsArray = function (comments, trailing) { - if (!this.emitOptions.compilationSettings().removeComments() && comments) { - for (var i = 0, n = comments.length; i < n; i++) { - this.emitComment(comments[i], trailing, i === 0); - } - } - }; - - Emitter.prototype.emitObjectLiteralExpression = function (objectLiteral) { - this.recordSourceMappingStart(objectLiteral); - - this.writeToOutput("{"); - this.emitCommaSeparatedList(objectLiteral, objectLiteral.propertyAssignments, " ", true); - this.writeToOutput("}"); - - this.recordSourceMappingEnd(objectLiteral); - }; - - Emitter.prototype.emitArrayLiteralExpression = function (arrayLiteral) { - this.recordSourceMappingStart(arrayLiteral); - - this.writeToOutput("["); - this.emitCommaSeparatedList(arrayLiteral, arrayLiteral.expressions, "", true); - this.writeToOutput("]"); - - this.recordSourceMappingEnd(arrayLiteral); - }; - - Emitter.prototype.emitObjectCreationExpression = function (objectCreationExpression) { - this.recordSourceMappingStart(objectCreationExpression); - this.writeToOutput("new "); - var target = objectCreationExpression.expression; - - this.emit(target); - if (objectCreationExpression.argumentList) { - this.recordSourceMappingStart(objectCreationExpression.argumentList); - this.writeToOutput("("); - this.emitCommaSeparatedList(objectCreationExpression.argumentList, objectCreationExpression.argumentList.arguments, "", false); - this.writeToOutputWithSourceMapRecord(")", objectCreationExpression.argumentList.closeParenToken); - this.recordSourceMappingEnd(objectCreationExpression.argumentList); - } - - this.recordSourceMappingEnd(objectCreationExpression); - }; - - Emitter.prototype.getConstantDecl = function (dotExpr) { - var pullSymbol = this.semanticInfoChain.getSymbolForAST(dotExpr); - if (pullSymbol && pullSymbol.kind === 67108864 /* EnumMember */) { - var pullDecls = pullSymbol.getDeclarations(); - if (pullDecls.length === 1) { - var pullDecl = pullDecls[0]; - if (pullDecl.kind === 67108864 /* EnumMember */) { - return pullDecl; - } - } - } - - return null; - }; - - Emitter.prototype.tryEmitConstant = function (dotExpr) { - 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; - }; - - Emitter.prototype.emitInvocationExpression = function (callNode) { - this.recordSourceMappingStart(callNode); - var target = callNode.expression; - var args = callNode.argumentList.arguments; - - if (target.kind() === 212 /* MemberAccessExpression */ && target.expression.kind() === 50 /* SuperKeyword */) { - this.emit(target); - this.writeToOutput(".call"); - this.recordSourceMappingStart(args); - this.writeToOutput("("); - this.emitThis(); - if (args && args.nonSeparatorCount() > 0) { - this.writeToOutput(", "); - this.emitCommaSeparatedList(callNode.argumentList, args, "", false); - } - } else { - if (callNode.expression.kind() === 50 /* SuperKeyword */ && this.emitState.container === 4 /* Constructor */) { - this.writeToOutput("_super.call"); - } else { - this.emitJavascript(target, false); - } - this.recordSourceMappingStart(args); - this.writeToOutput("("); - if (callNode.expression.kind() === 50 /* SuperKeyword */ && this.emitState.container === 4 /* Constructor */) { - this.writeToOutput("this"); - if (args && args.nonSeparatorCount() > 0) { - this.writeToOutput(", "); - } - } - this.emitCommaSeparatedList(callNode.argumentList, args, "", false); - } - - this.writeToOutputWithSourceMapRecord(")", callNode.argumentList.closeParenToken); - this.recordSourceMappingEnd(args); - this.recordSourceMappingEnd(callNode); - }; - - Emitter.prototype.emitParameterList = function (list) { - this.writeToOutput("("); - this.emitCommentsArray(list.openParenTrailingComments, true); - this.emitFunctionParameters(TypeScript.ASTHelpers.parametersFromParameterList(list)); - this.writeToOutput(")"); - }; - - Emitter.prototype.emitFunctionParameters = function (parameters) { - var argsLen = 0; - - if (parameters) { - this.emitComments(parameters.ast, true); - - var tempContainer = this.setContainer(6 /* Args */); - argsLen = parameters.length; - var printLen = argsLen; - if (parameters.lastParameterIsRest()) { - printLen--; - } - for (var i = 0; i < printLen; i++) { - var arg = parameters.astAt(i); - this.emit(arg); - - if (i < (printLen - 1)) { - this.writeToOutput(", "); - } - } - this.setContainer(tempContainer); - - this.emitComments(parameters.ast, false); - } - }; - - Emitter.prototype.emitFunctionBodyStatements = function (name, funcDecl, parameterList, block, bodyExpression) { - this.writeLineToOutput(" {"); - if (name) { - this.recordSourceMappingNameStart(name); - } - - this.indenter.increaseIndent(); - - if (block) { - this.emitDetachedComments(block.statements); - } - - if (this.shouldCaptureThis(funcDecl)) { - this.writeCaptureThisStatement(funcDecl); - } - - if (parameterList) { - this.emitDefaultValueAssignments(parameterList); - this.emitRestParameterInitializer(parameterList); - } - - if (block) { - this.emitList(block.statements); - this.emitCommentsArray(block.closeBraceLeadingComments, false); - } else { - this.emitIndent(); - this.emitCommentsArray(bodyExpression.preComments(), false); - this.writeToOutput("return "); - this.emit(bodyExpression); - this.writeLineToOutput(";"); - this.emitCommentsArray(bodyExpression.postComments(), true); - } - - this.indenter.decreaseIndent(); - this.emitIndent(); - - if (block) { - this.writeToOutputWithSourceMapRecord("}", block.closeBraceToken); - } else { - this.writeToOutputWithSourceMapRecord("}", bodyExpression); - } - - if (name) { - this.recordSourceMappingNameEnd(); - } - }; - - Emitter.prototype.emitDefaultValueAssignments = function (parameters) { - var n = parameters.length; - if (parameters.lastParameterIsRest()) { - n--; - } - - for (var i = 0; i < n; i++) { - var arg = parameters.astAt(i); - var id = parameters.identifierAt(i); - var equalsValueClause = parameters.initializerAt(i); - if (equalsValueClause) { - this.emitIndent(); - this.recordSourceMappingStart(arg); - this.writeToOutput("if (typeof " + id.text() + " === \"undefined\") { "); - this.writeToOutputWithSourceMapRecord(id.text(), id); - this.emitJavascript(equalsValueClause, false); - this.writeLineToOutput("; }"); - this.recordSourceMappingEnd(arg); - } - } - }; - - Emitter.prototype.emitRestParameterInitializer = function (parameters) { - if (parameters.lastParameterIsRest()) { - var n = parameters.length; - var lastArg = parameters.astAt(n - 1); - var id = parameters.identifierAt(n - 1); - this.emitIndent(); - this.recordSourceMappingStart(lastArg); - this.writeToOutput("var "); - this.writeToOutputWithSourceMapRecord(id.text(), 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("}"); - } - }; - - Emitter.prototype.getImportDecls = function (fileName) { - var topLevelDecl = this.semanticInfoChain.topLevelDecl(this.document.fileName); - var result = []; - - var dynamicModuleDecl = topLevelDecl.getChildDecls()[0]; - var queue = dynamicModuleDecl.getChildDecls(); - - for (var i = 0, n = queue.length; i < n; i++) { - var decl = queue[i]; - - if (decl.kind & 128 /* TypeAlias */) { - var importStatementAST = this.semanticInfoChain.getASTForDecl(decl); - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - var symbol = decl.getSymbol(); - var typeSymbol = symbol && symbol.type; - if (typeSymbol && typeSymbol !== this.semanticInfoChain.anyTypeSymbol && !typeSymbol.isError()) { - result.push(decl); - } - } - } - } - - return result; - }; - - Emitter.prototype.getModuleImportAndDependencyList = function (sourceUnit) { - var importList = ""; - var dependencyList = ""; - - var importDecls = this.getImportDecls(this.document.fileName); - - if (importDecls.length) { - for (var i = 0; i < importDecls.length; i++) { - var importStatementDecl = importDecls[i]; - var importStatementSymbol = importStatementDecl.getSymbol(); - var importStatementAST = this.semanticInfoChain.getASTForDecl(importStatementDecl); - - if (importStatementSymbol.isUsedAsValue()) { - if (i <= importDecls.length - 1) { - dependencyList += ", "; - importList += ", "; - } - - importList += importStatementDecl.name; - dependencyList += importStatementAST.moduleReference.stringLiteral.text(); - } - } - } - - var amdDependencies = this.document.amdDependencies(); - for (var i = 0; i < amdDependencies.length; i++) { - dependencyList += ", \"" + amdDependencies[i] + "\""; - } - - return { - importList: importList, - dependencyList: dependencyList - }; - }; - - Emitter.prototype.shouldCaptureThis = function (ast) { - if (ast.kind() === 120 /* SourceUnit */) { - var scriptDecl = this.semanticInfoChain.topLevelDecl(this.document.fileName); - return TypeScript.hasFlag(scriptDecl.flags, 262144 /* MustCaptureThis */); - } - - var decl = this.semanticInfoChain.getDeclForAST(ast); - if (decl) { - return TypeScript.hasFlag(decl.flags, 262144 /* MustCaptureThis */); - } - - return false; - }; - - Emitter.prototype.emitEnum = function (moduleDecl) { - var pullDecl = this.semanticInfoChain.getDeclForAST(moduleDecl); - this.pushDecl(pullDecl); - - var svModuleName = this.moduleName; - this.moduleName = moduleDecl.identifier.text(); - - var temp = this.setContainer(1 /* Module */); - var isExported = TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */); - - if (!isExported) { - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("var "); - this.recordSourceMappingStart(moduleDecl.identifier); - this.writeToOutput(this.moduleName); - this.recordSourceMappingEnd(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 === 2 /* DynamicModule */; - if (temp === 0 /* Prog */ && isExported) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(this." + this.moduleName + " || (this." + this.moduleName + " = {}));"); - } else if (isExported || temp === 0 /* Prog */) { - var dotMod = svModuleName !== "" ? (parentIsDynamic ? "exports" : svModuleName) + "." : svModuleName; - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(" + dotMod + this.moduleName + " || (" + dotMod + this.moduleName + " = {}));"); - } else if (!isExported && temp !== 0 /* Prog */) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(" + this.moduleName + " || (" + this.moduleName + " = {}));"); - } else { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")();"); - } - - this.recordSourceMappingEnd(moduleDecl); - if (temp !== 0 /* 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); - }; - - Emitter.prototype.getModuleDeclToVerifyChildNameCollision = function (moduleDecl, changeNameIfAnyDeclarationInContext) { - if (TypeScript.ArrayUtilities.contains(this.declStack, moduleDecl)) { - return moduleDecl; - } else if (changeNameIfAnyDeclarationInContext) { - var symbol = moduleDecl.getSymbol(); - if (symbol) { - var otherDecls = symbol.getDeclarations(); - for (var i = 0; i < otherDecls.length; i++) { - if (TypeScript.ArrayUtilities.contains(this.declStack, otherDecls[i])) { - return otherDecls[i]; - } - } - } - } - - return null; - }; - - Emitter.prototype.hasChildNameCollision = function (moduleName, parentDecl) { - var _this = this; - var childDecls = parentDecl.getChildDecls(); - return TypeScript.ArrayUtilities.any(childDecls, function (childDecl) { - var childAST = _this.semanticInfoChain.getASTForDecl(childDecl); - - if (childDecl.kind != 67108864 /* EnumMember */ && _this.shouldEmit(childAST)) { - if (childDecl.name === moduleName) { - if (parentDecl.kind != 8 /* Class */) { - return true; - } - - if (!(childDecl.kind == 65536 /* Method */ || childDecl.kind == 4096 /* Property */ || childDecl.kind == 524288 /* SetAccessor */ || childDecl.kind == 262144 /* GetAccessor */)) { - return true; - } - } - - if (_this.hasChildNameCollision(moduleName, childDecl)) { - return true; - } - } - return false; - }); - }; - - Emitter.prototype.getModuleName = function (moduleDecl, changeNameIfAnyDeclarationInContext) { - var moduleName = moduleDecl.name; - var moduleDisplayName = moduleDecl.getDisplayName(); - - moduleDecl = this.getModuleDeclToVerifyChildNameCollision(moduleDecl, changeNameIfAnyDeclarationInContext); - if (moduleDecl && moduleDecl.kind != 64 /* Enum */) { - while (this.hasChildNameCollision(moduleName, moduleDecl)) { - moduleName = "_" + moduleName; - moduleDisplayName = "_" + moduleDisplayName; - } - } - - return moduleDisplayName; - }; - - Emitter.prototype.emitModuleDeclarationWorker = function (moduleDecl) { - if (moduleDecl.stringLiteral) { - this.emitSingleModuleDeclaration(moduleDecl, moduleDecl.stringLiteral); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(moduleDecl.name); - this.emitSingleModuleDeclaration(moduleDecl, moduleNames[0]); - } - }; - - Emitter.prototype.emitSingleModuleDeclaration = function (moduleDecl, moduleName) { - var isLastName = TypeScript.ASTHelpers.isLastNameOfModule(moduleDecl, moduleName); - - if (isLastName) { - this.emitComments(moduleDecl, true); - } - - var pullDecl = this.semanticInfoChain.getDeclForAST(moduleName); - this.pushDecl(pullDecl); - - var svModuleName = this.moduleName; - - if (moduleDecl.stringLiteral) { - this.moduleName = moduleDecl.stringLiteral.valueText(); - if (TypeScript.isTSFile(this.moduleName)) { - this.moduleName = this.moduleName.substring(0, this.moduleName.length - ".ts".length); - } - } else { - this.moduleName = moduleName.text(); - } - - var temp = this.setContainer(1 /* Module */); - var isExported = TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */); - - if (!isExported) { - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("var "); - this.recordSourceMappingStart(moduleName); - this.writeToOutput(this.moduleName); - this.recordSourceMappingEnd(moduleName); - this.writeLineToOutput(";"); - this.recordSourceMappingEnd(moduleDecl); - this.emitIndent(); - } - - this.writeToOutput("("); - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("function ("); - - 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 = TypeScript.ASTHelpers.getModuleNames(moduleDecl.name); - var nameIndex = moduleNames.indexOf(moduleName); - TypeScript.Debug.assert(nameIndex >= 0); - - if (isLastName) { - this.emitList(moduleDecl.moduleElements); - } else { - this.emitIndent(); - this.emitSingleModuleDeclaration(moduleDecl, moduleNames[nameIndex + 1]); - this.writeLineToOutput(""); - } - } - - this.moduleName = moduleName.text(); - this.indenter.decreaseIndent(); - this.emitIndent(); - - var parentIsDynamic = temp === 2 /* DynamicModule */; - this.recordSourceMappingStart(moduleDecl.endingToken); - if (temp === 0 /* Prog */ && isExported) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")(this." + this.moduleName + " || (this." + this.moduleName + " = {}));"); - } else if (isExported || temp === 0 /* Prog */) { - var dotMod = svModuleName !== "" ? (parentIsDynamic ? "exports" : svModuleName) + "." : svModuleName; - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")(" + dotMod + this.moduleName + " || (" + dotMod + this.moduleName + " = {}));"); - } else if (!isExported && temp !== 0 /* Prog */) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")(" + this.moduleName + " || (" + this.moduleName + " = {}));"); - } else { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")();"); - } - - this.recordSourceMappingEnd(moduleDecl); - if (temp !== 0 /* 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) { - this.emitComments(moduleDecl, false); - } - }; - - Emitter.prototype.emitEnumElement = function (varDecl) { - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - TypeScript.Debug.assert(pullDecl && pullDecl.kind === 67108864 /* EnumMember */); - - this.emitComments(varDecl, true); - this.recordSourceMappingStart(varDecl); - var name = varDecl.propertyName.text(); - var quoted = TypeScript.isQuoted(name); - this.writeToOutput(this.moduleName); - this.writeToOutput('['); - this.writeToOutput(this.moduleName); - this.writeToOutput('['); - this.writeToOutput(quoted ? name : '"' + name + '"'); - 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(quoted ? name : '"' + name + '"'); - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - this.writeToOutput(';'); - }; - - Emitter.prototype.emitElementAccessExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.emit(expression.expression); - this.writeToOutput("["); - this.emit(expression.argumentExpression); - this.writeToOutput("]"); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitSimpleArrowFunctionExpression = function (arrowFunction) { - this.emitAnyArrowFunctionExpression(arrowFunction, null, TypeScript.ASTHelpers.parametersFromIdentifier(arrowFunction.identifier), arrowFunction.block, arrowFunction.expression); - }; - - Emitter.prototype.emitParenthesizedArrowFunctionExpression = function (arrowFunction) { - this.emitAnyArrowFunctionExpression(arrowFunction, null, TypeScript.ASTHelpers.parametersFromParameterList(arrowFunction.callSignature.parameterList), arrowFunction.block, arrowFunction.expression); - }; - - Emitter.prototype.emitAnyArrowFunctionExpression = function (arrowFunction, funcName, parameters, block, expression) { - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = true; - - var temp = this.setContainer(5 /* Function */); - - this.recordSourceMappingStart(arrowFunction); - - var pullDecl = this.semanticInfoChain.getDeclForAST(arrowFunction); - this.pushDecl(pullDecl); - - this.emitComments(arrowFunction, true); - - this.recordSourceMappingStart(arrowFunction); - this.writeToOutput("function "); - this.writeToOutput("("); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(funcName, arrowFunction, parameters, block, expression); - - this.recordSourceMappingEnd(arrowFunction); - - this.recordSourceMappingEnd(arrowFunction); - - this.emitComments(arrowFunction, false); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - }; - - Emitter.prototype.emitConstructor = function (funcDecl) { - if (!funcDecl.block) { - return; - } - var temp = this.setContainer(4 /* 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.writeToOutput("("); - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionParameters(parameters); - this.writeLineToOutput(") {"); - - this.recordSourceMappingNameStart("constructor"); - this.indenter.increaseIndent(); - - this.emitDefaultValueAssignments(parameters); - this.emitRestParameterInitializer(parameters); - - if (this.shouldCaptureThis(funcDecl)) { - this.writeCaptureThisStatement(funcDecl); - } - - this.emitConstructorStatements(funcDecl); - this.emitCommentsArray(funcDecl.block.closeBraceLeadingComments, false); - - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("}", funcDecl.block.closeBraceToken); - - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(funcDecl); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - this.setContainer(temp); - }; - - Emitter.prototype.emitGetAccessor = function (accessor) { - this.recordSourceMappingStart(accessor); - this.writeToOutput("get "); - - var temp = this.setContainer(5 /* Function */); - - this.recordSourceMappingStart(accessor); - - var pullDecl = this.semanticInfoChain.getDeclForAST(accessor); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(accessor); - - var accessorSymbol = TypeScript.PullHelpers.getAccessorSymbol(accessor, this.semanticInfoChain); - var container = accessorSymbol.getContainer(); - var containerKind = container.kind; - - this.recordSourceMappingNameStart(accessor.propertyName.text()); - this.writeToOutput(accessor.propertyName.text()); - this.writeToOutput("("); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(null, accessor, TypeScript.ASTHelpers.parametersFromParameterList(accessor.parameterList), accessor.block, null); - - this.recordSourceMappingEnd(accessor); - - this.recordSourceMappingEnd(accessor); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.recordSourceMappingEnd(accessor); - }; - - Emitter.prototype.emitSetAccessor = function (accessor) { - this.recordSourceMappingStart(accessor); - this.writeToOutput("set "); - - var temp = this.setContainer(5 /* Function */); - - this.recordSourceMappingStart(accessor); - - var pullDecl = this.semanticInfoChain.getDeclForAST(accessor); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(accessor); - - var accessorSymbol = TypeScript.PullHelpers.getAccessorSymbol(accessor, this.semanticInfoChain); - var container = accessorSymbol.getContainer(); - var containerKind = container.kind; - - this.recordSourceMappingNameStart(accessor.propertyName.text()); - this.writeToOutput(accessor.propertyName.text()); - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(accessor.parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(null, accessor, parameters, accessor.block, null); - - this.recordSourceMappingEnd(accessor); - - this.recordSourceMappingEnd(accessor); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.recordSourceMappingEnd(accessor); - }; - - Emitter.prototype.emitFunctionExpression = function (funcDecl) { - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(5 /* Function */); - - var funcName = funcDecl.identifier ? funcDecl.identifier.text() : null; - - this.recordSourceMappingStart(funcDecl); - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - - if (funcDecl.identifier) { - this.recordSourceMappingStart(funcDecl.identifier); - this.writeToOutput(funcDecl.identifier.text()); - this.recordSourceMappingEnd(funcDecl.identifier); - } - - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(funcName, funcDecl, parameters, funcDecl.block, null); - - this.recordSourceMappingEnd(funcDecl); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - }; - - Emitter.prototype.emitFunction = function (funcDecl) { - if (funcDecl.block === null) { - return; - } - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(5 /* 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.writeToOutput("function "); - - 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 = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionBodyStatements(funcDecl.identifier.text(), funcDecl, parameters, funcDecl.block, null); - - this.recordSourceMappingEnd(funcDecl); - - 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 === 1 /* Module */ || this.emitState.container === 2 /* DynamicModule */) && pullFunctionDecl && TypeScript.hasFlag(pullFunctionDecl.flags, 1 /* Exported */)) { - this.writeLineToOutput(""); - this.emitIndent(); - var modName = this.emitState.container === 1 /* Module */ ? this.moduleName : "exports"; - this.recordSourceMappingStart(funcDecl); - this.writeToOutput(modName + "." + funcName + " = " + funcName + ";"); - this.recordSourceMappingEnd(funcDecl); - } - } - }; - - Emitter.prototype.emitAmbientVarDecl = function (varDecl) { - 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); - } - }; - - Emitter.prototype.emitVarDeclVar = function () { - if (this.currentVariableDeclaration) { - this.writeToOutput("var "); - } - }; - - Emitter.prototype.emitVariableDeclaration = function (declaration) { - var varDecl = declaration.declarators.nonSeparatorAt(0); - - var symbol = this.semanticInfoChain.getSymbolForAST(varDecl); - - var parentSymbol = symbol ? symbol.getContainer() : null; - var parentKind = parentSymbol ? parentSymbol.kind : 0 /* None */; - - this.emitComments(declaration, true); - - var pullVarDecl = this.semanticInfoChain.getDeclForAST(varDecl); - var isAmbientWithoutInit = pullVarDecl && TypeScript.hasFlag(pullVarDecl.flags, 8 /* Ambient */) && varDecl.equalsValueClause === null; - if (!isAmbientWithoutInit) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.currentVariableDeclaration = declaration; - - for (var i = 0, n = declaration.declarators.nonSeparatorCount(); i < n; i++) { - var declarator = declaration.declarators.nonSeparatorAt(i); - - if (i > 0) { - this.writeToOutput(", "); - } - - this.emit(declarator); - } - this.currentVariableDeclaration = prevVariableDeclaration; - - this.recordSourceMappingEnd(declaration); - } - - this.emitComments(declaration, false); - }; - - Emitter.prototype.emitMemberVariableDeclaration = function (varDecl) { - TypeScript.Debug.assert(!TypeScript.hasModifier(varDecl.modifiers, 16 /* 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 = TypeScript.isQuoted(varDeclName) || varDecl.variableDeclarator.propertyName.kind() !== 11 /* 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) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.emit(varDecl.variableDeclarator.equalsValueClause); - this.currentVariableDeclaration = prevVariableDeclaration; - } - - if (this.emitState.container !== 6 /* Args */) { - this.writeToOutput(";"); - } - - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - - this.popDecl(pullDecl); - }; - - Emitter.prototype.emitVariableDeclarator = function (varDecl) { - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - this.pushDecl(pullDecl); - if (pullDecl && (pullDecl.flags & 8 /* Ambient */) === 8 /* 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 & 102400 /* SomeInitializedModule */); - - if (parentIsModule) { - if (!TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */)) { - this.emitVarDeclVar(); - } else { - if (this.emitState.container === 2 /* DynamicModule */) { - this.writeToOutput("exports."); - } else { - this.writeToOutput(this.moduleName + "."); - } - } - } else { - this.emitVarDeclVar(); - } - - this.writeToOutputWithSourceMapRecord(varDecl.propertyName.text(), varDecl.propertyName); - - if (varDecl.equalsValueClause) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.emit(varDecl.equalsValueClause); - this.currentVariableDeclaration = prevVariableDeclaration; - } - - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - } - this.currentVariableDeclaration = undefined; - this.popDecl(pullDecl); - }; - - Emitter.prototype.symbolIsUsedInItsEnclosingContainer = function (symbol, dynamic) { - if (typeof dynamic === "undefined") { 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; - - while (symbolDeclarationEnclosingContainer) { - if (symbolDeclarationEnclosingContainer.kind === (dynamic ? 32 /* DynamicModule */ : 4 /* Container */)) { - break; - } - symbolDeclarationEnclosingContainer = symbolDeclarationEnclosingContainer.getParentDecl(); - } - - if (symbolDeclarationEnclosingContainer) { - while (enclosingContainer) { - if (enclosingContainer.kind === (dynamic ? 32 /* DynamicModule */ : 4 /* Container */)) { - break; - } - - enclosingContainer = enclosingContainer.getParentDecl(); - } - } - - if (symbolDeclarationEnclosingContainer && enclosingContainer) { - var same = symbolDeclarationEnclosingContainer === enclosingContainer; - - if (!same && symbol.anyDeclHasFlag(32768 /* InitializedModule */)) { - same = symbolDeclarationEnclosingContainer === enclosingContainer.getParentDecl(); - } - - return same; - } - } - } - } - - return false; - }; - - Emitter.prototype.shouldQualifySymbolNameWithParentName = function (symbol) { - 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 === 67108864 /* EnumMember */) { - return true; - } - - if (!TypeScript.hasFlag(currentDecl.flags, 1 /* Exported */)) { - return false; - } - - if (currentDecl.kind === 512 /* Variable */ && !TypeScript.hasFlag(currentDecl.flags, 118784 /* ImplicitVariable */)) { - return true; - } - - if (TypeScript.ArrayUtilities.contains(this.declStack, declParent)) { - return false; - } - } - - return true; - }; - - Emitter.prototype.getSymbolForEmit = function (ast) { - var pullSymbol = this.semanticInfoChain.getSymbolForAST(ast); - var pullSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(ast); - if (pullSymbol && pullSymbolAlias) { - var symbolToCompare = TypeScript.isTypesOnlyLocation(ast) ? pullSymbolAlias.getExportAssignedTypeSymbol() : pullSymbolAlias.getExportAssignedValueSymbol(); - - if (pullSymbol === symbolToCompare) { - pullSymbol = pullSymbolAlias; - pullSymbolAlias = null; - } - } - return { symbol: pullSymbol, aliasSymbol: pullSymbolAlias }; - }; - - Emitter.prototype.emitName = function (name, addThis) { - 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 !== 6 /* Args */) && pullSymbol) { - var pullSymbolContainer = pullSymbol.getContainer(); - - if (pullSymbolContainer) { - var pullSymbolContainerKind = pullSymbolContainer.kind; - - if (TypeScript.PullHelpers.symbolIsModule(pullSymbolContainer) || pullSymbolContainerKind === 64 /* Enum */ || pullSymbolContainer.anyDeclHasFlag(32768 /* InitializedModule */ | 4096 /* Enum */)) { - var needToEmitParentName = this.shouldQualifySymbolNameWithParentName(pullSymbol); - if (needToEmitParentName) { - var parentDecl = pullSymbol.getDeclarations()[0].getParentDecl(); - TypeScript.Debug.assert(parentDecl && !parentDecl.isRootDecl()); - this.writeToOutput(this.getModuleName(parentDecl, true) + "."); - } - } else if (pullSymbolContainerKind === 32 /* DynamicModule */ || pullSymbolContainer.anyDeclHasFlag(65536 /* InitializedDynamicModule */)) { - if (pullSymbolKind === 4096 /* Property */) { - this.writeToOutput("exports."); - } else if (pullSymbol.anyDeclHasFlag(1 /* Exported */) && !isLocalAlias && !pullSymbol.anyDeclHasFlag(118784 /* ImplicitVariable */) && pullSymbol.kind !== 32768 /* ConstructorMethod */ && pullSymbol.kind !== 8 /* Class */ && pullSymbol.kind !== 64 /* Enum */) { - this.writeToOutput("exports."); - } - } - } - } - - this.writeToOutput(name.text()); - } - - this.recordSourceMappingEnd(name); - this.emitComments(name, false); - }; - - Emitter.prototype.recordSourceMappingNameStart = function (name) { - 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; - } - } - - 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); - } - }; - - Emitter.prototype.recordSourceMappingNameEnd = function () { - if (this.sourceMapper) { - this.sourceMapper.currentNameIndex.pop(); - } - }; - - Emitter.prototype.recordSourceMappingStart = function (ast) { - if (this.sourceMapper && TypeScript.ASTHelpers.isValidAstNode(ast)) { - var lineCol = { line: -1, character: -1 }; - var sourceMapping = new TypeScript.SourceMapping(); - sourceMapping.start.emittedColumn = this.emitState.column; - sourceMapping.start.emittedLine = this.emitState.line; - - var lineMap = this.document.lineMap(); - lineMap.fillLineAndCharacterFromPosition(ast.start(), lineCol); - sourceMapping.start.sourceColumn = lineCol.character; - sourceMapping.start.sourceLine = lineCol.line + 1; - lineMap.fillLineAndCharacterFromPosition(ast.end(), lineCol); - sourceMapping.end.sourceColumn = lineCol.character; - sourceMapping.end.sourceLine = lineCol.line + 1; - - TypeScript.Debug.assert(!isNaN(sourceMapping.start.emittedColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.start.emittedLine)); - TypeScript.Debug.assert(!isNaN(sourceMapping.start.sourceColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.start.sourceLine)); - TypeScript.Debug.assert(!isNaN(sourceMapping.end.sourceColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.end.sourceLine)); - - if (this.sourceMapper.currentNameIndex.length > 0) { - sourceMapping.nameIndex = this.sourceMapper.currentNameIndex[this.sourceMapper.currentNameIndex.length - 1]; - } - - var siblings = this.sourceMapper.currentMappings[this.sourceMapper.currentMappings.length - 1]; - siblings.push(sourceMapping); - this.sourceMapper.currentMappings.push(sourceMapping.childMappings); - this.sourceMapper.increaseMappingLevel(ast); - } - }; - - Emitter.prototype.recordSourceMappingEnd = function (ast) { - if (this.sourceMapper && TypeScript.ASTHelpers.isValidAstNode(ast)) { - this.sourceMapper.currentMappings.pop(); - - 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; - - TypeScript.Debug.assert(!isNaN(sourceMapping.end.emittedColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.end.emittedLine)); - - this.sourceMapper.decreaseMappingLevel(ast); - } - }; - - Emitter.prototype.getOutputFiles = function () { - var result = []; - if (this.sourceMapper !== null) { - this.sourceMapper.emitSourceMapping(); - result.push(this.sourceMapper.getOutputFile()); - } - - result.push(this.outfile.getOutputFile()); - return result; - }; - - Emitter.prototype.emitParameterPropertyAndMemberVariableAssignments = function () { - var constructorDecl = getLastConstructor(this.thisClassNode); - - if (constructorDecl) { - for (var i = 0, n = constructorDecl.callSignature.parameterList.parameters.nonSeparatorCount(); i < n; i++) { - var parameter = constructorDecl.callSignature.parameterList.parameters.nonSeparatorAt(i); - var parameterDecl = this.semanticInfoChain.getDeclForAST(parameter); - if (TypeScript.hasFlag(parameterDecl.flags, 8388608 /* 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.childCount(); i < n; i++) { - if (this.thisClassNode.classElements.childAt(i).kind() === 136 /* MemberVariableDeclaration */) { - var varDecl = this.thisClassNode.classElements.childAt(i); - if (!TypeScript.hasModifier(varDecl.modifiers, 16 /* Static */) && varDecl.variableDeclarator.equalsValueClause) { - this.emitIndent(); - this.emitMemberVariableDeclaration(varDecl); - this.writeLineToOutput(""); - } - } - } - }; - - Emitter.prototype.isOnSameLine = function (pos1, pos2) { - var lineMap = this.document.lineMap(); - return lineMap.getLineNumberFromPosition(pos1) === lineMap.getLineNumberFromPosition(pos2); - }; - - Emitter.prototype.emitCommaSeparatedList = function (parent, list, buffer, preserveNewLines) { - if (list === null || list.nonSeparatorCount() === 0) { - return; - } - - var startLine = preserveNewLines && !this.isOnSameLine(parent.end(), list.nonSeparatorAt(0).end()); - - if (preserveNewLines) { - this.indenter.increaseIndent(); - } - - if (startLine) { - this.writeLineToOutput(""); - } else { - this.writeToOutput(buffer); - } - - for (var i = 0, n = list.nonSeparatorCount(); i < n; i++) { - var emitNode = list.nonSeparatorAt(i); - - this.emitJavascript(emitNode, startLine); - - if (i < (n - 1)) { - startLine = preserveNewLines && !this.isOnSameLine(emitNode.end(), list.nonSeparatorAt(i + 1).start()); - if (startLine) { - this.writeLineToOutput(","); - } else { - this.writeToOutput(", "); - } - } - } - - if (preserveNewLines) { - this.indenter.decreaseIndent(); - } - - if (preserveNewLines && !this.isOnSameLine(parent.end(), list.nonSeparatorAt(list.nonSeparatorCount() - 1).end())) { - this.writeLineToOutput(""); - this.emitIndent(); - } else { - this.writeToOutput(buffer); - } - }; - - Emitter.prototype.emitList = function (list, useNewLineSeparator, startInclusive, endExclusive) { - if (typeof useNewLineSeparator === "undefined") { useNewLineSeparator = true; } - if (typeof startInclusive === "undefined") { startInclusive = 0; } - if (typeof endExclusive === "undefined") { endExclusive = list.childCount(); } - if (list === null) { - return; - } - - this.emitComments(list, true); - var lastEmittedNode = null; - - for (var i = startInclusive; i < endExclusive; i++) { - var node = list.childAt(i); - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - if (useNewLineSeparator) { - this.writeLineToOutput(""); - } - - lastEmittedNode = node; - } - } - - this.emitComments(list, false); - }; - - Emitter.prototype.emitSeparatedList = function (list, useNewLineSeparator, startInclusive, endExclusive) { - if (typeof useNewLineSeparator === "undefined") { useNewLineSeparator = true; } - if (typeof startInclusive === "undefined") { startInclusive = 0; } - if (typeof endExclusive === "undefined") { endExclusive = list.nonSeparatorCount(); } - if (list === null) { - return; - } - - this.emitComments(list, true); - var lastEmittedNode = null; - - for (var i = startInclusive; i < endExclusive; i++) { - var node = list.nonSeparatorAt(i); - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - if (useNewLineSeparator) { - this.writeLineToOutput(""); - } - - lastEmittedNode = node; - } - } - - this.emitComments(list, false); - }; - - Emitter.prototype.isDirectivePrologueElement = function (node) { - if (node.kind() === 149 /* ExpressionStatement */) { - var exprStatement = node; - return exprStatement.expression.kind() === 14 /* StringLiteral */; - } - - return false; - }; - - Emitter.prototype.emitSpaceBetweenConstructs = function (node1, node2) { - if (node1 === null || node2 === null) { - return; - } - - if (node1.start() === -1 || node1.end() === -1 || node2.start() === -1 || node2.end() === -1) { - return; - } - - var lineMap = this.document.lineMap(); - var node1EndLine = lineMap.getLineNumberFromPosition(node1.end()); - var node2StartLine = lineMap.getLineNumberFromPosition(node2.start()); - - if ((node2StartLine - node1EndLine) > 1) { - this.writeLineToOutput("", true); - } - }; - - Emitter.prototype.getDetachedComments = function (element) { - var preComments = element.preComments(); - if (preComments) { - var lineMap = this.document.lineMap(); - - var detachedComments = []; - var lastComment = 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) { - return detachedComments; - } - } - - detachedComments.push(comment); - lastComment = comment; - } - - var lastCommentLine = lineMap.getLineNumberFromPosition(TypeScript.ArrayUtilities.last(detachedComments).end()); - var astLine = lineMap.getLineNumberFromPosition(element.start()); - if (astLine >= lastCommentLine + 2) { - return detachedComments; - } - } - - return []; - }; - - Emitter.prototype.emitPossibleCopyrightHeaders = function (script) { - this.emitDetachedComments(script.moduleElements); - }; - - Emitter.prototype.emitDetachedComments = function (list) { - if (list.childCount() > 0) { - var firstElement = list.childAt(0); - - this.detachedCommentsElement = firstElement; - this.emitCommentsArray(this.getDetachedComments(this.detachedCommentsElement), false); - } - }; - - Emitter.prototype.emitScriptElements = function (sourceUnit) { - var list = sourceUnit.moduleElements; - - this.emitPossibleCopyrightHeaders(sourceUnit); - - for (var i = 0, n = list.childCount(); i < n; i++) { - var node = list.childAt(i); - - if (!this.isDirectivePrologueElement(node)) { - break; - } - - this.emitJavascript(node, true); - this.writeLineToOutput(""); - } - - this.emitPrologue(sourceUnit); - - var isExternalModule = this.document.isExternalModule(); - var isNonElidedExternalModule = isExternalModule && !TypeScript.ASTHelpers.scriptIsElided(sourceUnit); - if (isNonElidedExternalModule) { - this.recordSourceMappingStart(sourceUnit); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - 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(2 /* DynamicModule */); - - var svModuleName = this.moduleName; - this.moduleName = sourceUnit.fileName(); - if (TypeScript.isTSFile(this.moduleName)) { - this.moduleName = this.moduleName.substring(0, this.moduleName.length - ".ts".length); - } - - this.setExportAssignment(null); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - this.indenter.increaseIndent(); - } - - var externalModule = this.semanticInfoChain.getDeclForAST(this.document.sourceUnit()); - - if (TypeScript.hasFlag(externalModule.flags, 262144 /* MustCaptureThis */)) { - this.writeCaptureThisStatement(sourceUnit); - } - - this.pushDecl(externalModule); - } - - this.emitList(list, true, i, n); - - if (isExternalModule) { - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - this.indenter.decreaseIndent(); - } - - if (isNonElidedExternalModule) { - var exportAssignment = this.getExportAssignment(); - var exportAssignmentIdentifierText = exportAssignment ? exportAssignment.identifier.text() : null; - var exportAssignmentValueSymbol = externalModule.getSymbol().getExportAssignedValueSymbol(); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - if (exportAssignmentIdentifierText && exportAssignmentValueSymbol && !(exportAssignmentValueSymbol.kind & 58720272 /* SomeTypeReference */)) { - this.indenter.increaseIndent(); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("return " + exportAssignmentIdentifierText, exportAssignment); - this.writeLineToOutput(";"); - this.indenter.decreaseIndent(); - } - this.writeToOutput("});"); - } else if (exportAssignmentIdentifierText && exportAssignmentValueSymbol && !(exportAssignmentValueSymbol.kind & 58720272 /* 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); - } - }; - - Emitter.prototype.emitConstructorStatements = function (funcDecl) { - var list = funcDecl.block.statements; - - if (list === null) { - return; - } - - this.emitComments(list, true); - - var emitPropertyAssignmentsAfterSuperCall = TypeScript.ASTHelpers.getExtendsHeritageClause(this.thisClassNode.heritageClauses) !== null; - var propertyAssignmentIndex = emitPropertyAssignmentsAfterSuperCall ? 1 : 0; - var lastEmittedNode = null; - - for (var i = 0, n = list.childCount(); i < n; i++) { - if (i === propertyAssignmentIndex) { - this.emitParameterPropertyAndMemberVariableAssignments(); - } - - var node = list.childAt(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); - }; - - Emitter.prototype.emitJavascript = function (ast, startLine) { - if (ast === null) { - return; - } - - if (startLine && this.indenter.indentAmt > 0) { - this.emitIndent(); - } - - this.emit(ast); - }; - - Emitter.prototype.emitAccessorMemberDeclaration = function (funcDecl, name, className, isProto) { - if (funcDecl.kind() !== 139 /* GetAccessor */) { - var accessorSymbol = TypeScript.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 (TypeScript.isQuoted(functionName)) { - this.writeToOutput(functionName); - } else { - this.writeToOutput('"' + functionName + '"'); - } - - this.writeLineToOutput(", {"); - - this.indenter.increaseIndent(); - - var accessors = TypeScript.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.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.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); - }; - - Emitter.prototype.emitAccessorBody = function (funcDecl, parameterList, block) { - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(null, funcDecl, parameters, block, null); - - this.recordSourceMappingEnd(funcDecl); - - this.recordSourceMappingEnd(funcDecl); - this.popDecl(pullDecl); - }; - - Emitter.prototype.emitClass = function (classDecl) { - 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(3 /* Class */); - - this.recordSourceMappingStart(classDecl); - this.writeToOutput("var " + className); - - var hasBaseClass = TypeScript.ASTHelpers.getExtendsHeritageClause(classDecl.heritageClauses) !== null; - var baseTypeReference = null; - var varDecl = null; - - if (hasBaseClass) { - this.writeLineToOutput(" = (function (_super) {"); - } else { - this.writeLineToOutput(" = (function () {"); - } - - this.recordSourceMappingNameStart(className); - this.indenter.increaseIndent(); - - if (hasBaseClass) { - baseTypeReference = TypeScript.ASTHelpers.getExtendsHeritageClause(classDecl.heritageClauses).typeNames.nonSeparatorAt(0); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("__extends(" + className + ", _super)", baseTypeReference); - this.writeLineToOutput(";"); - } - - this.emitIndent(); - - var constrDecl = getLastConstructor(classDecl); - - if (constrDecl) { - this.emit(constrDecl); - this.writeLineToOutput(""); - } else { - this.recordSourceMappingStart(classDecl); - - 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.writeToOutputWithSourceMapRecord("}", 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.writeToOutputWithSourceMapRecord("}", classDecl.closeBraceToken); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingStart(classDecl); - this.writeToOutput(")("); - if (hasBaseClass) { - this.emitJavascript(baseTypeReference, false); - } - this.writeToOutput(");"); - this.recordSourceMappingEnd(classDecl); - - if ((temp === 1 /* Module */ || temp === 2 /* DynamicModule */) && TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */)) { - this.writeLineToOutput(""); - this.emitIndent(); - var modName = temp === 1 /* 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); - }; - - Emitter.prototype.emitClassMembers = function (classDecl) { - var lastEmittedMember = null; - - for (var i = 0, n = classDecl.classElements.childCount(); i < n; i++) { - var memberDecl = classDecl.classElements.childAt(i); - - if (memberDecl.kind() === 139 /* GetAccessor */) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - var getter = memberDecl; - this.emitAccessorMemberDeclaration(getter, getter.propertyName, classDecl.identifier.text(), !TypeScript.hasModifier(getter.modifiers, 16 /* Static */)); - lastEmittedMember = memberDecl; - } else if (memberDecl.kind() === 140 /* SetAccessor */) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - var setter = memberDecl; - this.emitAccessorMemberDeclaration(setter, setter.propertyName, classDecl.identifier.text(), !TypeScript.hasModifier(setter.modifiers, 16 /* Static */)); - lastEmittedMember = memberDecl; - } else if (memberDecl.kind() === 135 /* MemberFunctionDeclaration */) { - var memberFunction = memberDecl; - - if (memberFunction.block) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - - this.emitClassMemberFunctionDeclaration(classDecl, memberFunction); - lastEmittedMember = memberDecl; - } - } - } - - for (var i = 0, n = classDecl.classElements.childCount(); i < n; i++) { - var memberDecl = classDecl.classElements.childAt(i); - - if (memberDecl.kind() === 136 /* MemberVariableDeclaration */) { - var varDecl = memberDecl; - - if (TypeScript.hasModifier(varDecl.modifiers, 16 /* Static */) && varDecl.variableDeclarator.equalsValueClause) { - this.emitSpaceBetweenConstructs(lastEmittedMember, varDecl); - - this.emitIndent(); - this.recordSourceMappingStart(varDecl); - - var varDeclName = varDecl.variableDeclarator.propertyName.text(); - if (TypeScript.isQuoted(varDeclName) || varDecl.variableDeclarator.propertyName.kind() !== 11 /* 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; - } - } - } - }; - - Emitter.prototype.emitClassMemberFunctionDeclaration = function (classDecl, funcDecl) { - this.emitIndent(); - this.recordSourceMappingStart(funcDecl); - this.emitComments(funcDecl, true); - var functionName = funcDecl.propertyName.text(); - - this.writeToOutput(classDecl.identifier.text()); - - if (!TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */)) { - this.writeToOutput(".prototype"); - } - - if (TypeScript.isQuoted(functionName) || funcDecl.propertyName.kind() !== 11 /* 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 = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionBodyStatements(funcDecl.propertyName.text(), funcDecl, parameters, funcDecl.block, null); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.recordSourceMappingEnd(funcDecl); - this.popDecl(pullDecl); - - this.writeLineToOutput(";"); - }; - - Emitter.prototype.requiresExtendsBlock = function (moduleElements) { - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var moduleElement = moduleElements.childAt(i); - - if (moduleElement.kind() === 130 /* ModuleDeclaration */) { - var moduleAST = moduleElement; - - if (!TypeScript.hasModifier(moduleAST.modifiers, 8 /* Ambient */) && this.requiresExtendsBlock(moduleAST.moduleElements)) { - return true; - } - } else if (moduleElement.kind() === 131 /* ClassDeclaration */) { - var classDeclaration = moduleElement; - - if (!TypeScript.hasModifier(classDeclaration.modifiers, 8 /* Ambient */) && TypeScript.ASTHelpers.getExtendsHeritageClause(classDeclaration.heritageClauses) !== null) { - return true; - } - } - } - - return false; - }; - - Emitter.prototype.emitPrologue = function (sourceUnit) { - 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); - } - } - }; - - Emitter.prototype.emitThis = function () { - if (!this.inWithBlock && this.inArrowFunction) { - this.writeToOutput("_this"); - } else { - this.writeToOutput("this"); - } - }; - - Emitter.prototype.emitBlockOrStatement = function (node) { - if (node.kind() === 146 /* Block */) { - this.emit(node); - } else { - this.writeLineToOutput(""); - this.indenter.increaseIndent(); - this.emitJavascript(node, true); - this.indenter.decreaseIndent(); - } - }; - - Emitter.prototype.emitLiteralExpression = function (expression) { - switch (expression.kind()) { - case 32 /* NullKeyword */: - this.writeToOutputWithSourceMapRecord("null", expression); - break; - case 24 /* FalseKeyword */: - this.writeToOutputWithSourceMapRecord("false", expression); - break; - case 37 /* TrueKeyword */: - this.writeToOutputWithSourceMapRecord("true", expression); - break; - default: - throw TypeScript.Errors.abstract(); - } - }; - - Emitter.prototype.emitThisExpression = function (expression) { - if (!this.inWithBlock && this.inArrowFunction) { - this.writeToOutputWithSourceMapRecord("_this", expression); - } else { - this.writeToOutputWithSourceMapRecord("this", expression); - } - }; - - Emitter.prototype.emitSuperExpression = function (expression) { - this.writeToOutputWithSourceMapRecord("_super.prototype", expression); - }; - - Emitter.prototype.emitParenthesizedExpression = function (parenthesizedExpression) { - var omitParentheses = false; - - if (parenthesizedExpression.expression.kind() === 220 /* CastExpression */ && parenthesizedExpression.openParenTrailingComments === null) { - var castedExpression = parenthesizedExpression.expression.expression; - - while (castedExpression.kind() == 220 /* CastExpression */) { - castedExpression = castedExpression.expression; - } - - switch (castedExpression.kind()) { - case 217 /* ParenthesizedExpression */: - case 11 /* IdentifierName */: - case 32 /* NullKeyword */: - case 35 /* ThisKeyword */: - case 14 /* StringLiteral */: - case 13 /* NumericLiteral */: - case 12 /* RegularExpressionLiteral */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - case 214 /* ArrayLiteralExpression */: - case 215 /* ObjectLiteralExpression */: - case 212 /* MemberAccessExpression */: - case 221 /* ElementAccessExpression */: - omitParentheses = true; - break; - - case 213 /* InvocationExpression */: - if (parenthesizedExpression.parent.kind() !== 216 /* ObjectCreationExpression */) { - omitParentheses = true; - } - - break; - } - } - - if (omitParentheses) { - this.emit(parenthesizedExpression.expression); - } else { - this.recordSourceMappingStart(parenthesizedExpression); - this.writeToOutput("("); - this.emitCommentsArray(parenthesizedExpression.openParenTrailingComments, false); - this.emit(parenthesizedExpression.expression); - this.writeToOutput(")"); - this.recordSourceMappingEnd(parenthesizedExpression); - } - }; - - Emitter.prototype.emitCastExpression = function (expression) { - this.emit(expression.expression); - }; - - Emitter.prototype.emitPrefixUnaryExpression = function (expression) { - var nodeType = expression.kind(); - - this.recordSourceMappingStart(expression); - switch (nodeType) { - case 167 /* LogicalNotExpression */: - this.writeToOutput("!"); - this.emit(expression.operand); - break; - case 166 /* BitwiseNotExpression */: - this.writeToOutput("~"); - this.emit(expression.operand); - break; - case 165 /* NegateExpression */: - this.writeToOutput("-"); - if (expression.operand.kind() === 165 /* NegateExpression */ || expression.operand.kind() === 169 /* PreDecrementExpression */) { - this.writeToOutput(" "); - } - this.emit(expression.operand); - break; - case 164 /* PlusExpression */: - this.writeToOutput("+"); - if (expression.operand.kind() === 164 /* PlusExpression */ || expression.operand.kind() === 168 /* PreIncrementExpression */) { - this.writeToOutput(" "); - } - this.emit(expression.operand); - break; - case 168 /* PreIncrementExpression */: - this.writeToOutput("++"); - this.emit(expression.operand); - break; - case 169 /* PreDecrementExpression */: - this.writeToOutput("--"); - this.emit(expression.operand); - break; - default: - throw TypeScript.Errors.abstract(); - } - - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitPostfixUnaryExpression = function (expression) { - var nodeType = expression.kind(); - - this.recordSourceMappingStart(expression); - switch (nodeType) { - case 210 /* PostIncrementExpression */: - this.emit(expression.operand); - this.writeToOutput("++"); - break; - case 211 /* PostDecrementExpression */: - this.emit(expression.operand); - this.writeToOutput("--"); - break; - default: - throw TypeScript.Errors.abstract(); - } - - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitTypeOfExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.writeToOutput("typeof "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitDeleteExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.writeToOutput("delete "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitVoidExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.writeToOutput("void "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.canEmitDottedNameMemberAccessExpression = function (expression) { - var memberExpressionNodeType = expression.expression.kind(); - - if (memberExpressionNodeType === 11 /* IdentifierName */ || memberExpressionNodeType == 212 /* MemberAccessExpression */) { - var memberAccessSymbol = this.getSymbolForEmit(expression).symbol; - var memberAccessExpressionSymbol = this.getSymbolForEmit(expression.expression).symbol; - if (memberAccessSymbol && memberAccessExpressionSymbol && !this.semanticInfoChain.getAliasSymbolForAST(expression.expression) && (TypeScript.PullHelpers.symbolIsModule(memberAccessExpressionSymbol) || memberAccessExpressionSymbol.kind === 64 /* Enum */ || memberAccessExpressionSymbol.anyDeclHasFlag(32768 /* InitializedModule */ | 4096 /* Enum */))) { - var memberAccessSymbolKind = memberAccessSymbol.kind; - if (memberAccessSymbolKind === 4096 /* Property */ || memberAccessSymbolKind === 67108864 /* EnumMember */ || (memberAccessSymbol.anyDeclHasFlag(1 /* Exported */) && memberAccessSymbolKind === 512 /* Variable */ && !memberAccessSymbol.anyDeclHasFlag(32768 /* InitializedModule */ | 4096 /* Enum */)) || ((memberAccessSymbol.anyDeclHasFlag(1 /* Exported */) && !this.symbolIsUsedInItsEnclosingContainer(memberAccessSymbol)))) { - if (memberExpressionNodeType === 212 /* MemberAccessExpression */) { - return this.canEmitDottedNameMemberAccessExpression(expression.expression); - } - - return true; - } - } - } - - return false; - }; - - Emitter.prototype.emitDottedNameMemberAccessExpression = function (expression) { - this.recordSourceMappingStart(expression); - if (expression.expression.kind() === 212 /* MemberAccessExpression */) { - this.emitDottedNameMemberAccessExpressionRecurse(expression.expression); - } else { - this.emitName(expression.expression, true); - } - - this.writeToOutput("."); - this.emitName(expression.name, false); - - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitDottedNameMemberAccessExpressionRecurse = function (expression) { - this.emitComments(expression, true); - this.emitDottedNameMemberAccessExpression(expression); - this.emitComments(expression, false); - }; - - Emitter.prototype.emitMemberAccessExpression = function (expression) { - if (!this.tryEmitConstant(expression)) { - if (this.canEmitDottedNameMemberAccessExpression(expression)) { - this.emitDottedNameMemberAccessExpression(expression); - } else { - this.recordSourceMappingStart(expression); - this.emit(expression.expression); - this.writeToOutput("."); - this.emitName(expression.name, false); - this.recordSourceMappingEnd(expression); - } - } - }; - - Emitter.prototype.emitQualifiedName = function (name) { - this.recordSourceMappingStart(name); - - this.emit(name.left); - this.writeToOutput("."); - this.emitName(name.right, false); - - this.recordSourceMappingEnd(name); - }; - - Emitter.prototype.emitBinaryExpression = function (expression) { - this.recordSourceMappingStart(expression); - switch (expression.kind()) { - case 173 /* CommaExpression */: - this.emit(expression.left); - this.writeToOutput(", "); - this.emit(expression.right); - break; - default: { - this.emit(expression.left); - var binOp = TypeScript.SyntaxFacts.getText(TypeScript.SyntaxFacts.getOperatorTokenFromBinaryExpression(expression.kind())); - if (binOp === "instanceof") { - this.writeToOutput(" instanceof "); - } else if (binOp === "in") { - this.writeToOutput(" in "); - } else { - this.writeToOutput(" " + binOp + " "); - } - this.emit(expression.right); - } - } - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitSimplePropertyAssignment = function (property) { - this.recordSourceMappingStart(property); - this.emit(property.propertyName); - this.writeToOutput(": "); - this.emit(property.expression); - this.recordSourceMappingEnd(property); - }; - - Emitter.prototype.emitFunctionPropertyAssignment = function (funcProp) { - 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(5 /* Function */); - var funcName = funcProp.propertyName; - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcProp); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcProp); - this.writeToOutput("function "); - - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(funcProp.callSignature.parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(funcProp.propertyName.text(), funcProp, parameters, funcProp.block, null); - - this.recordSourceMappingEnd(funcProp); - - this.recordSourceMappingEnd(funcProp); - - this.emitComments(funcProp, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - }; - - Emitter.prototype.emitConditionalExpression = function (expression) { - this.emit(expression.condition); - this.writeToOutput(" ? "); - this.emit(expression.whenTrue); - this.writeToOutput(" : "); - this.emit(expression.whenFalse); - }; - - Emitter.prototype.emitThrowStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("throw "); - this.emit(statement.expression); - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitExpressionStatement = function (statement) { - var isArrowExpression = statement.expression.kind() === 219 /* SimpleArrowFunctionExpression */ || statement.expression.kind() === 218 /* ParenthesizedArrowFunctionExpression */; - - this.recordSourceMappingStart(statement); - if (isArrowExpression) { - this.writeToOutput("("); - } - - this.emit(statement.expression); - - if (isArrowExpression) { - this.writeToOutput(")"); - } - - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitLabeledStatement = function (statement) { - this.writeToOutputWithSourceMapRecord(statement.identifier.text(), statement.identifier); - this.writeLineToOutput(":"); - this.emitJavascript(statement.statement, true); - }; - - Emitter.prototype.emitBlock = function (block) { - this.recordSourceMappingStart(block); - this.writeLineToOutput(" {"); - this.indenter.increaseIndent(); - if (block.statements) { - this.emitList(block.statements); - } - this.emitCommentsArray(block.closeBraceLeadingComments, false); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToOutput("}"); - this.recordSourceMappingEnd(block); - }; - - Emitter.prototype.emitBreakStatement = function (jump) { - this.recordSourceMappingStart(jump); - this.writeToOutput("break"); - - if (jump.identifier) { - this.writeToOutput(" " + jump.identifier.text()); - } - - this.recordSourceMappingEnd(jump); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitContinueStatement = function (jump) { - this.recordSourceMappingStart(jump); - this.writeToOutput("continue"); - - if (jump.identifier) { - this.writeToOutput(" " + jump.identifier.text()); - } - - this.recordSourceMappingEnd(jump); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitWhileStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("while ("); - this.emit(statement.condition); - this.writeToOutput(")"); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitDoStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("do"); - this.emitBlockOrStatement(statement.statement); - this.writeToOutputWithSourceMapRecord(" while", statement.whileKeyword); - this.writeToOutput('('); - this.emit(statement.condition); - this.writeToOutput(")"); - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitIfStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("if ("); - this.emit(statement.condition); - this.writeToOutput(")"); - - this.emitBlockOrStatement(statement.statement); - - if (statement.elseClause) { - if (statement.statement.kind() !== 146 /* Block */) { - this.writeLineToOutput(""); - this.emitIndent(); - } else { - this.writeToOutput(" "); - } - - this.emit(statement.elseClause); - } - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitElseClause = function (elseClause) { - if (elseClause.statement.kind() === 147 /* IfStatement */) { - this.writeToOutput("else "); - this.emit(elseClause.statement); - } else { - this.writeToOutput("else"); - this.emitBlockOrStatement(elseClause.statement); - } - }; - - Emitter.prototype.emitReturnStatement = function (statement) { - this.recordSourceMappingStart(statement); - if (statement.expression) { - this.writeToOutput("return "); - this.emit(statement.expression); - } else { - this.writeToOutput("return"); - } - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitForInStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("for ("); - if (statement.left) { - this.emit(statement.left); - } else { - this.emit(statement.variableDeclaration); - } - this.writeToOutput(" in "); - this.emit(statement.expression); - this.writeToOutput(")"); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitForStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("for ("); - if (statement.variableDeclaration) { - this.emit(statement.variableDeclaration); - } else if (statement.initializer) { - this.emit(statement.initializer); - } - - this.writeToOutput("; "); - this.emitJavascript(statement.condition, false); - this.writeToOutput(";"); - if (statement.incrementor) { - this.writeToOutput(" "); - this.emitJavascript(statement.incrementor, false); - } - this.writeToOutput(")"); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitWithStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("with ("); - if (statement.condition) { - this.emit(statement.condition); - } - - this.writeToOutput(")"); - var prevInWithBlock = this.inWithBlock; - this.inWithBlock = true; - this.emitBlockOrStatement(statement.statement); - this.inWithBlock = prevInWithBlock; - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitSwitchStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("switch ("); - this.emit(statement.expression); - this.recordSourceMappingStart(statement.closeParenToken); - this.writeToOutput(")"); - this.recordSourceMappingEnd(statement.closeParenToken); - this.writeLineToOutput(" {"); - this.indenter.increaseIndent(); - this.emitList(statement.switchClauses, false); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToOutput("}"); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitCaseSwitchClause = function (clause) { - this.recordSourceMappingStart(clause); - this.writeToOutput("case "); - this.emit(clause.expression); - this.writeToOutput(":"); - - this.emitSwitchClauseBody(clause.statements); - this.recordSourceMappingEnd(clause); - }; - - Emitter.prototype.emitSwitchClauseBody = function (body) { - if (body.childCount() === 1 && body.childAt(0).kind() === 146 /* Block */) { - this.emit(body.childAt(0)); - this.writeLineToOutput(""); - } else { - this.writeLineToOutput(""); - this.indenter.increaseIndent(); - this.emit(body); - this.indenter.decreaseIndent(); - } - }; - - Emitter.prototype.emitDefaultSwitchClause = function (clause) { - this.recordSourceMappingStart(clause); - this.writeToOutput("default:"); - - this.emitSwitchClauseBody(clause.statements); - this.recordSourceMappingEnd(clause); - }; - - Emitter.prototype.emitTryStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("try "); - this.emit(statement.block); - this.emitJavascript(statement.catchClause, false); - - if (statement.finallyClause) { - this.emit(statement.finallyClause); - } - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitCatchClause = function (clause) { - this.writeToOutput(" "); - this.recordSourceMappingStart(clause); - this.writeToOutput("catch ("); - this.emit(clause.identifier); - this.writeToOutput(")"); - this.emit(clause.block); - this.recordSourceMappingEnd(clause); - }; - - Emitter.prototype.emitFinallyClause = function (clause) { - this.writeToOutput(" finally"); - this.emit(clause.block); - }; - - Emitter.prototype.emitDebuggerStatement = function (statement) { - this.writeToOutputWithSourceMapRecord("debugger", statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitNumericLiteral = function (literal) { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - }; - - Emitter.prototype.emitRegularExpressionLiteral = function (literal) { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - }; - - Emitter.prototype.emitStringLiteral = function (literal) { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - }; - - Emitter.prototype.emitEqualsValueClause = function (clause) { - this.writeToOutput(" = "); - this.emit(clause.value); - }; - - Emitter.prototype.emitParameter = function (parameter) { - this.writeToOutputWithSourceMapRecord(parameter.identifier.text(), parameter); - }; - - Emitter.prototype.emitConstructorDeclaration = function (declaration) { - if (declaration.block) { - this.emitConstructor(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitFunctionDeclaration = function (declaration) { - return declaration.preComments() !== null || (!TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */) && declaration.block !== null); - }; - - Emitter.prototype.emitFunctionDeclaration = function (declaration) { - if (!TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */) && declaration.block !== null) { - this.emitFunction(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.emitSourceUnit = function (sourceUnit) { - if (!this.document.isDeclareFile()) { - var pullDecl = this.semanticInfoChain.getDeclForAST(sourceUnit); - this.pushDecl(pullDecl); - this.emitScriptElements(sourceUnit); - this.popDecl(pullDecl); - - this.emitCommentsArray(sourceUnit.endOfFileTokenLeadingComments, false); - } - }; - - Emitter.prototype.shouldEmitEnumDeclaration = function (declaration) { - return declaration.preComments() !== null || !TypeScript.ASTHelpers.enumIsElided(declaration); - }; - - Emitter.prototype.emitEnumDeclaration = function (declaration) { - if (!TypeScript.ASTHelpers.enumIsElided(declaration)) { - this.emitComments(declaration, true); - this.emitEnum(declaration); - this.emitComments(declaration, false); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitModuleDeclaration = function (declaration) { - return declaration.preComments() !== null || !TypeScript.ASTHelpers.moduleIsElided(declaration); - }; - - Emitter.prototype.emitModuleDeclaration = function (declaration) { - if (!TypeScript.ASTHelpers.moduleIsElided(declaration)) { - this.emitModuleDeclarationWorker(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitClassDeclaration = function (declaration) { - return declaration.preComments() !== null || !TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */); - }; - - Emitter.prototype.emitClassDeclaration = function (declaration) { - if (!TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */)) { - this.emitClass(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitInterfaceDeclaration = function (declaration) { - return declaration.preComments() !== null; - }; - - Emitter.prototype.emitInterfaceDeclaration = function (declaration) { - this.emitComments(declaration, true, true); - }; - - Emitter.prototype.firstVariableDeclarator = function (statement) { - return statement.declaration.declarators.nonSeparatorAt(0); - }; - - Emitter.prototype.isNotAmbientOrHasInitializer = function (variableStatement) { - return !TypeScript.hasModifier(variableStatement.modifiers, 8 /* Ambient */) || this.firstVariableDeclarator(variableStatement).equalsValueClause !== null; - }; - - Emitter.prototype.shouldEmitVariableStatement = function (statement) { - return statement.preComments() !== null || this.isNotAmbientOrHasInitializer(statement); - }; - - Emitter.prototype.emitVariableStatement = function (statement) { - if (this.isNotAmbientOrHasInitializer(statement)) { - this.emitComments(statement, true); - this.emit(statement.declaration); - this.writeToOutput(";"); - this.emitComments(statement, false); - } else { - this.emitComments(statement, true, true); - } - }; - - Emitter.prototype.emitGenericType = function (type) { - this.emit(type.name); - }; - - Emitter.prototype.shouldEmit = function (ast) { - if (!ast) { - return false; - } - - switch (ast.kind()) { - case 133 /* ImportDeclaration */: - return this.shouldEmitImportDeclaration(ast); - case 131 /* ClassDeclaration */: - return this.shouldEmitClassDeclaration(ast); - case 128 /* InterfaceDeclaration */: - return this.shouldEmitInterfaceDeclaration(ast); - case 129 /* FunctionDeclaration */: - return this.shouldEmitFunctionDeclaration(ast); - case 130 /* ModuleDeclaration */: - return this.shouldEmitModuleDeclaration(ast); - case 148 /* VariableStatement */: - return this.shouldEmitVariableStatement(ast); - case 223 /* OmittedExpression */: - return false; - case 132 /* EnumDeclaration */: - return this.shouldEmitEnumDeclaration(ast); - } - - return true; - }; - - Emitter.prototype.emit = function (ast) { - if (!ast) { - return; - } - - switch (ast.kind()) { - case 2 /* SeparatedList */: - return this.emitSeparatedList(ast); - case 1 /* List */: - return this.emitList(ast); - case 120 /* SourceUnit */: - return this.emitSourceUnit(ast); - case 133 /* ImportDeclaration */: - return this.emitImportDeclaration(ast); - case 134 /* ExportAssignment */: - return this.setExportAssignment(ast); - case 131 /* ClassDeclaration */: - return this.emitClassDeclaration(ast); - case 128 /* InterfaceDeclaration */: - return this.emitInterfaceDeclaration(ast); - case 11 /* IdentifierName */: - return this.emitName(ast, true); - case 225 /* VariableDeclarator */: - return this.emitVariableDeclarator(ast); - case 219 /* SimpleArrowFunctionExpression */: - return this.emitSimpleArrowFunctionExpression(ast); - case 218 /* ParenthesizedArrowFunctionExpression */: - return this.emitParenthesizedArrowFunctionExpression(ast); - case 129 /* FunctionDeclaration */: - return this.emitFunctionDeclaration(ast); - case 130 /* ModuleDeclaration */: - return this.emitModuleDeclaration(ast); - case 224 /* VariableDeclaration */: - return this.emitVariableDeclaration(ast); - case 126 /* GenericType */: - return this.emitGenericType(ast); - case 137 /* ConstructorDeclaration */: - return this.emitConstructorDeclaration(ast); - case 132 /* EnumDeclaration */: - return this.emitEnumDeclaration(ast); - case 243 /* EnumElement */: - return this.emitEnumElement(ast); - case 222 /* FunctionExpression */: - return this.emitFunctionExpression(ast); - case 148 /* VariableStatement */: - return this.emitVariableStatement(ast); - } - - this.emitComments(ast, true); - this.emitWorker(ast); - this.emitComments(ast, false); - }; - - Emitter.prototype.emitWorker = function (ast) { - if (!ast) { - return; - } - - switch (ast.kind()) { - case 13 /* NumericLiteral */: - return this.emitNumericLiteral(ast); - case 12 /* RegularExpressionLiteral */: - return this.emitRegularExpressionLiteral(ast); - case 14 /* StringLiteral */: - return this.emitStringLiteral(ast); - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 37 /* TrueKeyword */: - return this.emitLiteralExpression(ast); - case 35 /* ThisKeyword */: - return this.emitThisExpression(ast); - case 50 /* SuperKeyword */: - return this.emitSuperExpression(ast); - case 217 /* ParenthesizedExpression */: - return this.emitParenthesizedExpression(ast); - case 214 /* ArrayLiteralExpression */: - return this.emitArrayLiteralExpression(ast); - case 211 /* PostDecrementExpression */: - case 210 /* PostIncrementExpression */: - return this.emitPostfixUnaryExpression(ast); - case 167 /* LogicalNotExpression */: - case 166 /* BitwiseNotExpression */: - case 165 /* NegateExpression */: - case 164 /* PlusExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - return this.emitPrefixUnaryExpression(ast); - case 213 /* InvocationExpression */: - return this.emitInvocationExpression(ast); - case 221 /* ElementAccessExpression */: - return this.emitElementAccessExpression(ast); - case 212 /* MemberAccessExpression */: - return this.emitMemberAccessExpression(ast); - case 121 /* QualifiedName */: - return this.emitQualifiedName(ast); - case 173 /* CommaExpression */: - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 187 /* LogicalOrExpression */: - case 188 /* LogicalAndExpression */: - case 189 /* BitwiseOrExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 191 /* BitwiseAndExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: - return this.emitBinaryExpression(ast); - case 186 /* ConditionalExpression */: - return this.emitConditionalExpression(ast); - case 232 /* EqualsValueClause */: - return this.emitEqualsValueClause(ast); - case 242 /* Parameter */: - return this.emitParameter(ast); - case 146 /* Block */: - return this.emitBlock(ast); - case 235 /* ElseClause */: - return this.emitElseClause(ast); - case 147 /* IfStatement */: - return this.emitIfStatement(ast); - case 149 /* ExpressionStatement */: - return this.emitExpressionStatement(ast); - case 139 /* GetAccessor */: - return this.emitGetAccessor(ast); - case 140 /* SetAccessor */: - return this.emitSetAccessor(ast); - case 157 /* ThrowStatement */: - return this.emitThrowStatement(ast); - case 150 /* ReturnStatement */: - return this.emitReturnStatement(ast); - case 216 /* ObjectCreationExpression */: - return this.emitObjectCreationExpression(ast); - case 151 /* SwitchStatement */: - return this.emitSwitchStatement(ast); - case 233 /* CaseSwitchClause */: - return this.emitCaseSwitchClause(ast); - case 234 /* DefaultSwitchClause */: - return this.emitDefaultSwitchClause(ast); - case 152 /* BreakStatement */: - return this.emitBreakStatement(ast); - case 153 /* ContinueStatement */: - return this.emitContinueStatement(ast); - case 154 /* ForStatement */: - return this.emitForStatement(ast); - case 155 /* ForInStatement */: - return this.emitForInStatement(ast); - case 158 /* WhileStatement */: - return this.emitWhileStatement(ast); - case 163 /* WithStatement */: - return this.emitWithStatement(ast); - case 220 /* CastExpression */: - return this.emitCastExpression(ast); - case 215 /* ObjectLiteralExpression */: - return this.emitObjectLiteralExpression(ast); - case 240 /* SimplePropertyAssignment */: - return this.emitSimplePropertyAssignment(ast); - case 241 /* FunctionPropertyAssignment */: - return this.emitFunctionPropertyAssignment(ast); - case 156 /* EmptyStatement */: - return this.writeToOutputWithSourceMapRecord(";", ast); - case 159 /* TryStatement */: - return this.emitTryStatement(ast); - case 236 /* CatchClause */: - return this.emitCatchClause(ast); - case 237 /* FinallyClause */: - return this.emitFinallyClause(ast); - case 160 /* LabeledStatement */: - return this.emitLabeledStatement(ast); - case 161 /* DoStatement */: - return this.emitDoStatement(ast); - case 171 /* TypeOfExpression */: - return this.emitTypeOfExpression(ast); - case 170 /* DeleteExpression */: - return this.emitDeleteExpression(ast); - case 172 /* VoidExpression */: - return this.emitVoidExpression(ast); - case 162 /* DebuggerStatement */: - return this.emitDebuggerStatement(ast); - } - }; - return Emitter; - })(); - TypeScript.Emitter = Emitter; - - function getLastConstructor(classDecl) { - return classDecl.classElements.lastOrDefault(function (e) { - return e.kind() === 137 /* ConstructorDeclaration */; - }); - } - TypeScript.getLastConstructor = getLastConstructor; - - function getTrimmedTextLines(comment) { - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - return comment.fullText().split("\n").map(function (s) { - return s.trim(); - }); - } else { - return [comment.fullText().trim()]; - } - } - TypeScript.getTrimmedTextLines = getTrimmedTextLines; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var MemberName = (function () { - function MemberName() { - this.prefix = ""; - this.suffix = ""; - } - MemberName.prototype.isString = function () { - return false; - }; - MemberName.prototype.isArray = function () { - return false; - }; - MemberName.prototype.isMarker = function () { - return !this.isString() && !this.isArray(); - }; - - MemberName.prototype.toString = function () { - return MemberName.memberNameToString(this); - }; - - MemberName.memberNameToString = function (memberName, markerInfo, markerBaseLength) { - if (typeof markerBaseLength === "undefined") { markerBaseLength = 0; } - var result = memberName.prefix; - - if (memberName.isString()) { - result += memberName.text; - } else if (memberName.isArray()) { - var ar = memberName; - for (var index = 0; index < ar.entries.length; index++) { - if (ar.entries[index].isMarker()) { - if (markerInfo) { - markerInfo.push(markerBaseLength + result.length); - } - continue; - } - - result += MemberName.memberNameToString(ar.entries[index], markerInfo, markerBaseLength + result.length); - result += ar.delim; - } - } - - result += memberName.suffix; - return result; - }; - - MemberName.create = function (arg1, arg2, arg3) { - if (typeof arg1 === "string") { - return new MemberNameString(arg1); - } else { - var result = new MemberNameArray(); - if (arg2) - result.prefix = arg2; - if (arg3) - result.suffix = arg3; - result.entries.push(arg1); - return result; - } - }; - return MemberName; - })(); - TypeScript.MemberName = MemberName; - - var MemberNameString = (function (_super) { - __extends(MemberNameString, _super); - function MemberNameString(text) { - _super.call(this); - this.text = text; - } - MemberNameString.prototype.isString = function () { - return true; - }; - return MemberNameString; - })(MemberName); - TypeScript.MemberNameString = MemberNameString; - - var MemberNameArray = (function (_super) { - __extends(MemberNameArray, _super); - function MemberNameArray() { - _super.call(this); - this.delim = ""; - this.entries = []; - } - MemberNameArray.prototype.isArray = function () { - return true; - }; - - MemberNameArray.prototype.add = function (entry) { - this.entries.push(entry); - }; - - MemberNameArray.prototype.addAll = function (entries) { - for (var i = 0; i < entries.length; i++) { - this.entries.push(entries[i]); - } - }; - return MemberNameArray; - })(MemberName); - TypeScript.MemberNameArray = MemberNameArray; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function stripStartAndEndQuotes(str) { - var firstCharCode = str && str.charCodeAt(0); - if (str && str.length >= 2 && firstCharCode === str.charCodeAt(str.length - 1) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { - return str.substring(1, str.length - 1); - } - - return str; - } - TypeScript.stripStartAndEndQuotes = stripStartAndEndQuotes; - - function isSingleQuoted(str) { - return str && str.length >= 2 && str.charCodeAt(0) === str.charCodeAt(str.length - 1) && str.charCodeAt(0) === 39 /* singleQuote */; - } - TypeScript.isSingleQuoted = isSingleQuoted; - - function isDoubleQuoted(str) { - return str && str.length >= 2 && str.charCodeAt(0) === str.charCodeAt(str.length - 1) && str.charCodeAt(0) === 34 /* doubleQuote */; - } - TypeScript.isDoubleQuoted = isDoubleQuoted; - - function isQuoted(str) { - return isDoubleQuoted(str) || isSingleQuoted(str); - } - TypeScript.isQuoted = isQuoted; - - function quoteStr(str) { - return "\"" + str + "\""; - } - TypeScript.quoteStr = quoteStr; - - var switchToForwardSlashesRegEx = /\\/g; - function switchToForwardSlashes(path) { - return path.replace(switchToForwardSlashesRegEx, "/"); - } - TypeScript.switchToForwardSlashes = switchToForwardSlashes; - - function trimModName(modName) { - if (modName.length > 5 && modName.substring(modName.length - 5, modName.length) === ".d.ts") { - return modName.substring(0, modName.length - 5); - } - if (modName.length > 3 && modName.substring(modName.length - 3, modName.length) === ".ts") { - return modName.substring(0, modName.length - 3); - } - - if (modName.length > 3 && modName.substring(modName.length - 3, modName.length) === ".js") { - return modName.substring(0, modName.length - 3); - } - - return modName; - } - TypeScript.trimModName = trimModName; - - function getDeclareFilePath(fname) { - return isTSFile(fname) ? changePathToDTS(fname) : changePathToDTS(fname); - } - TypeScript.getDeclareFilePath = getDeclareFilePath; - - function isFileOfExtension(fname, ext) { - var invariantFname = fname.toLocaleUpperCase(); - var invariantExt = ext.toLocaleUpperCase(); - var extLength = invariantExt.length; - return invariantFname.length > extLength && invariantFname.substring(invariantFname.length - extLength, invariantFname.length) === invariantExt; - } - - function isTSFile(fname) { - return isFileOfExtension(fname, ".ts"); - } - TypeScript.isTSFile = isTSFile; - - function isDTSFile(fname) { - return isFileOfExtension(fname, ".d.ts"); - } - TypeScript.isDTSFile = isDTSFile; - - function getPrettyName(modPath, quote, treatAsFileName) { - if (typeof quote === "undefined") { quote = true; } - if (typeof treatAsFileName === "undefined") { treatAsFileName = false; } - var modName = treatAsFileName ? switchToForwardSlashes(modPath) : trimModName(stripStartAndEndQuotes(modPath)); - var components = this.getPathComponents(modName); - return components.length ? (quote ? quoteStr(components[components.length - 1]) : components[components.length - 1]) : modPath; - } - TypeScript.getPrettyName = getPrettyName; - - function getPathComponents(path) { - return path.split("/"); - } - TypeScript.getPathComponents = getPathComponents; - - function getRelativePathToFixedPath(fixedModFilePath, absoluteModPath, isAbsoultePathURL) { - if (typeof isAbsoultePathURL === "undefined") { isAbsoultePathURL = true; } - absoluteModPath = switchToForwardSlashes(absoluteModPath); - - var modComponents = this.getPathComponents(absoluteModPath); - var fixedModComponents = this.getPathComponents(fixedModFilePath); - - var joinStartIndex = 0; - for (; joinStartIndex < modComponents.length && joinStartIndex < fixedModComponents.length; joinStartIndex++) { - if (fixedModComponents[joinStartIndex] !== modComponents[joinStartIndex]) { - break; - } - } - - if (joinStartIndex !== 0) { - var relativePath = ""; - var relativePathComponents = modComponents.slice(joinStartIndex, modComponents.length); - for (; joinStartIndex < fixedModComponents.length; joinStartIndex++) { - if (fixedModComponents[joinStartIndex] !== "") { - relativePath = relativePath + "../"; - } - } - - return relativePath + relativePathComponents.join("/"); - } - - if (isAbsoultePathURL && absoluteModPath.indexOf("://") === -1) { - absoluteModPath = "file:///" + absoluteModPath; - } - - return absoluteModPath; - } - TypeScript.getRelativePathToFixedPath = getRelativePathToFixedPath; - - function changePathToDTS(modPath) { - return trimModName(stripStartAndEndQuotes(modPath)) + ".d.ts"; - } - TypeScript.changePathToDTS = changePathToDTS; - - function isRelative(path) { - return path.length > 0 && path.charAt(0) === "."; - } - TypeScript.isRelative = isRelative; - function isRooted(path) { - return path.length > 0 && (path.charAt(0) === "\\" || path.charAt(0) === "/" || (path.indexOf(":\\") !== -1) || (path.indexOf(":/") !== -1)); - } - TypeScript.isRooted = isRooted; - - function getRootFilePath(outFname) { - if (outFname === "") { - return outFname; - } else { - var isPath = outFname.indexOf("/") !== -1; - return isPath ? filePath(outFname) : ""; - } - } - TypeScript.getRootFilePath = getRootFilePath; - - function filePathComponents(fullPath) { - fullPath = switchToForwardSlashes(fullPath); - var components = getPathComponents(fullPath); - return components.slice(0, components.length - 1); - } - TypeScript.filePathComponents = filePathComponents; - - function filePath(fullPath) { - var path = filePathComponents(fullPath); - return path.join("/") + "/"; - } - TypeScript.filePath = filePath; - - function convertToDirectoryPath(dirPath) { - if (dirPath && dirPath.charAt(dirPath.length - 1) !== "/") { - dirPath += "/"; - } - - return dirPath; - } - TypeScript.convertToDirectoryPath = convertToDirectoryPath; - - var normalizePathRegEx = /^\\\\[^\\]/; - function normalizePath(path) { - if (normalizePathRegEx.test(path)) { - path = "file:" + path; - } - var parts = this.getPathComponents(switchToForwardSlashes(path)); - var normalizedParts = []; - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part === ".") { - continue; - } - - if (normalizedParts.length > 0 && TypeScript.ArrayUtilities.last(normalizedParts) !== ".." && part === "..") { - normalizedParts.pop(); - continue; - } - - normalizedParts.push(part); - } - - return normalizedParts.join("/"); - } - TypeScript.normalizePath = normalizePath; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - - - function isNoDefaultLibMatch(comment) { - var isNoDefaultLibRegex = /^(\/\/\/\s*/gim; - return isNoDefaultLibRegex.exec(comment); - } - - TypeScript.tripleSlashReferenceRegExp = /^(\/\/\/\s*/; - - function getFileReferenceFromReferencePath(fileName, lineMap, position, comment, diagnostics) { - var simpleReferenceRegEx = /^\/\/\/\s*= 7 && fullReference[6] === "true"; - if (isResident) { - TypeScript.CompilerDiagnostics.debugPrint(path + " is resident"); - } - return { - line: 0, - character: 0, - position: 0, - length: 0, - path: TypeScript.switchToForwardSlashes(adjustedPath), - isResident: isResident - }; - } - } - } - - return null; - } - - var scannerWindow = TypeScript.ArrayUtilities.createArray(2048, 0); - var scannerDiagnostics = []; - - function processImports(lineMap, scanner, token, importedFiles) { - var position = 0; - var lineChar = { line: -1, character: -1 }; - - var start = new Date().getTime(); - - while (token.tokenKind !== 10 /* EndOfFileToken */) { - if (token.tokenKind === 49 /* ImportKeyword */) { - var importStart = position + token.leadingTriviaWidth(); - token = scanner.scan(scannerDiagnostics, false); - - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { - token = scanner.scan(scannerDiagnostics, false); - - if (token.tokenKind === 107 /* EqualsToken */) { - token = scanner.scan(scannerDiagnostics, false); - - if (token.tokenKind === 65 /* ModuleKeyword */ || token.tokenKind === 66 /* RequireKeyword */) { - token = scanner.scan(scannerDiagnostics, false); - - if (token.tokenKind === 72 /* OpenParenToken */) { - var afterOpenParenPosition = scanner.absoluteIndex(); - token = scanner.scan(scannerDiagnostics, false); - - lineMap.fillLineAndCharacterFromPosition(importStart, lineChar); - - if (token.tokenKind === 14 /* StringLiteral */) { - var ref = { - line: lineChar.line, - character: lineChar.character, - position: afterOpenParenPosition + token.leadingTriviaWidth(), - length: token.width(), - path: TypeScript.stripStartAndEndQuotes(TypeScript.switchToForwardSlashes(token.text())), - isResident: false - }; - importedFiles.push(ref); - } - } - } - } - } - } - - position = scanner.absoluteIndex(); - token = scanner.scan(scannerDiagnostics, false); - } - - var totalTime = new Date().getTime() - start; - TypeScript.fileResolutionScanImportsTime += totalTime; - } - - function processTripleSlashDirectives(fileName, lineMap, firstToken) { - var leadingTrivia = firstToken.leadingTrivia(); - - var position = 0; - var lineChar = { line: -1, character: -1 }; - var noDefaultLib = false; - var diagnostics = []; - var referencedFiles = []; - - for (var i = 0, n = leadingTrivia.count(); i < n; i++) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - - if (trivia.kind() === 7 /* SingleLineCommentTrivia */) { - var triviaText = trivia.fullText(); - var referencedCode = getFileReferenceFromReferencePath(fileName, lineMap, position, triviaText, diagnostics); - - if (referencedCode) { - lineMap.fillLineAndCharacterFromPosition(position, lineChar); - referencedCode.position = position; - referencedCode.length = trivia.fullWidth(); - referencedCode.line = lineChar.line; - referencedCode.character = lineChar.character; - - referencedFiles.push(referencedCode); - } - - var isNoDefaultLib = isNoDefaultLibMatch(triviaText); - if (isNoDefaultLib) { - noDefaultLib = isNoDefaultLib[3] === "true"; - } - } - - position += trivia.fullWidth(); - } - - return { noDefaultLib: noDefaultLib, diagnostics: diagnostics, referencedFiles: referencedFiles }; - } - - function preProcessFile(fileName, sourceText, readImportFiles) { - if (typeof readImportFiles === "undefined") { readImportFiles = true; } - var text = TypeScript.SimpleText.fromScriptSnapshot(sourceText); - var scanner = new TypeScript.Scanner(fileName, text, 1 /* EcmaScript5 */, scannerWindow); - - var firstToken = scanner.scan(scannerDiagnostics, false); - - var importedFiles = []; - if (readImportFiles) { - processImports(text.lineMap(), scanner, firstToken, importedFiles); - } - - var properties = processTripleSlashDirectives(fileName, text.lineMap(), firstToken); - - scannerDiagnostics.length = 0; - return { referencedFiles: properties.referencedFiles, importedFiles: importedFiles, isLibFile: properties.noDefaultLib, diagnostics: properties.diagnostics }; - } - TypeScript.preProcessFile = preProcessFile; - - function getParseOptions(settings) { - return new TypeScript.ParseOptions(settings.codeGenTarget(), settings.allowAutomaticSemicolonInsertion()); - } - TypeScript.getParseOptions = getParseOptions; - - function getReferencedFiles(fileName, sourceText) { - return preProcessFile(fileName, sourceText, false).referencedFiles; - } - TypeScript.getReferencedFiles = getReferencedFiles; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ReferenceResolutionResult = (function () { - function ReferenceResolutionResult() { - this.resolvedFiles = []; - this.diagnostics = []; - this.seenNoDefaultLibTag = false; - } - return ReferenceResolutionResult; - })(); - TypeScript.ReferenceResolutionResult = ReferenceResolutionResult; - - var ReferenceLocation = (function () { - function ReferenceLocation(filePath, lineMap, position, length, isImported) { - this.filePath = filePath; - this.lineMap = lineMap; - this.position = position; - this.length = length; - this.isImported = isImported; - } - return ReferenceLocation; - })(); - - var ReferenceResolver = (function () { - function ReferenceResolver(inputFileNames, host, useCaseSensitiveFileResolution) { - this.useCaseSensitiveFileResolution = useCaseSensitiveFileResolution; - this.inputFileNames = inputFileNames; - this.host = host; - this.visited = {}; - } - ReferenceResolver.resolve = function (inputFileNames, host, useCaseSensitiveFileResolution) { - var resolver = new ReferenceResolver(inputFileNames, host, useCaseSensitiveFileResolution); - return resolver.resolveInputFiles(); - }; - - ReferenceResolver.prototype.resolveInputFiles = function () { - var _this = this; - var result = new ReferenceResolutionResult(); - - if (!this.inputFileNames || this.inputFileNames.length <= 0) { - return result; - } - - var referenceLocation = new ReferenceLocation(null, null, 0, 0, false); - this.inputFileNames.forEach(function (fileName) { - return _this.resolveIncludedFile(fileName, referenceLocation, result); - }); - - return result; - }; - - ReferenceResolver.prototype.resolveIncludedFile = function (path, referenceLocation, resolutionResult) { - var normalizedPath = this.getNormalizedFilePath(path, referenceLocation.filePath); - - if (this.isSameFile(normalizedPath, referenceLocation.filePath)) { - if (!referenceLocation.isImported) { - resolutionResult.diagnostics.push(new TypeScript.Diagnostic(referenceLocation.filePath, referenceLocation.lineMap, referenceLocation.position, referenceLocation.length, TypeScript.DiagnosticCode.A_file_cannot_have_a_reference_to_itself, null)); - } - - return normalizedPath; - } - - if (!TypeScript.isTSFile(normalizedPath) && !TypeScript.isDTSFile(normalizedPath)) { - var dtsFile = normalizedPath + ".d.ts"; - var tsFile = normalizedPath + ".ts"; - - if (this.host.fileExists(tsFile)) { - normalizedPath = tsFile; - } else { - normalizedPath = dtsFile; - } - } - - if (!this.host.fileExists(normalizedPath)) { - if (!referenceLocation.isImported) { - resolutionResult.diagnostics.push(new TypeScript.Diagnostic(referenceLocation.filePath, referenceLocation.lineMap, referenceLocation.position, referenceLocation.length, TypeScript.DiagnosticCode.Cannot_resolve_referenced_file_0, [path])); - } - - return normalizedPath; - } - - return this.resolveFile(normalizedPath, resolutionResult); - }; - - ReferenceResolver.prototype.resolveImportedFile = function (path, referenceLocation, resolutionResult) { - var isRelativePath = TypeScript.isRelative(path); - var isRootedPath = isRelativePath ? false : TypeScript.isRooted(path); - - if (isRelativePath || isRootedPath) { - return this.resolveIncludedFile(path, referenceLocation, resolutionResult); - } else { - var parentDirectory = this.host.getParentDirectory(referenceLocation.filePath); - var searchFilePath = null; - var dtsFileName = path + ".d.ts"; - var tsFilePath = path + ".ts"; - - var start = new Date().getTime(); - - do { - currentFilePath = this.host.resolveRelativePath(tsFilePath, parentDirectory); - if (this.host.fileExists(currentFilePath)) { - searchFilePath = currentFilePath; - break; - } - - var currentFilePath = this.host.resolveRelativePath(dtsFileName, parentDirectory); - if (this.host.fileExists(currentFilePath)) { - searchFilePath = currentFilePath; - break; - } - - parentDirectory = this.host.getParentDirectory(parentDirectory); - } while(parentDirectory); - - TypeScript.fileResolutionImportFileSearchTime += new Date().getTime() - start; - - if (!searchFilePath) { - return path; - } - - return this.resolveFile(searchFilePath, resolutionResult); - } - }; - - ReferenceResolver.prototype.resolveFile = function (normalizedPath, resolutionResult) { - var _this = this; - var visitedPath = this.isVisited(normalizedPath); - if (!visitedPath) { - this.recordVisitedFile(normalizedPath); - - var start = new Date().getTime(); - var scriptSnapshot = this.host.getScriptSnapshot(normalizedPath); - var totalTime = new Date().getTime() - start; - TypeScript.fileResolutionIOTime += totalTime; - - var lineMap = TypeScript.LineMap1.fromScriptSnapshot(scriptSnapshot); - var preprocessedFileInformation = TypeScript.preProcessFile(normalizedPath, scriptSnapshot); - resolutionResult.diagnostics.push.apply(resolutionResult.diagnostics, preprocessedFileInformation.diagnostics); - - if (preprocessedFileInformation.isLibFile) { - resolutionResult.seenNoDefaultLibTag = true; - } - - var normalizedReferencePaths = []; - preprocessedFileInformation.referencedFiles.forEach(function (fileReference) { - var currentReferenceLocation = new ReferenceLocation(normalizedPath, lineMap, fileReference.position, fileReference.length, false); - var normalizedReferencePath = _this.resolveIncludedFile(fileReference.path, currentReferenceLocation, resolutionResult); - normalizedReferencePaths.push(normalizedReferencePath); - }); - - var normalizedImportPaths = []; - for (var i = 0; i < preprocessedFileInformation.importedFiles.length; i++) { - var fileImport = preprocessedFileInformation.importedFiles[i]; - var currentReferenceLocation = new ReferenceLocation(normalizedPath, lineMap, fileImport.position, fileImport.length, true); - var normalizedImportPath = this.resolveImportedFile(fileImport.path, currentReferenceLocation, resolutionResult); - normalizedImportPaths.push(normalizedImportPath); - } - - resolutionResult.resolvedFiles.push({ - path: normalizedPath, - referencedFiles: normalizedReferencePaths, - importedFiles: normalizedImportPaths - }); - } else { - normalizedPath = visitedPath; - } - - return normalizedPath; - }; - - ReferenceResolver.prototype.getNormalizedFilePath = function (path, parentFilePath) { - var parentFileDirectory = parentFilePath ? this.host.getParentDirectory(parentFilePath) : ""; - var normalizedPath = this.host.resolveRelativePath(path, parentFileDirectory); - return normalizedPath; - }; - - ReferenceResolver.prototype.getUniqueFileId = function (filePath) { - return this.useCaseSensitiveFileResolution ? filePath : filePath.toLocaleUpperCase(); - }; - - ReferenceResolver.prototype.recordVisitedFile = function (filePath) { - this.visited[this.getUniqueFileId(filePath)] = filePath; - }; - - ReferenceResolver.prototype.isVisited = function (filePath) { - return this.visited[this.getUniqueFileId(filePath)]; - }; - - ReferenceResolver.prototype.isSameFile = function (filePath1, filePath2) { - if (!filePath1 || !filePath2) { - return false; - } - - if (this.useCaseSensitiveFileResolution) { - return filePath1 === filePath2; - } else { - return filePath1.toLocaleUpperCase() === filePath2.toLocaleUpperCase(); - } - }; - return ReferenceResolver; - })(); - TypeScript.ReferenceResolver = ReferenceResolver; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextWriter = (function () { - function TextWriter(name, writeByteOrderMark, outputFileType) { - this.name = name; - this.writeByteOrderMark = writeByteOrderMark; - this.outputFileType = outputFileType; - this.contents = ""; - this.onNewLine = true; - } - TextWriter.prototype.Write = function (s) { - this.contents += s; - this.onNewLine = false; - }; - - TextWriter.prototype.WriteLine = function (s) { - this.contents += s; - this.contents += TypeScript.newLine(); - this.onNewLine = true; - }; - - TextWriter.prototype.Close = function () { - }; - - TextWriter.prototype.getOutputFile = function () { - return new TypeScript.OutputFile(this.name, this.writeByteOrderMark, this.contents, this.outputFileType); - }; - return TextWriter; - })(); - TypeScript.TextWriter = TextWriter; - - var DeclarationEmitter = (function () { - function DeclarationEmitter(emittingFileName, document, compiler, emitOptions, semanticInfoChain) { - this.emittingFileName = emittingFileName; - this.document = document; - this.compiler = compiler; - this.emitOptions = emitOptions; - this.semanticInfoChain = semanticInfoChain; - this.declFile = null; - this.indenter = new TypeScript.Indenter(); - this.emittedReferencePaths = false; - this.declFile = new TextWriter(emittingFileName, this.document.byteOrderMark !== 0 /* None */, 2 /* Declaration */); - } - DeclarationEmitter.prototype.getOutputFile = function () { - return this.declFile.getOutputFile(); - }; - - DeclarationEmitter.prototype.emitDeclarations = function (sourceUnit) { - this.emitDeclarationsForSourceUnit(sourceUnit); - }; - - DeclarationEmitter.prototype.emitDeclarationsForList = function (list) { - for (var i = 0, n = list.childCount(); i < n; i++) { - this.emitDeclarationsForAST(list.childAt(i)); - } - }; - - DeclarationEmitter.prototype.emitSeparatedList = function (list) { - for (var i = 0, n = list.nonSeparatorCount(); i < n; i++) { - this.emitDeclarationsForAST(list.nonSeparatorAt(i)); - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForAST = function (ast) { - switch (ast.kind()) { - case 148 /* VariableStatement */: - return this.emitDeclarationsForVariableStatement(ast); - case 141 /* PropertySignature */: - return this.emitPropertySignature(ast); - case 225 /* VariableDeclarator */: - return this.emitVariableDeclarator(ast, true, true); - case 136 /* MemberVariableDeclaration */: - return this.emitDeclarationsForMemberVariableDeclaration(ast); - case 137 /* ConstructorDeclaration */: - return this.emitDeclarationsForConstructorDeclaration(ast); - case 139 /* GetAccessor */: - return this.emitDeclarationsForGetAccessor(ast); - case 140 /* SetAccessor */: - return this.emitDeclarationsForSetAccessor(ast); - case 138 /* IndexMemberDeclaration */: - return this.emitIndexMemberDeclaration(ast); - case 144 /* IndexSignature */: - return this.emitIndexSignature(ast); - case 142 /* CallSignature */: - return this.emitCallSignature(ast); - case 143 /* ConstructSignature */: - return this.emitConstructSignature(ast); - case 145 /* MethodSignature */: - return this.emitMethodSignature(ast); - case 129 /* FunctionDeclaration */: - return this.emitDeclarationsForFunctionDeclaration(ast); - case 135 /* MemberFunctionDeclaration */: - return this.emitMemberFunctionDeclaration(ast); - case 131 /* ClassDeclaration */: - return this.emitDeclarationsForClassDeclaration(ast); - case 128 /* InterfaceDeclaration */: - return this.emitDeclarationsForInterfaceDeclaration(ast); - case 133 /* ImportDeclaration */: - return this.emitDeclarationsForImportDeclaration(ast); - case 130 /* ModuleDeclaration */: - return this.emitDeclarationsForModuleDeclaration(ast); - case 132 /* EnumDeclaration */: - return this.emitDeclarationsForEnumDeclaration(ast); - case 134 /* ExportAssignment */: - return this.emitDeclarationsForExportAssignment(ast); - } - }; - - DeclarationEmitter.prototype.getIndentString = function (declIndent) { - if (typeof declIndent === "undefined") { declIndent = false; } - return this.indenter.getIndent(); - }; - - DeclarationEmitter.prototype.emitIndent = function () { - this.declFile.Write(this.getIndentString()); - }; - - DeclarationEmitter.prototype.canEmitDeclarations = function (declAST) { - var container = DeclarationEmitter.getEnclosingContainer(declAST); - if (container.kind() === 130 /* ModuleDeclaration */ || container.kind() === 120 /* SourceUnit */) { - var pullDecl = this.semanticInfoChain.getDeclForAST(declAST); - if (!TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */)) { - var start = new Date().getTime(); - var declSymbol = this.semanticInfoChain.getSymbolForAST(declAST); - var result = declSymbol && declSymbol.isExternallyVisible(); - TypeScript.declarationEmitIsExternallyVisibleTime += new Date().getTime() - start; - - return result; - } - } - - return true; - }; - - DeclarationEmitter.prototype.getDeclFlagsString = function (pullDecl, typeString) { - var result = this.getIndentString(); - var pullFlags = pullDecl.flags; - - if (TypeScript.hasFlag(pullFlags, 16 /* Static */)) { - if (TypeScript.hasFlag(pullFlags, 2 /* Private */)) { - result += "private "; - } - result += "static "; - } else { - if (TypeScript.hasFlag(pullFlags, 2 /* Private */)) { - result += "private "; - } else if (TypeScript.hasFlag(pullFlags, 4 /* Public */)) { - result += "public "; - } else { - var emitDeclare = !TypeScript.hasFlag(pullFlags, 1 /* Exported */); - - var declAST = this.semanticInfoChain.getASTForDecl(pullDecl); - var container = DeclarationEmitter.getEnclosingContainer(declAST); - - var isExternalModule = container.kind() === 120 /* SourceUnit */ && this.document.isExternalModule(); - - if (isExternalModule && TypeScript.hasFlag(pullFlags, 1 /* Exported */)) { - result += "export "; - emitDeclare = true; - } - - if (isExternalModule || container.kind() === 120 /* SourceUnit */) { - if (emitDeclare && typeString !== "interface" && typeString !== "import") { - result += "declare "; - } - } - - result += typeString + " "; - } - } - - return result; - }; - - DeclarationEmitter.prototype.emitDeclFlags = function (declarationAST, typeString) { - this.declFile.Write(this.getDeclFlagsString(this.semanticInfoChain.getDeclForAST(declarationAST), typeString)); - }; - - DeclarationEmitter.prototype.emitTypeNamesMember = function (memberName, emitIndent) { - if (typeof emitIndent === "undefined") { emitIndent = false; } - if (memberName.prefix === "{ ") { - if (emitIndent) { - this.emitIndent(); - } - - this.declFile.WriteLine("{"); - this.indenter.increaseIndent(); - emitIndent = true; - } else if (memberName.prefix !== "") { - if (emitIndent) { - this.emitIndent(); - } - - this.declFile.Write(memberName.prefix); - emitIndent = false; - } - - if (memberName.isString()) { - if (emitIndent) { - this.emitIndent(); - } - - this.declFile.Write(memberName.text); - } else if (memberName.isArray()) { - var ar = memberName; - for (var index = 0; index < ar.entries.length; index++) { - this.emitTypeNamesMember(ar.entries[index], emitIndent); - if (ar.delim === "; ") { - this.declFile.WriteLine(";"); - } - } - } - - if (memberName.suffix === "}") { - this.indenter.decreaseIndent(); - this.emitIndent(); - this.declFile.Write(memberName.suffix); - } else { - this.declFile.Write(memberName.suffix); - } - }; - - DeclarationEmitter.prototype.emitTypeSignature = function (ast, type) { - var declarationContainerAst = DeclarationEmitter.getEnclosingContainer(ast); - - var start = new Date().getTime(); - var declarationContainerDecl = this.semanticInfoChain.getDeclForAST(declarationContainerAst); - - var declarationPullSymbol = declarationContainerDecl.getSymbol(); - TypeScript.declarationEmitTypeSignatureTime += new Date().getTime() - start; - - var isNotAGenericType = ast.kind() !== 126 /* GenericType */; - - var typeNameMembers = type.getScopedNameEx(declarationPullSymbol, false, false, false, false, false, isNotAGenericType); - this.emitTypeNamesMember(typeNameMembers); - }; - - DeclarationEmitter.prototype.emitComment = function (comment) { - var text = TypeScript.getTrimmedTextLines(comment); - if (this.declFile.onNewLine) { - this.emitIndent(); - } else if (comment.kind() !== 6 /* MultiLineCommentTrivia */) { - this.declFile.WriteLine(""); - this.emitIndent(); - } - - this.declFile.Write(text[0]); - - for (var i = 1; i < text.length; i++) { - this.declFile.WriteLine(""); - this.emitIndent(); - this.declFile.Write(text[i]); - } - - if (comment.endsLine || comment.kind() !== 6 /* MultiLineCommentTrivia */) { - this.declFile.WriteLine(""); - } else { - this.declFile.Write(" "); - } - }; - - DeclarationEmitter.prototype.emitDeclarationComments = function (astOrSymbol, endLine) { - if (typeof endLine === "undefined") { endLine = true; } - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var declComments = astOrSymbol.docComments ? astOrSymbol.docComments() : TypeScript.ASTHelpers.docComments(astOrSymbol); - this.writeDeclarationComments(declComments, endLine); - }; - - DeclarationEmitter.prototype.writeDeclarationComments = function (declComments, endLine) { - if (typeof endLine === "undefined") { endLine = true; } - if (declComments.length > 0) { - for (var i = 0; i < declComments.length; i++) { - this.emitComment(declComments[i]); - } - - if (endLine) { - if (!this.declFile.onNewLine) { - this.declFile.WriteLine(""); - } - } else { - if (this.declFile.onNewLine) { - this.emitIndent(); - } - } - } - }; - - DeclarationEmitter.prototype.emitTypeOfVariableDeclaratorOrParameter = function (boundDecl) { - var start = new Date().getTime(); - var decl = this.semanticInfoChain.getDeclForAST(boundDecl); - var pullSymbol = decl.getSymbol(); - TypeScript.declarationEmitGetBoundDeclTypeTime += new Date().getTime() - start; - - var type = pullSymbol.type; - TypeScript.Debug.assert(type); - - this.declFile.Write(": "); - this.emitTypeSignature(boundDecl, type); - }; - - DeclarationEmitter.prototype.emitPropertySignature = function (varDecl) { - this.emitDeclarationComments(varDecl); - this.emitIndent(); - this.declFile.Write(varDecl.propertyName.text()); - if (varDecl.questionToken) { - this.declFile.Write("?"); - } - - this.emitTypeOfVariableDeclaratorOrParameter(varDecl); - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitVariableDeclarator = function (varDecl, isFirstVarInList, isLastVarInList) { - if (this.canEmitDeclarations(varDecl)) { - this.emitDeclarationComments(varDecl); - - if (isFirstVarInList) { - this.emitDeclFlags(varDecl, "var"); - } - - this.declFile.Write(varDecl.propertyName.text()); - - if (!TypeScript.hasModifier(TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl), 2 /* Private */)) { - this.emitTypeOfVariableDeclaratorOrParameter(varDecl); - } - - if (isLastVarInList) { - this.declFile.WriteLine(";"); - } else { - this.declFile.Write(", "); - } - } - }; - - DeclarationEmitter.prototype.emitClassElementModifiers = function (modifiers) { - if (TypeScript.hasModifier(modifiers, 16 /* Static */)) { - if (TypeScript.hasModifier(modifiers, 2 /* Private */)) { - this.declFile.Write("private "); - } - this.declFile.Write("static "); - } else { - if (TypeScript.hasModifier(modifiers, 2 /* Private */)) { - this.declFile.Write("private "); - } else { - this.declFile.Write("public "); - } - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForMemberVariableDeclaration = function (varDecl) { - if (this.canEmitDeclarations(varDecl)) { - this.emitDeclarationComments(varDecl); - - this.declFile.Write(this.getIndentString()); - this.emitClassElementModifiers(varDecl.modifiers); - ; - - this.declFile.Write(varDecl.variableDeclarator.propertyName.text()); - - if (!TypeScript.hasModifier(varDecl.modifiers, 2 /* Private */)) { - this.emitTypeOfVariableDeclaratorOrParameter(varDecl); - } - - this.declFile.WriteLine(";"); - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForVariableStatement = function (variableStatement) { - this.emitDeclarationsForVariableDeclaration(variableStatement.declaration); - }; - - DeclarationEmitter.prototype.emitDeclarationsForVariableDeclaration = function (variableDeclaration) { - var varListCount = variableDeclaration.declarators.nonSeparatorCount(); - for (var i = 0; i < varListCount; i++) { - this.emitVariableDeclarator(variableDeclaration.declarators.nonSeparatorAt(i), i === 0, i === varListCount - 1); - } - }; - - DeclarationEmitter.prototype.emitArgDecl = function (argDecl, id, isOptional, isPrivate) { - this.indenter.increaseIndent(); - - this.emitDeclarationComments(argDecl, false); - this.declFile.Write(id.text()); - if (isOptional) { - this.declFile.Write("?"); - } - - this.indenter.decreaseIndent(); - - if (!isPrivate) { - this.emitTypeOfVariableDeclaratorOrParameter(argDecl); - } - }; - - DeclarationEmitter.prototype.isOverloadedCallSignature = function (funcDecl) { - var start = new Date().getTime(); - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSymbol = functionDecl.getSymbol(); - TypeScript.declarationEmitIsOverloadedCallSignatureTime += new Date().getTime() - start; - - var funcTypeSymbol = funcSymbol.type; - var signatures = funcTypeSymbol.getCallSignatures(); - var result = signatures && signatures.length > 1; - - return result; - }; - - DeclarationEmitter.prototype.emitDeclarationsForConstructorDeclaration = function (funcDecl) { - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - var funcTypeSymbol = funcSymbol.type; - if (funcDecl.block) { - var constructSignatures = funcTypeSymbol.getConstructSignatures(); - if (constructSignatures && constructSignatures.length > 1) { - return; - } - } - - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write("constructor"); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitParameterList = function (isPrivate, parameterList) { - this.declFile.Write("("); - this.emitParameters(isPrivate, TypeScript.ASTHelpers.parametersFromParameterList(parameterList)); - this.declFile.Write(")"); - }; - - DeclarationEmitter.prototype.emitParameters = function (isPrivate, parameterList) { - var hasLastParameterRestParameter = parameterList.lastParameterIsRest(); - var argsLen = parameterList.length; - if (hasLastParameterRestParameter) { - argsLen--; - } - - for (var i = 0; i < argsLen; i++) { - this.emitArgDecl(parameterList.astAt(i), parameterList.identifierAt(i), parameterList.isOptionalAt(i), isPrivate); - if (i < (argsLen - 1)) { - this.declFile.Write(", "); - } - } - - if (hasLastParameterRestParameter) { - if (parameterList.length > 1) { - this.declFile.Write(", ..."); - } else { - this.declFile.Write("..."); - } - - var index = parameterList.length - 1; - this.emitArgDecl(parameterList.astAt(index), parameterList.identifierAt(index), parameterList.isOptionalAt(index), isPrivate); - } - }; - - DeclarationEmitter.prototype.emitMemberFunctionDeclaration = function (funcDecl) { - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - var funcTypeSymbol = funcSymbol.type; - if (funcDecl.block) { - var constructSignatures = funcTypeSymbol.getConstructSignatures(); - if (constructSignatures && constructSignatures.length > 1) { - return; - } else if (this.isOverloadedCallSignature(funcDecl)) { - return; - } - } else if (TypeScript.hasModifier(funcDecl.modifiers, 2 /* Private */) && this.isOverloadedCallSignature(funcDecl)) { - var callSignatures = funcTypeSymbol.getCallSignatures(); - TypeScript.Debug.assert(callSignatures && callSignatures.length > 1); - var firstSignature = callSignatures[0].isDefinition() ? callSignatures[1] : callSignatures[0]; - var firstSignatureDecl = firstSignature.getDeclarations()[0]; - var firstFuncDecl = this.semanticInfoChain.getASTForDecl(firstSignatureDecl); - if (firstFuncDecl !== funcDecl) { - return; - } - } - - if (!this.canEmitDeclarations(funcDecl)) { - return; - } - - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitDeclarationComments(funcDecl); - - this.emitDeclFlags(funcDecl, "function"); - var id = funcDecl.propertyName.text(); - this.declFile.Write(id); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - var isPrivate = TypeScript.hasModifier(funcDecl.modifiers, 2 /* Private */); - - this.emitParameterList(isPrivate, funcDecl.callSignature.parameterList); - - if (!isPrivate) { - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - this.emitTypeSignature(funcDecl, returnType); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitCallSignature = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - this.emitDeclarationComments(funcDecl); - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.typeParameterList, funcSignature); - - this.emitIndent(); - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitConstructSignature = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write("new"); - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitMethodSignature = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write(funcDecl.propertyName.text()); - if (funcDecl.questionToken) { - this.declFile.Write("? "); - } - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForFunctionDeclaration = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - if (funcDecl.block) { - var funcTypeSymbol = funcSymbol.type; - var constructSignatures = funcTypeSymbol.getConstructSignatures(); - if (constructSignatures && constructSignatures.length > 1) { - return; - } else if (this.isOverloadedCallSignature(funcDecl)) { - return; - } - } - - if (!this.canEmitDeclarations(funcDecl)) { - return; - } - - this.emitDeclarationComments(funcDecl); - - var id = funcDecl.identifier.text(); - this.emitDeclFlags(funcDecl, "function"); - if (id !== "" || !funcDecl.identifier || funcDecl.identifier.text().length > 0) { - this.declFile.Write(id); - } else if (funcPullDecl.kind === 2097152 /* ConstructSignature */) { - this.declFile.Write("new"); - } - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitIndexMemberDeclaration = function (funcDecl) { - this.emitDeclarationsForAST(funcDecl.indexSignature); - }; - - DeclarationEmitter.prototype.emitIndexSignature = function (funcDecl) { - if (!this.canEmitDeclarations(funcDecl)) { - return; - } - - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write("["); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameter(funcDecl.parameter)); - this.declFile.Write("]"); - - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSignature = funcPullDecl.getSignatureSymbol(); - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - this.emitTypeSignature(funcDecl, returnType); - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitBaseList = function (bases, useExtendsList) { - if (bases && (bases.nonSeparatorCount() > 0)) { - var qual = useExtendsList ? "extends" : "implements"; - this.declFile.Write(" " + qual + " "); - var basesLen = bases.nonSeparatorCount(); - for (var i = 0; i < basesLen; i++) { - if (i > 0) { - this.declFile.Write(", "); - } - var base = bases.nonSeparatorAt(i); - var baseType = this.semanticInfoChain.getSymbolForAST(base); - this.emitTypeSignature(base, baseType); - } - } - }; - - DeclarationEmitter.prototype.emitAccessorDeclarationComments = function (funcDecl) { - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var start = new Date().getTime(); - var accessors = TypeScript.PullHelpers.getGetterAndSetterFunction(funcDecl, this.semanticInfoChain); - TypeScript.declarationEmitGetAccessorFunctionTime += new Date().getTime(); - - var comments = []; - if (accessors.getter) { - comments = comments.concat(TypeScript.ASTHelpers.docComments(accessors.getter)); - } - if (accessors.setter) { - comments = comments.concat(TypeScript.ASTHelpers.docComments(accessors.setter)); - } - - this.writeDeclarationComments(comments); - }; - - DeclarationEmitter.prototype.emitDeclarationsForGetAccessor = function (funcDecl) { - this.emitMemberAccessorDeclaration(funcDecl, funcDecl.modifiers, funcDecl.propertyName); - }; - - DeclarationEmitter.prototype.emitDeclarationsForSetAccessor = function (funcDecl) { - this.emitMemberAccessorDeclaration(funcDecl, funcDecl.modifiers, funcDecl.propertyName); - }; - - DeclarationEmitter.prototype.emitMemberAccessorDeclaration = function (funcDecl, modifiers, name) { - var start = new Date().getTime(); - var accessorSymbol = TypeScript.PullHelpers.getAccessorSymbol(funcDecl, this.semanticInfoChain); - TypeScript.declarationEmitGetAccessorFunctionTime += new Date().getTime(); - - if (funcDecl.kind() === 140 /* SetAccessor */ && accessorSymbol.getGetter()) { - return; - } - - var isPrivate = TypeScript.hasModifier(modifiers, 2 /* Private */); - this.emitAccessorDeclarationComments(funcDecl); - this.declFile.Write(this.getIndentString()); - this.emitClassElementModifiers(modifiers); - this.declFile.Write(name.text()); - if (!isPrivate) { - this.declFile.Write(" : "); - var type = accessorSymbol.type; - this.emitTypeSignature(funcDecl, type); - } - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitClassMembersFromConstructorDefinition = function (funcDecl) { - var argsLen = funcDecl.callSignature.parameterList.parameters.nonSeparatorCount(); - if (TypeScript.lastParameterIsRest(funcDecl.callSignature.parameterList)) { - argsLen--; - } - - for (var i = 0; i < argsLen; i++) { - var parameter = funcDecl.callSignature.parameterList.parameters.nonSeparatorAt(i); - var parameterDecl = this.semanticInfoChain.getDeclForAST(parameter); - if (TypeScript.hasFlag(parameterDecl.flags, 8388608 /* PropertyParameter */)) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.emitDeclarationComments(parameter); - this.declFile.Write(this.getIndentString()); - this.emitClassElementModifiers(parameter.modifiers); - this.declFile.Write(parameter.identifier.text()); - - if (!TypeScript.hasModifier(parameter.modifiers, 2 /* Private */)) { - this.emitTypeOfVariableDeclaratorOrParameter(parameter); - } - this.declFile.WriteLine(";"); - } - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForClassDeclaration = function (classDecl) { - if (!this.canEmitDeclarations(classDecl)) { - return; - } - - var className = classDecl.identifier.text(); - this.emitDeclarationComments(classDecl); - var classPullDecl = this.semanticInfoChain.getDeclForAST(classDecl); - this.emitDeclFlags(classDecl, "class"); - this.declFile.Write(className); - - this.emitTypeParameters(classDecl.typeParameterList); - this.emitHeritageClauses(classDecl.heritageClauses); - this.declFile.WriteLine(" {"); - - this.indenter.increaseIndent(); - var constructorDecl = TypeScript.getLastConstructor(classDecl); - if (constructorDecl) { - this.emitClassMembersFromConstructorDefinition(constructorDecl); - } - - this.emitDeclarationsForList(classDecl.classElements); - - this.indenter.decreaseIndent(); - - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitHeritageClauses = function (clauses) { - if (clauses) { - for (var i = 0, n = clauses.childCount(); i < n; i++) { - this.emitHeritageClause(clauses.childAt(i)); - } - } - }; - - DeclarationEmitter.prototype.emitHeritageClause = function (clause) { - this.emitBaseList(clause.typeNames, clause.kind() === 230 /* ExtendsHeritageClause */); - }; - - DeclarationEmitter.getEnclosingContainer = function (ast) { - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(ast); - ast = enclosingModule || ast; - - ast = ast.parent; - while (ast) { - if (ast.kind() === 131 /* ClassDeclaration */ || ast.kind() === 128 /* InterfaceDeclaration */ || ast.kind() === 130 /* ModuleDeclaration */ || ast.kind() === 120 /* SourceUnit */) { - return ast; - } - - ast = ast.parent; - } - - return null; - }; - - DeclarationEmitter.prototype.emitTypeParameters = function (typeParams, funcSignature) { - if (!typeParams || !typeParams.typeParameters.nonSeparatorCount()) { - return; - } - - this.declFile.Write("<"); - var containerAst = DeclarationEmitter.getEnclosingContainer(typeParams); - - var start = new Date().getTime(); - var containerDecl = this.semanticInfoChain.getDeclForAST(containerAst); - var containerSymbol = containerDecl.getSymbol(); - TypeScript.declarationEmitGetTypeParameterSymbolTime += new Date().getTime() - start; - - var typars; - if (funcSignature) { - typars = funcSignature.getTypeParameters(); - } else { - typars = containerSymbol.getTypeArgumentsOrTypeParameters(); - } - - for (var i = 0; i < typars.length; i++) { - if (i) { - this.declFile.Write(", "); - } - - var memberName = typars[i].getScopedNameEx(containerSymbol, false, true); - this.emitTypeNamesMember(memberName); - } - - this.declFile.Write(">"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForInterfaceDeclaration = function (interfaceDecl) { - if (!this.canEmitDeclarations(interfaceDecl)) { - return; - } - - var interfaceName = interfaceDecl.identifier.text(); - this.emitDeclarationComments(interfaceDecl); - var interfacePullDecl = this.semanticInfoChain.getDeclForAST(interfaceDecl); - this.emitDeclFlags(interfaceDecl, "interface"); - this.declFile.Write(interfaceName); - - this.emitTypeParameters(interfaceDecl.typeParameterList); - this.emitHeritageClauses(interfaceDecl.heritageClauses); - this.declFile.WriteLine(" {"); - - this.indenter.increaseIndent(); - - this.emitSeparatedList(interfaceDecl.body.typeMembers); - - this.indenter.decreaseIndent(); - - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForImportDeclaration = function (importDeclAST) { - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var importSymbol = importDecl.getSymbol(); - var isExportedImportDecl = TypeScript.hasModifier(importDeclAST.modifiers, 1 /* Exported */); - - if (isExportedImportDecl || importSymbol.typeUsedExternally() || TypeScript.PullContainerSymbol.usedAsSymbol(importSymbol.getContainer(), importSymbol)) { - this.emitDeclarationComments(importDeclAST); - this.emitIndent(); - if (isExportedImportDecl) { - this.declFile.Write("export "); - } - this.declFile.Write("import "); - this.declFile.Write(importDeclAST.identifier.text() + " = "); - if (importDeclAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - this.declFile.WriteLine("require(" + importDeclAST.moduleReference.stringLiteral.text() + ");"); - } else { - this.declFile.WriteLine(TypeScript.ASTHelpers.getNameOfIdenfierOrQualifiedName(importDeclAST.moduleReference.moduleName) + ";"); - } - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForEnumDeclaration = function (moduleDecl) { - if (!this.canEmitDeclarations(moduleDecl)) { - return; - } - - this.emitDeclarationComments(moduleDecl); - var modulePullDecl = this.semanticInfoChain.getDeclForAST(moduleDecl); - this.emitDeclFlags(moduleDecl, "enum"); - this.declFile.WriteLine(moduleDecl.identifier.text() + " {"); - - this.indenter.increaseIndent(); - var membersLen = moduleDecl.enumElements.nonSeparatorCount(); - for (var j = 0; j < membersLen; j++) { - var memberDecl = moduleDecl.enumElements.nonSeparatorAt(j); - var enumElement = memberDecl; - var enumElementDecl = this.semanticInfoChain.getDeclForAST(enumElement); - this.emitDeclarationComments(enumElement); - this.emitIndent(); - this.declFile.Write(enumElement.propertyName.text()); - if (enumElementDecl.constantValue !== null) { - this.declFile.Write(" = " + enumElementDecl.constantValue); - } - this.declFile.WriteLine(","); - } - this.indenter.decreaseIndent(); - - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForModuleDeclaration = function (moduleDecl) { - var name = moduleDecl.stringLiteral || TypeScript.ArrayUtilities.first(TypeScript.ASTHelpers.getModuleNames(moduleDecl.name)); - if (!this.canEmitDeclarations(name)) { - return; - } - - this.emitDeclarationComments(moduleDecl); - this.emitDeclFlags(name, "module"); - - if (moduleDecl.stringLiteral) { - this.declFile.Write(moduleDecl.stringLiteral.text()); - } else { - this.declFile.Write(TypeScript.ASTHelpers.getNameOfIdenfierOrQualifiedName(moduleDecl.name)); - } - - this.declFile.WriteLine(" {"); - this.indenter.increaseIndent(); - - this.emitDeclarationsForList(moduleDecl.moduleElements); - - this.indenter.decreaseIndent(); - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForExportAssignment = function (ast) { - this.emitIndent(); - this.declFile.Write("export = "); - this.declFile.Write(ast.identifier.text()); - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.resolveScriptReference = function (document, reference) { - if (!this.emitOptions.compilationSettings().noResolve() || TypeScript.isRooted(reference)) { - return reference; - } - - var documentDir = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(TypeScript.getRootFilePath(document.fileName))); - var resolvedReferencePath = this.emitOptions.resolvePath(documentDir + reference); - return resolvedReferencePath; - }; - - DeclarationEmitter.prototype.emitReferencePaths = function (sourceUnit) { - if (this.emittedReferencePaths) { - return; - } - - var documents = []; - if (this.document.emitToOwnOutputFile()) { - var scriptReferences = this.document.referencedFiles; - var addedGlobalDocument = false; - for (var j = 0; j < scriptReferences.length; j++) { - var currentReference = this.resolveScriptReference(this.document, scriptReferences[j]); - var document = this.compiler.getDocument(currentReference); - - if (document && (document.emitToOwnOutputFile() || document.isDeclareFile() || !addedGlobalDocument)) { - documents = documents.concat(document); - - if (!document.isDeclareFile() && document.isExternalModule()) { - addedGlobalDocument = true; - } - } - } - } else { - var fileNames = this.compiler.fileNames(); - for (var i = 0; i < fileNames.length; i++) { - var doc = this.compiler.getDocument(fileNames[i]); - if (!doc.isDeclareFile() && !doc.isExternalModule()) { - var scriptReferences = doc.referencedFiles; - for (var j = 0; j < scriptReferences.length; j++) { - var currentReference = this.resolveScriptReference(doc, scriptReferences[j]); - var document = this.compiler.getDocument(currentReference); - - if (document && (document.isDeclareFile() || document.isExternalModule())) { - for (var k = 0; k < documents.length; k++) { - if (documents[k] === document) { - break; - } - } - - if (k === documents.length) { - documents = documents.concat(document); - } - } - } - } - } - } - - var emittingFilePath = documents.length ? TypeScript.getRootFilePath(this.emittingFileName) : null; - for (var i = 0; i < documents.length; i++) { - var document = documents[i]; - var declFileName; - if (document.isDeclareFile()) { - declFileName = document.fileName; - } else { - declFileName = this.compiler.mapOutputFileName(document, this.emitOptions, TypeScript.TypeScriptCompiler.mapToDTSFileName); - } - - declFileName = TypeScript.getRelativePathToFixedPath(emittingFilePath, declFileName, false); - this.declFile.WriteLine('/// '); - } - - this.emittedReferencePaths = true; - }; - - DeclarationEmitter.prototype.emitDeclarationsForSourceUnit = function (sourceUnit) { - this.emitReferencePaths(sourceUnit); - this.emitDeclarationsForList(sourceUnit.moduleElements); - }; - return DeclarationEmitter; - })(); - TypeScript.DeclarationEmitter = DeclarationEmitter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var BloomFilter = (function () { - function BloomFilter(expectedCount) { - var m = Math.max(1, BloomFilter.computeM(expectedCount)); - var k = Math.max(1, BloomFilter.computeK(expectedCount)); - ; - - var sizeInEvenBytes = (m + 7) & ~7; - - this.bitArray = []; - for (var i = 0, len = sizeInEvenBytes; i < len; i++) { - this.bitArray[i] = false; - } - this.hashFunctionCount = k; - } - BloomFilter.computeM = function (expectedCount) { - var p = BloomFilter.falsePositiveProbability; - var n = expectedCount; - - var numerator = n * Math.log(p); - var denominator = Math.log(1.0 / Math.pow(2.0, Math.log(2.0))); - return Math.ceil(numerator / denominator); - }; - - BloomFilter.computeK = function (expectedCount) { - var n = expectedCount; - var m = BloomFilter.computeM(expectedCount); - - var temp = Math.log(2.0) * m / n; - return Math.round(temp); - }; - - BloomFilter.prototype.computeHash = function (key, seed) { - return TypeScript.Hash.computeMurmur2StringHashCode(key, seed); - }; - - BloomFilter.prototype.addKeys = function (keys) { - for (var name in keys) { - if (keys[name]) { - this.add(name); - } - } - }; - - BloomFilter.prototype.add = function (value) { - for (var i = 0; i < this.hashFunctionCount; i++) { - var hash = this.computeHash(value, i); - hash = hash % this.bitArray.length; - this.bitArray[Math.abs(hash)] = true; - } - }; - - BloomFilter.prototype.probablyContains = function (value) { - for (var i = 0; i < this.hashFunctionCount; i++) { - var hash = this.computeHash(value, i); - hash = hash % this.bitArray.length; - if (!this.bitArray[Math.abs(hash)]) { - return false; - } - } - - return true; - }; - - BloomFilter.prototype.isEquivalent = function (filter) { - return BloomFilter.isEquivalent(this.bitArray, filter.bitArray) && this.hashFunctionCount === filter.hashFunctionCount; - }; - - BloomFilter.isEquivalent = function (array1, array2) { - if (array1.length !== array2.length) { - return false; - } - - for (var i = 0; i < array1.length; i++) { - if (array1[i] !== array2[i]) { - return false; - } - } - - return true; - }; - BloomFilter.falsePositiveProbability = 0.0001; - return BloomFilter; - })(); - TypeScript.BloomFilter = BloomFilter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var IdentifierWalker = (function (_super) { - __extends(IdentifierWalker, _super); - function IdentifierWalker(list) { - _super.call(this); - this.list = list; - } - IdentifierWalker.prototype.visitToken = function (token) { - this.list[token.text()] = true; - }; - return IdentifierWalker; - })(TypeScript.SyntaxWalker); - TypeScript.IdentifierWalker = IdentifierWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CompilationSettings = (function () { - function CompilationSettings() { - this.propagateEnumConstants = false; - this.removeComments = false; - this.watch = false; - this.noResolve = false; - this.allowAutomaticSemicolonInsertion = true; - this.noImplicitAny = false; - this.noLib = false; - this.codeGenTarget = 0 /* EcmaScript3 */; - this.moduleGenTarget = 0 /* Unspecified */; - this.outFileOption = ""; - this.outDirOption = ""; - this.mapSourceFiles = false; - this.mapRoot = ""; - this.sourceRoot = ""; - this.generateDeclarationFiles = false; - this.useCaseSensitiveFileResolution = false; - this.gatherDiagnostics = false; - this.codepage = null; - this.createFileLog = false; - } - return CompilationSettings; - })(); - TypeScript.CompilationSettings = CompilationSettings; - - var ImmutableCompilationSettings = (function () { - function ImmutableCompilationSettings(propagateEnumConstants, removeComments, watch, noResolve, allowAutomaticSemicolonInsertion, noImplicitAny, noLib, codeGenTarget, moduleGenTarget, outFileOption, outDirOption, mapSourceFiles, mapRoot, sourceRoot, generateDeclarationFiles, useCaseSensitiveFileResolution, gatherDiagnostics, codepage, createFileLog) { - this._propagateEnumConstants = propagateEnumConstants; - this._removeComments = removeComments; - this._watch = watch; - this._noResolve = noResolve; - this._allowAutomaticSemicolonInsertion = allowAutomaticSemicolonInsertion; - this._noImplicitAny = noImplicitAny; - this._noLib = noLib; - this._codeGenTarget = codeGenTarget; - this._moduleGenTarget = moduleGenTarget; - this._outFileOption = outFileOption; - this._outDirOption = outDirOption; - this._mapSourceFiles = mapSourceFiles; - this._mapRoot = mapRoot; - this._sourceRoot = sourceRoot; - this._generateDeclarationFiles = generateDeclarationFiles; - this._useCaseSensitiveFileResolution = useCaseSensitiveFileResolution; - this._gatherDiagnostics = gatherDiagnostics; - this._codepage = codepage; - this._createFileLog = createFileLog; - } - ImmutableCompilationSettings.prototype.propagateEnumConstants = function () { - return this._propagateEnumConstants; - }; - ImmutableCompilationSettings.prototype.removeComments = function () { - return this._removeComments; - }; - ImmutableCompilationSettings.prototype.watch = function () { - return this._watch; - }; - ImmutableCompilationSettings.prototype.noResolve = function () { - return this._noResolve; - }; - ImmutableCompilationSettings.prototype.allowAutomaticSemicolonInsertion = function () { - return this._allowAutomaticSemicolonInsertion; - }; - ImmutableCompilationSettings.prototype.noImplicitAny = function () { - return this._noImplicitAny; - }; - ImmutableCompilationSettings.prototype.noLib = function () { - return this._noLib; - }; - ImmutableCompilationSettings.prototype.codeGenTarget = function () { - return this._codeGenTarget; - }; - ImmutableCompilationSettings.prototype.moduleGenTarget = function () { - return this._moduleGenTarget; - }; - ImmutableCompilationSettings.prototype.outFileOption = function () { - return this._outFileOption; - }; - ImmutableCompilationSettings.prototype.outDirOption = function () { - return this._outDirOption; - }; - ImmutableCompilationSettings.prototype.mapSourceFiles = function () { - return this._mapSourceFiles; - }; - ImmutableCompilationSettings.prototype.mapRoot = function () { - return this._mapRoot; - }; - ImmutableCompilationSettings.prototype.sourceRoot = function () { - return this._sourceRoot; - }; - ImmutableCompilationSettings.prototype.generateDeclarationFiles = function () { - return this._generateDeclarationFiles; - }; - ImmutableCompilationSettings.prototype.useCaseSensitiveFileResolution = function () { - return this._useCaseSensitiveFileResolution; - }; - ImmutableCompilationSettings.prototype.gatherDiagnostics = function () { - return this._gatherDiagnostics; - }; - ImmutableCompilationSettings.prototype.codepage = function () { - return this._codepage; - }; - ImmutableCompilationSettings.prototype.createFileLog = function () { - return this._createFileLog; - }; - - ImmutableCompilationSettings.defaultSettings = function () { - if (!ImmutableCompilationSettings._defaultSettings) { - ImmutableCompilationSettings._defaultSettings = ImmutableCompilationSettings.fromCompilationSettings(new CompilationSettings()); - } - - return ImmutableCompilationSettings._defaultSettings; - }; - - ImmutableCompilationSettings.fromCompilationSettings = function (settings) { - return new ImmutableCompilationSettings(settings.propagateEnumConstants, settings.removeComments, settings.watch, settings.noResolve, settings.allowAutomaticSemicolonInsertion, settings.noImplicitAny, settings.noLib, settings.codeGenTarget, settings.moduleGenTarget, settings.outFileOption, settings.outDirOption, settings.mapSourceFiles, settings.mapRoot, settings.sourceRoot, settings.generateDeclarationFiles, settings.useCaseSensitiveFileResolution, settings.gatherDiagnostics, settings.codepage, settings.createFileLog); - }; - - ImmutableCompilationSettings.prototype.toCompilationSettings = function () { - var result = new CompilationSettings(); - - var thisAsIndexable = this; - var resultAsIndexable = result; - for (var name in this) { - if (this.hasOwnProperty(name) && TypeScript.StringUtilities.startsWith(name, "_")) { - resultAsIndexable[name.substr(1)] = thisAsIndexable[name]; - } - } - - return result; - }; - return ImmutableCompilationSettings; - })(); - TypeScript.ImmutableCompilationSettings = ImmutableCompilationSettings; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (PullElementFlags) { - PullElementFlags[PullElementFlags["None"] = 0] = "None"; - PullElementFlags[PullElementFlags["Exported"] = 1] = "Exported"; - PullElementFlags[PullElementFlags["Private"] = 1 << 1] = "Private"; - PullElementFlags[PullElementFlags["Public"] = 1 << 2] = "Public"; - PullElementFlags[PullElementFlags["Ambient"] = 1 << 3] = "Ambient"; - PullElementFlags[PullElementFlags["Static"] = 1 << 4] = "Static"; - PullElementFlags[PullElementFlags["Optional"] = 1 << 7] = "Optional"; - PullElementFlags[PullElementFlags["Signature"] = 1 << 11] = "Signature"; - PullElementFlags[PullElementFlags["Enum"] = 1 << 12] = "Enum"; - PullElementFlags[PullElementFlags["ArrowFunction"] = 1 << 13] = "ArrowFunction"; - - PullElementFlags[PullElementFlags["ClassConstructorVariable"] = 1 << 14] = "ClassConstructorVariable"; - PullElementFlags[PullElementFlags["InitializedModule"] = 1 << 15] = "InitializedModule"; - PullElementFlags[PullElementFlags["InitializedDynamicModule"] = 1 << 16] = "InitializedDynamicModule"; - - PullElementFlags[PullElementFlags["MustCaptureThis"] = 1 << 18] = "MustCaptureThis"; - - PullElementFlags[PullElementFlags["DeclaredInAWithBlock"] = 1 << 21] = "DeclaredInAWithBlock"; - - PullElementFlags[PullElementFlags["HasReturnStatement"] = 1 << 22] = "HasReturnStatement"; - - PullElementFlags[PullElementFlags["PropertyParameter"] = 1 << 23] = "PropertyParameter"; - - PullElementFlags[PullElementFlags["IsAnnotatedWithAny"] = 1 << 24] = "IsAnnotatedWithAny"; - - PullElementFlags[PullElementFlags["HasDefaultArgs"] = 1 << 25] = "HasDefaultArgs"; - - PullElementFlags[PullElementFlags["ConstructorParameter"] = 1 << 26] = "ConstructorParameter"; - - PullElementFlags[PullElementFlags["ImplicitVariable"] = PullElementFlags.ClassConstructorVariable | PullElementFlags.InitializedModule | PullElementFlags.InitializedDynamicModule | PullElementFlags.Enum] = "ImplicitVariable"; - PullElementFlags[PullElementFlags["SomeInitializedModule"] = PullElementFlags.InitializedModule | PullElementFlags.InitializedDynamicModule | PullElementFlags.Enum] = "SomeInitializedModule"; - })(TypeScript.PullElementFlags || (TypeScript.PullElementFlags = {})); - var PullElementFlags = TypeScript.PullElementFlags; - - function hasModifier(modifiers, flag) { - for (var i = 0, n = modifiers.length; i < n; i++) { - if (TypeScript.hasFlag(modifiers[i], flag)) { - return true; - } - } - - return false; - } - TypeScript.hasModifier = hasModifier; - - (function (PullElementKind) { - PullElementKind[PullElementKind["None"] = 0] = "None"; - PullElementKind[PullElementKind["Global"] = 0] = "Global"; - - PullElementKind[PullElementKind["Script"] = 1 << 0] = "Script"; - PullElementKind[PullElementKind["Primitive"] = 1 << 1] = "Primitive"; - - PullElementKind[PullElementKind["Container"] = 1 << 2] = "Container"; - PullElementKind[PullElementKind["Class"] = 1 << 3] = "Class"; - PullElementKind[PullElementKind["Interface"] = 1 << 4] = "Interface"; - PullElementKind[PullElementKind["DynamicModule"] = 1 << 5] = "DynamicModule"; - PullElementKind[PullElementKind["Enum"] = 1 << 6] = "Enum"; - PullElementKind[PullElementKind["TypeAlias"] = 1 << 7] = "TypeAlias"; - PullElementKind[PullElementKind["ObjectLiteral"] = 1 << 8] = "ObjectLiteral"; - - PullElementKind[PullElementKind["Variable"] = 1 << 9] = "Variable"; - PullElementKind[PullElementKind["CatchVariable"] = 1 << 10] = "CatchVariable"; - PullElementKind[PullElementKind["Parameter"] = 1 << 11] = "Parameter"; - PullElementKind[PullElementKind["Property"] = 1 << 12] = "Property"; - PullElementKind[PullElementKind["TypeParameter"] = 1 << 13] = "TypeParameter"; - - PullElementKind[PullElementKind["Function"] = 1 << 14] = "Function"; - PullElementKind[PullElementKind["ConstructorMethod"] = 1 << 15] = "ConstructorMethod"; - PullElementKind[PullElementKind["Method"] = 1 << 16] = "Method"; - PullElementKind[PullElementKind["FunctionExpression"] = 1 << 17] = "FunctionExpression"; - - PullElementKind[PullElementKind["GetAccessor"] = 1 << 18] = "GetAccessor"; - PullElementKind[PullElementKind["SetAccessor"] = 1 << 19] = "SetAccessor"; - - PullElementKind[PullElementKind["CallSignature"] = 1 << 20] = "CallSignature"; - PullElementKind[PullElementKind["ConstructSignature"] = 1 << 21] = "ConstructSignature"; - PullElementKind[PullElementKind["IndexSignature"] = 1 << 22] = "IndexSignature"; - - PullElementKind[PullElementKind["ObjectType"] = 1 << 23] = "ObjectType"; - PullElementKind[PullElementKind["FunctionType"] = 1 << 24] = "FunctionType"; - PullElementKind[PullElementKind["ConstructorType"] = 1 << 25] = "ConstructorType"; - - PullElementKind[PullElementKind["EnumMember"] = 1 << 26] = "EnumMember"; - - PullElementKind[PullElementKind["WithBlock"] = 1 << 27] = "WithBlock"; - PullElementKind[PullElementKind["CatchBlock"] = 1 << 28] = "CatchBlock"; - - PullElementKind[PullElementKind["All"] = PullElementKind.Script | PullElementKind.Global | PullElementKind.Primitive | PullElementKind.Container | PullElementKind.Class | PullElementKind.Interface | PullElementKind.DynamicModule | PullElementKind.Enum | PullElementKind.TypeAlias | PullElementKind.ObjectLiteral | PullElementKind.Variable | PullElementKind.Parameter | PullElementKind.Property | PullElementKind.TypeParameter | PullElementKind.Function | PullElementKind.ConstructorMethod | PullElementKind.Method | PullElementKind.FunctionExpression | PullElementKind.GetAccessor | PullElementKind.SetAccessor | PullElementKind.CallSignature | PullElementKind.ConstructSignature | PullElementKind.IndexSignature | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType | PullElementKind.EnumMember | PullElementKind.WithBlock | PullElementKind.CatchBlock] = "All"; - - PullElementKind[PullElementKind["SomeFunction"] = PullElementKind.Function | PullElementKind.ConstructorMethod | PullElementKind.Method | PullElementKind.FunctionExpression | PullElementKind.GetAccessor | PullElementKind.SetAccessor] = "SomeFunction"; - - PullElementKind[PullElementKind["SomeValue"] = PullElementKind.Variable | PullElementKind.Parameter | PullElementKind.Property | PullElementKind.EnumMember | PullElementKind.SomeFunction] = "SomeValue"; - - PullElementKind[PullElementKind["SomeType"] = PullElementKind.Script | PullElementKind.Global | PullElementKind.Primitive | PullElementKind.Class | PullElementKind.Interface | PullElementKind.Enum | PullElementKind.ObjectLiteral | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType | PullElementKind.TypeParameter] = "SomeType"; - - PullElementKind[PullElementKind["AcceptableAlias"] = PullElementKind.Variable | PullElementKind.SomeFunction | PullElementKind.Class | PullElementKind.Interface | PullElementKind.Enum | PullElementKind.Container | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType] = "AcceptableAlias"; - - PullElementKind[PullElementKind["SomeContainer"] = PullElementKind.Container | PullElementKind.DynamicModule | PullElementKind.TypeAlias] = "SomeContainer"; - - PullElementKind[PullElementKind["SomeSignature"] = PullElementKind.CallSignature | PullElementKind.ConstructSignature | PullElementKind.IndexSignature] = "SomeSignature"; - - PullElementKind[PullElementKind["SomeTypeReference"] = PullElementKind.Interface | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType] = "SomeTypeReference"; - - PullElementKind[PullElementKind["SomeInstantiatableType"] = PullElementKind.Class | PullElementKind.Interface | PullElementKind.TypeParameter] = "SomeInstantiatableType"; - })(TypeScript.PullElementKind || (TypeScript.PullElementKind = {})); - var PullElementKind = TypeScript.PullElementKind; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var pullDeclID = 0; - var sentinelEmptyPullDeclArray = []; - - var PullDecl = (function () { - function PullDecl(declName, displayName, kind, declFlags, semanticInfoChain) { - this.declID = pullDeclID++; - this.flags = 0 /* None */; - this.declGroups = null; - this.childDecls = null; - this.typeParameters = null; - this.synthesizedValDecl = null; - this.containerDecl = null; - this.childDeclTypeCache = null; - this.childDeclValueCache = null; - this.childDeclNamespaceCache = null; - this.childDeclTypeParameterCache = null; - this.name = declName; - this.kind = kind; - this.flags = declFlags; - this.semanticInfoChain = semanticInfoChain; - - if (displayName !== this.name) { - this.declDisplayName = displayName; - } - } - PullDecl.prototype.fileName = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.getParentPath = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.getParentDecl = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.isExternalModule = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.getEnclosingDecl = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype._getEnclosingDeclFromParentDecl = function () { - var decl = this; - while (decl) { - switch (decl.kind) { - default: - return decl; - case 512 /* Variable */: - case 8192 /* TypeParameter */: - case 2048 /* Parameter */: - case 128 /* TypeAlias */: - case 67108864 /* EnumMember */: - } - - decl = decl.getParentDecl(); - } - - TypeScript.Debug.fail(); - }; - - PullDecl.prototype.getDisplayName = function () { - return this.declDisplayName === undefined ? this.name : this.declDisplayName; - }; - - PullDecl.prototype.setSymbol = function (symbol) { - this.semanticInfoChain.setSymbolForDecl(this, symbol); - }; - - PullDecl.prototype.ensureSymbolIsBound = function () { - if (!this.hasBeenBound() && this.kind !== 1 /* Script */) { - var binder = this.semanticInfoChain.getBinder(); - binder.bindDeclToPullSymbol(this); - } - }; - - PullDecl.prototype.getSymbol = function () { - if (this.kind === 1 /* Script */) { - return null; - } - - this.ensureSymbolIsBound(); - - return this.semanticInfoChain.getSymbolForDecl(this); - }; - - PullDecl.prototype.hasSymbol = function () { - var symbol = this.semanticInfoChain.getSymbolForDecl(this); - return !!symbol; - }; - - PullDecl.prototype.setSignatureSymbol = function (signatureSymbol) { - this.semanticInfoChain.setSignatureSymbolForDecl(this, signatureSymbol); - }; - - PullDecl.prototype.getSignatureSymbol = function () { - this.ensureSymbolIsBound(); - return this.semanticInfoChain.getSignatureSymbolForDecl(this); - }; - - PullDecl.prototype.hasSignatureSymbol = function () { - var signatureSymbol = this.semanticInfoChain.getSignatureSymbolForDecl(this); - return !!signatureSymbol; - }; - - PullDecl.prototype.setFlags = function (flags) { - this.flags = flags; - }; - - PullDecl.prototype.setFlag = function (flags) { - this.flags |= flags; - }; - - PullDecl.prototype.setValueDecl = function (valDecl) { - this.synthesizedValDecl = valDecl; - valDecl.containerDecl = this; - }; - - PullDecl.prototype.getValueDecl = function () { - return this.synthesizedValDecl; - }; - - PullDecl.prototype.getContainerDecl = function () { - return this.containerDecl; - }; - - PullDecl.prototype.getChildDeclCache = function (declKind) { - if (declKind === 8192 /* TypeParameter */) { - if (!this.childDeclTypeParameterCache) { - this.childDeclTypeParameterCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclTypeParameterCache; - } else if (TypeScript.hasFlag(declKind, 164 /* SomeContainer */)) { - if (!this.childDeclNamespaceCache) { - this.childDeclNamespaceCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclNamespaceCache; - } else if (TypeScript.hasFlag(declKind, 58728795 /* SomeType */)) { - if (!this.childDeclTypeCache) { - this.childDeclTypeCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclTypeCache; - } else { - if (!this.childDeclValueCache) { - this.childDeclValueCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclValueCache; - } - }; - - PullDecl.prototype.addChildDecl = function (childDecl) { - if (childDecl.kind === 8192 /* TypeParameter */) { - if (!this.typeParameters) { - this.typeParameters = []; - } - this.typeParameters[this.typeParameters.length] = childDecl; - } else { - if (!this.childDecls) { - this.childDecls = []; - } - this.childDecls[this.childDecls.length] = childDecl; - } - - var declName = childDecl.name; - - if (!(childDecl.kind & 7340032 /* SomeSignature */)) { - var cache = this.getChildDeclCache(childDecl.kind); - var childrenOfName = cache[declName]; - if (!childrenOfName) { - childrenOfName = []; - } - - childrenOfName.push(childDecl); - cache[declName] = childrenOfName; - } - }; - - PullDecl.prototype.searchChildDecls = function (declName, searchKind) { - var cacheVal = null; - - if (searchKind & 58728795 /* SomeType */) { - cacheVal = this.childDeclTypeCache ? this.childDeclTypeCache[declName] : null; - } else if (searchKind & 164 /* SomeContainer */) { - cacheVal = this.childDeclNamespaceCache ? this.childDeclNamespaceCache[declName] : null; - } else { - cacheVal = this.childDeclValueCache ? this.childDeclValueCache[declName] : null; - } - - if (cacheVal) { - return cacheVal; - } else { - if (searchKind & 58728795 /* SomeType */) { - cacheVal = this.childDeclTypeParameterCache ? this.childDeclTypeParameterCache[declName] : null; - - if (cacheVal) { - return cacheVal; - } - } - - return sentinelEmptyPullDeclArray; - } - }; - - PullDecl.prototype.getChildDecls = function () { - return this.childDecls || sentinelEmptyPullDeclArray; - }; - - PullDecl.prototype.getTypeParameters = function () { - return this.typeParameters || sentinelEmptyPullDeclArray; - }; - - PullDecl.prototype.addVariableDeclToGroup = function (decl) { - if (!this.declGroups) { - this.declGroups = TypeScript.createIntrinsicsObject(); - } - - var declGroup = this.declGroups[decl.name]; - if (declGroup) { - declGroup.addDecl(decl); - } else { - declGroup = new PullDeclGroup(decl.name); - declGroup.addDecl(decl); - this.declGroups[decl.name] = declGroup; - } - }; - - PullDecl.prototype.getVariableDeclGroups = function () { - var declGroups = null; - - if (this.declGroups) { - for (var declName in this.declGroups) { - if (this.declGroups[declName]) { - if (declGroups === null) { - declGroups = []; - } - - declGroups.push(this.declGroups[declName].getDecls()); - } - } - } - - return declGroups || sentinelEmptyPullDeclArray; - }; - - PullDecl.prototype.hasBeenBound = function () { - return this.hasSymbol() || this.hasSignatureSymbol(); - }; - - PullDecl.prototype.isSynthesized = function () { - return false; - }; - - PullDecl.prototype.ast = function () { - return this.semanticInfoChain.getASTForDecl(this); - }; - - PullDecl.prototype.isRootDecl = function () { - throw TypeScript.Errors.abstract(); - }; - return PullDecl; - })(); - TypeScript.PullDecl = PullDecl; - - var RootPullDecl = (function (_super) { - __extends(RootPullDecl, _super); - function RootPullDecl(name, fileName, kind, declFlags, semanticInfoChain, isExternalModule) { - _super.call(this, name, name, kind, declFlags, semanticInfoChain); - this.semanticInfoChain = semanticInfoChain; - this._isExternalModule = isExternalModule; - this._fileName = fileName; - } - RootPullDecl.prototype.fileName = function () { - return this._fileName; - }; - - RootPullDecl.prototype.getParentPath = function () { - return [this]; - }; - - RootPullDecl.prototype.getParentDecl = function () { - return null; - }; - - RootPullDecl.prototype.isExternalModule = function () { - return this._isExternalModule; - }; - - RootPullDecl.prototype.getEnclosingDecl = function () { - return this; - }; - - RootPullDecl.prototype.isRootDecl = function () { - return true; - }; - return RootPullDecl; - })(PullDecl); - TypeScript.RootPullDecl = RootPullDecl; - - var NormalPullDecl = (function (_super) { - __extends(NormalPullDecl, _super); - function NormalPullDecl(declName, displayName, kind, declFlags, parentDecl, addToParent) { - if (typeof addToParent === "undefined") { addToParent = true; } - _super.call(this, declName, displayName, kind, declFlags, parentDecl ? parentDecl.semanticInfoChain : null); - this.parentDecl = null; - this.parentPath = null; - - this.parentDecl = parentDecl; - if (addToParent) { - parentDecl.addChildDecl(this); - } - - if (this.parentDecl) { - if (this.parentDecl.isRootDecl()) { - this._rootDecl = this.parentDecl; - } else { - this._rootDecl = this.parentDecl._rootDecl; - } - } else { - TypeScript.Debug.assert(this.isSynthesized()); - this._rootDecl = null; - } - } - NormalPullDecl.prototype.fileName = function () { - return this._rootDecl.fileName(); - }; - - NormalPullDecl.prototype.getParentDecl = function () { - return this.parentDecl; - }; - - NormalPullDecl.prototype.getParentPath = function () { - if (!this.parentPath) { - var path = [this]; - var parentDecl = this.parentDecl; - - while (parentDecl) { - if (parentDecl && path[path.length - 1] !== parentDecl && !(parentDecl.kind & (256 /* ObjectLiteral */ | 8388608 /* ObjectType */))) { - path.unshift(parentDecl); - } - - parentDecl = parentDecl.getParentDecl(); - } - - this.parentPath = path; - } - - return this.parentPath; - }; - - NormalPullDecl.prototype.isExternalModule = function () { - return false; - }; - - NormalPullDecl.prototype.getEnclosingDecl = function () { - return this.parentDecl && this.parentDecl._getEnclosingDeclFromParentDecl(); - }; - - NormalPullDecl.prototype.isRootDecl = function () { - return false; - }; - return NormalPullDecl; - })(PullDecl); - TypeScript.NormalPullDecl = NormalPullDecl; - - var PullEnumElementDecl = (function (_super) { - __extends(PullEnumElementDecl, _super); - function PullEnumElementDecl(declName, displayName, parentDecl) { - _super.call(this, declName, displayName, 67108864 /* EnumMember */, 4 /* Public */, parentDecl); - this.constantValue = null; - } - return PullEnumElementDecl; - })(NormalPullDecl); - TypeScript.PullEnumElementDecl = PullEnumElementDecl; - - var PullFunctionExpressionDecl = (function (_super) { - __extends(PullFunctionExpressionDecl, _super); - function PullFunctionExpressionDecl(expressionName, declFlags, parentDecl, displayName) { - if (typeof displayName === "undefined") { displayName = ""; } - _super.call(this, "", displayName, 131072 /* FunctionExpression */, declFlags, parentDecl); - this.functionExpressionName = expressionName; - } - PullFunctionExpressionDecl.prototype.getFunctionExpressionName = function () { - return this.functionExpressionName; - }; - return PullFunctionExpressionDecl; - })(NormalPullDecl); - TypeScript.PullFunctionExpressionDecl = PullFunctionExpressionDecl; - - var PullSynthesizedDecl = (function (_super) { - __extends(PullSynthesizedDecl, _super); - function PullSynthesizedDecl(declName, displayName, kind, declFlags, parentDecl, semanticInfoChain) { - _super.call(this, declName, displayName, kind, declFlags, parentDecl, false); - this.semanticInfoChain = semanticInfoChain; - } - PullSynthesizedDecl.prototype.isSynthesized = function () { - return true; - }; - - PullSynthesizedDecl.prototype.fileName = function () { - return this._rootDecl ? this._rootDecl.fileName() : ""; - }; - return PullSynthesizedDecl; - })(NormalPullDecl); - TypeScript.PullSynthesizedDecl = PullSynthesizedDecl; - - var PullDeclGroup = (function () { - function PullDeclGroup(name) { - this.name = name; - this._decls = []; - } - PullDeclGroup.prototype.addDecl = function (decl) { - if (decl.name === this.name) { - this._decls[this._decls.length] = decl; - } - }; - - PullDeclGroup.prototype.getDecls = function () { - return this._decls; - }; - return PullDeclGroup; - })(); - TypeScript.PullDeclGroup = PullDeclGroup; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.pullSymbolID = 0; - TypeScript.sentinelEmptyArray = []; - - var PullSymbol = (function () { - function PullSymbol(name, declKind) { - this.pullSymbolID = ++TypeScript.pullSymbolID; - this._container = null; - this.type = null; - this._declarations = null; - this.isResolved = false; - this.isOptional = false; - this.inResolution = false; - this.isSynthesized = false; - this.isVarArg = false; - this.rootSymbol = null; - this._enclosingSignature = null; - this._docComments = null; - this.isPrinting = false; - this.name = name; - this.kind = declKind; - } - PullSymbol.prototype.isAny = function () { - return false; - }; - - PullSymbol.prototype.isType = function () { - return (this.kind & 58728795 /* SomeType */) !== 0; - }; - - PullSymbol.prototype.isTypeReference = function () { - return false; - }; - - PullSymbol.prototype.isSignature = function () { - return (this.kind & 7340032 /* SomeSignature */) !== 0; - }; - - PullSymbol.prototype.isArrayNamedTypeReference = function () { - return false; - }; - - PullSymbol.prototype.isPrimitive = function () { - return this.kind === 2 /* Primitive */; - }; - - PullSymbol.prototype.isAccessor = function () { - return false; - }; - - PullSymbol.prototype.isError = function () { - return false; - }; - - PullSymbol.prototype.isInterface = function () { - return this.kind === 16 /* Interface */; - }; - - PullSymbol.prototype.isMethod = function () { - return this.kind === 65536 /* Method */; - }; - - PullSymbol.prototype.isProperty = function () { - return this.kind === 4096 /* Property */; - }; - - PullSymbol.prototype.isAlias = function () { - return false; - }; - - PullSymbol.prototype.isContainer = function () { - return false; - }; - - PullSymbol.prototype.findAliasedTypeSymbols = function (scopeSymbol, skipScopeSymbolAliasesLookIn, lookIntoOnlyExportedAlias, aliasSymbols, visitedScopeDeclarations) { - if (typeof aliasSymbols === "undefined") { aliasSymbols = []; } - if (typeof visitedScopeDeclarations === "undefined") { visitedScopeDeclarations = []; } - var scopeDeclarations = scopeSymbol.getDeclarations(); - var scopeSymbolAliasesToLookIn = []; - - for (var i = 0; i < scopeDeclarations.length; i++) { - var scopeDecl = scopeDeclarations[i]; - if (!TypeScript.ArrayUtilities.contains(visitedScopeDeclarations, scopeDecl)) { - visitedScopeDeclarations.push(scopeDecl); - - var childDecls = scopeDecl.getChildDecls(); - for (var j = 0; j < childDecls.length; j++) { - var childDecl = childDecls[j]; - if (childDecl.kind === 128 /* TypeAlias */ && (!lookIntoOnlyExportedAlias || (childDecl.flags & 1 /* Exported */))) { - var symbol = childDecl.getSymbol(); - - if (PullContainerSymbol.usedAsSymbol(symbol, this) || (this.rootSymbol && PullContainerSymbol.usedAsSymbol(symbol, this.rootSymbol))) { - aliasSymbols.push(symbol); - return aliasSymbols; - } - - if (!skipScopeSymbolAliasesLookIn && PullSymbol._isExternalModuleReferenceAlias(symbol) && (!symbol.assignedContainer().hasExportAssignment() || (symbol.assignedContainer().getExportAssignedContainerSymbol() && symbol.assignedContainer().getExportAssignedContainerSymbol().kind === 32 /* DynamicModule */))) { - scopeSymbolAliasesToLookIn.push(symbol); - } - } - } - } - } - - for (var i = 0; i < scopeSymbolAliasesToLookIn.length; i++) { - var scopeSymbolAlias = scopeSymbolAliasesToLookIn[i]; - - aliasSymbols.push(scopeSymbolAlias); - var result = this.findAliasedTypeSymbols(scopeSymbolAlias.assignedContainer().hasExportAssignment() ? scopeSymbolAlias.assignedContainer().getExportAssignedContainerSymbol() : scopeSymbolAlias.assignedContainer(), false, true, aliasSymbols, visitedScopeDeclarations); - if (result) { - return result; - } - - aliasSymbols.pop(); - } - - return null; - }; - - PullSymbol.prototype.getExternalAliasedSymbols = function (scopeSymbol) { - if (!scopeSymbol) { - return null; - } - - var scopePath = scopeSymbol.pathToRoot(); - if (scopePath.length && scopePath[scopePath.length - 1].kind === 32 /* DynamicModule */) { - var symbols = this.findAliasedTypeSymbols(scopePath[scopePath.length - 1]); - return symbols; - } - - return null; - }; - - PullSymbol._isExternalModuleReferenceAlias = function (aliasSymbol) { - if (aliasSymbol) { - if (aliasSymbol.assignedValue()) { - return false; - } - - if (aliasSymbol.assignedType() && aliasSymbol.assignedType() !== aliasSymbol.assignedContainer()) { - return false; - } - - if (aliasSymbol.assignedContainer() && aliasSymbol.assignedContainer().kind !== 32 /* DynamicModule */) { - return false; - } - - return true; - } - - return false; - }; - - PullSymbol.prototype.getExportedInternalAliasSymbol = function (scopeSymbol) { - if (scopeSymbol) { - if (this.kind !== 128 /* TypeAlias */) { - var scopePath = scopeSymbol.pathToRoot(); - for (var i = 0; i < scopePath.length; i++) { - var internalAliases = this.findAliasedTypeSymbols(scopeSymbol, true, true); - if (internalAliases) { - TypeScript.Debug.assert(internalAliases.length === 1); - return internalAliases[0]; - } - } - } - } - - return null; - }; - - PullSymbol.prototype.getAliasSymbolName = function (scopeSymbol, aliasNameGetter, aliasPartsNameGetter, skipInternalAlias) { - if (!skipInternalAlias) { - var internalAlias = this.getExportedInternalAliasSymbol(scopeSymbol); - if (internalAlias) { - return aliasNameGetter(internalAlias); - } - } - - var externalAliases = this.getExternalAliasedSymbols(scopeSymbol); - - if (externalAliases && externalAliases[0] != this && PullSymbol._isExternalModuleReferenceAlias(externalAliases[externalAliases.length - 1])) { - var aliasFullName = aliasNameGetter(externalAliases[0]); - if (!aliasFullName) { - return null; - } - for (var i = 1, symbolsLen = externalAliases.length; i < symbolsLen; i++) { - aliasFullName = aliasFullName + "." + aliasPartsNameGetter(externalAliases[i]); - } - return aliasFullName; - } - - return null; - }; - - PullSymbol.prototype._getResolver = function () { - TypeScript.Debug.assert(this._declarations && this._declarations.length > 0); - return this._declarations[0].semanticInfoChain.getResolver(); - }; - - PullSymbol.prototype._resolveDeclaredSymbol = function () { - return this._getResolver().resolveDeclaredSymbol(this); - }; - - PullSymbol.prototype.getName = function (scopeSymbol, useConstraintInName) { - var aliasName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getName(scopeSymbol, useConstraintInName); - }, function (symbol) { - return symbol.getName(); - }); - return aliasName || this.name; - }; - - PullSymbol.prototype.getDisplayName = function (scopeSymbol, useConstraintInName, skipInternalAliasName) { - var aliasDisplayName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getDisplayName(scopeSymbol, useConstraintInName); - }, function (symbol) { - return symbol.getDisplayName(); - }, skipInternalAliasName); - if (aliasDisplayName) { - return aliasDisplayName; - } - - var decls = this.getDeclarations(); - var name = decls.length && decls[0].getDisplayName(); - - return (name && name.length) ? name : this.name; - }; - - PullSymbol.prototype.getIsSpecialized = function () { - return false; - }; - - PullSymbol.prototype.getRootSymbol = function () { - if (!this.rootSymbol) { - return this; - } - return this.rootSymbol; - }; - PullSymbol.prototype.setRootSymbol = function (symbol) { - this.rootSymbol = symbol; - }; - - PullSymbol.prototype.setIsSynthesized = function (value) { - if (typeof value === "undefined") { value = true; } - TypeScript.Debug.assert(this.rootSymbol == null); - this.isSynthesized = value; - }; - - PullSymbol.prototype.getIsSynthesized = function () { - if (this.rootSymbol) { - return this.rootSymbol.getIsSynthesized(); - } - return this.isSynthesized; - }; - - PullSymbol.prototype.setEnclosingSignature = function (signature) { - this._enclosingSignature = signature; - }; - - PullSymbol.prototype.getEnclosingSignature = function () { - return this._enclosingSignature; - }; - - PullSymbol.prototype.addDeclaration = function (decl) { - TypeScript.Debug.assert(!!decl); - - if (this.rootSymbol) { - return; - } - - if (!this._declarations) { - this._declarations = [decl]; - } else { - this._declarations[this._declarations.length] = decl; - } - }; - - PullSymbol.prototype.getDeclarations = function () { - if (this.rootSymbol) { - return this.rootSymbol.getDeclarations(); - } - - if (!this._declarations) { - this._declarations = []; - } - - return this._declarations; - }; - - PullSymbol.prototype.hasDeclaration = function (decl) { - if (!this._declarations) { - return false; - } - - return TypeScript.ArrayUtilities.any(this._declarations, function (eachDecl) { - return eachDecl === decl; - }); - }; - - PullSymbol.prototype.setContainer = function (containerSymbol) { - if (this.rootSymbol) { - return; - } - - this._container = containerSymbol; - }; - - PullSymbol.prototype.getContainer = function () { - if (this.rootSymbol) { - return this.rootSymbol.getContainer(); - } - - return this._container; - }; - - PullSymbol.prototype.setResolved = function () { - this.isResolved = true; - this.inResolution = false; - }; - - PullSymbol.prototype.startResolving = function () { - this.inResolution = true; - }; - - PullSymbol.prototype.setUnresolved = function () { - this.isResolved = false; - this.inResolution = false; - }; - - PullSymbol.prototype.anyDeclHasFlag = function (flag) { - var declarations = this.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - if (TypeScript.hasFlag(declarations[i].flags, flag)) { - return true; - } - } - return false; - }; - - PullSymbol.prototype.allDeclsHaveFlag = function (flag) { - var declarations = this.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - if (!TypeScript.hasFlag(declarations[i].flags, flag)) { - return false; - } - } - return true; - }; - - PullSymbol.prototype.pathToRoot = function () { - var path = []; - var node = this; - while (node) { - if (node.isType()) { - var associatedContainerSymbol = node.getAssociatedContainerType(); - if (associatedContainerSymbol) { - node = associatedContainerSymbol; - } - } - path[path.length] = node; - var nodeKind = node.kind; - if (nodeKind === 2048 /* Parameter */) { - break; - } else { - node = node.getContainer(); - } - } - return path; - }; - - PullSymbol.unqualifiedNameReferencesDifferentSymbolInScope = function (symbol, scopePath, endScopePathIndex) { - var declPath = scopePath[0].getDeclarations()[0].getParentPath(); - for (var i = 0, declIndex = declPath.length - 1; i <= endScopePathIndex; i++, declIndex--) { - if (scopePath[i].isContainer()) { - var scopeContainer = scopePath[i]; - if (symbol.isContainer()) { - var memberSymbol = scopeContainer.findContainedNonMemberContainer(symbol.name, 164 /* SomeContainer */); - if (memberSymbol && memberSymbol != symbol && memberSymbol.getDeclarations()[0].getParentDecl() == declPath[declIndex]) { - return true; - } - - var memberSymbol = scopeContainer.findNestedContainer(symbol.name, 164 /* SomeContainer */); - if (memberSymbol && memberSymbol != symbol) { - return true; - } - } else if (symbol.isType()) { - var memberSymbol = scopeContainer.findContainedNonMemberType(symbol.name, 58728795 /* SomeType */); - var symbolRootType = TypeScript.PullHelpers.getRootType(symbol); - if (memberSymbol && TypeScript.PullHelpers.getRootType(memberSymbol) != symbolRootType && memberSymbol.getDeclarations()[0].getParentDecl() == declPath[declIndex]) { - return true; - } - - var memberSymbol = scopeContainer.findNestedType(symbol.name, 58728795 /* SomeType */); - if (memberSymbol && TypeScript.PullHelpers.getRootType(memberSymbol) != symbolRootType) { - return true; - } - } - } - } - - return false; - }; - - PullSymbol.prototype.findQualifyingSymbolPathInScopeSymbol = function (scopeSymbol) { - var thisPath = this.pathToRoot(); - if (thisPath.length === 1) { - return thisPath; - } - - var scopeSymbolPath; - if (scopeSymbol) { - scopeSymbolPath = scopeSymbol.pathToRoot(); - } else { - return thisPath; - } - - var thisCommonAncestorIndex = TypeScript.ArrayUtilities.indexOf(thisPath, function (thisNode) { - return TypeScript.ArrayUtilities.contains(scopeSymbolPath, thisNode); - }); - if (thisCommonAncestorIndex > 0) { - var thisCommonAncestor = thisPath[thisCommonAncestorIndex]; - var scopeCommonAncestorIndex = TypeScript.ArrayUtilities.indexOf(scopeSymbolPath, function (scopeNode) { - return scopeNode === thisCommonAncestor; - }); - TypeScript.Debug.assert(thisPath.length - thisCommonAncestorIndex === scopeSymbolPath.length - scopeCommonAncestorIndex); - - for (; thisCommonAncestorIndex < thisPath.length; thisCommonAncestorIndex++, scopeCommonAncestorIndex++) { - if (!PullSymbol.unqualifiedNameReferencesDifferentSymbolInScope(thisPath[thisCommonAncestorIndex - 1], scopeSymbolPath, scopeCommonAncestorIndex)) { - break; - } - } - } - - if (thisCommonAncestorIndex >= 0 && thisCommonAncestorIndex < thisPath.length) { - return thisPath.slice(0, thisCommonAncestorIndex); - } else { - return thisPath; - } - }; - - PullSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - var str = this.getNameAndTypeName(scopeSymbol); - return str; - }; - - PullSymbol.prototype.getNamePartForFullName = function () { - return this.getDisplayName(null, true); - }; - - PullSymbol.prototype.fullName = function (scopeSymbol) { - var _this = this; - var path = this.pathToRoot(); - var fullName = ""; - - var aliasFullName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.fullName(scopeSymbol); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }); - if (aliasFullName) { - return aliasFullName; - } - - for (var i = 1; i < path.length; i++) { - var aliasFullName = path[i].getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol === _this ? null : symbol.fullName(scopeSymbol); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }); - if (aliasFullName) { - fullName = aliasFullName + "." + fullName; - break; - } - - var scopedName = path[i].getNamePartForFullName(); - if (path[i].kind === 32 /* DynamicModule */ && !TypeScript.isQuoted(scopedName)) { - break; - } - - if (scopedName === "") { - break; - } - - fullName = scopedName + "." + fullName; - } - - fullName = fullName + this.getNamePartForFullName(); - return fullName; - }; - - PullSymbol.prototype.getScopedName = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName) { - var path = this.findQualifyingSymbolPathInScopeSymbol(scopeSymbol); - var fullName = ""; - - var aliasFullName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getScopedName(scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }, skipInternalAliasName); - if (aliasFullName) { - return aliasFullName; - } - - for (var i = 1; i < path.length; i++) { - var kind = path[i].kind; - if (kind === 4 /* Container */ || kind === 32 /* DynamicModule */) { - var aliasFullName = path[i].getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getScopedName(scopeSymbol, skipTypeParametersInName, false, skipInternalAliasName); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }, skipInternalAliasName); - if (aliasFullName) { - fullName = aliasFullName + "." + fullName; - break; - } - - if (kind === 4 /* Container */) { - fullName = path[i].getDisplayName() + "." + fullName; - } else { - var displayName = path[i].getDisplayName(); - if (TypeScript.isQuoted(displayName)) { - fullName = displayName + "." + fullName; - } - break; - } - } else { - break; - } - } - fullName = fullName + this.getDisplayName(scopeSymbol, useConstraintInName, skipInternalAliasName); - return fullName; - }; - - PullSymbol.prototype.getScopedNameEx = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, getPrettyTypeName, getTypeParamMarkerInfo, skipInternalAliasName) { - var name = this.getScopedName(scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName); - return TypeScript.MemberName.create(name); - }; - - PullSymbol.prototype.getTypeName = function (scopeSymbol, getPrettyTypeName) { - var memberName = this.getTypeNameEx(scopeSymbol, getPrettyTypeName); - return memberName.toString(); - }; - - PullSymbol.prototype.getTypeNameEx = function (scopeSymbol, getPrettyTypeName) { - var type = this.type; - if (type) { - var memberName = getPrettyTypeName ? this.getTypeNameForFunctionSignature("", scopeSymbol, getPrettyTypeName) : null; - if (!memberName) { - memberName = type.getScopedNameEx(scopeSymbol, false, true, getPrettyTypeName); - } - - return memberName; - } - return TypeScript.MemberName.create(""); - }; - - PullSymbol.prototype.getTypeNameForFunctionSignature = function (prefix, scopeSymbol, getPrettyTypeName) { - var type = this.type; - if (type && !type.isNamedTypeSymbol() && this.kind !== 4096 /* Property */ && this.kind !== 512 /* Variable */ && this.kind !== 2048 /* Parameter */) { - var signatures = type.getCallSignatures(); - if (signatures.length === 1 || (getPrettyTypeName && signatures.length)) { - var typeName = new TypeScript.MemberNameArray(); - var signatureName = PullSignatureSymbol.getSignaturesTypeNameEx(signatures, prefix, false, false, scopeSymbol, getPrettyTypeName); - typeName.addAll(signatureName); - return typeName; - } - } - - return null; - }; - - PullSymbol.prototype.getNameAndTypeName = function (scopeSymbol) { - var nameAndTypeName = this.getNameAndTypeNameEx(scopeSymbol); - return nameAndTypeName.toString(); - }; - - PullSymbol.prototype.getNameAndTypeNameEx = function (scopeSymbol) { - var type = this.type; - var nameStr = this.getDisplayName(scopeSymbol); - if (type) { - nameStr = nameStr + (this.isOptional ? "?" : ""); - var memberName = this.getTypeNameForFunctionSignature(nameStr, scopeSymbol); - if (!memberName) { - var typeNameEx = type.getScopedNameEx(scopeSymbol); - memberName = TypeScript.MemberName.create(typeNameEx, nameStr + ": ", ""); - } - return memberName; - } - return TypeScript.MemberName.create(nameStr); - }; - - PullSymbol.getTypeParameterString = function (typars, scopeSymbol, useContraintInName) { - return PullSymbol.getTypeParameterStringEx(typars, scopeSymbol, undefined, useContraintInName).toString(); - }; - - PullSymbol.getTypeParameterStringEx = function (typeParameters, scopeSymbol, getTypeParamMarkerInfo, useContraintInName) { - var builder = new TypeScript.MemberNameArray(); - builder.prefix = ""; - - if (typeParameters && typeParameters.length) { - builder.add(TypeScript.MemberName.create("<")); - - for (var i = 0; i < typeParameters.length; i++) { - if (i) { - builder.add(TypeScript.MemberName.create(", ")); - } - - if (getTypeParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - - builder.add(typeParameters[i].getScopedNameEx(scopeSymbol, false, useContraintInName)); - - if (getTypeParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - } - - builder.add(TypeScript.MemberName.create(">")); - } - - return builder; - }; - - PullSymbol.getIsExternallyVisible = function (symbol, fromIsExternallyVisibleSymbol, inIsExternallyVisibleSymbols) { - if (inIsExternallyVisibleSymbols) { - for (var i = 0; i < inIsExternallyVisibleSymbols.length; i++) { - if (inIsExternallyVisibleSymbols[i] === symbol) { - return true; - } - } - } else { - inIsExternallyVisibleSymbols = []; - } - - if (fromIsExternallyVisibleSymbol === symbol) { - return true; - } - - inIsExternallyVisibleSymbols.push(fromIsExternallyVisibleSymbol); - - var result = symbol.isExternallyVisible(inIsExternallyVisibleSymbols); - - TypeScript.Debug.assert(TypeScript.ArrayUtilities.last(inIsExternallyVisibleSymbols) === fromIsExternallyVisibleSymbol); - inIsExternallyVisibleSymbols.pop(); - - return result; - }; - - PullSymbol.prototype.isExternallyVisible = function (inIsExternallyVisibleSymbols) { - var kind = this.kind; - if (kind === 2 /* Primitive */) { - return true; - } - - if (this.rootSymbol) { - return PullSymbol.getIsExternallyVisible(this.rootSymbol, this, inIsExternallyVisibleSymbols); - } - - if (this.isType()) { - var associatedContainerSymbol = this.getAssociatedContainerType(); - if (associatedContainerSymbol) { - return PullSymbol.getIsExternallyVisible(associatedContainerSymbol, this, inIsExternallyVisibleSymbols); - } - } - - if (this.anyDeclHasFlag(2 /* Private */)) { - return false; - } - - var container = this.getContainer(); - if (container === null) { - var decls = this.getDeclarations(); - if (decls.length) { - var parentDecl = decls[0].getParentDecl(); - if (parentDecl) { - var parentSymbol = parentDecl.getSymbol(); - if (!parentSymbol || parentDecl.kind === 1 /* Script */) { - return true; - } - - return PullSymbol.getIsExternallyVisible(parentSymbol, this, inIsExternallyVisibleSymbols); - } - } - - return true; - } - - if (container.kind === 32 /* DynamicModule */ || (container.getAssociatedContainerType() && container.getAssociatedContainerType().kind === 32 /* DynamicModule */)) { - var containerSymbol = container.kind === 32 /* DynamicModule */ ? container : container.getAssociatedContainerType(); - if (PullContainerSymbol.usedAsSymbol(containerSymbol, this)) { - return true; - } - } - - if (!this.anyDeclHasFlag(1 /* Exported */) && kind !== 4096 /* Property */ && kind !== 65536 /* Method */) { - return false; - } - - return PullSymbol.getIsExternallyVisible(container, this, inIsExternallyVisibleSymbols); - }; - - PullSymbol.prototype.getDocCommentsOfDecl = function (decl) { - var ast = decl.ast(); - - if (ast) { - var enclosingModuleDeclaration = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(ast); - if (TypeScript.ASTHelpers.isLastNameOfModule(enclosingModuleDeclaration, ast)) { - return TypeScript.ASTHelpers.docComments(enclosingModuleDeclaration); - } - - if (ast.kind() !== 130 /* ModuleDeclaration */ || decl.kind !== 512 /* Variable */) { - return TypeScript.ASTHelpers.docComments(ast); - } - } - - return []; - }; - - PullSymbol.prototype.getDocCommentArray = function (symbol) { - var docComments = []; - if (!symbol) { - return docComments; - } - - var isParameter = symbol.kind === 2048 /* Parameter */; - var decls = symbol.getDeclarations(); - for (var i = 0; i < decls.length; i++) { - if (isParameter && decls[i].kind === 4096 /* Property */) { - continue; - } - docComments = docComments.concat(this.getDocCommentsOfDecl(decls[i])); - } - return docComments; - }; - - PullSymbol.getDefaultConstructorSymbolForDocComments = function (classSymbol) { - if (classSymbol.getHasDefaultConstructor()) { - var extendedTypes = classSymbol.getExtendedTypes(); - if (extendedTypes.length) { - return PullSymbol.getDefaultConstructorSymbolForDocComments(extendedTypes[0]); - } - } - - return classSymbol.type.getConstructSignatures()[0]; - }; - - PullSymbol.prototype.getDocCommentText = function (comments) { - var docCommentText = new Array(); - for (var c = 0; c < comments.length; c++) { - var commentText = this.getDocCommentTextValue(comments[c]); - if (commentText !== "") { - docCommentText.push(commentText); - } - } - return docCommentText.join("\n"); - }; - - PullSymbol.prototype.getDocCommentTextValue = function (comment) { - return this.cleanJSDocComment(comment.fullText()); - }; - - PullSymbol.prototype.docComments = function (useConstructorAsClass) { - var decls = this.getDeclarations(); - if (useConstructorAsClass && decls.length && decls[0].kind === 32768 /* ConstructorMethod */) { - var classDecl = decls[0].getParentDecl(); - return this.getDocCommentText(this.getDocCommentsOfDecl(classDecl)); - } - - if (this._docComments === null) { - var docComments = ""; - if (!useConstructorAsClass && this.kind === 2097152 /* ConstructSignature */ && decls.length && decls[0].kind === 8 /* Class */) { - var classSymbol = this.returnType; - var extendedTypes = classSymbol.getExtendedTypes(); - if (extendedTypes.length) { - docComments = extendedTypes[0].getConstructorMethod().docComments(); - } else { - docComments = ""; - } - } else if (this.kind === 2048 /* Parameter */) { - var parameterComments = []; - - var funcContainer = this.getEnclosingSignature(); - var funcDocComments = this.getDocCommentArray(funcContainer); - var paramComment = this.getParameterDocCommentText(this.getDisplayName(), funcDocComments); - if (paramComment != "") { - parameterComments.push(paramComment); - } - - var paramSelfComment = this.getDocCommentText(this.getDocCommentArray(this)); - if (paramSelfComment != "") { - parameterComments.push(paramSelfComment); - } - docComments = parameterComments.join("\n"); - } else { - var getSymbolComments = true; - if (this.kind === 16777216 /* FunctionType */) { - var functionSymbol = this.getFunctionSymbol(); - - if (functionSymbol) { - docComments = functionSymbol._docComments || ""; - getSymbolComments = false; - } else { - var declarationList = this.getDeclarations(); - if (declarationList.length > 0) { - docComments = declarationList[0].getSymbol()._docComments || ""; - getSymbolComments = false; - } - } - } - if (getSymbolComments) { - docComments = this.getDocCommentText(this.getDocCommentArray(this)); - if (docComments === "") { - if (this.kind === 1048576 /* CallSignature */) { - var callTypeSymbol = this.functionType; - if (callTypeSymbol && callTypeSymbol.getCallSignatures().length === 1) { - docComments = callTypeSymbol.docComments(); - } - } - } - } - } - - this._docComments = docComments; - } - - return this._docComments; - }; - - PullSymbol.prototype.getParameterDocCommentText = function (param, fncDocComments) { - if (fncDocComments.length === 0 || fncDocComments[0].kind() !== 6 /* MultiLineCommentTrivia */) { - return ""; - } - - for (var i = 0; i < fncDocComments.length; i++) { - var commentContents = fncDocComments[i].fullText(); - for (var j = commentContents.indexOf("@param", 0); 0 <= j; j = commentContents.indexOf("@param", j)) { - j += 6; - if (!this.isSpaceChar(commentContents, j)) { - continue; - } - - j = this.consumeLeadingSpace(commentContents, j); - if (j === -1) { - break; - } - - if (commentContents.charCodeAt(j) === 123 /* openBrace */) { - j++; - - var charCode = 0; - for (var curlies = 1; j < commentContents.length; j++) { - charCode = commentContents.charCodeAt(j); - - if (charCode === 123 /* openBrace */) { - curlies++; - continue; - } - - if (charCode === 125 /* closeBrace */) { - curlies--; - if (curlies === 0) { - break; - } else { - continue; - } - } - - if (charCode === 64 /* at */) { - break; - } - } - - if (j === commentContents.length) { - break; - } - - if (charCode === 64 /* at */) { - continue; - } - - j = this.consumeLeadingSpace(commentContents, j + 1); - if (j === -1) { - break; - } - } - - if (param !== commentContents.substr(j, param.length) || !this.isSpaceChar(commentContents, j + param.length)) { - continue; - } - - j = this.consumeLeadingSpace(commentContents, j + param.length); - if (j === -1) { - return ""; - } - - var endOfParam = commentContents.indexOf("@", j); - var paramHelpString = commentContents.substring(j, endOfParam < 0 ? commentContents.length : endOfParam); - - var paramSpacesToRemove = undefined; - var paramLineIndex = commentContents.substring(0, j).lastIndexOf("\n") + 1; - if (paramLineIndex !== 0) { - if (paramLineIndex < j && commentContents.charAt(paramLineIndex + 1) === "\r") { - paramLineIndex++; - } - } - var startSpaceRemovalIndex = this.consumeLeadingSpace(commentContents, paramLineIndex); - if (startSpaceRemovalIndex !== j && commentContents.charAt(startSpaceRemovalIndex) === "*") { - paramSpacesToRemove = j - startSpaceRemovalIndex - 1; - } - - return this.cleanJSDocComment(paramHelpString, paramSpacesToRemove); - } - } - - return ""; - }; - - PullSymbol.prototype.cleanJSDocComment = function (content, spacesToRemove) { - var docCommentLines = new Array(); - content = content.replace("/**", ""); - if (content.length >= 2 && content.charAt(content.length - 1) === "/" && content.charAt(content.length - 2) === "*") { - content = content.substring(0, content.length - 2); - } - var lines = content.split("\n"); - var inParamTag = false; - for (var l = 0; l < lines.length; l++) { - var line = lines[l]; - var cleanLinePos = this.cleanDocCommentLine(line, true, spacesToRemove); - if (!cleanLinePos) { - continue; - } - - var docCommentText = ""; - var prevPos = cleanLinePos.start; - for (var i = line.indexOf("@", cleanLinePos.start); 0 <= i && i < cleanLinePos.end; i = line.indexOf("@", i + 1)) { - var wasInParamtag = inParamTag; - - if (line.indexOf("param", i + 1) === i + 1 && this.isSpaceChar(line, i + 6)) { - if (!wasInParamtag) { - docCommentText += line.substring(prevPos, i); - } - - prevPos = i; - inParamTag = true; - } else if (wasInParamtag) { - prevPos = i; - inParamTag = false; - } - } - - if (!inParamTag) { - docCommentText += line.substring(prevPos, cleanLinePos.end); - } - - var newCleanPos = this.cleanDocCommentLine(docCommentText, false); - if (newCleanPos) { - if (spacesToRemove === undefined) { - spacesToRemove = cleanLinePos.jsDocSpacesRemoved; - } - docCommentLines.push(docCommentText); - } - } - - return docCommentLines.join("\n"); - }; - - PullSymbol.prototype.consumeLeadingSpace = function (line, startIndex, maxSpacesToRemove) { - var endIndex = line.length; - if (maxSpacesToRemove !== undefined) { - endIndex = TypeScript.MathPrototype.min(startIndex + maxSpacesToRemove, endIndex); - } - - for (; startIndex < endIndex; startIndex++) { - var charCode = line.charCodeAt(startIndex); - if (charCode !== 32 /* space */ && charCode !== 9 /* tab */) { - return startIndex; - } - } - - if (endIndex !== line.length) { - return endIndex; - } - - return -1; - }; - - PullSymbol.prototype.isSpaceChar = function (line, index) { - var length = line.length; - if (index < length) { - var charCode = line.charCodeAt(index); - - return charCode === 32 /* space */ || charCode === 9 /* tab */; - } - - return index === length; - }; - - PullSymbol.prototype.cleanDocCommentLine = function (line, jsDocStyleComment, jsDocLineSpaceToRemove) { - var nonSpaceIndex = this.consumeLeadingSpace(line, 0); - if (nonSpaceIndex !== -1) { - var jsDocSpacesRemoved = nonSpaceIndex; - if (jsDocStyleComment && line.charAt(nonSpaceIndex) === '*') { - var startIndex = nonSpaceIndex + 1; - nonSpaceIndex = this.consumeLeadingSpace(line, startIndex, jsDocLineSpaceToRemove); - - if (nonSpaceIndex !== -1) { - jsDocSpacesRemoved = nonSpaceIndex - startIndex; - } else { - return null; - } - } - - return { - start: nonSpaceIndex, - end: line.charAt(line.length - 1) === "\r" ? line.length - 1 : line.length, - jsDocSpacesRemoved: jsDocSpacesRemoved - }; - } - - return null; - }; - return PullSymbol; - })(); - TypeScript.PullSymbol = PullSymbol; - - - - var PullSignatureSymbol = (function (_super) { - __extends(PullSignatureSymbol, _super); - function PullSignatureSymbol(kind, _isDefinition) { - if (typeof _isDefinition === "undefined") { _isDefinition = false; } - _super.call(this, "", kind); - this._isDefinition = _isDefinition; - this._memberTypeParameterNameCache = null; - this._stringConstantOverload = undefined; - this.parameters = TypeScript.sentinelEmptyArray; - this._typeParameters = null; - this.returnType = null; - this.functionType = null; - this.hasOptionalParam = false; - this.nonOptionalParamCount = 0; - this.hasVarArgs = false; - this._allowedToReferenceTypeParameters = null; - this._instantiationCache = null; - this.hasBeenChecked = false; - this.inWrapCheck = false; - this.inWrapInfiniteExpandingReferenceCheck = false; - } - PullSignatureSymbol.prototype.isDefinition = function () { - return this._isDefinition; - }; - - PullSignatureSymbol.prototype.isGeneric = function () { - var typeParameters = this.getTypeParameters(); - return !!typeParameters && typeParameters.length !== 0; - }; - - PullSignatureSymbol.prototype.addParameter = function (parameter, isOptional) { - if (typeof isOptional === "undefined") { isOptional = false; } - if (this.parameters === TypeScript.sentinelEmptyArray) { - this.parameters = []; - } - - this.parameters[this.parameters.length] = parameter; - this.hasOptionalParam = isOptional; - - if (!parameter.getEnclosingSignature()) { - parameter.setEnclosingSignature(this); - } - - if (!isOptional) { - this.nonOptionalParamCount++; - } - }; - - PullSignatureSymbol.prototype.addTypeParameter = function (typeParameter) { - if (!this._typeParameters) { - this._typeParameters = []; - } - - if (!this._memberTypeParameterNameCache) { - this._memberTypeParameterNameCache = TypeScript.createIntrinsicsObject(); - } - - this._typeParameters[this._typeParameters.length] = typeParameter; - - this._memberTypeParameterNameCache[typeParameter.getName()] = typeParameter; - }; - - PullSignatureSymbol.prototype.addTypeParametersFromReturnType = function () { - var typeParameters = this.returnType.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - this.addTypeParameter(typeParameters[i]); - } - }; - - PullSignatureSymbol.prototype.getTypeParameters = function () { - if (!this._typeParameters) { - this._typeParameters = []; - } - - return this._typeParameters; - }; - - PullSignatureSymbol.prototype.findTypeParameter = function (name) { - var memberSymbol; - - if (!this._memberTypeParameterNameCache) { - this._memberTypeParameterNameCache = TypeScript.createIntrinsicsObject(); - - for (var i = 0; i < this.getTypeParameters().length; i++) { - this._memberTypeParameterNameCache[this._typeParameters[i].getName()] = this._typeParameters[i]; - } - } - - memberSymbol = this._memberTypeParameterNameCache[name]; - - return memberSymbol; - }; - - PullSignatureSymbol.prototype.getTypeParameterArgumentMap = function () { - return null; - }; - - PullSignatureSymbol.prototype.getAllowedToReferenceTypeParameters = function () { - TypeScript.Debug.assert(this.getRootSymbol() == this); - if (!this._allowedToReferenceTypeParameters) { - this._allowedToReferenceTypeParameters = TypeScript.PullInstantiationHelpers.getAllowedToReferenceTypeParametersFromDecl(this.getDeclarations()[0]); - } - - return this._allowedToReferenceTypeParameters; - }; - - PullSignatureSymbol.prototype.addSpecialization = function (specializedVersionOfThisSignature, typeArgumentMap) { - TypeScript.Debug.assert(this.getRootSymbol() == this); - if (!this._instantiationCache) { - this._instantiationCache = TypeScript.createIntrinsicsObject(); - } - - this._instantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)] = specializedVersionOfThisSignature; - }; - - PullSignatureSymbol.prototype.getSpecialization = function (typeArgumentMap) { - TypeScript.Debug.assert(this.getRootSymbol() == this); - if (!this._instantiationCache) { - return null; - } - - var result = this._instantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)]; - return result || null; - }; - - PullSignatureSymbol.prototype.isStringConstantOverloadSignature = function () { - if (this._stringConstantOverload === undefined) { - var params = this.parameters; - this._stringConstantOverload = false; - for (var i = 0; i < params.length; i++) { - var paramType = params[i].type; - if (paramType && paramType.isPrimitive() && paramType.isStringConstant()) { - this._stringConstantOverload = true; - } - } - } - - return this._stringConstantOverload; - }; - - PullSignatureSymbol.prototype.getParameterTypeAtIndex = function (iParam) { - if (iParam < this.parameters.length - 1 || (iParam < this.parameters.length && !this.hasVarArgs)) { - return this.parameters[iParam].type; - } else if (this.hasVarArgs) { - var paramType = this.parameters[this.parameters.length - 1].type; - if (paramType.isArrayNamedTypeReference()) { - paramType = paramType.getElementType(); - } - return paramType; - } - - return null; - }; - - PullSignatureSymbol.getSignatureTypeMemberName = function (candidateSignature, signatures, scopeSymbol) { - var allMemberNames = new TypeScript.MemberNameArray(); - var signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(signatures, "", false, false, scopeSymbol, true, candidateSignature); - allMemberNames.addAll(signatureMemberName); - return allMemberNames; - }; - - PullSignatureSymbol.getSignaturesTypeNameEx = function (signatures, prefix, shortform, brackets, scopeSymbol, getPrettyTypeName, candidateSignature) { - var result = []; - if (!signatures) { - return result; - } - - var len = signatures.length; - if (!getPrettyTypeName && len > 1) { - shortform = false; - } - - var foundDefinition = false; - if (candidateSignature && candidateSignature.isDefinition() && len > 1) { - candidateSignature = null; - } - - for (var i = 0; i < len; i++) { - if (len > 1 && signatures[i].isDefinition()) { - foundDefinition = true; - continue; - } - - var signature = signatures[i]; - if (getPrettyTypeName && candidateSignature) { - signature = candidateSignature; - } - - result.push(signature.getSignatureTypeNameEx(prefix, shortform, brackets, scopeSymbol)); - if (getPrettyTypeName) { - break; - } - } - - if (getPrettyTypeName && result.length && len > 1) { - var lastMemberName = result[result.length - 1]; - for (var i = i + 1; i < len; i++) { - if (signatures[i].isDefinition()) { - foundDefinition = true; - break; - } - } - var overloadString = TypeScript.getLocalizedText(TypeScript.DiagnosticCode._0_overload_s, [foundDefinition ? len - 2 : len - 1]); - lastMemberName.add(TypeScript.MemberName.create(overloadString)); - } - - return result; - }; - - PullSignatureSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - var s = this.getSignatureTypeNameEx(this.getScopedNameEx().toString(), false, false, scopeSymbol, undefined, useConstraintInName).toString(); - return s; - }; - - PullSignatureSymbol.prototype.getSignatureTypeNameEx = function (prefix, shortform, brackets, scopeSymbol, getParamMarkerInfo, getTypeParamMarkerInfo) { - var typeParamterBuilder = new TypeScript.MemberNameArray(); - - typeParamterBuilder.add(PullSymbol.getTypeParameterStringEx(this.getTypeParameters(), scopeSymbol, getTypeParamMarkerInfo, true)); - - if (brackets) { - typeParamterBuilder.add(TypeScript.MemberName.create("[")); - } else { - typeParamterBuilder.add(TypeScript.MemberName.create("(")); - } - - var builder = new TypeScript.MemberNameArray(); - builder.prefix = prefix; - - if (getTypeParamMarkerInfo) { - builder.prefix = prefix; - builder.addAll(typeParamterBuilder.entries); - } else { - builder.prefix = prefix + typeParamterBuilder.toString(); - } - - var params = this.parameters; - var paramLen = params.length; - for (var i = 0; i < paramLen; i++) { - var paramType = params[i].type; - var typeString = paramType ? ": " : ""; - var paramIsVarArg = params[i].isVarArg; - var varArgPrefix = paramIsVarArg ? "..." : ""; - var optionalString = (!paramIsVarArg && params[i].isOptional) ? "?" : ""; - if (getParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - builder.add(TypeScript.MemberName.create(varArgPrefix + params[i].getScopedNameEx(scopeSymbol).toString() + optionalString + typeString)); - if (paramType) { - builder.add(paramType.getScopedNameEx(scopeSymbol)); - } - if (getParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - if (i < paramLen - 1) { - builder.add(TypeScript.MemberName.create(", ")); - } - } - - if (shortform) { - if (brackets) { - builder.add(TypeScript.MemberName.create("] => ")); - } else { - builder.add(TypeScript.MemberName.create(") => ")); - } - } else { - if (brackets) { - builder.add(TypeScript.MemberName.create("]: ")); - } else { - builder.add(TypeScript.MemberName.create("): ")); - } - } - - if (this.returnType) { - builder.add(this.returnType.getScopedNameEx(scopeSymbol)); - } else { - builder.add(TypeScript.MemberName.create("any")); - } - - return builder; - }; - - PullSignatureSymbol.prototype.forAllParameterTypes = function (length, predicate) { - if (this.parameters.length < length && !this.hasVarArgs) { - length = this.parameters.length; - } - - for (var i = 0; i < length; i++) { - var paramType = this.getParameterTypeAtIndex(i); - if (!predicate(paramType, i)) { - return false; - } - } - - return true; - }; - - PullSignatureSymbol.prototype.forAllCorrespondingParameterTypesInThisAndOtherSignature = function (otherSignature, predicate) { - var length; - if (this.hasVarArgs) { - length = otherSignature.hasVarArgs ? Math.max(this.parameters.length, otherSignature.parameters.length) : otherSignature.parameters.length; - } else { - length = otherSignature.hasVarArgs ? this.parameters.length : Math.min(this.parameters.length, otherSignature.parameters.length); - } - - for (var i = 0; i < length; i++) { - var thisParamType = this.getParameterTypeAtIndex(i); - var otherParamType = otherSignature.getParameterTypeAtIndex(i); - if (!predicate(thisParamType, otherParamType, i)) { - return false; - } - } - - return true; - }; - - PullSignatureSymbol.prototype.wrapsSomeTypeParameter = function (typeParameterArgumentMap) { - return this.getWrappingTypeParameterID(typeParameterArgumentMap) !== 0; - }; - - PullSignatureSymbol.prototype.getWrappingTypeParameterID = function (typeParameterArgumentMap) { - var signature = this; - if (signature.inWrapCheck) { - return 0; - } - - this._wrapsTypeParameterCache = this._wrapsTypeParameterCache || new TypeScript.WrapsTypeParameterCache(); - - var wrappingTypeParameterID = this._wrapsTypeParameterCache.getWrapsTypeParameter(typeParameterArgumentMap); - if (wrappingTypeParameterID === undefined) { - wrappingTypeParameterID = this.getWrappingTypeParameterIDWorker(typeParameterArgumentMap); - this._wrapsTypeParameterCache.setWrapsTypeParameter(typeParameterArgumentMap, wrappingTypeParameterID); - } - - return wrappingTypeParameterID; - }; - - PullSignatureSymbol.prototype.getWrappingTypeParameterIDWorker = function (typeParameterArgumentMap) { - var signature = this; - signature.inWrapCheck = true; - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(signature); - var wrappingTypeParameterID = signature.returnType ? signature.returnType.getWrappingTypeParameterID(typeParameterArgumentMap) : 0; - - var parameters = signature.parameters; - for (var i = 0; !wrappingTypeParameterID && i < parameters.length; i++) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(parameters[i]); - wrappingTypeParameterID = parameters[i].type.getWrappingTypeParameterID(typeParameterArgumentMap); - } - - signature.inWrapCheck = false; - - return wrappingTypeParameterID; - }; - - PullSignatureSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference = function (enclosingType, knownWrapMap) { - var wrapsIntoInfinitelyExpandingTypeReference = knownWrapMap.valueAt(this.pullSymbolID, enclosingType.pullSymbolID); - if (wrapsIntoInfinitelyExpandingTypeReference != undefined) { - return wrapsIntoInfinitelyExpandingTypeReference; - } - - if (this.inWrapInfiniteExpandingReferenceCheck) { - return false; - } - - this.inWrapInfiniteExpandingReferenceCheck = true; - wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker(enclosingType, knownWrapMap); - knownWrapMap.setValueAt(this.pullSymbolID, enclosingType.pullSymbolID, wrapsIntoInfinitelyExpandingTypeReference); - this.inWrapInfiniteExpandingReferenceCheck = false; - - return wrapsIntoInfinitelyExpandingTypeReference; - }; - - PullSignatureSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker = function (enclosingType, knownWrapMap) { - if (this.returnType && this.returnType._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap)) { - return true; - } - - var parameters = this.parameters; - - for (var i = 0; i < parameters.length; i++) { - if (parameters[i].type && parameters[i].type._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap)) { - return true; - } - } - - return false; - }; - return PullSignatureSymbol; - })(PullSymbol); - TypeScript.PullSignatureSymbol = PullSignatureSymbol; - - var PullTypeSymbol = (function (_super) { - __extends(PullTypeSymbol, _super); - function PullTypeSymbol(name, kind) { - _super.call(this, name, kind); - this._members = TypeScript.sentinelEmptyArray; - this._enclosedMemberTypes = null; - this._enclosedMemberContainers = null; - this._typeParameters = null; - this._allowedToReferenceTypeParameters = null; - this._specializedVersionsOfThisType = null; - this._arrayVersionOfThisType = null; - this._implementedTypes = null; - this._extendedTypes = null; - this._typesThatExplicitlyImplementThisType = null; - this._typesThatExtendThisType = null; - this._callSignatures = null; - this._allCallSignatures = null; - this._constructSignatures = null; - this._allConstructSignatures = null; - this._indexSignatures = null; - this._allIndexSignatures = null; - this._allIndexSignaturesOfAugmentedType = null; - this._memberNameCache = null; - this._enclosedTypeNameCache = null; - this._enclosedContainerCache = null; - this._typeParameterNameCache = null; - this._containedNonMemberNameCache = null; - this._containedNonMemberTypeNameCache = null; - this._containedNonMemberContainerCache = null; - this._simpleInstantiationCache = null; - this._complexInstantiationCache = null; - this._hasGenericSignature = false; - this._hasGenericMember = false; - this._hasBaseTypeConflict = false; - this._knownBaseTypeCount = 0; - this._associatedContainerTypeSymbol = null; - this._constructorMethod = null; - this._hasDefaultConstructor = false; - this._functionSymbol = null; - this._inMemberTypeNameEx = false; - this.inSymbolPrivacyCheck = false; - this.inWrapCheck = false; - this.inWrapInfiniteExpandingReferenceCheck = false; - this.typeReference = null; - this._widenedType = null; - this._isArrayNamedTypeReference = undefined; - this.type = this; - } - PullTypeSymbol.prototype.isArrayNamedTypeReference = function () { - if (this._isArrayNamedTypeReference === undefined) { - this._isArrayNamedTypeReference = this.computeIsArrayNamedTypeReference(); - } - - return this._isArrayNamedTypeReference; - }; - - PullTypeSymbol.prototype.computeIsArrayNamedTypeReference = function () { - var typeArgs = this.getTypeArguments(); - if (typeArgs && this.getTypeArguments().length === 1 && this.name === "Array") { - var declaration = this.getDeclarations()[0]; - - if (declaration && declaration.getParentDecl() && declaration.getParentDecl().getParentDecl() === null) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype.isType = function () { - return true; - }; - PullTypeSymbol.prototype.isClass = function () { - return this.kind === 8 /* Class */ || (this._constructorMethod !== null); - }; - PullTypeSymbol.prototype.isFunction = function () { - return (this.kind & (33554432 /* ConstructorType */ | 16777216 /* FunctionType */)) !== 0; - }; - PullTypeSymbol.prototype.isConstructor = function () { - return this.kind === 33554432 /* ConstructorType */ || (this._associatedContainerTypeSymbol && this._associatedContainerTypeSymbol.isClass()); - }; - PullTypeSymbol.prototype.isTypeParameter = function () { - return false; - }; - PullTypeSymbol.prototype.isTypeVariable = function () { - return false; - }; - PullTypeSymbol.prototype.isError = function () { - return false; - }; - PullTypeSymbol.prototype.isEnum = function () { - return this.kind === 64 /* Enum */; - }; - - PullTypeSymbol.prototype.getTypeParameterArgumentMap = function () { - return null; - }; - - PullTypeSymbol.prototype.isObject = function () { - return TypeScript.hasFlag(this.kind, 8 /* Class */ | 33554432 /* ConstructorType */ | 64 /* Enum */ | 16777216 /* FunctionType */ | 16 /* Interface */ | 8388608 /* ObjectType */ | 256 /* ObjectLiteral */); - }; - - PullTypeSymbol.prototype.isFunctionType = function () { - return this.getCallSignatures().length > 0 || this.getConstructSignatures().length > 0; - }; - - PullTypeSymbol.prototype.getKnownBaseTypeCount = function () { - return this._knownBaseTypeCount; - }; - PullTypeSymbol.prototype.resetKnownBaseTypeCount = function () { - this._knownBaseTypeCount = 0; - }; - PullTypeSymbol.prototype.incrementKnownBaseCount = function () { - this._knownBaseTypeCount++; - }; - - PullTypeSymbol.prototype.setHasBaseTypeConflict = function () { - this._hasBaseTypeConflict = true; - }; - PullTypeSymbol.prototype.hasBaseTypeConflict = function () { - return this._hasBaseTypeConflict; - }; - - PullTypeSymbol.prototype.hasMembers = function () { - if (this._members !== TypeScript.sentinelEmptyArray) { - return true; - } - - var parents = this.getExtendedTypes(); - - for (var i = 0; i < parents.length; i++) { - if (parents[i].hasMembers()) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype.setHasGenericSignature = function () { - this._hasGenericSignature = true; - }; - PullTypeSymbol.prototype.getHasGenericSignature = function () { - return this._hasGenericSignature; - }; - - PullTypeSymbol.prototype.setHasGenericMember = function () { - this._hasGenericMember = true; - }; - PullTypeSymbol.prototype.getHasGenericMember = function () { - return this._hasGenericMember; - }; - - PullTypeSymbol.prototype.setAssociatedContainerType = function (type) { - this._associatedContainerTypeSymbol = type; - }; - - PullTypeSymbol.prototype.getAssociatedContainerType = function () { - return this._associatedContainerTypeSymbol; - }; - - PullTypeSymbol.prototype.getArrayType = function () { - return this._arrayVersionOfThisType; - }; - - PullTypeSymbol.prototype.getElementType = function () { - return null; - }; - - PullTypeSymbol.prototype.setArrayType = function (arrayType) { - this._arrayVersionOfThisType = arrayType; - }; - - PullTypeSymbol.prototype.getFunctionSymbol = function () { - return this._functionSymbol; - }; - - PullTypeSymbol.prototype.setFunctionSymbol = function (symbol) { - if (symbol) { - this._functionSymbol = symbol; - } - }; - - PullTypeSymbol.prototype.findContainedNonMember = function (name) { - if (!this._containedNonMemberNameCache) { - return null; - } - - return this._containedNonMemberNameCache[name]; - }; - - PullTypeSymbol.prototype.findContainedNonMemberType = function (typeName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - if (!this._containedNonMemberTypeNameCache) { - return null; - } - - var nonMemberSymbol = this._containedNonMemberTypeNameCache[typeName]; - - if (nonMemberSymbol && kind !== 0 /* None */) { - nonMemberSymbol = TypeScript.hasFlag(nonMemberSymbol.kind, kind) ? nonMemberSymbol : null; - } - - return nonMemberSymbol; - }; - - PullTypeSymbol.prototype.findContainedNonMemberContainer = function (containerName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - if (!this._containedNonMemberContainerCache) { - return null; - } - - var nonMemberSymbol = this._containedNonMemberContainerCache[containerName]; - - if (nonMemberSymbol && kind !== 0 /* None */) { - nonMemberSymbol = TypeScript.hasFlag(nonMemberSymbol.kind, kind) ? nonMemberSymbol : null; - } - - return nonMemberSymbol; - }; - - PullTypeSymbol.prototype.addMember = function (memberSymbol) { - if (!memberSymbol) { - return; - } - - memberSymbol.setContainer(this); - - if (!this._memberNameCache) { - this._memberNameCache = TypeScript.createIntrinsicsObject(); - } - - if (this._members === TypeScript.sentinelEmptyArray) { - this._members = []; - } - - this._members.push(memberSymbol); - this._memberNameCache[memberSymbol.name] = memberSymbol; - }; - - PullTypeSymbol.prototype.addEnclosedMemberType = function (enclosedType) { - if (!enclosedType) { - return; - } - - enclosedType.setContainer(this); - - if (!this._enclosedTypeNameCache) { - this._enclosedTypeNameCache = TypeScript.createIntrinsicsObject(); - } - - if (!this._enclosedMemberTypes) { - this._enclosedMemberTypes = []; - } - - this._enclosedMemberTypes[this._enclosedMemberTypes.length] = enclosedType; - this._enclosedTypeNameCache[enclosedType.name] = enclosedType; - }; - - PullTypeSymbol.prototype.addEnclosedMemberContainer = function (enclosedContainer) { - if (!enclosedContainer) { - return; - } - - enclosedContainer.setContainer(this); - - if (!this._enclosedContainerCache) { - this._enclosedContainerCache = TypeScript.createIntrinsicsObject(); - } - - if (!this._enclosedMemberContainers) { - this._enclosedMemberContainers = []; - } - - this._enclosedMemberContainers[this._enclosedMemberContainers.length] = enclosedContainer; - this._enclosedContainerCache[enclosedContainer.name] = enclosedContainer; - }; - - PullTypeSymbol.prototype.addEnclosedNonMember = function (enclosedNonMember) { - if (!enclosedNonMember) { - return; - } - - enclosedNonMember.setContainer(this); - - if (!this._containedNonMemberNameCache) { - this._containedNonMemberNameCache = TypeScript.createIntrinsicsObject(); - } - - this._containedNonMemberNameCache[enclosedNonMember.name] = enclosedNonMember; - }; - - PullTypeSymbol.prototype.addEnclosedNonMemberType = function (enclosedNonMemberType) { - if (!enclosedNonMemberType) { - return; - } - - enclosedNonMemberType.setContainer(this); - - if (!this._containedNonMemberTypeNameCache) { - this._containedNonMemberTypeNameCache = TypeScript.createIntrinsicsObject(); - } - - this._containedNonMemberTypeNameCache[enclosedNonMemberType.name] = enclosedNonMemberType; - }; - - PullTypeSymbol.prototype.addEnclosedNonMemberContainer = function (enclosedNonMemberContainer) { - if (!enclosedNonMemberContainer) { - return; - } - - enclosedNonMemberContainer.setContainer(this); - - if (!this._containedNonMemberContainerCache) { - this._containedNonMemberContainerCache = TypeScript.createIntrinsicsObject(); - } - - this._containedNonMemberContainerCache[enclosedNonMemberContainer.name] = enclosedNonMemberContainer; - }; - - PullTypeSymbol.prototype.addTypeParameter = function (typeParameter) { - if (!typeParameter) { - return; - } - - if (!typeParameter.getContainer()) { - typeParameter.setContainer(this); - } - - if (!this._typeParameterNameCache) { - this._typeParameterNameCache = TypeScript.createIntrinsicsObject(); - } - - if (!this._typeParameters) { - this._typeParameters = []; - } - - this._typeParameters[this._typeParameters.length] = typeParameter; - this._typeParameterNameCache[typeParameter.getName()] = typeParameter; - }; - - PullTypeSymbol.prototype.getMembers = function () { - return this._members; - }; - - PullTypeSymbol.prototype.setHasDefaultConstructor = function (hasOne) { - if (typeof hasOne === "undefined") { hasOne = true; } - this._hasDefaultConstructor = hasOne; - }; - - PullTypeSymbol.prototype.getHasDefaultConstructor = function () { - return this._hasDefaultConstructor; - }; - - PullTypeSymbol.prototype.getConstructorMethod = function () { - return this._constructorMethod; - }; - - PullTypeSymbol.prototype.setConstructorMethod = function (constructorMethod) { - this._constructorMethod = constructorMethod; - }; - - PullTypeSymbol.prototype.getTypeParameters = function () { - if (!this._typeParameters) { - return TypeScript.sentinelEmptyArray; - } - - return this._typeParameters; - }; - - PullTypeSymbol.prototype.getAllowedToReferenceTypeParameters = function () { - if (!!(this.kind && 8216 /* SomeInstantiatableType */) && this.isNamedTypeSymbol() && !this.isTypeParameter()) { - return this.getTypeParameters(); - } - - if (!this._allowedToReferenceTypeParameters) { - this._allowedToReferenceTypeParameters = TypeScript.PullInstantiationHelpers.getAllowedToReferenceTypeParametersFromDecl(this.getDeclarations()[0]); - } - - return this._allowedToReferenceTypeParameters; - }; - - PullTypeSymbol.prototype.isGeneric = function () { - return (this._typeParameters && this._typeParameters.length > 0) || this._hasGenericSignature || this._hasGenericMember || this.isArrayNamedTypeReference(); - }; - - PullTypeSymbol.prototype.canUseSimpleInstantiationCache = function (typeArgumentMap) { - if (this.isTypeParameter()) { - return true; - } - - var typeParameters = this.getTypeParameters(); - return typeArgumentMap && this.isNamedTypeSymbol() && typeParameters.length === 1 && typeArgumentMap[typeParameters[0].pullSymbolID].kind !== 8388608 /* ObjectType */; - }; - - PullTypeSymbol.prototype.getSimpleInstantiationCacheId = function (typeArgumentMap) { - if (this.isTypeParameter()) { - return typeArgumentMap[0].pullSymbolID; - } - - return typeArgumentMap[this.getTypeParameters()[0].pullSymbolID].pullSymbolID; - }; - - PullTypeSymbol.prototype.addSpecialization = function (specializedVersionOfThisType, typeArgumentMap) { - if (this.canUseSimpleInstantiationCache(typeArgumentMap)) { - if (!this._simpleInstantiationCache) { - this._simpleInstantiationCache = []; - } - - this._simpleInstantiationCache[this.getSimpleInstantiationCacheId(typeArgumentMap)] = specializedVersionOfThisType; - } else { - if (!this._complexInstantiationCache) { - this._complexInstantiationCache = TypeScript.createIntrinsicsObject(); - } - - this._complexInstantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)] = specializedVersionOfThisType; - } - - if (!this._specializedVersionsOfThisType) { - this._specializedVersionsOfThisType = []; - } - - this._specializedVersionsOfThisType.push(specializedVersionOfThisType); - }; - - PullTypeSymbol.prototype.getSpecialization = function (typeArgumentMap) { - if (this.canUseSimpleInstantiationCache(typeArgumentMap)) { - if (!this._simpleInstantiationCache) { - return null; - } - - var result = this._simpleInstantiationCache[this.getSimpleInstantiationCacheId(typeArgumentMap)]; - return result || null; - } else { - if (!this._complexInstantiationCache) { - return null; - } - - if (this.getAllowedToReferenceTypeParameters().length == 0) { - return this; - } - - var result = this._complexInstantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)]; - return result || null; - } - }; - - PullTypeSymbol.prototype.getKnownSpecializations = function () { - if (!this._specializedVersionsOfThisType) { - return TypeScript.sentinelEmptyArray; - } - - return this._specializedVersionsOfThisType; - }; - - PullTypeSymbol.prototype.getTypeArguments = function () { - return null; - }; - - PullTypeSymbol.prototype.getTypeArgumentsOrTypeParameters = function () { - return this.getTypeParameters(); - }; - - PullTypeSymbol.prototype.addCallOrConstructSignaturePrerequisiteBase = function (signature) { - if (signature.isGeneric()) { - this._hasGenericSignature = true; - } - - signature.functionType = this; - }; - - PullTypeSymbol.prototype.addCallSignaturePrerequisite = function (callSignature) { - if (!this._callSignatures) { - this._callSignatures = []; - } - - this.addCallOrConstructSignaturePrerequisiteBase(callSignature); - }; - - PullTypeSymbol.prototype.appendCallSignature = function (callSignature) { - this.addCallSignaturePrerequisite(callSignature); - this._callSignatures.push(callSignature); - }; - - PullTypeSymbol.prototype.insertCallSignatureAtIndex = function (callSignature, index) { - this.addCallSignaturePrerequisite(callSignature); - TypeScript.Debug.assert(index <= this._callSignatures.length); - if (index === this._callSignatures.length) { - this._callSignatures.push(callSignature); - } else { - this._callSignatures.splice(index, 0, callSignature); - } - }; - - PullTypeSymbol.prototype.addConstructSignaturePrerequisite = function (constructSignature) { - if (!this._constructSignatures) { - this._constructSignatures = []; - } - - this.addCallOrConstructSignaturePrerequisiteBase(constructSignature); - }; - - PullTypeSymbol.prototype.appendConstructSignature = function (constructSignature) { - this.addConstructSignaturePrerequisite(constructSignature); - this._constructSignatures.push(constructSignature); - }; - - PullTypeSymbol.prototype.insertConstructSignatureAtIndex = function (constructSignature, index) { - this.addConstructSignaturePrerequisite(constructSignature); - TypeScript.Debug.assert(index <= this._constructSignatures.length); - if (index === this._constructSignatures.length) { - this._constructSignatures.push(constructSignature); - } else { - this._constructSignatures.splice(index, 0, constructSignature); - } - }; - - PullTypeSymbol.prototype.addIndexSignature = function (indexSignature) { - if (!this._indexSignatures) { - this._indexSignatures = []; - } - - this._indexSignatures[this._indexSignatures.length] = indexSignature; - - if (indexSignature.isGeneric()) { - this._hasGenericSignature = true; - } - - indexSignature.functionType = this; - }; - - PullTypeSymbol.prototype.hasOwnCallSignatures = function () { - return this._callSignatures !== null; - }; - - PullTypeSymbol.prototype.getOwnCallSignatures = function () { - return this._callSignatures || TypeScript.sentinelEmptyArray; - }; - - PullTypeSymbol.prototype.getCallSignatures = function () { - if (this._allCallSignatures) { - return this._allCallSignatures; - } - - var signatures = []; - - if (this._callSignatures) { - signatures = signatures.concat(this._callSignatures); - } - - if (this._extendedTypes && this.kind === 16 /* Interface */) { - for (var i = 0; i < this._extendedTypes.length; i++) { - if (this._extendedTypes[i].hasBase(this)) { - continue; - } - - this._getResolver()._addUnhiddenSignaturesFromBaseType(this._callSignatures, this._extendedTypes[i].getCallSignatures(), signatures); - } - } - - this._allCallSignatures = signatures; - - return signatures; - }; - - PullTypeSymbol.prototype.hasOwnConstructSignatures = function () { - return this._constructSignatures !== null; - }; - - PullTypeSymbol.prototype.getOwnDeclaredConstructSignatures = function () { - return this._constructSignatures || TypeScript.sentinelEmptyArray; - }; - - PullTypeSymbol.prototype.getConstructSignatures = function () { - if (this._allConstructSignatures) { - return this._allConstructSignatures; - } - - var signatures = []; - - if (this._constructSignatures) { - signatures = signatures.concat(this._constructSignatures); - } else if (this.isConstructor()) { - if (this._extendedTypes && this._extendedTypes.length > 0) { - signatures = this.getBaseClassConstructSignatures(this._extendedTypes[0]); - } else { - signatures = [this.getDefaultClassConstructSignature()]; - } - } - - if (this._extendedTypes && this.kind === 16 /* Interface */) { - for (var i = 0; i < this._extendedTypes.length; i++) { - if (this._extendedTypes[i].hasBase(this)) { - continue; - } - - this._getResolver()._addUnhiddenSignaturesFromBaseType(this._constructSignatures, this._extendedTypes[i].getConstructSignatures(), signatures); - } - } - - this._allConstructSignatures = signatures; - - return signatures; - }; - - PullTypeSymbol.prototype.hasOwnIndexSignatures = function () { - return this._indexSignatures !== null; - }; - - PullTypeSymbol.prototype.getOwnIndexSignatures = function () { - return this._indexSignatures || TypeScript.sentinelEmptyArray; - }; - - PullTypeSymbol.prototype.getIndexSignatures = function () { - if (this._allIndexSignatures) { - return this._allIndexSignatures; - } - - var signatures = []; - - if (this._indexSignatures) { - signatures = signatures.concat(this._indexSignatures); - } - - if (this._extendedTypes) { - for (var i = 0; i < this._extendedTypes.length; i++) { - if (this._extendedTypes[i].hasBase(this)) { - continue; - } - - this._getResolver()._addUnhiddenSignaturesFromBaseType(this._indexSignatures, this._extendedTypes[i].getIndexSignatures(), signatures); - } - } - - this._allIndexSignatures = signatures; - - return signatures; - }; - - PullTypeSymbol.prototype.getIndexSignaturesOfAugmentedType = function (resolver, globalFunctionInterface, globalObjectInterface) { - if (!this._allIndexSignaturesOfAugmentedType) { - var initialIndexSignatures = this.getIndexSignatures(); - var shouldAddFunctionSignatures = false; - var shouldAddObjectSignatures = false; - - if (globalFunctionInterface && this.isFunctionType() && this !== globalFunctionInterface) { - var functionIndexSignatures = globalFunctionInterface.getIndexSignatures(); - if (functionIndexSignatures.length) { - shouldAddFunctionSignatures = true; - } - } - - if (globalObjectInterface && this !== globalObjectInterface) { - var objectIndexSignatures = globalObjectInterface.getIndexSignatures(); - if (objectIndexSignatures.length) { - shouldAddObjectSignatures = true; - } - } - - if (shouldAddFunctionSignatures || shouldAddObjectSignatures) { - this._allIndexSignaturesOfAugmentedType = initialIndexSignatures.slice(0); - if (shouldAddFunctionSignatures) { - resolver._addUnhiddenSignaturesFromBaseType(initialIndexSignatures, functionIndexSignatures, this._allIndexSignaturesOfAugmentedType); - } - if (shouldAddObjectSignatures) { - if (shouldAddFunctionSignatures) { - initialIndexSignatures = initialIndexSignatures.concat(functionIndexSignatures); - } - resolver._addUnhiddenSignaturesFromBaseType(initialIndexSignatures, objectIndexSignatures, this._allIndexSignaturesOfAugmentedType); - } - } else { - this._allIndexSignaturesOfAugmentedType = initialIndexSignatures; - } - } - - return this._allIndexSignaturesOfAugmentedType; - }; - - PullTypeSymbol.prototype.getBaseClassConstructSignatures = function (baseType) { - TypeScript.Debug.assert(this.isConstructor() && baseType.isConstructor()); - var instanceTypeSymbol = this.getAssociatedContainerType(); - TypeScript.Debug.assert(instanceTypeSymbol.getDeclarations().length === 1); - if (baseType.hasBase(this)) { - return null; - } - - var baseConstructSignatures = baseType.getConstructSignatures(); - var signatures = []; - for (var i = 0; i < baseConstructSignatures.length; i++) { - var baseSignature = baseConstructSignatures[i]; - - baseSignature._resolveDeclaredSymbol(); - var currentSignature = new PullSignatureSymbol(2097152 /* ConstructSignature */, baseSignature.isDefinition()); - currentSignature.returnType = instanceTypeSymbol; - currentSignature.addTypeParametersFromReturnType(); - for (var j = 0; j < baseSignature.parameters.length; j++) { - currentSignature.addParameter(baseSignature.parameters[j], baseSignature.parameters[j].isOptional); - } - if (baseSignature.parameters.length > 0) { - currentSignature.hasVarArgs = baseSignature.parameters[baseSignature.parameters.length - 1].isVarArg; - } - - currentSignature.addDeclaration(instanceTypeSymbol.getDeclarations()[0]); - this.addCallOrConstructSignaturePrerequisiteBase(currentSignature); - signatures.push(currentSignature); - } - - return signatures; - }; - - PullTypeSymbol.prototype.getDefaultClassConstructSignature = function () { - TypeScript.Debug.assert(this.isConstructor()); - var instanceTypeSymbol = this.getAssociatedContainerType(); - TypeScript.Debug.assert(instanceTypeSymbol.getDeclarations().length == 1); - var signature = new PullSignatureSymbol(2097152 /* ConstructSignature */, true); - signature.returnType = instanceTypeSymbol; - signature.addTypeParametersFromReturnType(); - signature.addDeclaration(instanceTypeSymbol.getDeclarations()[0]); - this.addCallOrConstructSignaturePrerequisiteBase(signature); - - return signature; - }; - - PullTypeSymbol.prototype.addImplementedType = function (implementedType) { - if (!implementedType) { - return; - } - - if (!this._implementedTypes) { - this._implementedTypes = []; - } - - this._implementedTypes[this._implementedTypes.length] = implementedType; - - implementedType.addTypeThatExplicitlyImplementsThisType(this); - }; - - PullTypeSymbol.prototype.getImplementedTypes = function () { - if (!this._implementedTypes) { - return TypeScript.sentinelEmptyArray; - } - - return this._implementedTypes; - }; - - PullTypeSymbol.prototype.addExtendedType = function (extendedType) { - if (!extendedType) { - return; - } - - if (!this._extendedTypes) { - this._extendedTypes = []; - } - - this._extendedTypes[this._extendedTypes.length] = extendedType; - - extendedType.addTypeThatExtendsThisType(this); - }; - - PullTypeSymbol.prototype.getExtendedTypes = function () { - if (!this._extendedTypes) { - return TypeScript.sentinelEmptyArray; - } - - return this._extendedTypes; - }; - - PullTypeSymbol.prototype.addTypeThatExtendsThisType = function (type) { - if (!type) { - return; - } - - if (!this._typesThatExtendThisType) { - this._typesThatExtendThisType = []; - } - - this._typesThatExtendThisType[this._typesThatExtendThisType.length] = type; - }; - - PullTypeSymbol.prototype.getTypesThatExtendThisType = function () { - if (!this._typesThatExtendThisType) { - this._typesThatExtendThisType = []; - } - - return this._typesThatExtendThisType; - }; - - PullTypeSymbol.prototype.addTypeThatExplicitlyImplementsThisType = function (type) { - if (!type) { - return; - } - - if (!this._typesThatExplicitlyImplementThisType) { - this._typesThatExplicitlyImplementThisType = []; - } - - this._typesThatExplicitlyImplementThisType[this._typesThatExplicitlyImplementThisType.length] = type; - }; - - PullTypeSymbol.prototype.getTypesThatExplicitlyImplementThisType = function () { - if (!this._typesThatExplicitlyImplementThisType) { - this._typesThatExplicitlyImplementThisType = []; - } - - return this._typesThatExplicitlyImplementThisType; - }; - - PullTypeSymbol.prototype.hasBase = function (potentialBase, visited) { - if (typeof visited === "undefined") { visited = []; } - if (this === potentialBase || this.getRootSymbol() === potentialBase || this === potentialBase.getRootSymbol()) { - return true; - } - - if (TypeScript.ArrayUtilities.contains(visited, this)) { - return true; - } - - visited.push(this); - - var extendedTypes = this.getExtendedTypes(); - - for (var i = 0; i < extendedTypes.length; i++) { - if (extendedTypes[i].hasBase(potentialBase, visited)) { - return true; - } - } - - var implementedTypes = this.getImplementedTypes(); - - for (var i = 0; i < implementedTypes.length; i++) { - if (implementedTypes[i].hasBase(potentialBase, visited)) { - return true; - } - } - - visited.pop(); - - return false; - }; - - PullTypeSymbol.prototype.isValidBaseKind = function (baseType, isExtendedType) { - if (baseType.isError()) { - return false; - } - - var thisIsClass = this.isClass(); - if (isExtendedType) { - if (thisIsClass) { - return baseType.kind === 8 /* Class */; - } - } else { - if (!thisIsClass) { - return false; - } - } - - return !!(baseType.kind & (16 /* Interface */ | 8 /* Class */)); - }; - - PullTypeSymbol.prototype.findMember = function (name, lookInParent) { - var memberSymbol = null; - - if (this._memberNameCache) { - memberSymbol = this._memberNameCache[name]; - } - - if (memberSymbol || !lookInParent) { - return memberSymbol; - } - - if (this._extendedTypes) { - for (var i = 0; i < this._extendedTypes.length; i++) { - memberSymbol = this._extendedTypes[i].findMember(name, lookInParent); - - if (memberSymbol) { - return memberSymbol; - } - } - } - - return null; - }; - - PullTypeSymbol.prototype.findNestedType = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - var memberSymbol; - - if (!this._enclosedTypeNameCache) { - return null; - } - - memberSymbol = this._enclosedTypeNameCache[name]; - - if (memberSymbol && kind !== 0 /* None */) { - memberSymbol = TypeScript.hasFlag(memberSymbol.kind, kind) ? memberSymbol : null; - } - - return memberSymbol; - }; - - PullTypeSymbol.prototype.findNestedContainer = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - var memberSymbol; - - if (!this._enclosedContainerCache) { - return null; - } - - memberSymbol = this._enclosedContainerCache[name]; - - if (memberSymbol && kind !== 0 /* None */) { - memberSymbol = TypeScript.hasFlag(memberSymbol.kind, kind) ? memberSymbol : null; - } - - return memberSymbol; - }; - - PullTypeSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisiblity) { - var allMembers = []; - - if (this._members !== TypeScript.sentinelEmptyArray) { - for (var i = 0, n = this._members.length; i < n; i++) { - var member = this._members[i]; - if ((member.kind & searchDeclKind) && (memberVisiblity !== 2 /* externallyVisible */ || !member.anyDeclHasFlag(2 /* Private */))) { - allMembers[allMembers.length] = member; - } - } - } - - if (this._extendedTypes) { - var extenedMembersVisibility = memberVisiblity !== 0 /* all */ ? 2 /* externallyVisible */ : 0 /* all */; - - for (var i = 0, n = this._extendedTypes.length; i < n; i++) { - var extendedMembers = this._extendedTypes[i].getAllMembers(searchDeclKind, extenedMembersVisibility); - - for (var j = 0, m = extendedMembers.length; j < m; j++) { - var extendedMember = extendedMembers[j]; - if (!(this._memberNameCache && this._memberNameCache[extendedMember.name])) { - allMembers[allMembers.length] = extendedMember; - } - } - } - } - - if (this.isContainer()) { - if (this._enclosedMemberTypes) { - for (var i = 0; i < this._enclosedMemberTypes.length; i++) { - allMembers[allMembers.length] = this._enclosedMemberTypes[i]; - } - } - if (this._enclosedMemberContainers) { - for (var i = 0; i < this._enclosedMemberContainers.length; i++) { - allMembers[allMembers.length] = this._enclosedMemberContainers[i]; - } - } - } - - return allMembers; - }; - - PullTypeSymbol.prototype.findTypeParameter = function (name) { - if (!this._typeParameterNameCache) { - return null; - } - - return this._typeParameterNameCache[name]; - }; - - PullTypeSymbol.prototype.setResolved = function () { - _super.prototype.setResolved.call(this); - }; - - PullTypeSymbol.prototype.getNamePartForFullName = function () { - var name = _super.prototype.getNamePartForFullName.call(this); - - var typars = this.getTypeArgumentsOrTypeParameters(); - var typarString = PullSymbol.getTypeParameterString(typars, this, true); - return name + typarString; - }; - - PullTypeSymbol.prototype.getScopedName = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName) { - return this.getScopedNameEx(scopeSymbol, skipTypeParametersInName, useConstraintInName, false, false, skipInternalAliasName).toString(); - }; - - PullTypeSymbol.prototype.isNamedTypeSymbol = function () { - var kind = this.kind; - if (kind === 2 /* Primitive */ || kind === 8 /* Class */ || kind === 4 /* Container */ || kind === 32 /* DynamicModule */ || kind === 128 /* TypeAlias */ || kind === 64 /* Enum */ || kind === 8192 /* TypeParameter */ || ((kind === 16 /* Interface */ || kind === 8388608 /* ObjectType */) && this.name !== "")) { - return true; - } - - return false; - }; - - PullTypeSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - var s = this.getScopedNameEx(scopeSymbol, false, useConstraintInName).toString(); - return s; - }; - - PullTypeSymbol.prototype.getScopedNameEx = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, getPrettyTypeName, getTypeParamMarkerInfo, skipInternalAliasName, shouldAllowArrayType) { - if (typeof shouldAllowArrayType === "undefined") { shouldAllowArrayType = true; } - if (this.isArrayNamedTypeReference() && shouldAllowArrayType) { - var elementType = this.getElementType(); - var elementMemberName = elementType ? (elementType.isArrayNamedTypeReference() || elementType.isNamedTypeSymbol() ? elementType.getScopedNameEx(scopeSymbol, false, false, getPrettyTypeName, getTypeParamMarkerInfo, skipInternalAliasName) : elementType.getMemberTypeNameEx(false, scopeSymbol, getPrettyTypeName)) : TypeScript.MemberName.create("any"); - return TypeScript.MemberName.create(elementMemberName, "", "[]"); - } - - if (!this.isNamedTypeSymbol()) { - return this.getMemberTypeNameEx(true, scopeSymbol, getPrettyTypeName); - } - - if (skipTypeParametersInName) { - return TypeScript.MemberName.create(_super.prototype.getScopedName.call(this, scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName)); - } else { - var builder = new TypeScript.MemberNameArray(); - builder.prefix = _super.prototype.getScopedName.call(this, scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName); - - var typars = this.getTypeArgumentsOrTypeParameters(); - builder.add(PullSymbol.getTypeParameterStringEx(typars, scopeSymbol, getTypeParamMarkerInfo, useConstraintInName)); - - return builder; - } - }; - - PullTypeSymbol.prototype.hasOnlyOverloadCallSignatures = function () { - var members = this.getMembers(); - var callSignatures = this.getCallSignatures(); - var constructSignatures = this.getConstructSignatures(); - return members.length === 0 && constructSignatures.length === 0 && callSignatures.length > 1; - }; - - PullTypeSymbol.prototype.getTypeOfSymbol = function () { - var associatedContainerType = this.getAssociatedContainerType(); - if (associatedContainerType && associatedContainerType.isNamedTypeSymbol()) { - return associatedContainerType; - } - - var functionSymbol = this.getFunctionSymbol(); - if (functionSymbol && functionSymbol.kind === 16384 /* Function */ && !TypeScript.PullHelpers.isSymbolLocal(functionSymbol)) { - return TypeScript.PullHelpers.isExportedSymbolInClodule(functionSymbol) ? null : functionSymbol; - } - - return null; - }; - - PullTypeSymbol.prototype.getMemberTypeNameEx = function (topLevel, scopeSymbol, getPrettyTypeName) { - var members = this.getMembers(); - var callSignatures = this.getCallSignatures(); - var constructSignatures = this.getConstructSignatures(); - var indexSignatures = this.getIndexSignatures(); - - var typeOfSymbol = this.getTypeOfSymbol(); - if (typeOfSymbol) { - var nameForTypeOf = typeOfSymbol.getScopedNameEx(scopeSymbol, true); - return TypeScript.MemberName.create(nameForTypeOf, "typeof ", ""); - } - - if (members.length > 0 || callSignatures.length > 0 || constructSignatures.length > 0 || indexSignatures.length > 0) { - if (this._inMemberTypeNameEx) { - return TypeScript.MemberName.create("any"); - } - - this._inMemberTypeNameEx = true; - - var allMemberNames = new TypeScript.MemberNameArray(); - var curlies = !topLevel || indexSignatures.length !== 0; - var delim = "; "; - for (var i = 0; i < members.length; i++) { - if (members[i].kind === 65536 /* Method */ && members[i].type.hasOnlyOverloadCallSignatures()) { - var methodCallSignatures = members[i].type.getCallSignatures(); - var nameStr = members[i].getDisplayName(scopeSymbol) + (members[i].isOptional ? "?" : ""); - ; - var methodMemberNames = PullSignatureSymbol.getSignaturesTypeNameEx(methodCallSignatures, nameStr, false, false, scopeSymbol); - allMemberNames.addAll(methodMemberNames); - } else { - var memberTypeName = members[i].getNameAndTypeNameEx(scopeSymbol); - if (memberTypeName.isArray() && memberTypeName.delim === delim) { - allMemberNames.addAll(memberTypeName.entries); - } else { - allMemberNames.add(memberTypeName); - } - } - curlies = true; - } - - var getPrettyFunctionOverload = getPrettyTypeName && !curlies && this.hasOnlyOverloadCallSignatures(); - - var signatureCount = callSignatures.length + constructSignatures.length + indexSignatures.length; - var useShortFormSignature = !curlies && (signatureCount === 1); - var signatureMemberName; - - if (callSignatures.length > 0) { - signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(callSignatures, "", useShortFormSignature, false, scopeSymbol, getPrettyFunctionOverload); - allMemberNames.addAll(signatureMemberName); - } - - if (constructSignatures.length > 0) { - signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(constructSignatures, "new", useShortFormSignature, false, scopeSymbol); - allMemberNames.addAll(signatureMemberName); - } - - if (indexSignatures.length > 0) { - signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(indexSignatures, "", useShortFormSignature, true, scopeSymbol); - allMemberNames.addAll(signatureMemberName); - } - - if ((curlies) || (!getPrettyFunctionOverload && (signatureCount > 1) && topLevel)) { - allMemberNames.prefix = "{ "; - allMemberNames.suffix = "}"; - allMemberNames.delim = delim; - } else if (allMemberNames.entries.length > 1) { - allMemberNames.delim = delim; - } - - this._inMemberTypeNameEx = false; - - return allMemberNames; - } - - return TypeScript.MemberName.create("{}"); - }; - - PullTypeSymbol.prototype.getGenerativeTypeClassification = function (enclosingType) { - return 2 /* Closed */; - }; - - PullTypeSymbol.prototype.wrapsSomeTypeParameter = function (typeParameterArgumentMap, skipTypeArgumentCheck) { - return this.getWrappingTypeParameterID(typeParameterArgumentMap, skipTypeArgumentCheck) != 0; - }; - - PullTypeSymbol.prototype.getWrappingTypeParameterID = function (typeParameterArgumentMap, skipTypeArgumentCheck) { - var type = this; - - if (type.isTypeParameter()) { - if (typeParameterArgumentMap[type.pullSymbolID] || typeParameterArgumentMap[type.getRootSymbol().pullSymbolID]) { - return type.pullSymbolID; - } - - var constraint = type.getConstraint(); - var wrappingTypeParameterID = constraint ? constraint.getWrappingTypeParameterID(typeParameterArgumentMap) : 0; - return wrappingTypeParameterID; - } - - if (type.inWrapCheck) { - return 0; - } - - this._wrapsTypeParameterCache = this._wrapsTypeParameterCache || new TypeScript.WrapsTypeParameterCache(); - var wrappingTypeParameterID = this._wrapsTypeParameterCache.getWrapsTypeParameter(typeParameterArgumentMap); - if (wrappingTypeParameterID === undefined) { - wrappingTypeParameterID = this.getWrappingTypeParameterIDWorker(typeParameterArgumentMap, skipTypeArgumentCheck); - - this._wrapsTypeParameterCache.setWrapsTypeParameter(typeParameterArgumentMap, wrappingTypeParameterID); - } - return wrappingTypeParameterID; - }; - - PullTypeSymbol.prototype.getWrappingTypeParameterIDFromSignatures = function (signatures, typeParameterArgumentMap) { - for (var i = 0; i < signatures.length; i++) { - var wrappingTypeParameterID = signatures[i].getWrappingTypeParameterID(typeParameterArgumentMap); - if (wrappingTypeParameterID !== 0) { - return wrappingTypeParameterID; - } - } - - return 0; - }; - - PullTypeSymbol.prototype.getWrappingTypeParameterIDWorker = function (typeParameterArgumentMap, skipTypeArgumentCheck) { - var type = this; - var wrappingTypeParameterID = 0; - - if (!skipTypeArgumentCheck) { - type.inWrapCheck = true; - - var typeArguments = type.getTypeArguments(); - - if (type.isGeneric() && !typeArguments) { - typeArguments = type.getTypeParameters(); - } - - if (typeArguments) { - for (var i = 0; !wrappingTypeParameterID && i < typeArguments.length; i++) { - wrappingTypeParameterID = typeArguments[i].getWrappingTypeParameterID(typeParameterArgumentMap); - } - } - } - - if (skipTypeArgumentCheck || !(type.kind & 8216 /* SomeInstantiatableType */) || !type.name) { - var members = type.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - for (var i = 0; !wrappingTypeParameterID && i < members.length; i++) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(members[i]); - wrappingTypeParameterID = members[i].type.getWrappingTypeParameterID(typeParameterArgumentMap); - } - - wrappingTypeParameterID = wrappingTypeParameterID || this.getWrappingTypeParameterIDFromSignatures(type.getCallSignatures(), typeParameterArgumentMap) || this.getWrappingTypeParameterIDFromSignatures(type.getConstructSignatures(), typeParameterArgumentMap) || this.getWrappingTypeParameterIDFromSignatures(type.getIndexSignatures(), typeParameterArgumentMap); - } - - if (!skipTypeArgumentCheck) { - type.inWrapCheck = false; - } - - return wrappingTypeParameterID; - }; - - PullTypeSymbol.prototype.wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference = function (enclosingType) { - TypeScript.Debug.assert(this.isNamedTypeSymbol()); - TypeScript.Debug.assert(TypeScript.PullHelpers.getRootType(enclosingType) == enclosingType); - var knownWrapMap = TypeScript.BitMatrix.getBitMatrix(true); - var wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap); - knownWrapMap.release(); - return wrapsIntoInfinitelyExpandingTypeReference; - }; - - PullTypeSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse = function (enclosingType, knownWrapMap) { - var wrapsIntoInfinitelyExpandingTypeReference = knownWrapMap.valueAt(this.pullSymbolID, enclosingType.pullSymbolID); - if (wrapsIntoInfinitelyExpandingTypeReference != undefined) { - return wrapsIntoInfinitelyExpandingTypeReference; - } - - if (this.inWrapInfiniteExpandingReferenceCheck) { - return false; - } - - this.inWrapInfiniteExpandingReferenceCheck = true; - wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker(enclosingType, knownWrapMap); - knownWrapMap.setValueAt(this.pullSymbolID, enclosingType.pullSymbolID, wrapsIntoInfinitelyExpandingTypeReference); - this.inWrapInfiniteExpandingReferenceCheck = false; - - return wrapsIntoInfinitelyExpandingTypeReference; - }; - - PullTypeSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker = function (enclosingType, knownWrapMap) { - var thisRootType = TypeScript.PullHelpers.getRootType(this); - - if (thisRootType != enclosingType) { - var thisIsNamedType = this.isNamedTypeSymbol(); - - if (thisIsNamedType) { - if (thisRootType.inWrapInfiniteExpandingReferenceCheck) { - return false; - } - - thisRootType.inWrapInfiniteExpandingReferenceCheck = true; - } - - var wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceStructure(enclosingType, knownWrapMap); - - if (thisIsNamedType) { - thisRootType.inWrapInfiniteExpandingReferenceCheck = false; - } - - return wrapsIntoInfinitelyExpandingTypeReference; - } - - var enclosingTypeParameters = enclosingType.getTypeParameters(); - var typeArguments = this.getTypeArguments(); - for (var i = 0; i < typeArguments.length; i++) { - if (TypeScript.ArrayUtilities.contains(enclosingTypeParameters, typeArguments[i])) { - continue; - } - - if (typeArguments[i].wrapsSomeTypeParameter(this.getTypeParameterArgumentMap())) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceStructure = function (enclosingType, knownWrapMap) { - var members = this.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - for (var i = 0; i < members.length; i++) { - if (members[i].type && members[i].type._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap)) { - return true; - } - } - - var sigs = this.getCallSignatures(); - for (var i = 0; i < sigs.length; i++) { - if (sigs[i]._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType, knownWrapMap)) { - return true; - } - } - - sigs = this.getConstructSignatures(); - for (var i = 0; i < sigs.length; i++) { - if (sigs[i]._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType, knownWrapMap)) { - return true; - } - } - - sigs = this.getIndexSignatures(); - for (var i = 0; i < sigs.length; i++) { - if (sigs[i]._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType, knownWrapMap)) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype.widenedType = function (resolver, ast, context) { - if (!this._widenedType) { - this._widenedType = resolver.widenType(this, ast, context); - } - return this._widenedType; - }; - return PullTypeSymbol; - })(PullSymbol); - TypeScript.PullTypeSymbol = PullTypeSymbol; - - var PullPrimitiveTypeSymbol = (function (_super) { - __extends(PullPrimitiveTypeSymbol, _super); - function PullPrimitiveTypeSymbol(name) { - _super.call(this, name, 2 /* Primitive */); - - this.isResolved = true; - } - PullPrimitiveTypeSymbol.prototype.isAny = function () { - return !this.isStringConstant() && this.name === "any"; - }; - - PullPrimitiveTypeSymbol.prototype.isNull = function () { - return !this.isStringConstant() && this.name === "null"; - }; - - PullPrimitiveTypeSymbol.prototype.isUndefined = function () { - return !this.isStringConstant() && this.name === "undefined"; - }; - - PullPrimitiveTypeSymbol.prototype.isStringConstant = function () { - return false; - }; - - PullPrimitiveTypeSymbol.prototype.setUnresolved = function () { - }; - - PullPrimitiveTypeSymbol.prototype.getDisplayName = function () { - if (this.isNull() || this.isUndefined()) { - return "any"; - } else { - return _super.prototype.getDisplayName.call(this); - } - }; - return PullPrimitiveTypeSymbol; - })(PullTypeSymbol); - TypeScript.PullPrimitiveTypeSymbol = PullPrimitiveTypeSymbol; - - var PullStringConstantTypeSymbol = (function (_super) { - __extends(PullStringConstantTypeSymbol, _super); - function PullStringConstantTypeSymbol(name) { - _super.call(this, name); - } - PullStringConstantTypeSymbol.prototype.isStringConstant = function () { - return true; - }; - return PullStringConstantTypeSymbol; - })(PullPrimitiveTypeSymbol); - TypeScript.PullStringConstantTypeSymbol = PullStringConstantTypeSymbol; - - var PullErrorTypeSymbol = (function (_super) { - __extends(PullErrorTypeSymbol, _super); - function PullErrorTypeSymbol(_anyType, name) { - _super.call(this, name); - this._anyType = _anyType; - - TypeScript.Debug.assert(this._anyType); - this.isResolved = true; - } - PullErrorTypeSymbol.prototype.isError = function () { - return true; - }; - - PullErrorTypeSymbol.prototype._getResolver = function () { - return this._anyType._getResolver(); - }; - - PullErrorTypeSymbol.prototype.getName = function (scopeSymbol, useConstraintInName) { - return this._anyType.getName(scopeSymbol, useConstraintInName); - }; - - PullErrorTypeSymbol.prototype.getDisplayName = function (scopeSymbol, useConstraintInName, skipInternalAliasName) { - return this._anyType.getName(scopeSymbol, useConstraintInName); - }; - - PullErrorTypeSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - return this._anyType.getName(scopeSymbol, useConstraintInName); - }; - return PullErrorTypeSymbol; - })(PullPrimitiveTypeSymbol); - TypeScript.PullErrorTypeSymbol = PullErrorTypeSymbol; - - var PullContainerSymbol = (function (_super) { - __extends(PullContainerSymbol, _super); - function PullContainerSymbol(name, kind) { - _super.call(this, name, kind); - this.instanceSymbol = null; - this.assignedValue = null; - this.assignedType = null; - this.assignedContainer = null; - } - PullContainerSymbol.prototype.isContainer = function () { - return true; - }; - - PullContainerSymbol.prototype.setInstanceSymbol = function (symbol) { - this.instanceSymbol = symbol; - }; - - PullContainerSymbol.prototype.getInstanceSymbol = function () { - return this.instanceSymbol; - }; - - PullContainerSymbol.prototype.setExportAssignedValueSymbol = function (symbol) { - this.assignedValue = symbol; - }; - - PullContainerSymbol.prototype.getExportAssignedValueSymbol = function () { - return this.assignedValue; - }; - - PullContainerSymbol.prototype.setExportAssignedTypeSymbol = function (type) { - this.assignedType = type; - }; - - PullContainerSymbol.prototype.getExportAssignedTypeSymbol = function () { - return this.assignedType; - }; - - PullContainerSymbol.prototype.setExportAssignedContainerSymbol = function (container) { - this.assignedContainer = container; - }; - - PullContainerSymbol.prototype.getExportAssignedContainerSymbol = function () { - return this.assignedContainer; - }; - - PullContainerSymbol.prototype.hasExportAssignment = function () { - return !!this.assignedValue || !!this.assignedType || !!this.assignedContainer; - }; - - PullContainerSymbol.usedAsSymbol = function (containerSymbol, symbol) { - if (!containerSymbol || !containerSymbol.isContainer()) { - return false; - } - - if (!containerSymbol.isAlias() && containerSymbol.type === symbol) { - return true; - } - - var moduleSymbol = containerSymbol; - var valueExportSymbol = moduleSymbol.getExportAssignedValueSymbol(); - var typeExportSymbol = moduleSymbol.getExportAssignedTypeSymbol(); - var containerExportSymbol = moduleSymbol.getExportAssignedContainerSymbol(); - if (valueExportSymbol || typeExportSymbol || containerExportSymbol) { - if (valueExportSymbol === symbol || typeExportSymbol == symbol || containerExportSymbol == symbol) { - return true; - } - - if (containerExportSymbol != containerSymbol) { - return PullContainerSymbol.usedAsSymbol(containerExportSymbol, symbol); - } - } - - return false; - }; - - PullContainerSymbol.prototype.getInstanceType = function () { - return this.instanceSymbol ? this.instanceSymbol.type : null; - }; - return PullContainerSymbol; - })(PullTypeSymbol); - TypeScript.PullContainerSymbol = PullContainerSymbol; - - var PullTypeAliasSymbol = (function (_super) { - __extends(PullTypeAliasSymbol, _super); - function PullTypeAliasSymbol(name) { - _super.call(this, name, 128 /* TypeAlias */); - this._assignedValue = null; - this._assignedType = null; - this._assignedContainer = null; - this._isUsedAsValue = false; - this._typeUsedExternally = false; - this._isUsedInExportAlias = false; - this.retrievingExportAssignment = false; - this.linkedAliasSymbols = null; - } - PullTypeAliasSymbol.prototype.isUsedInExportedAlias = function () { - this._resolveDeclaredSymbol(); - return this._isUsedInExportAlias; - }; - - PullTypeAliasSymbol.prototype.typeUsedExternally = function () { - this._resolveDeclaredSymbol(); - return this._typeUsedExternally; - }; - - PullTypeAliasSymbol.prototype.isUsedAsValue = function () { - this._resolveDeclaredSymbol(); - return this._isUsedAsValue; - }; - - PullTypeAliasSymbol.prototype.setTypeUsedExternally = function () { - this._typeUsedExternally = true; - }; - - PullTypeAliasSymbol.prototype.setIsUsedInExportedAlias = function () { - this._isUsedInExportAlias = true; - if (this.linkedAliasSymbols) { - this.linkedAliasSymbols.forEach(function (s) { - return s.setIsUsedInExportedAlias(); - }); - } - }; - - PullTypeAliasSymbol.prototype.addLinkedAliasSymbol = function (contingentValueSymbol) { - if (!this.linkedAliasSymbols) { - this.linkedAliasSymbols = [contingentValueSymbol]; - } else { - this.linkedAliasSymbols.push(contingentValueSymbol); - } - }; - - PullTypeAliasSymbol.prototype.setIsUsedAsValue = function () { - this._isUsedAsValue = true; - if (this.linkedAliasSymbols) { - this.linkedAliasSymbols.forEach(function (s) { - return s.setIsUsedAsValue(); - }); - } - }; - - PullTypeAliasSymbol.prototype.assignedValue = function () { - this._resolveDeclaredSymbol(); - return this._assignedValue; - }; - - PullTypeAliasSymbol.prototype.assignedType = function () { - this._resolveDeclaredSymbol(); - return this._assignedType; - }; - - PullTypeAliasSymbol.prototype.assignedContainer = function () { - this._resolveDeclaredSymbol(); - return this._assignedContainer; - }; - - PullTypeAliasSymbol.prototype.isAlias = function () { - return true; - }; - PullTypeAliasSymbol.prototype.isContainer = function () { - return true; - }; - - PullTypeAliasSymbol.prototype.setAssignedValueSymbol = function (symbol) { - this._assignedValue = symbol; - }; - - PullTypeAliasSymbol.prototype.getExportAssignedValueSymbol = function () { - if (this._assignedValue) { - return this._assignedValue; - } - - if (this.retrievingExportAssignment) { - return null; - } - - if (this._assignedContainer) { - if (this._assignedContainer.hasExportAssignment()) { - this.retrievingExportAssignment = true; - var sym = this._assignedContainer.getExportAssignedValueSymbol(); - this.retrievingExportAssignment = false; - return sym; - } - - return this._assignedContainer.getInstanceSymbol(); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.setAssignedTypeSymbol = function (type) { - this._assignedType = type; - }; - - PullTypeAliasSymbol.prototype.getExportAssignedTypeSymbol = function () { - if (this.retrievingExportAssignment) { - return null; - } - - if (this._assignedType) { - if (this._assignedType.isAlias()) { - this.retrievingExportAssignment = true; - var sym = this._assignedType.getExportAssignedTypeSymbol(); - this.retrievingExportAssignment = false; - } else if (this._assignedType !== this._assignedContainer) { - return this._assignedType; - } - } - - if (this._assignedContainer) { - this.retrievingExportAssignment = true; - var sym = this._assignedContainer.getExportAssignedTypeSymbol(); - this.retrievingExportAssignment = false; - if (sym) { - return sym; - } - } - - return this._assignedContainer; - }; - - PullTypeAliasSymbol.prototype.setAssignedContainerSymbol = function (container) { - this._assignedContainer = container; - }; - - PullTypeAliasSymbol.prototype.getExportAssignedContainerSymbol = function () { - if (this.retrievingExportAssignment) { - return null; - } - - if (this._assignedContainer) { - this.retrievingExportAssignment = true; - var sym = this._assignedContainer.getExportAssignedContainerSymbol(); - this.retrievingExportAssignment = false; - if (sym) { - return sym; - } - } - - return this._assignedContainer; - }; - - PullTypeAliasSymbol.prototype.getMembers = function () { - if (this._assignedType) { - return this._assignedType.getMembers(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.getCallSignatures = function () { - if (this._assignedType) { - return this._assignedType.getCallSignatures(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.getConstructSignatures = function () { - if (this._assignedType) { - return this._assignedType.getConstructSignatures(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.getIndexSignatures = function () { - if (this._assignedType) { - return this._assignedType.getIndexSignatures(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.findMember = function (name) { - if (this._assignedType) { - return this._assignedType.findMember(name, true); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.findNestedType = function (name) { - if (this._assignedType) { - return this._assignedType.findNestedType(name); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.findNestedContainer = function (name) { - if (this._assignedType) { - return this._assignedType.findNestedContainer(name); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisibility) { - if (this._assignedType) { - return this._assignedType.getAllMembers(searchDeclKind, memberVisibility); - } - - return TypeScript.sentinelEmptyArray; - }; - return PullTypeAliasSymbol; - })(PullTypeSymbol); - TypeScript.PullTypeAliasSymbol = PullTypeAliasSymbol; - - var PullTypeParameterSymbol = (function (_super) { - __extends(PullTypeParameterSymbol, _super); - function PullTypeParameterSymbol(name) { - _super.call(this, name, 8192 /* TypeParameter */); - this._constraint = null; - } - PullTypeParameterSymbol.prototype.isTypeParameter = function () { - return true; - }; - - PullTypeParameterSymbol.prototype.setConstraint = function (constraintType) { - this._constraint = constraintType; - }; - - PullTypeParameterSymbol.prototype.getConstraint = function () { - return this._constraint; - }; - - PullTypeParameterSymbol.prototype.getBaseConstraint = function (semanticInfoChain) { - var preBaseConstraint = this.getConstraintRecursively({}); - TypeScript.Debug.assert(preBaseConstraint === null || !preBaseConstraint.isTypeParameter()); - return preBaseConstraint || semanticInfoChain.emptyTypeSymbol; - }; - - PullTypeParameterSymbol.prototype.getConstraintRecursively = function (visitedTypeParameters) { - var constraint = this.getConstraint(); - - if (constraint) { - if (constraint.isTypeParameter()) { - var constraintAsTypeParameter = constraint; - if (!visitedTypeParameters[constraintAsTypeParameter.pullSymbolID]) { - visitedTypeParameters[constraintAsTypeParameter.pullSymbolID] = constraintAsTypeParameter; - return constraintAsTypeParameter.getConstraintRecursively(visitedTypeParameters); - } - } else { - return constraint; - } - } - - return null; - }; - - PullTypeParameterSymbol.prototype.getDefaultConstraint = function (semanticInfoChain) { - return this._constraint || semanticInfoChain.emptyTypeSymbol; - }; - - PullTypeParameterSymbol.prototype.getCallSignatures = function () { - if (this._constraint) { - return this._constraint.getCallSignatures(); - } - - return _super.prototype.getCallSignatures.call(this); - }; - - PullTypeParameterSymbol.prototype.getConstructSignatures = function () { - if (this._constraint) { - return this._constraint.getConstructSignatures(); - } - - return _super.prototype.getConstructSignatures.call(this); - }; - - PullTypeParameterSymbol.prototype.getIndexSignatures = function () { - if (this._constraint) { - return this._constraint.getIndexSignatures(); - } - - return _super.prototype.getIndexSignatures.call(this); - }; - - PullTypeParameterSymbol.prototype.isGeneric = function () { - return true; - }; - - PullTypeParameterSymbol.prototype.fullName = function (scopeSymbol) { - var name = this.getDisplayName(scopeSymbol); - var container = this.getContainer(); - if (container) { - var containerName = container.fullName(scopeSymbol); - name = name + " in " + containerName; - } - - return name; - }; - - PullTypeParameterSymbol.prototype.getName = function (scopeSymbol, useConstraintInName) { - var name = _super.prototype.getName.call(this, scopeSymbol); - - if (this.isPrinting) { - return name; - } - - this.isPrinting = true; - - if (useConstraintInName && this._constraint) { - name += " extends " + this._constraint.toString(scopeSymbol); - } - - this.isPrinting = false; - - return name; - }; - - PullTypeParameterSymbol.prototype.getDisplayName = function (scopeSymbol, useConstraintInName, skipInternalAliasName) { - var name = _super.prototype.getDisplayName.call(this, scopeSymbol, useConstraintInName, skipInternalAliasName); - - if (this.isPrinting) { - return name; - } - - this.isPrinting = true; - - if (useConstraintInName && this._constraint) { - name += " extends " + this._constraint.toString(scopeSymbol); - } - - this.isPrinting = false; - - return name; - }; - - PullTypeParameterSymbol.prototype.isExternallyVisible = function (inIsExternallyVisibleSymbols) { - return true; - }; - return PullTypeParameterSymbol; - })(PullTypeSymbol); - TypeScript.PullTypeParameterSymbol = PullTypeParameterSymbol; - - var PullAccessorSymbol = (function (_super) { - __extends(PullAccessorSymbol, _super); - function PullAccessorSymbol(name) { - _super.call(this, name, 4096 /* Property */); - this._getterSymbol = null; - this._setterSymbol = null; - } - PullAccessorSymbol.prototype.isAccessor = function () { - return true; - }; - - PullAccessorSymbol.prototype.setSetter = function (setter) { - if (!setter) { - return; - } - - this._setterSymbol = setter; - }; - - PullAccessorSymbol.prototype.getSetter = function () { - return this._setterSymbol; - }; - - PullAccessorSymbol.prototype.setGetter = function (getter) { - if (!getter) { - return; - } - - this._getterSymbol = getter; - }; - - PullAccessorSymbol.prototype.getGetter = function () { - return this._getterSymbol; - }; - return PullAccessorSymbol; - })(PullSymbol); - TypeScript.PullAccessorSymbol = PullAccessorSymbol; - - function getIDForTypeSubstitutions(instantiatingTypeOrSignature, typeArgumentMap) { - var substitution = ""; - var members = null; - - var allowedToReferenceTypeParameters = instantiatingTypeOrSignature.getAllowedToReferenceTypeParameters(); - for (var i = 0; i < allowedToReferenceTypeParameters.length; i++) { - var typeParameter = allowedToReferenceTypeParameters[i]; - var typeParameterID = typeParameter.pullSymbolID; - var typeArg = typeArgumentMap[typeParameterID]; - if (!typeArg) { - typeArg = typeParameter; - } - substitution += typeParameterID + ":" + getIDForTypeSubstitutionsOfType(typeArg); - } - - return substitution; - } - TypeScript.getIDForTypeSubstitutions = getIDForTypeSubstitutions; - - function getIDForTypeSubstitutionsOfType(type) { - var structure; - if (type.isError()) { - structure = "E" + getIDForTypeSubstitutionsOfType(type._anyType); - } else if (!type.isNamedTypeSymbol()) { - structure = getIDForTypeSubstitutionsFromObjectType(type); - } - - if (!structure) { - structure = type.pullSymbolID + "#"; - } - - return structure; - } - - function getIDForTypeSubstitutionsFromObjectType(type) { - if (type.isResolved) { - var getIDForTypeSubStitutionWalker = new GetIDForTypeSubStitutionWalker(); - TypeScript.PullHelpers.walkPullTypeSymbolStructure(type, getIDForTypeSubStitutionWalker); - } - - return null; - } - - var GetIDForTypeSubStitutionWalker = (function () { - function GetIDForTypeSubStitutionWalker() { - this.structure = ""; - } - GetIDForTypeSubStitutionWalker.prototype.memberSymbolWalk = function (memberSymbol) { - this.structure += memberSymbol.name + "@" + getIDForTypeSubstitutionsOfType(memberSymbol.type); - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.callSignatureWalk = function (signatureSymbol) { - this.structure += "("; - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.constructSignatureWalk = function (signatureSymbol) { - this.structure += "new("; - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.indexSignatureWalk = function (signatureSymbol) { - this.structure += "[]("; - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.signatureParameterWalk = function (parameterSymbol) { - this.structure += parameterSymbol.name + "@" + getIDForTypeSubstitutionsOfType(parameterSymbol.type); - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.signatureReturnTypeWalk = function (returnType) { - this.structure += ")" + getIDForTypeSubstitutionsOfType(returnType); - return true; - }; - return GetIDForTypeSubStitutionWalker; - })(); - - (function (GetAllMembersVisiblity) { - GetAllMembersVisiblity[GetAllMembersVisiblity["all"] = 0] = "all"; - - GetAllMembersVisiblity[GetAllMembersVisiblity["internallyVisible"] = 1] = "internallyVisible"; - - GetAllMembersVisiblity[GetAllMembersVisiblity["externallyVisible"] = 2] = "externallyVisible"; - })(TypeScript.GetAllMembersVisiblity || (TypeScript.GetAllMembersVisiblity = {})); - var GetAllMembersVisiblity = TypeScript.GetAllMembersVisiblity; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var EnclosingTypeWalkerState = (function () { - function EnclosingTypeWalkerState() { - } - EnclosingTypeWalkerState.getDefaultEnclosingTypeWalkerState = function () { - var defaultEnclosingTypeWalkerState = new EnclosingTypeWalkerState(); - defaultEnclosingTypeWalkerState._hasSetEnclosingType = false; - return defaultEnclosingTypeWalkerState; - }; - - EnclosingTypeWalkerState.getNonGenericEnclosingTypeWalkerState = function () { - var defaultEnclosingTypeWalkerState = new EnclosingTypeWalkerState(); - defaultEnclosingTypeWalkerState._hasSetEnclosingType = true; - return defaultEnclosingTypeWalkerState; - }; - - EnclosingTypeWalkerState.getGenericEnclosingTypeWalkerState = function (genericEnclosingType) { - var defaultEnclosingTypeWalkerState = new EnclosingTypeWalkerState(); - defaultEnclosingTypeWalkerState._hasSetEnclosingType = true; - defaultEnclosingTypeWalkerState._currentSymbols = [TypeScript.PullHelpers.getRootType(genericEnclosingType)]; - return defaultEnclosingTypeWalkerState; - }; - return EnclosingTypeWalkerState; - })(); - TypeScript.EnclosingTypeWalkerState = EnclosingTypeWalkerState; - - var PullTypeEnclosingTypeWalker = (function () { - function PullTypeEnclosingTypeWalker() { - this.setDefaultTypeWalkerState(); - } - PullTypeEnclosingTypeWalker.prototype.setDefaultTypeWalkerState = function () { - this.enclosingTypeWalkerState = PullTypeEnclosingTypeWalker._defaultEnclosingTypeWalkerState; - }; - - PullTypeEnclosingTypeWalker.prototype.setNonGenericEnclosingTypeWalkerState = function () { - this.enclosingTypeWalkerState = PullTypeEnclosingTypeWalker._nonGenericEnclosingTypeWalkerState; - }; - - PullTypeEnclosingTypeWalker.prototype.canSymbolOrDeclBeUsedAsEnclosingTypeHelper = function (name, kind) { - return name && (kind === 8 /* Class */ || kind === 16 /* Interface */); - }; - - PullTypeEnclosingTypeWalker.prototype.canDeclBeUsedAsEnclosingType = function (decl) { - return this.canSymbolOrDeclBeUsedAsEnclosingTypeHelper(decl.name, decl.kind); - }; - - PullTypeEnclosingTypeWalker.prototype.canSymbolBeUsedAsEnclosingType = function (symbol) { - return this.canSymbolOrDeclBeUsedAsEnclosingTypeHelper(symbol.name, symbol.kind); - }; - - PullTypeEnclosingTypeWalker.prototype.getEnclosingType = function () { - var currentSymbols = this.enclosingTypeWalkerState._currentSymbols; - if (currentSymbols) { - TypeScript.Debug.assert(currentSymbols.length > 0); - return currentSymbols[0]; - } - - return null; - }; - - PullTypeEnclosingTypeWalker.prototype._canWalkStructure = function () { - var enclosingType = this.getEnclosingType(); - TypeScript.Debug.assert(!enclosingType || enclosingType.isGeneric()); - return !!enclosingType; - }; - - PullTypeEnclosingTypeWalker.prototype._getCurrentSymbol = function () { - var currentSymbols = this.enclosingTypeWalkerState._currentSymbols; - if (currentSymbols && currentSymbols.length) { - return currentSymbols[currentSymbols.length - 1]; - } - - return null; - }; - - PullTypeEnclosingTypeWalker.prototype.getGenerativeClassification = function () { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - if (!currentType) { - return 0 /* Unknown */; - } - - var variableNeededToFixNodeJitterBug = this.getEnclosingType(); - - return currentType.getGenerativeTypeClassification(variableNeededToFixNodeJitterBug); - } - - return 2 /* Closed */; - }; - - PullTypeEnclosingTypeWalker.prototype._pushSymbol = function (symbol) { - return this.enclosingTypeWalkerState._currentSymbols.push(symbol); - }; - - PullTypeEnclosingTypeWalker.prototype._popSymbol = function () { - return this.enclosingTypeWalkerState._currentSymbols.pop(); - }; - - PullTypeEnclosingTypeWalker.prototype.setSymbolAsEnclosingType = function (type) { - if (type.isGeneric()) { - this.enclosingTypeWalkerState = EnclosingTypeWalkerState.getGenericEnclosingTypeWalkerState(type); - } else { - this.setNonGenericEnclosingTypeWalkerState(); - } - }; - - PullTypeEnclosingTypeWalker.prototype._setEnclosingTypeOfParentDecl = function (decl, setSignature) { - var parentDecl = decl.getParentDecl(); - - if (parentDecl && !(parentDecl.kind & (164 /* SomeContainer */ | 1 /* Script */))) { - if (this.canDeclBeUsedAsEnclosingType(parentDecl)) { - this.setSymbolAsEnclosingType(parentDecl.getSymbol()); - } else { - this._setEnclosingTypeOfParentDecl(parentDecl, true); - } - - if (this._canWalkStructure()) { - var symbol = decl.getSymbol(); - if (symbol) { - if (!symbol.isType() && !symbol.isSignature()) { - symbol = symbol.type; - } - - this._pushSymbol(symbol); - } - - if (setSignature) { - var signature = decl.getSignatureSymbol(); - if (signature) { - this._pushSymbol(signature); - } - } - } - } - }; - - PullTypeEnclosingTypeWalker.prototype.setEnclosingTypeForSymbol = function (symbol) { - var currentEnclosingTypeWalkerState = this.enclosingTypeWalkerState; - if (this.canSymbolBeUsedAsEnclosingType(symbol)) { - this.setSymbolAsEnclosingType(symbol); - } else { - this.setDefaultTypeWalkerState(); - - var decls = symbol.getDeclarations(); - for (var i = 0; i < decls.length; i++) { - var decl = decls[i]; - this._setEnclosingTypeOfParentDecl(decl, symbol.isSignature()); - - if (this.enclosingTypeWalkerState._hasSetEnclosingType) { - break; - } - } - - if (!this.enclosingTypeWalkerState._hasSetEnclosingType) { - this.setNonGenericEnclosingTypeWalkerState(); - } - } - return currentEnclosingTypeWalkerState; - }; - - PullTypeEnclosingTypeWalker.prototype.startWalkingType = function (symbol) { - var currentState = this.enclosingTypeWalkerState; - - var setEnclosingTypeForSymbol = !this.enclosingTypeWalkerState._hasSetEnclosingType || this.canSymbolBeUsedAsEnclosingType(symbol); - if (setEnclosingTypeForSymbol) { - this.setEnclosingTypeForSymbol(symbol); - } - return currentState; - }; - - PullTypeEnclosingTypeWalker.prototype.endWalkingType = function (stateWhenStartedWalkingTypes) { - this.enclosingTypeWalkerState = stateWhenStartedWalkingTypes; - }; - - PullTypeEnclosingTypeWalker.prototype.walkMemberType = function (memberName, resolver) { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - var memberSymbol = currentType ? resolver._getNamedPropertySymbolOfAugmentedType(memberName, currentType) : null; - this._pushSymbol(memberSymbol ? memberSymbol.type : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkMemberType = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkSignature = function (kind, index) { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - var signatures; - if (currentType) { - if (kind == 1048576 /* CallSignature */) { - signatures = currentType.getCallSignatures(); - } else if (kind == 2097152 /* ConstructSignature */) { - signatures = currentType.getConstructSignatures(); - } else { - signatures = currentType.getIndexSignatures(); - } - } - - this._pushSymbol(signatures ? signatures[index] : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkSignature = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkTypeArgument = function (index) { - if (this._canWalkStructure()) { - var typeArgument = null; - var currentType = this._getCurrentSymbol(); - if (currentType) { - var typeArguments = currentType.getTypeArguments(); - typeArgument = typeArguments ? typeArguments[index] : null; - } - this._pushSymbol(typeArgument); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkTypeArgument = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkTypeParameterConstraint = function (index) { - if (this._canWalkStructure()) { - var typeParameters; - var currentSymbol = this._getCurrentSymbol(); - if (currentSymbol) { - if (currentSymbol.isSignature()) { - typeParameters = currentSymbol.getTypeParameters(); - } else { - TypeScript.Debug.assert(currentSymbol.isType()); - typeParameters = currentSymbol.getTypeParameters(); - } - } - this._pushSymbol(typeParameters ? typeParameters[index].getConstraint() : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkTypeParameterConstraint = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkReturnType = function () { - if (this._canWalkStructure()) { - var currentSignature = this._getCurrentSymbol(); - this._pushSymbol(currentSignature ? currentSignature.returnType : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkReturnType = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkParameterType = function (iParam) { - if (this._canWalkStructure()) { - var currentSignature = this._getCurrentSymbol(); - this._pushSymbol(currentSignature ? currentSignature.getParameterTypeAtIndex(iParam) : null); - } - }; - PullTypeEnclosingTypeWalker.prototype.postWalkParameterType = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.getBothKindOfIndexSignatures = function (resolver, context, includeAugmentedType) { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - if (currentType) { - return resolver._getBothKindsOfIndexSignatures(currentType, context, includeAugmentedType); - } - } - return null; - }; - - PullTypeEnclosingTypeWalker.prototype.walkIndexSignatureReturnType = function (indexSigInfo, useStringIndexSignature, onlySignature) { - if (this._canWalkStructure()) { - var indexSig = indexSigInfo ? (useStringIndexSignature ? indexSigInfo.stringSignature : indexSigInfo.numericSignature) : null; - this._pushSymbol(indexSig); - if (!onlySignature) { - this._pushSymbol(indexSig ? indexSig.returnType : null); - } - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkIndexSignatureReturnType = function (onlySignature) { - if (this._canWalkStructure()) { - if (!onlySignature) { - this._popSymbol(); - } - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.resetEnclosingTypeWalkerState = function () { - var currentState = this.enclosingTypeWalkerState; - this.setDefaultTypeWalkerState(); - return currentState; - }; - - PullTypeEnclosingTypeWalker.prototype.setEnclosingTypeWalkerState = function (enclosingTypeWalkerState) { - if (enclosingTypeWalkerState) { - this.enclosingTypeWalkerState = enclosingTypeWalkerState; - } else { - this.setDefaultTypeWalkerState(); - } - }; - PullTypeEnclosingTypeWalker._defaultEnclosingTypeWalkerState = EnclosingTypeWalkerState.getDefaultEnclosingTypeWalkerState(); - - PullTypeEnclosingTypeWalker._nonGenericEnclosingTypeWalkerState = EnclosingTypeWalkerState.getNonGenericEnclosingTypeWalkerState(); - return PullTypeEnclosingTypeWalker; - })(); - TypeScript.PullTypeEnclosingTypeWalker = PullTypeEnclosingTypeWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CandidateInferenceInfo = (function () { - function CandidateInferenceInfo() { - this.typeParameter = null; - this._inferredTypeAfterFixing = null; - this.inferenceCandidates = []; - } - CandidateInferenceInfo.prototype.addCandidate = function (candidate) { - if (!this._inferredTypeAfterFixing) { - this.inferenceCandidates[this.inferenceCandidates.length] = candidate; - } - }; - - CandidateInferenceInfo.prototype.isFixed = function () { - return !!this._inferredTypeAfterFixing; - }; - - CandidateInferenceInfo.prototype.fixTypeParameter = function (resolver, context) { - var _this = this; - if (!this._inferredTypeAfterFixing) { - var collection = { - getLength: function () { - return _this.inferenceCandidates.length; - }, - getTypeAtIndex: function (index) { - return _this.inferenceCandidates[index].type; - } - }; - - var bestCommonType = resolver.findBestCommonType(collection, context, new TypeScript.TypeComparisonInfo()); - this._inferredTypeAfterFixing = bestCommonType.widenedType(resolver, null, context); - } - }; - return CandidateInferenceInfo; - })(); - TypeScript.CandidateInferenceInfo = CandidateInferenceInfo; - - var TypeArgumentInferenceContext = (function () { - function TypeArgumentInferenceContext(resolver, context, signatureBeingInferred) { - this.resolver = resolver; - this.context = context; - this.signatureBeingInferred = signatureBeingInferred; - this.inferenceCache = TypeScript.BitMatrix.getBitMatrix(false); - this.candidateCache = []; - var typeParameters = signatureBeingInferred.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - this.addInferenceRoot(typeParameters[i]); - } - } - TypeArgumentInferenceContext.prototype.alreadyRelatingTypes = function (objectType, parameterType) { - if (this.inferenceCache.valueAt(objectType.pullSymbolID, parameterType.pullSymbolID)) { - return true; - } else { - this.inferenceCache.setValueAt(objectType.pullSymbolID, parameterType.pullSymbolID, true); - return false; - } - }; - - TypeArgumentInferenceContext.prototype.resetRelationshipCache = function () { - this.inferenceCache.release(); - this.inferenceCache = TypeScript.BitMatrix.getBitMatrix(false); - }; - - TypeArgumentInferenceContext.prototype.addInferenceRoot = function (param) { - var info = this.candidateCache[param.pullSymbolID]; - - if (!info) { - info = new CandidateInferenceInfo(); - info.typeParameter = param; - this.candidateCache[param.pullSymbolID] = info; - } - }; - - TypeArgumentInferenceContext.prototype.getInferenceInfo = function (param) { - return this.candidateCache[param.pullSymbolID]; - }; - - TypeArgumentInferenceContext.prototype.addCandidateForInference = function (param, candidate) { - var info = this.getInferenceInfo(param); - - if (info && candidate && info.inferenceCandidates.indexOf(candidate) < 0) { - info.addCandidate(candidate); - } - }; - - TypeArgumentInferenceContext.prototype.inferTypeArguments = function () { - throw TypeScript.Errors.abstract(); - }; - - TypeArgumentInferenceContext.prototype.fixTypeParameter = function (typeParameter) { - var candidateInfo = this.candidateCache[typeParameter.pullSymbolID]; - if (candidateInfo) { - candidateInfo.fixTypeParameter(this.resolver, this.context); - } - }; - - TypeArgumentInferenceContext.prototype._finalizeInferredTypeArguments = function () { - var results = []; - var typeParameters = this.signatureBeingInferred.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - var info = this.candidateCache[typeParameters[i].pullSymbolID]; - - info.fixTypeParameter(this.resolver, this.context); - - for (var i = 0; i < results.length; i++) { - if (results[i].type === info.typeParameter) { - results[i].type = info._inferredTypeAfterFixing; - } - } - - results.push(info._inferredTypeAfterFixing); - } - - return results; - }; - - TypeArgumentInferenceContext.prototype.isInvocationInferenceContext = function () { - throw TypeScript.Errors.abstract(); - }; - return TypeArgumentInferenceContext; - })(); - TypeScript.TypeArgumentInferenceContext = TypeArgumentInferenceContext; - - var InvocationTypeArgumentInferenceContext = (function (_super) { - __extends(InvocationTypeArgumentInferenceContext, _super); - function InvocationTypeArgumentInferenceContext(resolver, context, signatureBeingInferred, argumentASTs) { - _super.call(this, resolver, context, signatureBeingInferred); - this.argumentASTs = argumentASTs; - } - InvocationTypeArgumentInferenceContext.prototype.isInvocationInferenceContext = function () { - return true; - }; - - InvocationTypeArgumentInferenceContext.prototype.inferTypeArguments = function () { - var _this = this; - this.signatureBeingInferred.forAllParameterTypes(this.argumentASTs.nonSeparatorCount(), function (parameterType, argumentIndex) { - var argumentAST = _this.argumentASTs.nonSeparatorAt(argumentIndex); - - _this.context.pushInferentialType(parameterType, _this); - var argumentType = _this.resolver.resolveAST(argumentAST, true, _this.context).type; - _this.resolver.relateTypeToTypeParametersWithNewEnclosingTypes(argumentType, parameterType, _this, _this.context); - _this.context.popAnyContextualType(); - - return true; - }); - - return this._finalizeInferredTypeArguments(); - }; - return InvocationTypeArgumentInferenceContext; - })(TypeArgumentInferenceContext); - TypeScript.InvocationTypeArgumentInferenceContext = InvocationTypeArgumentInferenceContext; - - var ContextualSignatureInstantiationTypeArgumentInferenceContext = (function (_super) { - __extends(ContextualSignatureInstantiationTypeArgumentInferenceContext, _super); - function ContextualSignatureInstantiationTypeArgumentInferenceContext(resolver, context, signatureBeingInferred, contextualSignature, shouldFixContextualSignatureParameterTypes) { - _super.call(this, resolver, context, signatureBeingInferred); - this.contextualSignature = contextualSignature; - this.shouldFixContextualSignatureParameterTypes = shouldFixContextualSignatureParameterTypes; - } - ContextualSignatureInstantiationTypeArgumentInferenceContext.prototype.isInvocationInferenceContext = function () { - return false; - }; - - ContextualSignatureInstantiationTypeArgumentInferenceContext.prototype.inferTypeArguments = function () { - var _this = this; - var relateTypesCallback = function (parameterTypeBeingInferred, contextualParameterType) { - if (_this.shouldFixContextualSignatureParameterTypes) { - contextualParameterType = _this.context.fixAllTypeParametersReferencedByType(contextualParameterType, _this.resolver, _this); - } - _this.resolver.relateTypeToTypeParametersWithNewEnclosingTypes(contextualParameterType, parameterTypeBeingInferred, _this, _this.context); - - return true; - }; - - this.signatureBeingInferred.forAllCorrespondingParameterTypesInThisAndOtherSignature(this.contextualSignature, relateTypesCallback); - - return this._finalizeInferredTypeArguments(); - }; - return ContextualSignatureInstantiationTypeArgumentInferenceContext; - })(TypeArgumentInferenceContext); - TypeScript.ContextualSignatureInstantiationTypeArgumentInferenceContext = ContextualSignatureInstantiationTypeArgumentInferenceContext; - - var PullContextualTypeContext = (function () { - function PullContextualTypeContext(contextualType, provisional, isInferentiallyTyping, typeArgumentInferenceContext) { - this.contextualType = contextualType; - this.provisional = provisional; - this.isInferentiallyTyping = isInferentiallyTyping; - this.typeArgumentInferenceContext = typeArgumentInferenceContext; - this.provisionallyTypedSymbols = []; - this.hasProvisionalErrors = false; - this.astSymbolMap = []; - } - PullContextualTypeContext.prototype.recordProvisionallyTypedSymbol = function (symbol) { - this.provisionallyTypedSymbols[this.provisionallyTypedSymbols.length] = symbol; - }; - - PullContextualTypeContext.prototype.invalidateProvisionallyTypedSymbols = function () { - for (var i = 0; i < this.provisionallyTypedSymbols.length; i++) { - this.provisionallyTypedSymbols[i].setUnresolved(); - } - }; - - PullContextualTypeContext.prototype.setSymbolForAST = function (ast, symbol) { - this.astSymbolMap[ast.syntaxID()] = symbol; - }; - - PullContextualTypeContext.prototype.getSymbolForAST = function (ast) { - return this.astSymbolMap[ast.syntaxID()]; - }; - return PullContextualTypeContext; - })(); - TypeScript.PullContextualTypeContext = PullContextualTypeContext; - - var PullTypeResolutionContext = (function () { - function PullTypeResolutionContext(resolver, inTypeCheck, fileName) { - if (typeof inTypeCheck === "undefined") { inTypeCheck = false; } - if (typeof fileName === "undefined") { fileName = null; } - this.resolver = resolver; - this.inTypeCheck = inTypeCheck; - this.fileName = fileName; - this.contextStack = []; - this.typeCheckedNodes = null; - this.enclosingTypeWalker1 = null; - this.enclosingTypeWalker2 = null; - this.inBaseTypeResolution = false; - if (inTypeCheck) { - TypeScript.Debug.assert(fileName, "A file name must be provided if you are typechecking"); - this.typeCheckedNodes = TypeScript.BitVector.getBitVector(false); - } - } - PullTypeResolutionContext.prototype.setTypeChecked = function (ast) { - if (!this.inProvisionalResolution()) { - this.typeCheckedNodes.setValueAt(ast.syntaxID(), true); - } - }; - - PullTypeResolutionContext.prototype.canTypeCheckAST = function (ast) { - return this.typeCheck() && !this.typeCheckedNodes.valueAt(ast.syntaxID()) && this.fileName === ast.fileName(); - }; - - PullTypeResolutionContext.prototype._pushAnyContextualType = function (type, provisional, isInferentiallyTyping, argContext) { - this.contextStack.push(new PullContextualTypeContext(type, provisional, isInferentiallyTyping, argContext)); - }; - - PullTypeResolutionContext.prototype.pushNewContextualType = function (type) { - this._pushAnyContextualType(type, this.inProvisionalResolution(), false, null); - }; - - PullTypeResolutionContext.prototype.propagateContextualType = function (type) { - this._pushAnyContextualType(type, this.inProvisionalResolution(), this.isInferentiallyTyping(), this.getCurrentTypeArgumentInferenceContext()); - }; - - PullTypeResolutionContext.prototype.pushInferentialType = function (type, typeArgumentInferenceContext) { - this._pushAnyContextualType(type, true, true, typeArgumentInferenceContext); - }; - - PullTypeResolutionContext.prototype.pushProvisionalType = function (type) { - this._pushAnyContextualType(type, true, false, null); - }; - - PullTypeResolutionContext.prototype.popAnyContextualType = function () { - var tc = this.contextStack.pop(); - - tc.invalidateProvisionallyTypedSymbols(); - - if (tc.hasProvisionalErrors && this.inProvisionalResolution()) { - this.contextStack[this.contextStack.length - 1].hasProvisionalErrors = true; - } - - return tc; - }; - - PullTypeResolutionContext.prototype.hasProvisionalErrors = function () { - return this.contextStack.length ? this.contextStack[this.contextStack.length - 1].hasProvisionalErrors : false; - }; - - PullTypeResolutionContext.prototype.getContextualType = function () { - var context = !this.contextStack.length ? null : this.contextStack[this.contextStack.length - 1]; - - if (context) { - var type = context.contextualType; - - if (!type) { - return null; - } - - return type; - } - - return null; - }; - - PullTypeResolutionContext.prototype.fixAllTypeParametersReferencedByType = function (type, resolver, argContext) { - var argContext = this.getCurrentTypeArgumentInferenceContext(); - if (type.wrapsSomeTypeParameter(argContext.candidateCache)) { - var typeParameterArgumentMap = []; - - for (var n in argContext.candidateCache) { - var typeParameter = argContext.candidateCache[n] && argContext.candidateCache[n].typeParameter; - if (typeParameter) { - var dummyMap = []; - dummyMap[typeParameter.pullSymbolID] = typeParameter; - if (type.wrapsSomeTypeParameter(dummyMap)) { - argContext.fixTypeParameter(typeParameter); - TypeScript.Debug.assert(argContext.candidateCache[n]._inferredTypeAfterFixing); - typeParameterArgumentMap[typeParameter.pullSymbolID] = argContext.candidateCache[n]._inferredTypeAfterFixing; - } - } - } - - return resolver.instantiateType(type, typeParameterArgumentMap); - } - - return type; - }; - - PullTypeResolutionContext.prototype.getCurrentTypeArgumentInferenceContext = function () { - return this.contextStack.length ? this.contextStack[this.contextStack.length - 1].typeArgumentInferenceContext : null; - }; - - PullTypeResolutionContext.prototype.isInferentiallyTyping = function () { - return this.contextStack.length > 0 && this.contextStack[this.contextStack.length - 1].isInferentiallyTyping; - }; - - PullTypeResolutionContext.prototype.inProvisionalResolution = function () { - return (!this.contextStack.length ? false : this.contextStack[this.contextStack.length - 1].provisional); - }; - - PullTypeResolutionContext.prototype.isInBaseTypeResolution = function () { - return this.inBaseTypeResolution; - }; - - PullTypeResolutionContext.prototype.startBaseTypeResolution = function () { - var wasInBaseTypeResoltion = this.inBaseTypeResolution; - this.inBaseTypeResolution = true; - return wasInBaseTypeResoltion; - }; - - PullTypeResolutionContext.prototype.doneBaseTypeResolution = function (wasInBaseTypeResolution) { - this.inBaseTypeResolution = wasInBaseTypeResolution; - }; - - PullTypeResolutionContext.prototype.setTypeInContext = function (symbol, type) { - if (symbol.type && symbol.type.isError() && !type.isError()) { - return; - } - symbol.type = type; - - if (this.contextStack.length && this.inProvisionalResolution()) { - this.contextStack[this.contextStack.length - 1].recordProvisionallyTypedSymbol(symbol); - } - }; - - PullTypeResolutionContext.prototype.postDiagnostic = function (diagnostic) { - if (diagnostic) { - if (this.inProvisionalResolution()) { - (this.contextStack[this.contextStack.length - 1]).hasProvisionalErrors = true; - } else if (this.inTypeCheck && this.resolver) { - this.resolver.semanticInfoChain.addDiagnostic(diagnostic); - } - } - }; - - PullTypeResolutionContext.prototype.typeCheck = function () { - return this.inTypeCheck && !this.inProvisionalResolution(); - }; - - PullTypeResolutionContext.prototype.setSymbolForAST = function (ast, symbol) { - this.contextStack[this.contextStack.length - 1].setSymbolForAST(ast, symbol); - }; - - PullTypeResolutionContext.prototype.getSymbolForAST = function (ast) { - for (var i = this.contextStack.length - 1; i >= 0; i--) { - var typeContext = this.contextStack[i]; - if (!typeContext.provisional) { - break; - } - - var symbol = typeContext.getSymbolForAST(ast); - if (symbol) { - return symbol; - } - } - - return null; - }; - - PullTypeResolutionContext.prototype.startWalkingTypes = function (symbol1, symbol2) { - if (!this.enclosingTypeWalker1) { - this.enclosingTypeWalker1 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var stateWhenStartedWalkingTypes1 = this.enclosingTypeWalker1.startWalkingType(symbol1); - if (!this.enclosingTypeWalker2) { - this.enclosingTypeWalker2 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var stateWhenStartedWalkingTypes2 = this.enclosingTypeWalker2.startWalkingType(symbol2); - return { - stateWhenStartedWalkingTypes1: stateWhenStartedWalkingTypes1, - stateWhenStartedWalkingTypes2: stateWhenStartedWalkingTypes2 - }; - }; - - PullTypeResolutionContext.prototype.endWalkingTypes = function (statesWhenStartedWalkingTypes) { - this.enclosingTypeWalker1.endWalkingType(statesWhenStartedWalkingTypes.stateWhenStartedWalkingTypes1); - this.enclosingTypeWalker2.endWalkingType(statesWhenStartedWalkingTypes.stateWhenStartedWalkingTypes2); - }; - - PullTypeResolutionContext.prototype.setEnclosingTypeForSymbols = function (symbol1, symbol2) { - if (!this.enclosingTypeWalker1) { - this.enclosingTypeWalker1 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var enclosingTypeWalkerState1 = this.enclosingTypeWalker1.setEnclosingTypeForSymbol(symbol1); - if (!this.enclosingTypeWalker2) { - this.enclosingTypeWalker2 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var enclosingTypeWalkerState2 = this.enclosingTypeWalker2.setEnclosingTypeForSymbol(symbol2); - return { - enclosingTypeWalkerState1: enclosingTypeWalkerState1, - enclosingTypeWalkerState2: enclosingTypeWalkerState2 - }; - }; - - PullTypeResolutionContext.prototype.walkMemberTypes = function (memberName) { - this.enclosingTypeWalker1.walkMemberType(memberName, this.resolver); - this.enclosingTypeWalker2.walkMemberType(memberName, this.resolver); - }; - - PullTypeResolutionContext.prototype.postWalkMemberTypes = function () { - this.enclosingTypeWalker1.postWalkMemberType(); - this.enclosingTypeWalker2.postWalkMemberType(); - }; - - PullTypeResolutionContext.prototype.walkSignatures = function (kind, index, index2) { - this.enclosingTypeWalker1.walkSignature(kind, index); - this.enclosingTypeWalker2.walkSignature(kind, index2 == undefined ? index : index2); - }; - - PullTypeResolutionContext.prototype.postWalkSignatures = function () { - this.enclosingTypeWalker1.postWalkSignature(); - this.enclosingTypeWalker2.postWalkSignature(); - }; - - PullTypeResolutionContext.prototype.walkTypeParameterConstraints = function (index) { - this.enclosingTypeWalker1.walkTypeParameterConstraint(index); - this.enclosingTypeWalker2.walkTypeParameterConstraint(index); - }; - - PullTypeResolutionContext.prototype.postWalkTypeParameterConstraints = function () { - this.enclosingTypeWalker1.postWalkTypeParameterConstraint(); - this.enclosingTypeWalker2.postWalkTypeParameterConstraint(); - }; - - PullTypeResolutionContext.prototype.walkTypeArgument = function (index) { - this.enclosingTypeWalker1.walkTypeArgument(index); - this.enclosingTypeWalker2.walkTypeArgument(index); - }; - - PullTypeResolutionContext.prototype.postWalkTypeArgument = function () { - this.enclosingTypeWalker1.postWalkTypeArgument(); - this.enclosingTypeWalker2.postWalkTypeArgument(); - }; - - PullTypeResolutionContext.prototype.walkReturnTypes = function () { - this.enclosingTypeWalker1.walkReturnType(); - this.enclosingTypeWalker2.walkReturnType(); - }; - - PullTypeResolutionContext.prototype.postWalkReturnTypes = function () { - this.enclosingTypeWalker1.postWalkReturnType(); - this.enclosingTypeWalker2.postWalkReturnType(); - }; - - PullTypeResolutionContext.prototype.walkParameterTypes = function (iParam) { - this.enclosingTypeWalker1.walkParameterType(iParam); - this.enclosingTypeWalker2.walkParameterType(iParam); - }; - - PullTypeResolutionContext.prototype.postWalkParameterTypes = function () { - this.enclosingTypeWalker1.postWalkParameterType(); - this.enclosingTypeWalker2.postWalkParameterType(); - }; - - PullTypeResolutionContext.prototype.getBothKindOfIndexSignatures = function (includeAugmentedType1, includeAugmentedType2) { - var indexSigs1 = this.enclosingTypeWalker1.getBothKindOfIndexSignatures(this.resolver, this, includeAugmentedType1); - var indexSigs2 = this.enclosingTypeWalker2.getBothKindOfIndexSignatures(this.resolver, this, includeAugmentedType2); - return { indexSigs1: indexSigs1, indexSigs2: indexSigs2 }; - }; - - PullTypeResolutionContext.prototype.walkIndexSignatureReturnTypes = function (indexSigs, useStringIndexSignature1, useStringIndexSignature2, onlySignature) { - this.enclosingTypeWalker1.walkIndexSignatureReturnType(indexSigs.indexSigs1, useStringIndexSignature1, onlySignature); - this.enclosingTypeWalker2.walkIndexSignatureReturnType(indexSigs.indexSigs2, useStringIndexSignature2, onlySignature); - }; - - PullTypeResolutionContext.prototype.postWalkIndexSignatureReturnTypes = function (onlySignature) { - this.enclosingTypeWalker1.postWalkIndexSignatureReturnType(onlySignature); - this.enclosingTypeWalker2.postWalkIndexSignatureReturnType(onlySignature); - }; - - PullTypeResolutionContext.prototype.swapEnclosingTypeWalkers = function () { - var tempEnclosingWalker1 = this.enclosingTypeWalker1; - this.enclosingTypeWalker1 = this.enclosingTypeWalker2; - this.enclosingTypeWalker2 = tempEnclosingWalker1; - }; - - PullTypeResolutionContext.prototype.oneOfClassificationsIsInfinitelyExpanding = function () { - var generativeClassification1 = this.enclosingTypeWalker1.getGenerativeClassification(); - if (generativeClassification1 === 3 /* InfinitelyExpanding */) { - return true; - } - var generativeClassification2 = this.enclosingTypeWalker2.getGenerativeClassification(); - if (generativeClassification2 === 3 /* InfinitelyExpanding */) { - return true; - } - - return false; - }; - - PullTypeResolutionContext.prototype.resetEnclosingTypeWalkerStates = function () { - var enclosingTypeWalkerState1 = this.enclosingTypeWalker1 ? this.enclosingTypeWalker1.resetEnclosingTypeWalkerState() : null; - var enclosingTypeWalkerState2 = this.enclosingTypeWalker2 ? this.enclosingTypeWalker2.resetEnclosingTypeWalkerState() : null; - return { - enclosingTypeWalkerState1: enclosingTypeWalkerState1, - enclosingTypeWalkerState2: enclosingTypeWalkerState2 - }; - }; - - PullTypeResolutionContext.prototype.setEnclosingTypeWalkerStates = function (enclosingTypeWalkerStates) { - TypeScript.Debug.assert(this.enclosingTypeWalker1 || !enclosingTypeWalkerStates.enclosingTypeWalkerState1); - if (this.enclosingTypeWalker1) { - this.enclosingTypeWalker1.setEnclosingTypeWalkerState(enclosingTypeWalkerStates.enclosingTypeWalkerState1); - } - TypeScript.Debug.assert(this.enclosingTypeWalker2 || !enclosingTypeWalkerStates.enclosingTypeWalkerState2); - if (this.enclosingTypeWalker2) { - this.enclosingTypeWalker2.setEnclosingTypeWalkerState(enclosingTypeWalkerStates.enclosingTypeWalkerState2); - } - }; - return PullTypeResolutionContext; - })(); - TypeScript.PullTypeResolutionContext = PullTypeResolutionContext; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var OverloadApplicabilityStatus; - (function (OverloadApplicabilityStatus) { - OverloadApplicabilityStatus[OverloadApplicabilityStatus["NotAssignable"] = 0] = "NotAssignable"; - OverloadApplicabilityStatus[OverloadApplicabilityStatus["AssignableButWithProvisionalErrors"] = 1] = "AssignableButWithProvisionalErrors"; - OverloadApplicabilityStatus[OverloadApplicabilityStatus["AssignableWithNoProvisionalErrors"] = 2] = "AssignableWithNoProvisionalErrors"; - OverloadApplicabilityStatus[OverloadApplicabilityStatus["Subtype"] = 3] = "Subtype"; - })(OverloadApplicabilityStatus || (OverloadApplicabilityStatus = {})); - - var PullAdditionalCallResolutionData = (function () { - function PullAdditionalCallResolutionData() { - this.targetSymbol = null; - this.resolvedSignatures = null; - this.candidateSignature = null; - this.actualParametersContextTypeSymbols = null; - this.diagnosticsFromOverloadResolution = []; - } - return PullAdditionalCallResolutionData; - })(); - TypeScript.PullAdditionalCallResolutionData = PullAdditionalCallResolutionData; - - var PullAdditionalObjectLiteralResolutionData = (function () { - function PullAdditionalObjectLiteralResolutionData() { - this.membersContextTypeSymbols = null; - } - return PullAdditionalObjectLiteralResolutionData; - })(); - TypeScript.PullAdditionalObjectLiteralResolutionData = PullAdditionalObjectLiteralResolutionData; - - var MemberWithBaseOrigin = (function () { - function MemberWithBaseOrigin(memberSymbol, baseOrigin) { - this.memberSymbol = memberSymbol; - this.baseOrigin = baseOrigin; - } - return MemberWithBaseOrigin; - })(); - - var SignatureWithBaseOrigin = (function () { - function SignatureWithBaseOrigin(signature, baseOrigin) { - this.signature = signature; - this.baseOrigin = baseOrigin; - } - return SignatureWithBaseOrigin; - })(); - - var InheritedIndexSignatureInfo = (function () { - function InheritedIndexSignatureInfo() { - } - return InheritedIndexSignatureInfo; - })(); - - var CompilerReservedName; - (function (CompilerReservedName) { - CompilerReservedName[CompilerReservedName["_this"] = 1] = "_this"; - CompilerReservedName[CompilerReservedName["_super"] = 2] = "_super"; - CompilerReservedName[CompilerReservedName["arguments"] = 3] = "arguments"; - CompilerReservedName[CompilerReservedName["_i"] = 4] = "_i"; - CompilerReservedName[CompilerReservedName["require"] = 5] = "require"; - CompilerReservedName[CompilerReservedName["exports"] = 6] = "exports"; - })(CompilerReservedName || (CompilerReservedName = {})); - - function getCompilerReservedName(name) { - var nameText = name.valueText(); - return CompilerReservedName[nameText]; - } - - var PullTypeResolver = (function () { - function PullTypeResolver(compilationSettings, semanticInfoChain) { - this.compilationSettings = compilationSettings; - this.semanticInfoChain = semanticInfoChain; - this._cachedArrayInterfaceType = null; - this._cachedNumberInterfaceType = null; - this._cachedStringInterfaceType = null; - this._cachedBooleanInterfaceType = null; - this._cachedObjectInterfaceType = null; - this._cachedFunctionInterfaceType = null; - this._cachedIArgumentsInterfaceType = null; - this._cachedRegExpInterfaceType = null; - this._cachedAnyTypeArgs = null; - this.typeCheckCallBacks = []; - this.postTypeCheckWorkitems = []; - this._cachedFunctionArgumentsSymbol = null; - this.assignableCache = TypeScript.BitMatrix.getBitMatrix(true); - this.subtypeCache = TypeScript.BitMatrix.getBitMatrix(true); - this.identicalCache = TypeScript.BitMatrix.getBitMatrix(true); - this.inResolvingOtherDeclsWalker = new TypeScript.PullHelpers.OtherPullDeclsWalker(); - } - PullTypeResolver.prototype.cachedArrayInterfaceType = function () { - if (!this._cachedArrayInterfaceType) { - this._cachedArrayInterfaceType = this.getSymbolFromDeclPath("Array", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (!this._cachedArrayInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedArrayInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedArrayInterfaceType; - }; - - PullTypeResolver.prototype.getArrayNamedType = function () { - return this.cachedArrayInterfaceType(); - }; - - PullTypeResolver.prototype.cachedNumberInterfaceType = function () { - if (!this._cachedNumberInterfaceType) { - this._cachedNumberInterfaceType = this.getSymbolFromDeclPath("Number", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedNumberInterfaceType && !this._cachedNumberInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedNumberInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedNumberInterfaceType; - }; - - PullTypeResolver.prototype.cachedStringInterfaceType = function () { - if (!this._cachedStringInterfaceType) { - this._cachedStringInterfaceType = this.getSymbolFromDeclPath("String", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedStringInterfaceType && !this._cachedStringInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedStringInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedStringInterfaceType; - }; - - PullTypeResolver.prototype.cachedBooleanInterfaceType = function () { - if (!this._cachedBooleanInterfaceType) { - this._cachedBooleanInterfaceType = this.getSymbolFromDeclPath("Boolean", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedBooleanInterfaceType && !this._cachedBooleanInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedBooleanInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedBooleanInterfaceType; - }; - - PullTypeResolver.prototype.cachedObjectInterfaceType = function () { - if (!this._cachedObjectInterfaceType) { - this._cachedObjectInterfaceType = this.getSymbolFromDeclPath("Object", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (!this._cachedObjectInterfaceType) { - this._cachedObjectInterfaceType = this.semanticInfoChain.anyTypeSymbol; - } - - if (!this._cachedObjectInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedObjectInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedObjectInterfaceType; - }; - - PullTypeResolver.prototype.cachedFunctionInterfaceType = function () { - if (!this._cachedFunctionInterfaceType) { - this._cachedFunctionInterfaceType = this.getSymbolFromDeclPath("Function", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedFunctionInterfaceType && !this._cachedFunctionInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedFunctionInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedFunctionInterfaceType; - }; - - PullTypeResolver.prototype.cachedIArgumentsInterfaceType = function () { - if (!this._cachedIArgumentsInterfaceType) { - this._cachedIArgumentsInterfaceType = this.getSymbolFromDeclPath("IArguments", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedIArgumentsInterfaceType && !this._cachedIArgumentsInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedIArgumentsInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedIArgumentsInterfaceType; - }; - - PullTypeResolver.prototype.cachedRegExpInterfaceType = function () { - if (!this._cachedRegExpInterfaceType) { - this._cachedRegExpInterfaceType = this.getSymbolFromDeclPath("RegExp", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedRegExpInterfaceType && !this._cachedRegExpInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedRegExpInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedRegExpInterfaceType; - }; - - PullTypeResolver.prototype.cachedFunctionArgumentsSymbol = function () { - if (!this._cachedFunctionArgumentsSymbol) { - this._cachedFunctionArgumentsSymbol = new TypeScript.PullSymbol("arguments", 512 /* Variable */); - this._cachedFunctionArgumentsSymbol.type = this.cachedIArgumentsInterfaceType() || this.semanticInfoChain.anyTypeSymbol; - this._cachedFunctionArgumentsSymbol.setResolved(); - - var functionArgumentsDecl = new TypeScript.PullSynthesizedDecl("arguments", "arguments", 2048 /* Parameter */, 0 /* None */, null, this.semanticInfoChain); - functionArgumentsDecl.setSymbol(this._cachedFunctionArgumentsSymbol); - this._cachedFunctionArgumentsSymbol.addDeclaration(functionArgumentsDecl); - } - - return this._cachedFunctionArgumentsSymbol; - }; - - PullTypeResolver.prototype.getApparentType = function (type) { - if (type.isTypeParameter()) { - var baseConstraint = type.getBaseConstraint(this.semanticInfoChain); - if (baseConstraint === this.semanticInfoChain.anyTypeSymbol) { - return this.semanticInfoChain.emptyTypeSymbol; - } else { - type = baseConstraint; - } - } - if (type.isPrimitive()) { - if (type === this.semanticInfoChain.numberTypeSymbol) { - return this.cachedNumberInterfaceType(); - } - if (type === this.semanticInfoChain.booleanTypeSymbol) { - return this.cachedBooleanInterfaceType(); - } - if (type === this.semanticInfoChain.stringTypeSymbol) { - return this.cachedStringInterfaceType(); - } - return type; - } - if (type.isEnum()) { - return this.cachedNumberInterfaceType(); - } - return type; - }; - - PullTypeResolver.prototype.setTypeChecked = function (ast, context) { - context.setTypeChecked(ast); - }; - - PullTypeResolver.prototype.canTypeCheckAST = function (ast, context) { - return context.canTypeCheckAST(ast); - }; - - PullTypeResolver.prototype.setSymbolForAST = function (ast, symbol, context) { - if (context && context.inProvisionalResolution()) { - context.setSymbolForAST(ast, symbol); - } else { - this.semanticInfoChain.setSymbolForAST(ast, symbol); - } - }; - - PullTypeResolver.prototype.getSymbolForAST = function (ast, context) { - var symbol = this.semanticInfoChain.getSymbolForAST(ast); - - if (!symbol) { - if (context && context.inProvisionalResolution()) { - symbol = context.getSymbolForAST(ast); - } - } - - return symbol; - }; - - PullTypeResolver.prototype.getASTForDecl = function (decl) { - return this.semanticInfoChain.getASTForDecl(decl); - }; - - PullTypeResolver.prototype.getNewErrorTypeSymbol = function (name) { - if (typeof name === "undefined") { name = null; } - return new TypeScript.PullErrorTypeSymbol(this.semanticInfoChain.anyTypeSymbol, name); - }; - - PullTypeResolver.prototype.getEnclosingDecl = function (decl) { - var declPath = decl.getParentPath(); - - if (declPath.length > 1 && declPath[declPath.length - 1] === decl) { - return declPath[declPath.length - 2]; - } else { - return declPath[declPath.length - 1]; - } - }; - - PullTypeResolver.prototype.getExportedMemberSymbol = function (symbol, parent) { - if (!(symbol.kind & (65536 /* Method */ | 4096 /* Property */))) { - var isContainer = (parent.kind & (4 /* Container */ | 32 /* DynamicModule */)) !== 0; - var containerType = !isContainer ? parent.getAssociatedContainerType() : parent; - - if (isContainer && containerType) { - if (symbol.anyDeclHasFlag(1 /* Exported */)) { - return symbol; - } - - return null; - } - } - - return symbol; - }; - - PullTypeResolver.prototype._getNamedPropertySymbolOfAugmentedType = function (symbolName, parent) { - var memberSymbol = this.getNamedPropertySymbol(symbolName, 68147712 /* SomeValue */, parent); - if (memberSymbol) { - return memberSymbol; - } - - if (this.cachedFunctionInterfaceType() && parent.isFunctionType()) { - memberSymbol = this.cachedFunctionInterfaceType().findMember(symbolName, true); - if (memberSymbol) { - return memberSymbol; - } - } - - if (this.cachedObjectInterfaceType()) { - return this.cachedObjectInterfaceType().findMember(symbolName, true); - } - - return null; - }; - - PullTypeResolver.prototype.getNamedPropertySymbol = function (symbolName, declSearchKind, parent) { - var member = null; - - if (declSearchKind & 68147712 /* SomeValue */) { - member = parent.findMember(symbolName, true); - } else if (declSearchKind & 58728795 /* SomeType */) { - member = parent.findNestedType(symbolName); - } else if (declSearchKind & 164 /* SomeContainer */) { - member = parent.findNestedContainer(symbolName); - } - - if (member) { - return this.getExportedMemberSymbol(member, parent); - } - - var containerType = parent.getAssociatedContainerType(); - - if (containerType) { - if (containerType.isClass()) { - return null; - } - - parent = containerType; - - if (declSearchKind & 68147712 /* SomeValue */) { - member = parent.findMember(symbolName, true); - } else if (declSearchKind & 58728795 /* SomeType */) { - member = parent.findNestedType(symbolName); - } else if (declSearchKind & 164 /* SomeContainer */) { - member = parent.findNestedContainer(symbolName); - } - - if (member) { - return this.getExportedMemberSymbol(member, parent); - } - } - - if (parent.kind & 164 /* SomeContainer */) { - var typeDeclarations = parent.getDeclarations(); - var childDecls = null; - - for (var j = 0; j < typeDeclarations.length; j++) { - childDecls = typeDeclarations[j].searchChildDecls(symbolName, declSearchKind); - - if (childDecls.length) { - member = childDecls[0].getSymbol(); - - if (!member) { - member = childDecls[0].getSignatureSymbol(); - } - return this.getExportedMemberSymbol(member, parent); - } - - if ((declSearchKind & 58728795 /* SomeType */) !== 0 || (declSearchKind & 68147712 /* SomeValue */) !== 0) { - childDecls = typeDeclarations[j].searchChildDecls(symbolName, 128 /* TypeAlias */); - if (childDecls.length && childDecls[0].kind === 128 /* TypeAlias */) { - var aliasSymbol = this.getExportedMemberSymbol(childDecls[0].getSymbol(), parent); - if (aliasSymbol) { - if ((declSearchKind & 58728795 /* SomeType */) !== 0) { - var typeSymbol = aliasSymbol.getExportAssignedTypeSymbol(); - if (typeSymbol) { - return typeSymbol; - } - } else { - var valueSymbol = aliasSymbol.getExportAssignedValueSymbol(); - if (valueSymbol) { - aliasSymbol.setIsUsedAsValue(); - return valueSymbol; - } - } - - return aliasSymbol; - } - } - } - } - } - }; - - PullTypeResolver.prototype.getSymbolFromDeclPath = function (symbolName, declPath, declSearchKind) { - var _this = this; - var symbol = null; - - var decl = null; - var childDecls; - var declSymbol = null; - var declMembers; - var pathDeclKind; - var valDecl = null; - var kind; - var instanceSymbol = null; - var instanceType = null; - var childSymbol = null; - - var allowedContainerDeclKind = 4 /* Container */ | 32 /* DynamicModule */; - if (TypeScript.hasFlag(declSearchKind, 67108864 /* EnumMember */)) { - allowedContainerDeclKind |= 64 /* Enum */; - } - - var isAcceptableAlias = function (symbol) { - if (symbol.isAlias()) { - _this.resolveDeclaredSymbol(symbol); - if (TypeScript.hasFlag(declSearchKind, 164 /* SomeContainer */)) { - if (symbol.assignedContainer() || symbol.getExportAssignedContainerSymbol()) { - return true; - } - } else if (TypeScript.hasFlag(declSearchKind, 58728795 /* SomeType */)) { - var type = symbol.getExportAssignedTypeSymbol(); - if (type && type.kind !== 32 /* DynamicModule */) { - return true; - } - - var type = symbol.assignedType(); - if (type && type.kind !== 32 /* DynamicModule */) { - return true; - } - } else if (TypeScript.hasFlag(declSearchKind, 68147712 /* SomeValue */ & ~67108864 /* EnumMember */)) { - if (symbol.assignedType() && symbol.assignedType().isError()) { - return true; - } else if (symbol.assignedValue() || symbol.getExportAssignedValueSymbol()) { - return true; - } else { - var assignedType = symbol.assignedType(); - if (assignedType && assignedType.isContainer() && assignedType.getInstanceType()) { - return true; - } - - var decls = symbol.getDeclarations(); - var ast = decls[0].ast(); - return ast.moduleReference.kind() === 245 /* ExternalModuleReference */; - } - } - } - - return false; - }; - - var tryFindAlias = function (decl) { - var childDecls = decl.searchChildDecls(symbolName, 128 /* TypeAlias */); - - if (childDecls.length) { - var sym = childDecls[0].getSymbol(); - if (isAcceptableAlias(sym)) { - return sym; - } - } - return null; - }; - - for (var i = declPath.length - 1; i >= 0; i--) { - decl = declPath[i]; - pathDeclKind = decl.kind; - - if (decl.flags & 2097152 /* DeclaredInAWithBlock */) { - return this.semanticInfoChain.anyTypeSymbol; - } - - if (pathDeclKind & allowedContainerDeclKind) { - childDecls = decl.searchChildDecls(symbolName, declSearchKind); - - if (childDecls.length) { - return childDecls[0].getSymbol(); - } - - var alias = tryFindAlias(decl); - if (alias) { - return alias; - } - - if (declSearchKind & 68147712 /* SomeValue */) { - instanceSymbol = decl.getSymbol().getInstanceSymbol(); - - if (instanceSymbol) { - instanceType = instanceSymbol.type; - - childSymbol = this.getNamedPropertySymbol(symbolName, declSearchKind, instanceType); - - if (childSymbol && (childSymbol.kind & declSearchKind) && !childSymbol.anyDeclHasFlag(16 /* Static */)) { - return childSymbol; - } - } - - valDecl = decl.getValueDecl(); - - if (valDecl) { - decl = valDecl; - } - } - - declSymbol = decl.getSymbol().type; - - var childSymbol = this.getNamedPropertySymbol(symbolName, declSearchKind, declSymbol); - - if (childSymbol && (childSymbol.kind & declSearchKind) && !childSymbol.anyDeclHasFlag(16 /* Static */)) { - return childSymbol; - } - } else if ((declSearchKind & (58728795 /* SomeType */ | 164 /* SomeContainer */)) || !(pathDeclKind & 8 /* Class */)) { - var candidateSymbol = null; - - if (pathDeclKind === 131072 /* FunctionExpression */ && symbolName === decl.getFunctionExpressionName()) { - candidateSymbol = decl.getSymbol(); - } - - childDecls = decl.searchChildDecls(symbolName, declSearchKind); - - if (childDecls.length) { - if (decl.kind & 1032192 /* SomeFunction */) { - decl.ensureSymbolIsBound(); - } - return childDecls[0].getSymbol(); - } - - if (candidateSymbol) { - return candidateSymbol; - } - - var alias = tryFindAlias(decl); - if (alias) { - return alias; - } - } - } - - symbol = this.semanticInfoChain.findSymbol([symbolName], declSearchKind); - if (symbol) { - return symbol; - } - - if (!TypeScript.hasFlag(declSearchKind, 128 /* TypeAlias */)) { - symbol = this.semanticInfoChain.findSymbol([symbolName], 128 /* TypeAlias */); - if (symbol && isAcceptableAlias(symbol)) { - return symbol; - } - } - - return null; - }; - - PullTypeResolver.prototype.getVisibleDeclsFromDeclPath = function (declPath, declSearchKind) { - var result = []; - var decl = null; - var childDecls; - var pathDeclKind; - - for (var i = declPath.length - 1; i >= 0; i--) { - decl = declPath[i]; - pathDeclKind = decl.kind; - - var declKind = decl.kind; - - if (declKind !== 8 /* Class */ && declKind !== 16 /* Interface */) { - this.addFilteredDecls(decl.getChildDecls(), declSearchKind, result); - } - - switch (declKind) { - case 4 /* Container */: - case 32 /* DynamicModule */: - var otherDecls = this.semanticInfoChain.findDeclsFromPath(declPath.slice(0, i + 1), 164 /* SomeContainer */); - for (var j = 0, m = otherDecls.length; j < m; j++) { - var otherDecl = otherDecls[j]; - if (otherDecl === decl) { - continue; - } - - var otherDeclChildren = otherDecl.getChildDecls(); - for (var k = 0, s = otherDeclChildren.length; k < s; k++) { - var otherDeclChild = otherDeclChildren[k]; - if ((otherDeclChild.flags & 1 /* Exported */) && (otherDeclChild.kind & declSearchKind)) { - result.push(otherDeclChild); - } - } - } - - break; - - case 8 /* Class */: - case 16 /* Interface */: - var parameters = decl.getTypeParameters(); - if (parameters && parameters.length) { - this.addFilteredDecls(parameters, declSearchKind, result); - } - - break; - - case 131072 /* FunctionExpression */: - var functionExpressionName = decl.getFunctionExpressionName(); - if (functionExpressionName) { - result.push(decl); - } - - case 16384 /* Function */: - case 32768 /* ConstructorMethod */: - case 65536 /* Method */: - var parameters = decl.getTypeParameters(); - if (parameters && parameters.length) { - this.addFilteredDecls(parameters, declSearchKind, result); - } - - break; - } - } - - var topLevelDecls = this.semanticInfoChain.topLevelDecls(); - for (var i = 0, n = topLevelDecls.length; i < n; i++) { - var topLevelDecl = topLevelDecls[i]; - if (declPath.length > 0 && topLevelDecl.fileName() === declPath[0].fileName()) { - continue; - } - - if (!topLevelDecl.isExternalModule()) { - this.addFilteredDecls(topLevelDecl.getChildDecls(), declSearchKind, result); - } - } - - return result; - }; - - PullTypeResolver.prototype.addFilteredDecls = function (decls, declSearchKind, result) { - if (decls.length) { - for (var i = 0, n = decls.length; i < n; i++) { - var decl = decls[i]; - if (decl.kind & declSearchKind) { - result.push(decl); - } - } - } - }; - - PullTypeResolver.prototype.getVisibleDecls = function (enclosingDecl) { - var declPath = enclosingDecl.getParentPath(); - - var declSearchKind = 58728795 /* SomeType */ | 164 /* SomeContainer */ | 68147712 /* SomeValue */; - - return this.getVisibleDeclsFromDeclPath(declPath, declSearchKind); - }; - - PullTypeResolver.prototype.getVisibleContextSymbols = function (enclosingDecl, context) { - var contextualTypeSymbol = context.getContextualType(); - if (!contextualTypeSymbol || this.isAnyOrEquivalent(contextualTypeSymbol)) { - return null; - } - - var declSearchKind = 58728795 /* SomeType */ | 164 /* SomeContainer */ | 68147712 /* SomeValue */; - var members = contextualTypeSymbol.getAllMembers(declSearchKind, 2 /* externallyVisible */); - - for (var i = 0; i < members.length; i++) { - members[i].setUnresolved(); - } - - return members; - }; - - PullTypeResolver.prototype.getVisibleMembersFromExpression = function (expression, enclosingDecl, context) { - var lhs = this.resolveAST(expression, false, context); - - if (isTypesOnlyLocation(expression) && (lhs.kind === 8 /* Class */ || lhs.kind === 16 /* Interface */ || lhs.kind === 64 /* Enum */)) { - return null; - } - - var lhsType = lhs.type; - if (!lhsType) { - return null; - } - - this.resolveDeclaredSymbol(lhsType, context); - - if (lhsType.isContainer() && lhsType.isAlias()) { - lhsType = lhsType.getExportAssignedTypeSymbol(); - } - - if (this.isAnyOrEquivalent(lhsType)) { - return null; - } - - var memberVisibilty = 2 /* externallyVisible */; - var containerSymbol = lhsType; - if (containerSymbol.kind === 33554432 /* ConstructorType */) { - containerSymbol = containerSymbol.getConstructSignatures()[0].returnType; - } - - if (containerSymbol && containerSymbol.isClass()) { - var declPath = enclosingDecl.getParentPath(); - if (declPath && declPath.length) { - var declarations = containerSymbol.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - if (TypeScript.ArrayUtilities.contains(declPath, declaration)) { - memberVisibilty = 1 /* internallyVisible */; - break; - } - } - } - } - - var declSearchKind = 58728795 /* SomeType */ | 164 /* SomeContainer */ | 68147712 /* SomeValue */; - - var members = []; - - if (lhsType.isContainer()) { - var exportedAssignedContainerSymbol = lhsType.getExportAssignedContainerSymbol(); - if (exportedAssignedContainerSymbol) { - lhsType = exportedAssignedContainerSymbol; - } - } - - lhsType = this.getApparentType(lhsType); - - if (!lhsType.isResolved) { - var potentiallySpecializedType = this.resolveDeclaredSymbol(lhsType, context); - - if (potentiallySpecializedType !== lhsType) { - if (!lhs.isType()) { - context.setTypeInContext(lhs, potentiallySpecializedType); - } - - lhsType = potentiallySpecializedType; - } - } - - members = lhsType.getAllMembers(declSearchKind, memberVisibilty); - - if (lhsType.isContainer()) { - var associatedInstance = lhsType.getInstanceSymbol(); - if (associatedInstance) { - var instanceType = associatedInstance.type; - this.resolveDeclaredSymbol(instanceType, context); - var instanceMembers = instanceType.getAllMembers(declSearchKind, memberVisibilty); - members = members.concat(instanceMembers); - } - - var exportedContainer = lhsType.getExportAssignedContainerSymbol(); - if (exportedContainer) { - var exportedContainerMembers = exportedContainer.getAllMembers(declSearchKind, memberVisibilty); - members = members.concat(exportedContainerMembers); - } - } else if (!lhsType.isConstructor() && !lhsType.isEnum()) { - var associatedContainerSymbol = lhsType.getAssociatedContainerType(); - if (associatedContainerSymbol) { - var containerType = associatedContainerSymbol.type; - this.resolveDeclaredSymbol(containerType, context); - var containerMembers = containerType.getAllMembers(declSearchKind, memberVisibilty); - members = members.concat(containerMembers); - } - } - - if (lhsType.isFunctionType() && this.cachedFunctionInterfaceType()) { - members = members.concat(this.cachedFunctionInterfaceType().getAllMembers(declSearchKind, 2 /* externallyVisible */)); - } - - return members; - }; - - PullTypeResolver.prototype.isAnyOrEquivalent = function (type) { - return (type === this.semanticInfoChain.anyTypeSymbol) || type.isError(); - }; - - PullTypeResolver.prototype.resolveExternalModuleReference = function (idText, currentFileName) { - var originalIdText = idText; - var symbol = null; - - if (TypeScript.isRelative(originalIdText)) { - var path = TypeScript.getRootFilePath(TypeScript.switchToForwardSlashes(currentFileName)); - symbol = this.semanticInfoChain.findExternalModule(path + idText); - } else { - idText = originalIdText; - - symbol = this.semanticInfoChain.findAmbientExternalModuleInGlobalContext(TypeScript.quoteStr(originalIdText)); - - if (!symbol) { - var path = TypeScript.getRootFilePath(TypeScript.switchToForwardSlashes(currentFileName)); - - while (symbol === null && path != "") { - symbol = this.semanticInfoChain.findExternalModule(path + idText); - if (symbol === null) { - if (path === '/') { - path = ''; - } else { - path = TypeScript.normalizePath(path + ".."); - path = path && path != '/' ? path + '/' : path; - } - } - } - } - } - - return symbol; - }; - - PullTypeResolver.prototype.resolveDeclaredSymbol = function (symbol, context) { - if (!symbol || symbol.isResolved || symbol.isTypeReference()) { - return symbol; - } - - if (!context) { - context = new TypeScript.PullTypeResolutionContext(this); - } - - return this.resolveDeclaredSymbolWorker(symbol, context); - }; - - PullTypeResolver.prototype.resolveDeclaredSymbolWorker = function (symbol, context) { - if (!symbol || symbol.isResolved) { - return symbol; - } - - if (symbol.inResolution) { - if (!symbol.type && !symbol.isType()) { - symbol.type = this.semanticInfoChain.anyTypeSymbol; - } - - return symbol; - } - - var decls = symbol.getDeclarations(); - - for (var i = 0; i < decls.length; i++) { - var decl = decls[i]; - - var ast = this.semanticInfoChain.getASTForDecl(decl); - - if (!ast || (ast.kind() === 139 /* GetAccessor */ && ast.parent.parent.kind() === 215 /* ObjectLiteralExpression */) || (ast.kind() === 140 /* SetAccessor */ && ast.parent.parent.kind() === 215 /* ObjectLiteralExpression */)) { - return symbol; - } - - if (ast.parent && ast.parent.kind() === 236 /* CatchClause */ && ast.parent.identifier === ast) { - return symbol; - } - - if (ast.parent && ast.parent.kind() === 219 /* SimpleArrowFunctionExpression */ && ast.parent.identifier === ast) { - return symbol; - } - - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(ast); - var resolvedSymbol; - if (enclosingModule) { - resolvedSymbol = this.resolveSingleModuleDeclaration(enclosingModule, ast, context); - } else if (ast.kind() === 120 /* SourceUnit */ && decl.kind === 32 /* DynamicModule */) { - resolvedSymbol = this.resolveModuleSymbol(decl.getSymbol(), context, null, null, ast); - } else { - TypeScript.Debug.assert(ast.kind() !== 11 /* IdentifierName */ && ast.kind() !== 212 /* MemberAccessExpression */); - resolvedSymbol = this.resolveAST(ast, false, context); - } - - if (decl.kind === 2048 /* Parameter */ && !symbol.isResolved && !symbol.type && resolvedSymbol && symbol.anyDeclHasFlag(8388608 /* PropertyParameter */ | 67108864 /* ConstructorParameter */)) { - symbol.type = resolvedSymbol.type; - symbol.setResolved(); - } - } - - if (!symbol.isResolved) { - TypeScript.Debug.assert(!symbol.inResolution); - - symbol.setResolved(); - } - - return symbol; - }; - - PullTypeResolver.prototype.resolveOtherDecl = function (otherDecl, context) { - var astForOtherDecl = this.getASTForDecl(otherDecl); - var moduleDecl = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(astForOtherDecl); - if (moduleDecl) { - this.resolveSingleModuleDeclaration(moduleDecl, astForOtherDecl, context); - } else { - this.resolveAST(astForOtherDecl, false, context); - } - }; - - PullTypeResolver.prototype.resolveOtherDeclarations = function (astName, context) { - var _this = this; - var resolvedDecl = this.semanticInfoChain.getDeclForAST(astName); - var symbol = resolvedDecl.getSymbol(); - - var allDecls = symbol.getDeclarations(); - this.inResolvingOtherDeclsWalker.walkOtherPullDecls(resolvedDecl, symbol.getDeclarations(), function (otherDecl) { - return _this.resolveOtherDecl(otherDecl, context); - }); - }; - - PullTypeResolver.prototype.resolveSourceUnit = function (sourceUnit, context) { - var enclosingDecl = this.getEnclosingDeclForAST(sourceUnit); - var moduleSymbol = enclosingDecl.getSymbol(); - this.ensureAllSymbolsAreBound(moduleSymbol); - - this.resolveFirstExportAssignmentStatement(sourceUnit.moduleElements, context); - this.resolveAST(sourceUnit.moduleElements, false, context); - - if (this.canTypeCheckAST(sourceUnit, context)) { - this.typeCheckSourceUnit(sourceUnit, context); - } - - return moduleSymbol; - }; - - PullTypeResolver.prototype.typeCheckSourceUnit = function (sourceUnit, context) { - var _this = this; - this.setTypeChecked(sourceUnit, context); - - this.resolveAST(sourceUnit.moduleElements, false, context); - - this.typeCheckCallBacks.push(function (context) { - return _this.verifyUniquenessOfImportNamesInSourceUnit(sourceUnit); - }); - }; - - PullTypeResolver.prototype.verifyUniquenessOfImportNamesInSourceUnit = function (sourceUnit) { - var _this = this; - var enclosingDecl = this.semanticInfoChain.getDeclForAST(sourceUnit); - - var doesImportNameExistInOtherFiles = function (name) { - var importSymbol = _this.semanticInfoChain.findTopLevelSymbol(name, 128 /* TypeAlias */, null); - return importSymbol && importSymbol.isAlias(); - }; - - this.checkUniquenessOfImportNames([enclosingDecl], doesImportNameExistInOtherFiles); - }; - - PullTypeResolver.prototype.resolveEnumDeclaration = function (ast, context) { - var containerDecl = this.semanticInfoChain.getDeclForAST(ast); - var containerSymbol = containerDecl.getSymbol(); - - if (containerSymbol.isResolved || containerSymbol.inResolution) { - return containerSymbol; - } - - containerSymbol.inResolution = true; - - var containerDecls = containerSymbol.getDeclarations(); - - for (var i = 0; i < containerDecls.length; i++) { - var childDecls = containerDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - - containerSymbol.setResolved(); - - this.resolveOtherDeclarations(ast, context); - - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckEnumDeclaration(ast, context); - } - - return containerSymbol; - }; - - PullTypeResolver.prototype.typeCheckEnumDeclaration = function (ast, context) { - var _this = this; - this.setTypeChecked(ast, context); - - this.resolveAST(ast.enumElements, false, context); - var containerDecl = this.semanticInfoChain.getDeclForAST(ast); - this.validateVariableDeclarationGroups(containerDecl, context); - - this.typeCheckCallBacks.push(function (context) { - return _this.checkInitializersInEnumDeclarations(containerDecl, context); - }); - - if (!TypeScript.ASTHelpers.enumIsElided(ast)) { - this.checkNameForCompilerGeneratedDeclarationCollision(ast, true, ast.identifier, context); - } - }; - - PullTypeResolver.prototype.postTypeCheckEnumDeclaration = function (ast, context) { - this.checkThisCaptureVariableCollides(ast, true, context); - }; - - PullTypeResolver.prototype.checkInitializersInEnumDeclarations = function (decl, context) { - var symbol = decl.getSymbol(); - - var declarations = symbol.getDeclarations(); - if (decl !== declarations[0]) { - return; - } - - var seenEnumDeclWithNoFirstMember = false; - for (var i = 0; i < declarations.length; ++i) { - var currentDecl = declarations[i]; - - var ast = currentDecl.ast(); - if (ast.enumElements.nonSeparatorCount() === 0) { - continue; - } - - var firstVariable = ast.enumElements.nonSeparatorAt(0); - if (!firstVariable.equalsValueClause) { - if (!seenEnumDeclWithNoFirstMember) { - seenEnumDeclWithNoFirstMember = true; - } else { - this.semanticInfoChain.addDiagnosticFromAST(firstVariable, TypeScript.DiagnosticCode.In_enums_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_the_first_enum_element); - } - } - } - }; - - PullTypeResolver.prototype.resolveModuleDeclaration = function (ast, context) { - var result; - - if (ast.stringLiteral) { - result = this.resolveSingleModuleDeclaration(ast, ast.stringLiteral, context); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(ast.name); - for (var i = 0, n = moduleNames.length; i < n; i++) { - result = this.resolveSingleModuleDeclaration(ast, moduleNames[i], context); - } - } - - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckModuleDeclaration(ast, context); - } - - return result; - }; - - PullTypeResolver.prototype.ensureAllSymbolsAreBound = function (containerSymbol) { - if (containerSymbol) { - var containerDecls = containerSymbol.getDeclarations(); - - for (var i = 0; i < containerDecls.length; i++) { - var childDecls = containerDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - } - }; - - PullTypeResolver.prototype.resolveModuleSymbol = function (containerSymbol, context, moduleDeclAST, moduleDeclNameAST, sourceUnitAST) { - if (containerSymbol.isResolved || containerSymbol.inResolution) { - return containerSymbol; - } - - containerSymbol.inResolution = true; - this.ensureAllSymbolsAreBound(containerSymbol); - - var instanceSymbol = containerSymbol.getInstanceSymbol(); - - if (instanceSymbol) { - this.resolveDeclaredSymbol(instanceSymbol, context); - } - - var isLastName = TypeScript.ASTHelpers.isLastNameOfModule(moduleDeclAST, moduleDeclNameAST); - if (isLastName) { - this.resolveFirstExportAssignmentStatement(moduleDeclAST.moduleElements, context); - } else if (sourceUnitAST) { - this.resolveFirstExportAssignmentStatement(sourceUnitAST.moduleElements, context); - } - - containerSymbol.setResolved(); - - if (moduleDeclNameAST) { - this.resolveOtherDeclarations(moduleDeclNameAST, context); - } - - return containerSymbol; - }; - - PullTypeResolver.prototype.resolveFirstExportAssignmentStatement = function (moduleElements, context) { - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var moduleElement = moduleElements.childAt(i); - if (moduleElement.kind() === 134 /* ExportAssignment */) { - this.resolveExportAssignmentStatement(moduleElement, context); - return; - } - } - }; - - PullTypeResolver.prototype.resolveSingleModuleDeclaration = function (ast, astName, context) { - var containerDecl = this.semanticInfoChain.getDeclForAST(astName); - var containerSymbol = containerDecl.getSymbol(); - - return this.resolveModuleSymbol(containerSymbol, context, ast, astName, null); - }; - - PullTypeResolver.prototype.typeCheckModuleDeclaration = function (ast, context) { - if (ast.stringLiteral) { - this.typeCheckSingleModuleDeclaration(ast, ast.stringLiteral, context); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(ast.name); - for (var i = 0, n = moduleNames.length; i < n; i++) { - this.typeCheckSingleModuleDeclaration(ast, moduleNames[i], context); - } - } - }; - - PullTypeResolver.prototype.typeCheckSingleModuleDeclaration = function (ast, astName, context) { - var _this = this; - this.setTypeChecked(ast, context); - - if (TypeScript.ASTHelpers.isLastNameOfModule(ast, astName)) { - this.resolveAST(ast.moduleElements, false, context); - } - - var containerDecl = this.semanticInfoChain.getDeclForAST(astName); - this.validateVariableDeclarationGroups(containerDecl, context); - - if (ast.stringLiteral) { - if (TypeScript.isRelative(ast.stringLiteral.valueText())) { - this.semanticInfoChain.addDiagnosticFromAST(ast.stringLiteral, TypeScript.DiagnosticCode.Ambient_external_module_declaration_cannot_specify_relative_module_name); - } - } - - if (!TypeScript.ASTHelpers.moduleIsElided(ast) && !ast.stringLiteral) { - this.checkNameForCompilerGeneratedDeclarationCollision(astName, true, astName, context); - } - - this.typeCheckCallBacks.push(function (context) { - return _this.verifyUniquenessOfImportNamesInModule(containerDecl); - }); - }; - - PullTypeResolver.prototype.verifyUniquenessOfImportNamesInModule = function (decl) { - var symbol = decl.getSymbol(); - if (!symbol) { - return; - } - - var decls = symbol.getDeclarations(); - - if (decls[0] !== decl) { - return; - } - - this.checkUniquenessOfImportNames(decls); - }; - - PullTypeResolver.prototype.checkUniquenessOfImportNames = function (decls, doesNameExistOutside) { - var _this = this; - var importDeclarationNames; - - for (var i = 0; i < decls.length; ++i) { - var childDecls = decls[i].getChildDecls(); - for (var j = 0; j < childDecls.length; ++j) { - var childDecl = childDecls[j]; - if (childDecl.kind === 128 /* TypeAlias */) { - importDeclarationNames = importDeclarationNames || TypeScript.createIntrinsicsObject(); - importDeclarationNames[childDecl.name] = true; - } - } - } - - if (!importDeclarationNames && !doesNameExistOutside) { - return; - } - - for (var i = 0; i < decls.length; ++i) { - this.scanVariableDeclarationGroups(decls[i], function (firstDeclInGroup) { - var nameConflict = importDeclarationNames && importDeclarationNames[firstDeclInGroup.name]; - if (!nameConflict) { - nameConflict = doesNameExistOutside && doesNameExistOutside(firstDeclInGroup.name); - if (nameConflict) { - importDeclarationNames = importDeclarationNames || TypeScript.createIntrinsicsObject(); - importDeclarationNames[firstDeclInGroup.name] = true; - } - } - - if (nameConflict) { - _this.semanticInfoChain.addDiagnosticFromAST(firstDeclInGroup.ast(), TypeScript.DiagnosticCode.Variable_declaration_cannot_have_the_same_name_as_an_import_declaration); - } - }); - } - }; - - PullTypeResolver.prototype.scanVariableDeclarationGroups = function (enclosingDecl, firstDeclHandler, subsequentDeclHandler) { - var declGroups = enclosingDecl.getVariableDeclGroups(); - - for (var i = 0; i < declGroups.length; i++) { - var firstSymbol = null; - var enclosingDeclForFirstSymbol = null; - - if (enclosingDecl.kind === 1 /* Script */ && declGroups[i].length) { - var name = declGroups[i][0].name; - var candidateSymbol = this.semanticInfoChain.findTopLevelSymbol(name, 512 /* Variable */, enclosingDecl); - if (candidateSymbol) { - if (!candidateSymbol.anyDeclHasFlag(118784 /* ImplicitVariable */)) { - if (!candidateSymbol.isResolved) { - this.resolveDeclaredSymbol(candidateSymbol); - } - firstSymbol = candidateSymbol; - } - } - } - - for (var j = 0; j < declGroups[i].length; j++) { - var decl = declGroups[i][j]; - - var name = decl.name; - - var symbol = decl.getSymbol(); - - if (j === 0) { - firstDeclHandler(decl); - if (!subsequentDeclHandler) { - break; - } - - if (!firstSymbol || !firstSymbol.type) { - firstSymbol = symbol; - continue; - } - } - - subsequentDeclHandler(decl, firstSymbol); - } - } - }; - - PullTypeResolver.prototype.postTypeCheckModuleDeclaration = function (ast, context) { - this.checkThisCaptureVariableCollides(ast, true, context); - }; - - PullTypeResolver.prototype.isTypeRefWithoutTypeArgs = function (term) { - if (term.kind() === 11 /* IdentifierName */) { - return true; - } else if (term.kind() === 121 /* QualifiedName */) { - var binex = term; - - if (binex.right.kind() === 11 /* IdentifierName */) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.createInstantiatedType = function (type, typeArguments) { - if (!type.isGeneric()) { - return type; - } - - var typeParameters = type.getTypeArgumentsOrTypeParameters(); - - var typeParameterArgumentMap = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameterArgumentMap[typeParameters[i].pullSymbolID] = typeArguments[i] || new TypeScript.PullErrorTypeSymbol(this.semanticInfoChain.anyTypeSymbol, typeParameters[i].name); - } - - return TypeScript.PullInstantiatedTypeReferenceSymbol.create(this, type, typeParameterArgumentMap); - }; - - PullTypeResolver.prototype.resolveReferenceTypeDeclaration = function (classOrInterface, name, heritageClauses, context) { - var _this = this; - var typeDecl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var enclosingDecl = this.getEnclosingDecl(typeDecl); - var typeDeclSymbol = typeDecl.getSymbol(); - var typeDeclIsClass = classOrInterface.kind() === 131 /* ClassDeclaration */; - var hasVisited = this.getSymbolForAST(classOrInterface, context) !== null; - - if ((typeDeclSymbol.isResolved && hasVisited) || (typeDeclSymbol.inResolution && !context.isInBaseTypeResolution())) { - return typeDeclSymbol; - } - - var wasResolving = typeDeclSymbol.inResolution; - typeDeclSymbol.startResolving(); - - var typeRefDecls = typeDeclSymbol.getDeclarations(); - - for (var i = 0; i < typeRefDecls.length; i++) { - var childDecls = typeRefDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - - if (!typeDeclSymbol.isResolved) { - var typeDeclTypeParameters = typeDeclSymbol.getTypeParameters(); - for (var i = 0; i < typeDeclTypeParameters.length; i++) { - this.resolveDeclaredSymbol(typeDeclTypeParameters[i], context); - } - } - - var wasInBaseTypeResolution = context.startBaseTypeResolution(); - - if (!typeDeclIsClass && !hasVisited) { - typeDeclSymbol.resetKnownBaseTypeCount(); - } - - var extendsClause = TypeScript.ASTHelpers.getExtendsHeritageClause(heritageClauses); - if (extendsClause) { - for (var i = typeDeclSymbol.getKnownBaseTypeCount(); i < extendsClause.typeNames.nonSeparatorCount(); i = typeDeclSymbol.getKnownBaseTypeCount()) { - typeDeclSymbol.incrementKnownBaseCount(); - var parentType = this.resolveTypeReference(extendsClause.typeNames.nonSeparatorAt(i), context); - - if (typeDeclSymbol.isValidBaseKind(parentType, true)) { - this.setSymbolForAST(extendsClause.typeNames.nonSeparatorAt(i), parentType, null); - - if (!typeDeclSymbol.hasBase(parentType) && !parentType.hasBase(typeDeclSymbol)) { - typeDeclSymbol.addExtendedType(parentType); - - var specializations = typeDeclSymbol.getKnownSpecializations(); - - for (var j = 0; j < specializations.length; j++) { - specializations[j].addExtendedType(parentType); - } - } - } else if (parentType && !this.getSymbolForAST(extendsClause.typeNames.nonSeparatorAt(i), context)) { - this.setSymbolForAST(extendsClause.typeNames.nonSeparatorAt(i), parentType, null); - } - } - } - - var implementsClause = TypeScript.ASTHelpers.getImplementsHeritageClause(heritageClauses); - if (implementsClause && typeDeclIsClass) { - var extendsCount = extendsClause ? extendsClause.typeNames.nonSeparatorCount() : 0; - for (var i = typeDeclSymbol.getKnownBaseTypeCount(); ((i - extendsCount) >= 0) && ((i - extendsCount) < implementsClause.typeNames.nonSeparatorCount()); i = typeDeclSymbol.getKnownBaseTypeCount()) { - typeDeclSymbol.incrementKnownBaseCount(); - var implementedTypeAST = implementsClause.typeNames.nonSeparatorAt(i - extendsCount); - var implementedType = this.resolveTypeReference(implementedTypeAST, context); - - if (typeDeclSymbol.isValidBaseKind(implementedType, false)) { - this.setSymbolForAST(implementsClause.typeNames.nonSeparatorAt(i - extendsCount), implementedType, null); - - if (!typeDeclSymbol.hasBase(implementedType) && !implementedType.hasBase(typeDeclSymbol)) { - typeDeclSymbol.addImplementedType(implementedType); - } - } else if (implementedType && !this.getSymbolForAST(implementsClause.typeNames.nonSeparatorAt(i - extendsCount), context)) { - this.setSymbolForAST(implementsClause.typeNames.nonSeparatorAt(i - extendsCount), implementedType, null); - } - } - } - - context.doneBaseTypeResolution(wasInBaseTypeResolution); - - if (wasInBaseTypeResolution) { - typeDeclSymbol.inResolution = false; - - this.typeCheckCallBacks.push(function (context) { - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - _this.resolveClassDeclaration(classOrInterface, context); - } else { - _this.resolveInterfaceDeclaration(classOrInterface, context); - } - }); - - return typeDeclSymbol; - } - - this.setSymbolForAST(name, typeDeclSymbol, context); - this.setSymbolForAST(classOrInterface, typeDeclSymbol, context); - - typeDeclSymbol.setResolved(); - - return typeDeclSymbol; - }; - - PullTypeResolver.prototype.resolveClassDeclaration = function (classDeclAST, context) { - var classDecl = this.semanticInfoChain.getDeclForAST(classDeclAST); - var classDeclSymbol = classDecl.getSymbol(); - - if (!classDeclSymbol.isResolved) { - this.resolveReferenceTypeDeclaration(classDeclAST, classDeclAST.identifier, classDeclAST.heritageClauses, context); - - var constructorMethod = classDeclSymbol.getConstructorMethod(); - var extendedTypes = classDeclSymbol.getExtendedTypes(); - var parentType = extendedTypes.length ? extendedTypes[0] : null; - - if (constructorMethod) { - if (parentType) { - var parentConstructorSymbol = parentType.getConstructorMethod(); - - if (parentConstructorSymbol) { - var parentConstructorTypeSymbol = parentConstructorSymbol.type; - var constructorTypeSymbol = constructorMethod.type; - if (!constructorTypeSymbol.hasBase(parentConstructorTypeSymbol)) { - constructorTypeSymbol.addExtendedType(parentConstructorTypeSymbol); - } - } - } - - if (!classDeclSymbol.isResolved) { - return classDeclSymbol; - } - } - - this.resolveOtherDeclarations(classDeclAST, context); - } - - if (this.canTypeCheckAST(classDeclAST, context)) { - this.typeCheckClassDeclaration(classDeclAST, context); - } - - return classDeclSymbol; - }; - - PullTypeResolver.prototype.typeCheckTypeParametersOfTypeDeclaration = function (classOrInterface, context) { - var _this = this; - var typeParametersList = classOrInterface.kind() == 131 /* ClassDeclaration */ ? classOrInterface.typeParameterList : classOrInterface.typeParameterList; - - if (typeParametersList) { - var typeDecl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var typeDeclSymbol = typeDecl.getSymbol(); - - for (var i = 0; i < typeParametersList.typeParameters.nonSeparatorCount(); i++) { - var typeParameterAST = typeParametersList.typeParameters.nonSeparatorAt(i); - this.resolveTypeParameterDeclaration(typeParameterAST, context); - - var typeParameterDecl = this.semanticInfoChain.getDeclForAST(typeParameterAST); - var typeParameterSymbol = typeParameterDecl.getSymbol(); - - this.checkSymbolPrivacy(typeDeclSymbol, typeParameterSymbol, function (symbol) { - return _this.typeParameterOfTypeDeclarationPrivacyErrorReporter(classOrInterface, typeParameterAST, typeParameterSymbol, symbol, context); - }); - } - } - }; - - PullTypeResolver.prototype.typeCheckClassDeclaration = function (classDeclAST, context) { - this.setTypeChecked(classDeclAST, context); - - var classDecl = this.semanticInfoChain.getDeclForAST(classDeclAST); - var classDeclSymbol = classDecl.getSymbol(); - - this.checkNameForCompilerGeneratedDeclarationCollision(classDeclAST, true, classDeclAST.identifier, context); - this.resolveAST(classDeclAST.classElements, false, context); - - this.typeCheckTypeParametersOfTypeDeclaration(classDeclAST, context); - this.typeCheckBases(classDeclAST, classDeclAST.identifier, classDeclAST.heritageClauses, classDeclSymbol, this.getEnclosingDecl(classDecl), context); - - if (!classDeclSymbol.hasBaseTypeConflict()) { - this.typeCheckMembersAgainstIndexer(classDeclSymbol, classDecl, context); - } - - this.checkTypeForDuplicateIndexSignatures(classDeclSymbol); - }; - - PullTypeResolver.prototype.postTypeCheckClassDeclaration = function (classDeclAST, context) { - this.checkThisCaptureVariableCollides(classDeclAST, true, context); - }; - - PullTypeResolver.prototype.resolveTypeSymbolSignatures = function (typeSymbol, context) { - var callSignatures = typeSymbol.getCallSignatures(); - for (var i = 0; i < callSignatures.length; i++) { - this.resolveDeclaredSymbol(callSignatures[i], context); - } - - var constructSignatures = typeSymbol.getConstructSignatures(); - for (var i = 0; i < constructSignatures.length; i++) { - this.resolveDeclaredSymbol(constructSignatures[i], context); - } - - var indexSignatures = typeSymbol.getIndexSignatures(); - for (var i = 0; i < indexSignatures.length; i++) { - this.resolveDeclaredSymbol(indexSignatures[i], context); - } - }; - - PullTypeResolver.prototype.resolveInterfaceDeclaration = function (interfaceDeclAST, context) { - this.resolveReferenceTypeDeclaration(interfaceDeclAST, interfaceDeclAST.identifier, interfaceDeclAST.heritageClauses, context); - - var interfaceDecl = this.semanticInfoChain.getDeclForAST(interfaceDeclAST); - var interfaceDeclSymbol = interfaceDecl.getSymbol(); - - this.resolveTypeSymbolSignatures(interfaceDeclSymbol, context); - - if (interfaceDeclSymbol.isResolved) { - this.resolveOtherDeclarations(interfaceDeclAST, context); - - if (this.canTypeCheckAST(interfaceDeclAST, context)) { - this.typeCheckInterfaceDeclaration(interfaceDeclAST, context); - } - } - - return interfaceDeclSymbol; - }; - - PullTypeResolver.prototype.typeCheckInterfaceDeclaration = function (interfaceDeclAST, context) { - this.setTypeChecked(interfaceDeclAST, context); - - var interfaceDecl = this.semanticInfoChain.getDeclForAST(interfaceDeclAST); - var interfaceDeclSymbol = interfaceDecl.getSymbol(); - - this.resolveAST(interfaceDeclAST.body.typeMembers, false, context); - - this.typeCheckTypeParametersOfTypeDeclaration(interfaceDeclAST, context); - this.typeCheckBases(interfaceDeclAST, interfaceDeclAST.identifier, interfaceDeclAST.heritageClauses, interfaceDeclSymbol, this.getEnclosingDecl(interfaceDecl), context); - - if (!interfaceDeclSymbol.hasBaseTypeConflict()) { - this.typeCheckMembersAgainstIndexer(interfaceDeclSymbol, interfaceDecl, context); - } - - var allInterfaceDecls = interfaceDeclSymbol.getDeclarations(); - if (interfaceDecl === allInterfaceDecls[allInterfaceDecls.length - 1]) { - this.checkTypeForDuplicateIndexSignatures(interfaceDeclSymbol); - } - - if (!this.checkInterfaceDeclForIdenticalTypeParameters(interfaceDeclAST, context)) { - this.semanticInfoChain.addDiagnosticFromAST(interfaceDeclAST.identifier, TypeScript.DiagnosticCode.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - }; - - PullTypeResolver.prototype.checkInterfaceDeclForIdenticalTypeParameters = function (interfaceDeclAST, context) { - var interfaceDecl = this.semanticInfoChain.getDeclForAST(interfaceDeclAST); - var interfaceDeclSymbol = interfaceDecl.getSymbol(); - - if (!interfaceDeclSymbol.isGeneric()) { - return true; - } - - var firstInterfaceDecl = interfaceDeclSymbol.getDeclarations()[0]; - if (firstInterfaceDecl == interfaceDecl) { - return true; - } - - var typeParameters = interfaceDecl.getTypeParameters(); - var firstInterfaceDeclTypeParameters = firstInterfaceDecl.getTypeParameters(); - - if (typeParameters.length != firstInterfaceDeclTypeParameters.length) { - return false; - } - - for (var i = 0; i < typeParameters.length; i++) { - var typeParameter = typeParameters[i]; - var firstInterfaceDeclTypeParameter = firstInterfaceDeclTypeParameters[i]; - - if (typeParameter.name != firstInterfaceDeclTypeParameter.name) { - return false; - } - - var typeParameterSymbol = typeParameter.getSymbol(); - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter); - var firstInterfaceDeclTypeParameterAST = this.semanticInfoChain.getASTForDecl(firstInterfaceDeclTypeParameter); - - if (!!typeParameterAST.constraint != !!firstInterfaceDeclTypeParameterAST.constraint) { - return false; - } - - if (typeParameterAST.constraint) { - var typeParameterConstraint = this.resolveAST(typeParameterAST.constraint, false, context); - if (!this.typesAreIdenticalWithNewEnclosingTypes(typeParameterConstraint, typeParameterSymbol.getConstraint(), context)) { - return false; - } - } - } - - return true; - }; - - PullTypeResolver.prototype.checkTypeForDuplicateIndexSignatures = function (enclosingTypeSymbol) { - var indexSignatures = enclosingTypeSymbol.getOwnIndexSignatures(); - var firstStringIndexer = null; - var firstNumberIndexer = null; - for (var i = 0; i < indexSignatures.length; i++) { - var currentIndexer = indexSignatures[i]; - var currentParameterType = currentIndexer.parameters[0].type; - TypeScript.Debug.assert(currentParameterType); - if (currentParameterType === this.semanticInfoChain.stringTypeSymbol) { - if (firstStringIndexer) { - this.semanticInfoChain.addDiagnosticFromAST(currentIndexer.getDeclarations()[0].ast(), TypeScript.DiagnosticCode.Duplicate_string_index_signature, null, [this.semanticInfoChain.locationFromAST(firstStringIndexer.getDeclarations()[0].ast())]); - return; - } else { - firstStringIndexer = currentIndexer; - } - } else if (currentParameterType === this.semanticInfoChain.numberTypeSymbol) { - if (firstNumberIndexer) { - this.semanticInfoChain.addDiagnosticFromAST(currentIndexer.getDeclarations()[0].ast(), TypeScript.DiagnosticCode.Duplicate_number_index_signature, null, [this.semanticInfoChain.locationFromAST(firstNumberIndexer.getDeclarations()[0].ast())]); - return; - } else { - firstNumberIndexer = currentIndexer; - } - } - } - }; - - PullTypeResolver.prototype.filterSymbol = function (symbol, kind, enclosingDecl, context) { - if (symbol) { - if (symbol.kind & kind) { - return symbol; - } - - if (symbol.isAlias()) { - this.resolveDeclaredSymbol(symbol, context); - - var alias = symbol; - if (kind & 164 /* SomeContainer */) { - return alias.getExportAssignedContainerSymbol(); - } else if (kind & 58728795 /* SomeType */) { - return alias.getExportAssignedTypeSymbol(); - } else if (kind & 68147712 /* SomeValue */) { - return alias.getExportAssignedValueSymbol(); - } - } - } - return null; - }; - - PullTypeResolver.prototype.getMemberSymbolOfKind = function (symbolName, kind, pullTypeSymbol, enclosingDecl, context) { - var memberSymbol = this.getNamedPropertySymbol(symbolName, kind, pullTypeSymbol); - - return { - symbol: this.filterSymbol(memberSymbol, kind, enclosingDecl, context), - aliasSymbol: memberSymbol && memberSymbol.isAlias() ? memberSymbol : null - }; - }; - - PullTypeResolver.prototype.resolveIdentifierOfInternalModuleReference = function (importDecl, identifier, moduleSymbol, enclosingDecl, context) { - var rhsName = identifier.valueText(); - if (rhsName.length === 0) { - return null; - } - - var moduleTypeSymbol = moduleSymbol.type; - var memberSymbol = this.getMemberSymbolOfKind(rhsName, 164 /* SomeContainer */, moduleTypeSymbol, enclosingDecl, context); - var containerSymbol = memberSymbol.symbol; - var valueSymbol = null; - var typeSymbol = null; - var aliasSymbol = null; - - var acceptableAlias = true; - - if (containerSymbol) { - acceptableAlias = (containerSymbol.kind & 59753052 /* AcceptableAlias */) !== 0; - aliasSymbol = memberSymbol.aliasSymbol; - } - - if (!acceptableAlias && containerSymbol && containerSymbol.kind === 128 /* TypeAlias */) { - this.resolveDeclaredSymbol(containerSymbol, context); - var aliasedAssignedValue = containerSymbol.getExportAssignedValueSymbol(); - var aliasedAssignedType = containerSymbol.getExportAssignedTypeSymbol(); - var aliasedAssignedContainer = containerSymbol.getExportAssignedContainerSymbol(); - - if (aliasedAssignedValue || aliasedAssignedType || aliasedAssignedContainer) { - aliasSymbol = containerSymbol; - valueSymbol = aliasedAssignedValue; - typeSymbol = aliasedAssignedType; - containerSymbol = aliasedAssignedContainer; - acceptableAlias = true; - } - } - - if (!acceptableAlias) { - this.semanticInfoChain.addDiagnosticFromAST(identifier, TypeScript.DiagnosticCode.Import_declaration_referencing_identifier_from_internal_module_can_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules); - return null; - } - - if (!valueSymbol) { - if (moduleTypeSymbol.getInstanceSymbol()) { - memberSymbol = this.getMemberSymbolOfKind(rhsName, 68147712 /* SomeValue */, moduleTypeSymbol.getInstanceSymbol().type, enclosingDecl, context); - valueSymbol = memberSymbol.symbol; - if (valueSymbol && memberSymbol.aliasSymbol) { - aliasSymbol = memberSymbol.aliasSymbol; - } - } - } - - if (!typeSymbol) { - memberSymbol = this.getMemberSymbolOfKind(rhsName, 58728795 /* SomeType */, moduleTypeSymbol, enclosingDecl, context); - typeSymbol = memberSymbol.symbol; - if (typeSymbol && memberSymbol.aliasSymbol) { - aliasSymbol = memberSymbol.aliasSymbol; - } - } - - if (!valueSymbol && !typeSymbol && !containerSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(identifier, TypeScript.DiagnosticCode.Could_not_find_symbol_0_in_module_1, [rhsName, moduleSymbol.toString()]); - return null; - } - - if (!typeSymbol && containerSymbol) { - typeSymbol = containerSymbol; - } - - return { - valueSymbol: valueSymbol, - typeSymbol: typeSymbol, - containerSymbol: containerSymbol, - aliasSymbol: aliasSymbol - }; - }; - - PullTypeResolver.prototype.resolveModuleReference = function (importDecl, moduleNameExpr, enclosingDecl, context, declPath) { - TypeScript.Debug.assert(moduleNameExpr.kind() === 121 /* QualifiedName */ || moduleNameExpr.kind() === 11 /* IdentifierName */ || moduleNameExpr.kind() === 14 /* StringLiteral */, "resolving module reference should always be either name or member reference"); - - var moduleSymbol = null; - var moduleName; - - if (moduleNameExpr.kind() === 121 /* QualifiedName */) { - var dottedNameAST = moduleNameExpr; - var moduleContainer = this.resolveModuleReference(importDecl, dottedNameAST.left, enclosingDecl, context, declPath); - if (moduleContainer) { - moduleName = dottedNameAST.right.valueText(); - - moduleSymbol = this.getMemberSymbolOfKind(moduleName, 4 /* Container */, moduleContainer.type, enclosingDecl, context).symbol; - if (!moduleSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(dottedNameAST.right, TypeScript.DiagnosticCode.Could_not_find_module_0_in_module_1, [moduleName, moduleContainer.toString()]); - } - } - } else { - var valueText = moduleNameExpr.kind() === 11 /* IdentifierName */ ? moduleNameExpr.valueText() : moduleNameExpr.valueText(); - var text = moduleNameExpr.kind() === 11 /* IdentifierName */ ? moduleNameExpr.text() : moduleNameExpr.text(); - - if (text.length > 0) { - var resolvedModuleNameSymbol = this.getSymbolFromDeclPath(valueText, declPath, 4 /* Container */); - moduleSymbol = this.filterSymbol(resolvedModuleNameSymbol, 4 /* Container */, enclosingDecl, context); - if (moduleSymbol) { - this.semanticInfoChain.setSymbolForAST(moduleNameExpr, moduleSymbol); - if (resolvedModuleNameSymbol.isAlias()) { - this.semanticInfoChain.setAliasSymbolForAST(moduleNameExpr, resolvedModuleNameSymbol); - var importDeclSymbol = importDecl.getSymbol(); - importDeclSymbol.addLinkedAliasSymbol(resolvedModuleNameSymbol); - } - } else { - this.semanticInfoChain.addDiagnosticFromAST(moduleNameExpr, TypeScript.DiagnosticCode.Unable_to_resolve_module_reference_0, [valueText]); - } - } - } - - return moduleSymbol; - }; - - PullTypeResolver.prototype.resolveInternalModuleReference = function (importStatementAST, context) { - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var enclosingDecl = this.getEnclosingDecl(importDecl); - - var moduleReference = importStatementAST.moduleReference; - - var aliasExpr = moduleReference.kind() === 245 /* ExternalModuleReference */ ? moduleReference.stringLiteral : moduleReference.moduleName; - - var declPath = enclosingDecl.getParentPath(); - var aliasedType = null; - var importDeclSymbol = importDecl.getSymbol(); - - if (aliasExpr.kind() === 11 /* IdentifierName */ || aliasExpr.kind() === 14 /* StringLiteral */) { - var moduleSymbol = this.resolveModuleReference(importDecl, aliasExpr, enclosingDecl, context, declPath); - if (moduleSymbol) { - aliasedType = moduleSymbol.type; - this.semanticInfoChain.setAliasSymbolForAST(moduleReference, this.semanticInfoChain.getAliasSymbolForAST(aliasExpr)); - if (aliasedType.anyDeclHasFlag(32768 /* InitializedModule */)) { - var moduleName = aliasExpr.kind() === 11 /* IdentifierName */ ? aliasExpr.valueText() : aliasExpr.valueText(); - var valueSymbol = this.getSymbolFromDeclPath(moduleName, declPath, 68147712 /* SomeValue */); - var instanceSymbol = aliasedType.getInstanceSymbol(); - - if (valueSymbol && (instanceSymbol != valueSymbol || valueSymbol.type === aliasedType)) { - var text = aliasExpr.kind() === 11 /* IdentifierName */ ? aliasExpr.text() : aliasExpr.text(); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(aliasExpr, TypeScript.DiagnosticCode.Internal_module_reference_0_in_import_declaration_does_not_reference_module_instance_for_1, [text, moduleSymbol.type.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - } else { - importDeclSymbol.setAssignedValueSymbol(valueSymbol); - } - } - } else { - aliasedType = this.getNewErrorTypeSymbol(); - } - } else if (aliasExpr.kind() === 121 /* QualifiedName */) { - var dottedNameAST = aliasExpr; - var moduleSymbol = this.resolveModuleReference(importDecl, dottedNameAST.left, enclosingDecl, context, declPath); - if (moduleSymbol) { - var identifierResolution = this.resolveIdentifierOfInternalModuleReference(importDecl, dottedNameAST.right, moduleSymbol, enclosingDecl, context); - if (identifierResolution) { - importDeclSymbol.setAssignedValueSymbol(identifierResolution.valueSymbol); - importDeclSymbol.setAssignedTypeSymbol(identifierResolution.typeSymbol); - importDeclSymbol.setAssignedContainerSymbol(identifierResolution.containerSymbol); - this.semanticInfoChain.setAliasSymbolForAST(moduleReference, identifierResolution.aliasSymbol); - return null; - } - } - } - - if (!aliasedType) { - importDeclSymbol.setAssignedTypeSymbol(this.getNewErrorTypeSymbol()); - } - - return aliasedType; - }; - - PullTypeResolver.prototype.resolveImportDeclaration = function (importStatementAST, context) { - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var enclosingDecl = this.getEnclosingDecl(importDecl); - var importDeclSymbol = importDecl.getSymbol(); - - var aliasedType = null; - - if (importDeclSymbol.isResolved) { - return importDeclSymbol; - } - - importDeclSymbol.startResolving(); - - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - var modPath = importStatementAST.moduleReference.stringLiteral.valueText(); - var declPath = enclosingDecl.getParentPath(); - - aliasedType = this.resolveExternalModuleReference(modPath, importDecl.fileName()); - - if (!aliasedType) { - var path = importStatementAST.moduleReference.stringLiteral.text(); - this.semanticInfoChain.addDiagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Unable_to_resolve_external_module_0, [path]); - aliasedType = this.getNewErrorTypeSymbol(); - } - } else { - aliasedType = this.resolveInternalModuleReference(importStatementAST, context); - } - - if (aliasedType) { - if (!aliasedType.isContainer()) { - this.semanticInfoChain.addDiagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Module_cannot_be_aliased_to_a_non_module_type); - if (!aliasedType.isError()) { - aliasedType = this.getNewErrorTypeSymbol(); - } - } - - if (aliasedType.isContainer()) { - importDeclSymbol.setAssignedContainerSymbol(aliasedType); - } - importDeclSymbol.setAssignedTypeSymbol(aliasedType); - - this.setSymbolForAST(importStatementAST.moduleReference, aliasedType, null); - } - - importDeclSymbol.setResolved(); - - this.resolveDeclaredSymbol(importDeclSymbol.assignedValue(), context); - this.resolveDeclaredSymbol(importDeclSymbol.assignedType(), context); - this.resolveDeclaredSymbol(importDeclSymbol.assignedContainer(), context); - - if (aliasedType && importDeclSymbol.anyDeclHasFlag(1 /* Exported */)) { - importDeclSymbol.setIsUsedInExportedAlias(); - - if (aliasedType.isContainer() && aliasedType.getExportAssignedValueSymbol()) { - importDeclSymbol.setIsUsedAsValue(); - } - } - - if (this.canTypeCheckAST(importStatementAST, context)) { - this.typeCheckImportDeclaration(importStatementAST, context); - } - - return importDeclSymbol; - }; - - PullTypeResolver.prototype.typeCheckImportDeclaration = function (importStatementAST, context) { - var _this = this; - this.setTypeChecked(importStatementAST, context); - - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var enclosingDecl = this.getEnclosingDecl(importDecl); - var importDeclSymbol = importDecl.getSymbol(); - - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - if (this.compilationSettings.noResolve()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Import_declaration_cannot_refer_to_external_module_reference_when_noResolve_option_is_set, null)); - } - - var modPath = importStatementAST.moduleReference.stringLiteral.valueText(); - if (enclosingDecl.kind === 32 /* DynamicModule */) { - var ast = TypeScript.ASTHelpers.getEnclosingModuleDeclaration(this.getASTForDecl(enclosingDecl)); - if (ast && ast.kind() === 130 /* ModuleDeclaration */) { - if (TypeScript.isRelative(modPath)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name)); - } - } - } - } - - var checkPrivacy; - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - var containerSymbol = importDeclSymbol.getExportAssignedContainerSymbol(); - var container = containerSymbol ? containerSymbol.getContainer() : null; - if (container && container.kind === 32 /* DynamicModule */) { - checkPrivacy = true; - } - } else { - checkPrivacy = true; - } - - if (checkPrivacy) { - var typeSymbol = importDeclSymbol.getExportAssignedTypeSymbol(); - var containerSymbol = importDeclSymbol.getExportAssignedContainerSymbol(); - var valueSymbol = importDeclSymbol.getExportAssignedValueSymbol(); - - this.checkSymbolPrivacy(importDeclSymbol, containerSymbol, function (symbol) { - var messageCode = TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_container_that_is_or_is_using_inaccessible_module_1; - var messageArguments = [importDeclSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null), symbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null, false, false, true)]; - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(importStatementAST, messageCode, messageArguments)); - }); - - if (typeSymbol !== containerSymbol) { - this.checkSymbolPrivacy(importDeclSymbol, typeSymbol, function (symbol) { - var messageCode = symbol.isContainer() && !symbol.isEnum() ? TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_type_that_is_using_inaccessible_module_1 : TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_type_that_has_or_is_using_private_type_1; - - var messageArguments = [importDeclSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null), symbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null, false, false, true)]; - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(importStatementAST, messageCode, messageArguments)); - }); - } - - if (valueSymbol) { - this.checkSymbolPrivacy(importDeclSymbol, valueSymbol.type, function (symbol) { - var messageCode = symbol.isContainer() && !symbol.isEnum() ? TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_value_with_type_that_is_using_inaccessible_module_1 : TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_value_with_type_that_has_or_is_using_private_type_1; - var messageArguments = [importDeclSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null), symbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null, false, false, true)]; - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(importStatementAST, messageCode, messageArguments)); - }); - } - } - - this.checkNameForCompilerGeneratedDeclarationCollision(importStatementAST, true, importStatementAST.identifier, context); - }; - - PullTypeResolver.prototype.postTypeCheckImportDeclaration = function (importStatementAST, context) { - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var importSymbol = importDecl.getSymbol(); - - var isUsedAsValue = importSymbol.isUsedAsValue(); - var hasAssignedValue = importStatementAST.moduleReference.kind() !== 245 /* ExternalModuleReference */ && importSymbol.getExportAssignedValueSymbol() !== null; - - if (isUsedAsValue || hasAssignedValue) { - this.checkThisCaptureVariableCollides(importStatementAST, true, context); - } - }; - - PullTypeResolver.prototype.resolveExportAssignmentStatement = function (exportAssignmentAST, context) { - var id = exportAssignmentAST.identifier.valueText(); - if (id.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var valueSymbol = null; - var typeSymbol = null; - var containerSymbol = null; - - var enclosingDecl = this.getEnclosingDeclForAST(exportAssignmentAST); - var parentSymbol = enclosingDecl.getSymbol(); - - if (!parentSymbol.isType() && parentSymbol.isContainer()) { - this.semanticInfoChain.addDiagnosticFromAST(exportAssignmentAST, TypeScript.DiagnosticCode.Export_assignments_may_only_be_used_at_the_top_level_of_external_modules); - return this.semanticInfoChain.anyTypeSymbol; - } - - var declPath = enclosingDecl !== null ? [enclosingDecl] : []; - - containerSymbol = this.getSymbolFromDeclPath(id, declPath, 164 /* SomeContainer */); - - var acceptableAlias = true; - - if (containerSymbol) { - acceptableAlias = (containerSymbol.kind & 59753052 /* AcceptableAlias */) !== 0; - } - - if (!acceptableAlias && containerSymbol && containerSymbol.kind === 128 /* TypeAlias */) { - this.resolveDeclaredSymbol(containerSymbol, context); - - var aliasSymbol = containerSymbol; - var aliasedAssignedValue = aliasSymbol.getExportAssignedValueSymbol(); - var aliasedAssignedType = aliasSymbol.getExportAssignedTypeSymbol(); - var aliasedAssignedContainer = aliasSymbol.getExportAssignedContainerSymbol(); - - if (aliasedAssignedValue || aliasedAssignedType || aliasedAssignedContainer) { - valueSymbol = aliasedAssignedValue; - typeSymbol = aliasedAssignedType; - containerSymbol = aliasedAssignedContainer; - aliasSymbol.setTypeUsedExternally(); - if (valueSymbol) { - aliasSymbol.setIsUsedAsValue(); - } - acceptableAlias = true; - } - } - - if (!acceptableAlias) { - this.semanticInfoChain.addDiagnosticFromAST(exportAssignmentAST, TypeScript.DiagnosticCode.Export_assignments_may_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules); - return this.semanticInfoChain.voidTypeSymbol; - } - - if (!valueSymbol) { - valueSymbol = this.getSymbolFromDeclPath(id, declPath, 68147712 /* SomeValue */); - } - if (!typeSymbol) { - typeSymbol = this.getSymbolFromDeclPath(id, declPath, 58728795 /* SomeType */); - } - - if (!valueSymbol && !typeSymbol && !containerSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(exportAssignmentAST, TypeScript.DiagnosticCode.Could_not_find_symbol_0, [id])); - return this.semanticInfoChain.voidTypeSymbol; - } - - if (valueSymbol) { - parentSymbol.setExportAssignedValueSymbol(valueSymbol); - } - if (typeSymbol) { - parentSymbol.setExportAssignedTypeSymbol(typeSymbol); - } - if (containerSymbol) { - parentSymbol.setExportAssignedContainerSymbol(containerSymbol); - } - - this.resolveDeclaredSymbol(valueSymbol, context); - this.resolveDeclaredSymbol(typeSymbol, context); - this.resolveDeclaredSymbol(containerSymbol, context); - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveAnyFunctionTypeSignature = function (funcDeclAST, typeParameters, parameterList, returnTypeAnnotation, context) { - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - TypeScript.Debug.assert(functionDecl); - - var funcDeclSymbol = functionDecl.getSymbol(); - - var signature = funcDeclSymbol.kind === 33554432 /* ConstructorType */ ? funcDeclSymbol.getConstructSignatures()[0] : funcDeclSymbol.getCallSignatures()[0]; - - if (returnTypeAnnotation) { - signature.returnType = this.resolveTypeReference(returnTypeAnnotation, context); - } - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - if (parameterList) { - for (var i = 0; i < parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveFunctionTypeSignatureParameter(parameterList.parameters.nonSeparatorAt(i), signature, functionDecl, context); - } - } - - funcDeclSymbol.setResolved(); - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.setTypeChecked(funcDeclAST, context); - this.typeCheckFunctionOverloads(funcDeclAST, context); - } - - return funcDeclSymbol; - }; - - PullTypeResolver.prototype.resolveFunctionTypeSignatureParameter = function (argDeclAST, signature, enclosingDecl, context) { - var paramDecl = this.semanticInfoChain.getDeclForAST(argDeclAST); - var paramSymbol = paramDecl.getSymbol(); - - if (argDeclAST.typeAnnotation) { - var typeRef = this.resolveTypeReference(TypeScript.ASTHelpers.getType(argDeclAST), context); - - if (paramSymbol.isVarArg && !typeRef.isArrayNamedTypeReference()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Rest_parameters_must_be_array_types)); - typeRef = this.getNewErrorTypeSymbol(); - } - - context.setTypeInContext(paramSymbol, typeRef); - } else { - if (paramSymbol.isVarArg) { - if (this.cachedArrayInterfaceType()) { - context.setTypeInContext(paramSymbol, this.createInstantiatedType(this.cachedArrayInterfaceType(), [this.semanticInfoChain.anyTypeSymbol])); - } else { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - } - } else { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - } - - if (this.compilationSettings.noImplicitAny()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Parameter_0_of_function_type_implicitly_has_an_any_type, [argDeclAST.identifier.text()])); - } - } - - if (TypeScript.hasFlag(paramDecl.flags, 128 /* Optional */) && argDeclAST.equalsValueClause && isTypesOnlyLocation(argDeclAST)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Default_arguments_are_only_allowed_in_implementation)); - } - - paramSymbol.setResolved(); - }; - - PullTypeResolver.prototype.resolveFunctionExpressionParameter = function (argDeclAST, id, typeExpr, equalsValueClause, contextParam, enclosingDecl, context) { - var paramDecl = this.semanticInfoChain.getDeclForAST(argDeclAST); - var paramSymbol = paramDecl.getSymbol(); - var contextualType = contextParam && contextParam.type; - var isImplicitAny = false; - - if (typeExpr) { - var typeRef = this.resolveTypeReference(typeExpr, context); - - if (paramSymbol.isVarArg && !typeRef.isArrayNamedTypeReference()) { - var diagnostic = context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Rest_parameters_must_be_array_types)); - typeRef = this.getNewErrorTypeSymbol(); - } - - contextualType = typeRef || contextualType; - } - if (contextualType) { - if (context.isInferentiallyTyping()) { - contextualType = context.fixAllTypeParametersReferencedByType(contextualType, this); - } - context.setTypeInContext(paramSymbol, contextualType); - } else if (paramSymbol.isVarArg) { - if (this.cachedArrayInterfaceType()) { - context.setTypeInContext(paramSymbol, this.createInstantiatedType(this.cachedArrayInterfaceType(), [this.semanticInfoChain.anyTypeSymbol])); - } else { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - } - isImplicitAny = true; - } - - var canTypeCheckAST = this.canTypeCheckAST(argDeclAST, context); - if (equalsValueClause && (canTypeCheckAST || !contextualType)) { - if (contextualType) { - context.propagateContextualType(contextualType); - } - - var initExprSymbol = this.resolveAST(equalsValueClause, contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - } - - if (!initExprSymbol || !initExprSymbol.type) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Unable_to_resolve_type_of_0, [id.text()])); - - if (!contextualType) { - context.setTypeInContext(paramSymbol, this.getNewErrorTypeSymbol(paramSymbol.name)); - } - } else { - var initTypeSymbol = this.getInstanceTypeForAssignment(argDeclAST, initExprSymbol.type, context); - if (!contextualType) { - context.setTypeInContext(paramSymbol, initTypeSymbol.widenedType(this, equalsValueClause, context)); - isImplicitAny = initTypeSymbol !== paramSymbol.type; - } else { - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(initTypeSymbol, contextualType, argDeclAST, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(argDeclAST); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [initTypeSymbol.toString(enclosingSymbol), contextualType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [initTypeSymbol.toString(enclosingSymbol), contextualType.toString(enclosingSymbol)])); - } - } - } - } - } - - if (!contextualType && !paramSymbol.isVarArg && !initTypeSymbol) { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - isImplicitAny = true; - } - - if (isImplicitAny && this.compilationSettings.noImplicitAny()) { - var functionExpressionName = paramDecl.getParentDecl().getFunctionExpressionName(); - if (functionExpressionName) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Parameter_0_of_1_implicitly_has_an_any_type, [id.text(), functionExpressionName])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Parameter_0_of_lambda_function_implicitly_has_an_any_type, [id.text()])); - } - } - - if (canTypeCheckAST) { - this.checkNameForCompilerGeneratedDeclarationCollision(argDeclAST, true, id, context); - } - - paramSymbol.setResolved(); - }; - - PullTypeResolver.prototype.checkNameForCompilerGeneratedDeclarationCollision = function (astWithName, isDeclaration, name, context) { - var compilerReservedName = getCompilerReservedName(name); - switch (compilerReservedName) { - case 1 /* _this */: - this.postTypeCheckWorkitems.push(astWithName); - return; - - case 2 /* _super */: - this.checkSuperCaptureVariableCollides(astWithName, isDeclaration, context); - return; - - case 3 /* arguments */: - this.checkArgumentsCollides(astWithName, context); - return; - - case 4 /* _i */: - this.checkIndexOfRestArgumentInitializationCollides(astWithName, isDeclaration, context); - return; - - case 5 /* require */: - case 6 /* exports */: - if (isDeclaration) { - this.checkExternalModuleRequireExportsCollides(astWithName, name, context); - } - return; - } - }; - - PullTypeResolver.prototype.hasRestParameterCodeGen = function (someFunctionDecl) { - var enclosingAST = this.getASTForDecl(someFunctionDecl); - var nodeType = enclosingAST.kind(); - - if (nodeType === 129 /* FunctionDeclaration */) { - var functionDeclaration = enclosingAST; - return !TypeScript.hasFlag(someFunctionDecl.kind === 65536 /* Method */ ? someFunctionDecl.getParentDecl().flags : someFunctionDecl.flags, 8 /* Ambient */) && functionDeclaration.block && TypeScript.lastParameterIsRest(functionDeclaration.callSignature.parameterList); - } else if (nodeType === 135 /* MemberFunctionDeclaration */) { - var memberFunction = enclosingAST; - return !TypeScript.hasFlag(someFunctionDecl.kind === 65536 /* Method */ ? someFunctionDecl.getParentDecl().flags : someFunctionDecl.flags, 8 /* Ambient */) && memberFunction.block && TypeScript.lastParameterIsRest(memberFunction.callSignature.parameterList); - } else if (nodeType === 137 /* ConstructorDeclaration */) { - var constructorDeclaration = enclosingAST; - return !TypeScript.hasFlag(someFunctionDecl.getParentDecl().flags, 8 /* Ambient */) && constructorDeclaration.block && TypeScript.lastParameterIsRest(constructorDeclaration.callSignature.parameterList); - } else if (nodeType === 218 /* ParenthesizedArrowFunctionExpression */) { - var arrowFunctionExpression = enclosingAST; - return TypeScript.lastParameterIsRest(arrowFunctionExpression.callSignature.parameterList); - } else if (nodeType === 222 /* FunctionExpression */) { - var functionExpression = enclosingAST; - return TypeScript.lastParameterIsRest(functionExpression.callSignature.parameterList); - } - - return false; - }; - - PullTypeResolver.prototype.checkArgumentsCollides = function (ast, context) { - if (ast.kind() === 242 /* Parameter */) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - if (TypeScript.hasFlag(enclosingDecl.kind, 1032192 /* SomeFunction */)) { - if (this.hasRestParameterCodeGen(enclosingDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters)); - } - } - } - }; - - PullTypeResolver.prototype.checkIndexOfRestArgumentInitializationCollides = function (ast, isDeclaration, context) { - if (!isDeclaration || ast.kind() === 242 /* Parameter */) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - var declPath = isDeclaration ? [enclosingDecl] : (enclosingDecl ? enclosingDecl.getParentPath() : []); - var resolvedSymbol = null; - var resolvedSymbolContainer; - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - if (!isDeclaration) { - if (!resolvedSymbol) { - resolvedSymbol = this.resolveNameExpression(ast, context); - if (resolvedSymbol.isError()) { - return; - } - - resolvedSymbolContainer = resolvedSymbol.getContainer(); - } - - if (resolvedSymbolContainer && TypeScript.ArrayUtilities.contains(resolvedSymbolContainer.getDeclarations(), decl)) { - break; - } - } - - if (TypeScript.hasFlag(decl.kind, 1032192 /* SomeFunction */)) { - if (this.hasRestParameterCodeGen(decl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, isDeclaration ? TypeScript.DiagnosticCode.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter : TypeScript.DiagnosticCode.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter)); - } - } - } - } - }; - - PullTypeResolver.prototype.checkExternalModuleRequireExportsCollides = function (ast, name, context) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(name); - if (enclosingModule) { - enclosingDecl = this.getEnclosingDeclForAST(enclosingModule); - } - - if (enclosingDecl && enclosingDecl.kind === 32 /* DynamicModule */) { - var decl = this.semanticInfoChain.getDeclForAST(ast); - - if (!TypeScript.hasFlag(decl.flags, 8 /* Ambient */)) { - var nameText = name.valueText(); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, [nameText, nameText])); - } - } - }; - - PullTypeResolver.prototype.resolveObjectTypeTypeReference = function (objectType, context) { - var interfaceDecl = this.semanticInfoChain.getDeclForAST(objectType); - TypeScript.Debug.assert(interfaceDecl); - - var interfaceSymbol = interfaceDecl.getSymbol(); - TypeScript.Debug.assert(interfaceSymbol); - - if (objectType.typeMembers) { - var memberDecl = null; - var memberSymbol = null; - var memberType = null; - var typeMembers = objectType.typeMembers; - - for (var i = 0; i < typeMembers.nonSeparatorCount(); i++) { - memberDecl = this.semanticInfoChain.getDeclForAST(typeMembers.nonSeparatorAt(i)); - memberSymbol = (memberDecl.kind & 7340032 /* SomeSignature */) ? memberDecl.getSignatureSymbol() : memberDecl.getSymbol(); - - this.resolveAST(typeMembers.nonSeparatorAt(i), false, context); - - memberType = memberSymbol.type; - - if ((memberType && memberType.isGeneric()) || (memberSymbol.isSignature() && memberSymbol.isGeneric())) { - interfaceSymbol.setHasGenericMember(); - } - } - } - - interfaceSymbol.setResolved(); - - if (this.canTypeCheckAST(objectType, context)) { - this.typeCheckObjectTypeTypeReference(objectType, context); - } - - return interfaceSymbol; - }; - - PullTypeResolver.prototype.typeCheckObjectTypeTypeReference = function (objectType, context) { - this.setTypeChecked(objectType, context); - var objectTypeDecl = this.semanticInfoChain.getDeclForAST(objectType); - var objectTypeSymbol = objectTypeDecl.getSymbol(); - - this.typeCheckMembersAgainstIndexer(objectTypeSymbol, objectTypeDecl, context); - this.checkTypeForDuplicateIndexSignatures(objectTypeSymbol); - }; - - PullTypeResolver.prototype.resolveTypeAnnotation = function (typeAnnotation, context) { - return this.resolveTypeReference(typeAnnotation.type, context); - }; - - PullTypeResolver.prototype.resolveTypeReference = function (typeRef, context) { - if (typeRef === null) { - return null; - } - - TypeScript.Debug.assert(typeRef.kind() !== 244 /* TypeAnnotation */); - - var aliasType = null; - var type = this.computeTypeReferenceSymbol(typeRef, context); - - if (type.kind === 4 /* Container */) { - var container = type; - var instanceSymbol = container.getInstanceSymbol(); - - if (instanceSymbol && (instanceSymbol.anyDeclHasFlag(16384 /* ClassConstructorVariable */) || instanceSymbol.kind === 32768 /* ConstructorMethod */)) { - type = instanceSymbol.type.getAssociatedContainerType(); - } - } - - if (type && type.isAlias()) { - aliasType = type; - type = aliasType.getExportAssignedTypeSymbol(); - } - - if (type && !type.isGeneric()) { - if (aliasType) { - this.semanticInfoChain.setAliasSymbolForAST(typeRef, aliasType); - } - } - - if (type && !type.isError()) { - if ((type.kind & 58728795 /* SomeType */) === 0) { - if (type.kind & 164 /* SomeContainer */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeRef, TypeScript.DiagnosticCode.Type_reference_cannot_refer_to_container_0, [aliasType ? aliasType.toString() : type.toString()])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeRef, TypeScript.DiagnosticCode.Type_reference_must_refer_to_type)); - } - } - } - - if (this.canTypeCheckAST(typeRef, context)) { - this.setTypeChecked(typeRef, context); - } - - return type; - }; - - PullTypeResolver.prototype.getArrayType = function (elementType) { - var arraySymbol = elementType.getArrayType(); - - if (!arraySymbol) { - arraySymbol = this.createInstantiatedType(this.cachedArrayInterfaceType(), [elementType]); - - if (!arraySymbol) { - arraySymbol = this.semanticInfoChain.anyTypeSymbol; - } - - elementType.setArrayType(arraySymbol); - } - - return arraySymbol; - }; - - PullTypeResolver.prototype.computeTypeReferenceSymbol = function (term, context) { - switch (term.kind()) { - case 60 /* AnyKeyword */: - return this.semanticInfoChain.anyTypeSymbol; - case 61 /* BooleanKeyword */: - return this.semanticInfoChain.booleanTypeSymbol; - case 67 /* NumberKeyword */: - return this.semanticInfoChain.numberTypeSymbol; - case 69 /* StringKeyword */: - return this.semanticInfoChain.stringTypeSymbol; - case 41 /* VoidKeyword */: - return this.semanticInfoChain.voidTypeSymbol; - } - - var typeDeclSymbol = null; - - if (term.kind() === 11 /* IdentifierName */) { - typeDeclSymbol = this.resolveTypeNameExpression(term, context); - } else if (term.kind() === 123 /* FunctionType */) { - var functionType = term; - typeDeclSymbol = this.resolveAnyFunctionTypeSignature(functionType, functionType.typeParameterList, functionType.parameterList, functionType.type, context); - } else if (term.kind() === 125 /* ConstructorType */) { - var constructorType = term; - typeDeclSymbol = this.resolveAnyFunctionTypeSignature(constructorType, constructorType.typeParameterList, constructorType.parameterList, constructorType.type, context); - } else if (term.kind() === 122 /* ObjectType */) { - typeDeclSymbol = this.resolveObjectTypeTypeReference(term, context); - } else if (term.kind() === 126 /* GenericType */) { - typeDeclSymbol = this.resolveGenericTypeReference(term, context); - } else if (term.kind() === 121 /* QualifiedName */) { - typeDeclSymbol = this.resolveQualifiedName(term, context); - } else if (term.kind() === 14 /* StringLiteral */) { - var stringConstantAST = term; - var enclosingDecl = this.getEnclosingDeclForAST(term); - typeDeclSymbol = new TypeScript.PullStringConstantTypeSymbol(stringConstantAST.text()); - var decl = new TypeScript.PullSynthesizedDecl(stringConstantAST.text(), stringConstantAST.text(), typeDeclSymbol.kind, null, enclosingDecl, enclosingDecl.semanticInfoChain); - typeDeclSymbol.addDeclaration(decl); - } else if (term.kind() === 127 /* TypeQuery */) { - var typeQuery = term; - - var typeQueryTerm = typeQuery.name; - - var valueSymbol = this.resolveAST(typeQueryTerm, false, context); - - if (valueSymbol && valueSymbol.isAlias()) { - if (valueSymbol.assignedValue()) { - valueSymbol = valueSymbol.assignedValue(); - } else { - var containerSymbol = valueSymbol.getExportAssignedContainerSymbol(); - valueSymbol = (containerSymbol && containerSymbol.isContainer() && !containerSymbol.isEnum()) ? containerSymbol.getInstanceSymbol() : null; - } - } - - if (valueSymbol) { - typeDeclSymbol = valueSymbol.type.widenedType(this, typeQueryTerm, context); - } else { - typeDeclSymbol = this.getNewErrorTypeSymbol(); - } - } else if (term.kind() === 124 /* ArrayType */) { - var arrayType = term; - var underlying = this.resolveTypeReference(arrayType.type, context); - typeDeclSymbol = this.getArrayType(underlying); - } else { - throw TypeScript.Errors.invalidOperation("unknown type"); - } - - if (!typeDeclSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(term, TypeScript.DiagnosticCode.Unable_to_resolve_type)); - return this.getNewErrorTypeSymbol(); - } - - if (typeDeclSymbol.isError()) { - return typeDeclSymbol; - } - - if (this.genericTypeIsUsedWithoutRequiredTypeArguments(typeDeclSymbol, term, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(term, TypeScript.DiagnosticCode.Generic_type_references_must_include_all_type_arguments)); - typeDeclSymbol = this.instantiateTypeToAny(typeDeclSymbol, context); - } - - return typeDeclSymbol; - }; - - PullTypeResolver.prototype.genericTypeIsUsedWithoutRequiredTypeArguments = function (typeSymbol, term, context) { - if (!typeSymbol) { - return false; - } - - if (typeSymbol.isAlias()) { - return this.genericTypeIsUsedWithoutRequiredTypeArguments(typeSymbol.getExportAssignedTypeSymbol(), term, context); - } - - return typeSymbol.isNamedTypeSymbol() && typeSymbol.isGeneric() && !typeSymbol.isTypeParameter() && (typeSymbol.isResolved || typeSymbol.inResolution) && !typeSymbol.getIsSpecialized() && typeSymbol.getTypeParameters().length && typeSymbol.getTypeArguments() === null && this.isTypeRefWithoutTypeArgs(term); - }; - - PullTypeResolver.prototype.resolveMemberVariableDeclaration = function (varDecl, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(varDecl, varDecl.modifiers, varDecl.variableDeclarator.propertyName, TypeScript.ASTHelpers.getType(varDecl.variableDeclarator), varDecl.variableDeclarator.equalsValueClause, context); - }; - - PullTypeResolver.prototype.resolvePropertySignature = function (varDecl, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.sentinelEmptyArray, varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), null, context); - }; - - PullTypeResolver.prototype.resolveVariableDeclarator = function (varDecl, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl), varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), varDecl.equalsValueClause, context); - }; - - PullTypeResolver.prototype.resolveParameterList = function (list, context) { - return this.resolveSeparatedList(list.parameters, context); - }; - - PullTypeResolver.prototype.resolveParameter = function (parameter, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(parameter, parameter.modifiers, parameter.identifier, TypeScript.ASTHelpers.getType(parameter), parameter.equalsValueClause, context); - }; - - PullTypeResolver.prototype.getEnumTypeSymbol = function (enumElement, context) { - var enumDeclaration = enumElement.parent.parent; - var decl = this.semanticInfoChain.getDeclForAST(enumDeclaration); - var symbol = decl.getSymbol(); - this.resolveDeclaredSymbol(symbol, context); - - return symbol; - }; - - PullTypeResolver.prototype.resolveEnumElement = function (enumElement, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(enumElement, TypeScript.sentinelEmptyArray, enumElement.propertyName, null, enumElement.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckEnumElement = function (enumElement, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(enumElement, TypeScript.sentinelEmptyArray, enumElement.propertyName, null, enumElement.equalsValueClause, context); - }; - - PullTypeResolver.prototype.resolveEqualsValueClause = function (clause, isContextuallyTyped, context) { - if (this.canTypeCheckAST(clause, context)) { - this.setTypeChecked(clause, context); - } - - return this.resolveAST(clause.value, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveVariableDeclaratorOrParameterOrEnumElement = function (varDeclOrParameter, modifiers, name, typeExpr, init, context) { - var hasTypeExpr = typeExpr !== null || varDeclOrParameter.kind() === 243 /* EnumElement */; - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - - if (enclosingDecl && decl.kind === 2048 /* Parameter */) { - enclosingDecl.ensureSymbolIsBound(); - } - - var declSymbol = decl.getSymbol(); - var declParameterSymbol = decl.getValueDecl() ? decl.getValueDecl().getSymbol() : null; - - if (declSymbol.isResolved) { - var declType = declSymbol.type; - var valDecl = decl.getValueDecl(); - - if (valDecl) { - var valSymbol = valDecl.getSymbol(); - - if (valSymbol && !valSymbol.isResolved) { - valSymbol.type = declType; - valSymbol.setResolved(); - } - } - } else { - if (declSymbol.inResolution) { - declSymbol.type = this.semanticInfoChain.anyTypeSymbol; - declSymbol.setResolved(); - return declSymbol; - } - - if (!declSymbol.type || !declSymbol.type.isError()) { - declSymbol.startResolving(); - - var typeExprSymbol = this.resolveAndTypeCheckVariableDeclarationTypeExpr(varDeclOrParameter, name, typeExpr, context); - - if (!hasTypeExpr) { - this.resolveAndTypeCheckVariableDeclaratorOrParameterInitExpr(varDeclOrParameter, name, typeExpr, init, context, typeExprSymbol); - } - - if (!(hasTypeExpr || init)) { - var defaultType = this.semanticInfoChain.anyTypeSymbol; - - if (declSymbol.isVarArg && this.cachedArrayInterfaceType()) { - defaultType = this.createInstantiatedType(this.cachedArrayInterfaceType(), [defaultType]); - } - - context.setTypeInContext(declSymbol, defaultType); - - if (declParameterSymbol) { - declParameterSymbol.type = defaultType; - } - } - declSymbol.setResolved(); - - if (declParameterSymbol) { - declParameterSymbol.setResolved(); - } - } - } - - if (this.canTypeCheckAST(varDeclOrParameter, context)) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDeclOrParameter, modifiers, name, typeExpr, init, context); - } - - return declSymbol; - }; - - PullTypeResolver.prototype.resolveAndTypeCheckVariableDeclarationTypeExpr = function (varDeclOrParameter, name, typeExpr, context) { - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - var declSymbol = decl.getSymbol(); - var declParameterSymbol = decl.getValueDecl() ? decl.getValueDecl().getSymbol() : null; - - if (varDeclOrParameter.kind() === 243 /* EnumElement */) { - var result = this.getEnumTypeSymbol(varDeclOrParameter, context); - declSymbol.type = result; - return result; - } - - if (!typeExpr) { - return null; - } - - var wrapperDecl = this.getEnclosingDecl(decl); - wrapperDecl = wrapperDecl || enclosingDecl; - - var typeExprSymbol = this.resolveTypeReference(typeExpr, context); - - if (!typeExprSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Unable_to_resolve_type_of_0, [name.text()])); - declSymbol.type = this.getNewErrorTypeSymbol(); - - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, this.semanticInfoChain.anyTypeSymbol); - } - } else if (typeExprSymbol.isError()) { - context.setTypeInContext(declSymbol, typeExprSymbol); - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, typeExprSymbol); - } - } else { - if (typeExprSymbol === this.semanticInfoChain.anyTypeSymbol) { - decl.setFlag(16777216 /* IsAnnotatedWithAny */); - } - - if (typeExprSymbol.isContainer()) { - var exportedTypeSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - - if (exportedTypeSymbol) { - typeExprSymbol = exportedTypeSymbol; - } else { - typeExprSymbol = typeExprSymbol.type; - - if (typeExprSymbol.isAlias()) { - typeExprSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - } - - if (typeExprSymbol && typeExprSymbol.isContainer() && !typeExprSymbol.isEnum()) { - var instanceSymbol = typeExprSymbol.getInstanceSymbol(); - - if (!instanceSymbol || !TypeScript.PullHelpers.symbolIsEnum(instanceSymbol)) { - typeExprSymbol = this.getNewErrorTypeSymbol(); - } else { - typeExprSymbol = instanceSymbol.type; - } - } - } - } else if (declSymbol.isVarArg && !(typeExprSymbol.isArrayNamedTypeReference() || typeExprSymbol === this.cachedArrayInterfaceType())) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Rest_parameters_must_be_array_types)); - typeExprSymbol = this.getNewErrorTypeSymbol(); - } - - context.setTypeInContext(declSymbol, typeExprSymbol); - - if (declParameterSymbol) { - declParameterSymbol.type = typeExprSymbol; - } - - if (typeExprSymbol.kind === 16777216 /* FunctionType */ && !typeExprSymbol.getFunctionSymbol()) { - typeExprSymbol.setFunctionSymbol(declSymbol); - } - } - - return typeExprSymbol; - }; - - PullTypeResolver.prototype.resolveAndTypeCheckVariableDeclaratorOrParameterInitExpr = function (varDeclOrParameter, name, typeExpr, init, context, typeExprSymbol) { - if (!init) { - return null; - } - - var hasTypeExpr = typeExpr !== null || varDeclOrParameter.kind() === 243 /* EnumElement */; - if (typeExprSymbol) { - context.pushNewContextualType(typeExprSymbol); - } - - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - var declSymbol = decl.getSymbol(); - var declParameterSymbol = decl.getValueDecl() ? decl.getValueDecl().getSymbol() : null; - - var wrapperDecl = this.getEnclosingDecl(decl); - wrapperDecl = wrapperDecl || enclosingDecl; - - var initExprSymbol = this.resolveAST(init, typeExprSymbol !== null, context); - - if (typeExprSymbol) { - context.popAnyContextualType(); - } - - if (!initExprSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Unable_to_resolve_type_of_0, [name.text()])); - - if (!hasTypeExpr) { - context.setTypeInContext(declSymbol, this.getNewErrorTypeSymbol()); - - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, this.semanticInfoChain.anyTypeSymbol); - } - } - } else { - var initTypeSymbol = initExprSymbol.type; - - if (!hasTypeExpr) { - var widenedInitTypeSymbol = initTypeSymbol.widenedType(this, init.value, context); - context.setTypeInContext(declSymbol, widenedInitTypeSymbol); - - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, widenedInitTypeSymbol); - } - - if (this.compilationSettings.noImplicitAny()) { - if ((widenedInitTypeSymbol !== initTypeSymbol) && (widenedInitTypeSymbol === this.semanticInfoChain.anyTypeSymbol)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Variable_0_implicitly_has_an_any_type, [name.text()])); - } - } - - return widenedInitTypeSymbol; - } - } - - return initTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckPropertySignature = function (varDecl, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.sentinelEmptyArray, varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckMemberVariableDeclaration = function (varDecl, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDecl, varDecl.modifiers, varDecl.variableDeclarator.propertyName, TypeScript.ASTHelpers.getType(varDecl), varDecl.variableDeclarator.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckVariableDeclarator = function (varDecl, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl), varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), varDecl.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckParameter = function (parameter, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(parameter, parameter.modifiers, parameter.identifier, TypeScript.ASTHelpers.getType(parameter), parameter.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckVariableDeclaratorOrParameterOrEnumElement = function (varDeclOrParameter, modifiers, name, typeExpr, init, context) { - var _this = this; - this.setTypeChecked(varDeclOrParameter, context); - - var hasTypeExpr = typeExpr !== null || varDeclOrParameter.kind() === 243 /* EnumElement */; - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - var declSymbol = decl.getSymbol(); - - var typeExprSymbol = this.resolveAndTypeCheckVariableDeclarationTypeExpr(varDeclOrParameter, name, typeExpr, context); - - var initTypeSymbol = this.resolveAndTypeCheckVariableDeclaratorOrParameterInitExpr(varDeclOrParameter, name, typeExpr, init, context, typeExprSymbol); - - if (hasTypeExpr || init) { - if (typeExprSymbol && typeExprSymbol.isAlias()) { - typeExprSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - } - - if (typeExprSymbol && typeExprSymbol.kind === 32 /* DynamicModule */) { - var exportedTypeSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - - if (exportedTypeSymbol) { - typeExprSymbol = exportedTypeSymbol; - } else { - var instanceTypeSymbol = typeExprSymbol.getInstanceType(); - - if (!instanceTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Tried_to_set_variable_type_to_uninitialized_module_type_0, [typeExprSymbol.toString()])); - typeExprSymbol = null; - } else { - typeExprSymbol = instanceTypeSymbol; - } - } - } - - initTypeSymbol = this.getInstanceTypeForAssignment(varDeclOrParameter, initTypeSymbol, context); - - if (initTypeSymbol && typeExprSymbol) { - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(initTypeSymbol, typeExprSymbol, varDeclOrParameter, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(varDeclOrParameter); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [initTypeSymbol.toString(enclosingSymbol), typeExprSymbol.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [initTypeSymbol.toString(enclosingSymbol), typeExprSymbol.toString(enclosingSymbol)])); - } - } - } - } else if (varDeclOrParameter.kind() !== 243 /* EnumElement */ && this.compilationSettings.noImplicitAny() && !this.isForInVariableDeclarator(varDeclOrParameter)) { - var wrapperDecl = this.getEnclosingDecl(decl); - wrapperDecl = wrapperDecl || enclosingDecl; - - var needReportError = function (containerDecl, selfDecl) { - if (!TypeScript.hasFlag(containerDecl.flags, 8 /* Ambient */)) { - return true; - } - - return selfDecl && !TypeScript.hasFlag(selfDecl.flags, 2 /* Private */); - }; - - if ((wrapperDecl.kind === 16384 /* Function */ || wrapperDecl.kind === 32768 /* ConstructorMethod */ || wrapperDecl.kind === 2097152 /* ConstructSignature */)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Parameter_0_of_1_implicitly_has_an_any_type, [name.text(), enclosingDecl.name])); - } else if (wrapperDecl.kind === 65536 /* Method */) { - var parentDecl = wrapperDecl.getParentDecl(); - - if (needReportError(parentDecl, wrapperDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Parameter_0_of_1_implicitly_has_an_any_type, [name.text(), enclosingDecl.name])); - } - } else if (decl.kind === 4096 /* Property */ && !declSymbol.getContainer().isNamedTypeSymbol()) { - if (needReportError(wrapperDecl, decl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Member_0_of_object_type_implicitly_has_an_any_type, [name.text()])); - } - } else if (wrapperDecl.kind !== 268435456 /* CatchBlock */) { - if (needReportError(wrapperDecl) || !TypeScript.hasModifier(modifiers, 2 /* Private */)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Variable_0_implicitly_has_an_any_type, [name.text()])); - } - } - } - - if (init && varDeclOrParameter.kind() === 242 /* Parameter */) { - var containerSignature = enclosingDecl.getSignatureSymbol(); - if (containerSignature && !containerSignature.isDefinition()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Default_arguments_are_only_allowed_in_implementation)); - } - } - if (declSymbol.kind !== 2048 /* Parameter */ && (declSymbol.kind !== 4096 /* Property */ || declSymbol.getContainer().isNamedTypeSymbol())) { - this.checkSymbolPrivacy(declSymbol, declSymbol.type, function (symbol) { - return _this.variablePrivacyErrorReporter(varDeclOrParameter, declSymbol, symbol, context); - }); - } - - if ((declSymbol.kind !== 4096 /* Property */ && declSymbol.kind !== 67108864 /* EnumMember */) || declSymbol.anyDeclHasFlag(8388608 /* PropertyParameter */)) { - this.checkNameForCompilerGeneratedDeclarationCollision(varDeclOrParameter, true, name, context); - } - }; - - PullTypeResolver.prototype.isForInVariableDeclarator = function (ast) { - return ast.kind() === 225 /* VariableDeclarator */ && ast.parent && ast.parent.parent && ast.parent.parent.parent && ast.parent.kind() === 2 /* SeparatedList */ && ast.parent.parent.kind() === 224 /* VariableDeclaration */ && ast.parent.parent.parent.kind() === 155 /* ForInStatement */ && ast.parent.parent.parent.variableDeclaration === ast.parent.parent; - }; - - PullTypeResolver.prototype.checkSuperCaptureVariableCollides = function (superAST, isDeclaration, context) { - var enclosingDecl = this.getEnclosingDeclForAST(superAST); - - var classSymbol = this.getContextualClassSymbolForEnclosingDecl(superAST, enclosingDecl); - - if (classSymbol && !classSymbol.anyDeclHasFlag(8 /* Ambient */)) { - if (superAST.kind() === 242 /* Parameter */) { - var enclosingAST = this.getASTForDecl(enclosingDecl); - if (enclosingAST.kind() !== 218 /* ParenthesizedArrowFunctionExpression */ && enclosingAST.kind() !== 219 /* SimpleArrowFunctionExpression */) { - var block = enclosingDecl.kind === 65536 /* Method */ ? enclosingAST.block : enclosingAST.block; - if (!block) { - return; - } - } - } - - this.resolveDeclaredSymbol(classSymbol, context); - - var parents = classSymbol.getExtendedTypes(); - if (parents.length) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(superAST, isDeclaration ? TypeScript.DiagnosticCode.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference : TypeScript.DiagnosticCode.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference)); - } - } - }; - - PullTypeResolver.prototype.checkThisCaptureVariableCollides = function (_thisAST, isDeclaration, context) { - if (isDeclaration) { - var decl = this.semanticInfoChain.getDeclForAST(_thisAST); - if (TypeScript.hasFlag(decl.flags, 8 /* Ambient */)) { - return; - } - } - - var enclosingDecl = this.getEnclosingDeclForAST(_thisAST); - - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(_thisAST); - if (enclosingModule) { - enclosingDecl = this.getEnclosingDeclForAST(enclosingModule); - } - - var declPath = enclosingDecl.getParentPath(); - - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - var declKind = decl.kind; - if (declKind === 131072 /* FunctionExpression */ && TypeScript.hasFlag(decl.flags, 8192 /* ArrowFunction */)) { - continue; - } - - if (declKind === 16384 /* Function */ || declKind === 65536 /* Method */ || declKind === 32768 /* ConstructorMethod */ || declKind === 262144 /* GetAccessor */ || declKind === 524288 /* SetAccessor */ || declKind === 131072 /* FunctionExpression */ || declKind === 8 /* Class */ || declKind === 4 /* Container */ || declKind === 32 /* DynamicModule */ || declKind === 1 /* Script */) { - if (TypeScript.hasFlag(decl.flags, 262144 /* MustCaptureThis */)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(_thisAST, isDeclaration ? TypeScript.DiagnosticCode.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference : TypeScript.DiagnosticCode.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference)); - } - break; - } - } - }; - - PullTypeResolver.prototype.postTypeCheckVariableDeclaratorOrParameter = function (varDeclOrParameter, context) { - this.checkThisCaptureVariableCollides(varDeclOrParameter, true, context); - }; - - PullTypeResolver.prototype.resolveTypeParameterDeclaration = function (typeParameterAST, context) { - var typeParameterDecl = this.semanticInfoChain.getDeclForAST(typeParameterAST); - var typeParameterSymbol = typeParameterDecl.getSymbol(); - - this.resolveFirstTypeParameterDeclaration(typeParameterSymbol, context); - - if (typeParameterSymbol.isResolved && this.canTypeCheckAST(typeParameterAST, context)) { - this.typeCheckTypeParameterDeclaration(typeParameterAST, context); - } - - return typeParameterSymbol; - }; - - PullTypeResolver.prototype.resolveFirstTypeParameterDeclaration = function (typeParameterSymbol, context) { - var typeParameterDecl = typeParameterSymbol.getDeclarations()[0]; - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameterDecl); - - if (typeParameterSymbol.isResolved || typeParameterSymbol.inResolution) { - return; - } - - typeParameterSymbol.startResolving(); - - if (typeParameterAST.constraint) { - var constraintTypeSymbol = this.resolveTypeReference(typeParameterAST.constraint.type, context); - - if (constraintTypeSymbol) { - typeParameterSymbol.setConstraint(constraintTypeSymbol); - } - } - - typeParameterSymbol.setResolved(); - }; - - PullTypeResolver.prototype.typeCheckTypeParameterDeclaration = function (typeParameterAST, context) { - this.setTypeChecked(typeParameterAST, context); - - var constraint = this.resolveAST(typeParameterAST.constraint, false, context); - - if (constraint) { - var typeParametersAST = typeParameterAST.parent; - var typeParameters = []; - for (var i = 0; i < typeParametersAST.nonSeparatorCount(); i++) { - var currentTypeParameterAST = typeParametersAST.nonSeparatorAt(i); - var currentTypeParameterDecl = this.semanticInfoChain.getDeclForAST(currentTypeParameterAST); - var currentTypeParameter = this.semanticInfoChain.getSymbolForDecl(currentTypeParameterDecl); - typeParameters[currentTypeParameter.pullSymbolID] = currentTypeParameter; - } - - if (constraint.wrapsSomeTypeParameter(typeParameters)) { - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); - } - } - }; - - PullTypeResolver.prototype.resolveConstraint = function (constraint, context) { - if (this.canTypeCheckAST(constraint, context)) { - this.setTypeChecked(constraint, context); - } - - return this.resolveTypeReference(constraint.type, context); - }; - - PullTypeResolver.prototype.resolveFunctionBodyReturnTypes = function (funcDeclAST, block, bodyExpression, signature, useContextualType, enclosingDecl, context) { - var _this = this; - var returnStatementsExpressions = []; - - var enclosingDeclStack = [enclosingDecl]; - - var preFindReturnExpressionTypes = function (ast, walker) { - var go = true; - - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 215 /* ObjectLiteralExpression */: - go = false; - break; - - case 150 /* ReturnStatement */: - var returnStatement = ast; - enclosingDecl.setFlag(4194304 /* HasReturnStatement */); - returnStatementsExpressions.push({ expression: returnStatement.expression, enclosingDecl: enclosingDeclStack[enclosingDeclStack.length - 1] }); - go = false; - break; - - case 236 /* CatchClause */: - case 163 /* WithStatement */: - enclosingDeclStack[enclosingDeclStack.length] = _this.semanticInfoChain.getDeclForAST(ast); - break; - - default: - break; - } - - walker.options.goChildren = go; - - return ast; - }; - - var postFindReturnExpressionEnclosingDecls = function (ast, walker) { - switch (ast.kind()) { - case 236 /* CatchClause */: - case 163 /* WithStatement */: - enclosingDeclStack.length--; - break; - default: - break; - } - - walker.options.goChildren = true; - - return ast; - }; - - if (block) { - TypeScript.getAstWalkerFactory().walk(block, preFindReturnExpressionTypes, postFindReturnExpressionEnclosingDecls); - } else { - returnStatementsExpressions.push({ expression: bodyExpression, enclosingDecl: enclosingDecl }); - enclosingDecl.setFlag(4194304 /* HasReturnStatement */); - } - - if (!returnStatementsExpressions.length) { - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - } else { - var returnExpressionSymbols = []; - var returnExpressions = []; - - for (var i = 0; i < returnStatementsExpressions.length; i++) { - var returnExpression = returnStatementsExpressions[i].expression; - if (returnExpression) { - var returnType = this.resolveAST(returnExpression, useContextualType, context).type; - - if (returnType.isError()) { - signature.returnType = returnType; - return; - } else { - if (returnExpression.parent.kind() === 150 /* ReturnStatement */) { - this.setSymbolForAST(returnExpression.parent, returnType, context); - } - } - - returnExpressionSymbols.push(returnType); - returnExpressions.push(returnExpression); - } - } - - if (!returnExpressionSymbols.length) { - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - } else { - var collection = { - getLength: function () { - return returnExpressionSymbols.length; - }, - getTypeAtIndex: function (index) { - return returnExpressionSymbols[index].type; - } - }; - - var bestCommonReturnType = this.findBestCommonType(collection, context, new TypeComparisonInfo()); - var returnType = bestCommonReturnType; - var returnExpression = returnExpressions[returnExpressionSymbols.indexOf(returnType)]; - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var functionSymbol = functionDecl.getSymbol(); - - if (returnType) { - var previousReturnType = returnType; - var newReturnType = returnType.widenedType(this, returnExpression, context); - signature.returnType = newReturnType; - - if (!TypeScript.ArrayUtilities.contains(returnExpressionSymbols, bestCommonReturnType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Could_not_find_the_best_common_type_of_types_of_all_return_statement_expressions)); - } - - if (this.compilationSettings.noImplicitAny()) { - if (previousReturnType !== newReturnType && newReturnType === this.semanticInfoChain.anyTypeSymbol) { - var functionName = enclosingDecl.name; - if (functionName === "") { - functionName = enclosingDecl.getFunctionExpressionName(); - } - - if (functionName != "") { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type, [functionName])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - } - } - - if (!functionSymbol.type && functionSymbol.isAccessor()) { - functionSymbol.type = signature.returnType; - } - } - } - }; - - PullTypeResolver.prototype.typeCheckConstructorDeclaration = function (funcDeclAST, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - for (var i = 0; i < funcDeclAST.callSignature.parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveAST(funcDeclAST.callSignature.parameterList.parameters.nonSeparatorAt(i), false, context); - } - - this.resolveAST(funcDeclAST.block, false, context); - - if (funcDecl.getSignatureSymbol() && funcDecl.getSignatureSymbol().isDefinition() && this.enclosingClassIsDerived(funcDecl.getParentDecl())) { - if (!this.constructorHasSuperCall(funcDeclAST)) { - context.postDiagnostic(new TypeScript.Diagnostic(funcDeclAST.fileName(), this.semanticInfoChain.lineMap(funcDeclAST.fileName()), funcDeclAST.start(), "constructor".length, TypeScript.DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call)); - } else if (this.superCallMustBeFirstStatementInConstructor(funcDecl)) { - var firstStatement = this.getFirstStatementOfBlockOrNull(funcDeclAST.block); - if (!firstStatement || !this.isSuperInvocationExpressionStatement(firstStatement)) { - context.postDiagnostic(new TypeScript.Diagnostic(funcDeclAST.fileName(), this.semanticInfoChain.lineMap(funcDeclAST.fileName()), funcDeclAST.start(), "constructor".length, TypeScript.DiagnosticCode.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties)); - } - } - } - - this.validateVariableDeclarationGroups(funcDecl, context); - - this.checkFunctionTypePrivacy(funcDeclAST, false, null, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.callSignature.parameterList), null, funcDeclAST.block, context); - - this.typeCheckCallBacks.push(function (context) { - _this.typeCheckFunctionOverloads(funcDeclAST, context); - }); - }; - - PullTypeResolver.prototype.constructorHasSuperCall = function (constructorDecl) { - var _this = this; - if (constructorDecl.block) { - var foundSuperCall = false; - var pre = function (ast, walker) { - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 215 /* ObjectLiteralExpression */: - walker.options.goChildren = false; - default: - if (_this.isSuperInvocationExpression(ast)) { - foundSuperCall = true; - walker.options.stopWalking = true; - } - } - }; - - TypeScript.getAstWalkerFactory().walk(constructorDecl.block, pre); - return foundSuperCall; - } - - return false; - }; - - PullTypeResolver.prototype.typeCheckFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - this.typeCheckAnyFunctionExpression(funcDecl, funcDecl.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), funcDecl.callSignature.typeAnnotation, funcDecl.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckCallSignature = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, false, null, funcDecl.typeParameterList, funcDecl.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckConstructSignature = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, false, null, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckMethodSignature = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, false, funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckMemberFunctionDeclaration = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - }; - - PullTypeResolver.prototype.containsSingleThrowStatement = function (block) { - return block !== null && block.statements.childCount() === 1 && block.statements.childAt(0).kind() === 157 /* ThrowStatement */; - }; - - PullTypeResolver.prototype.typeCheckAnyFunctionDeclaration = function (funcDeclAST, isStatic, name, typeParameters, parameters, returnTypeAnnotation, block, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - this.resolveAST(parameters, false, context); - - this.resolveAST(block, false, context); - var enclosingDecl = this.getEnclosingDecl(funcDecl); - - this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, returnTypeAnnotation, context); - this.validateVariableDeclarationGroups(funcDecl, context); - - this.checkFunctionTypePrivacy(funcDeclAST, isStatic, typeParameters, TypeScript.ASTHelpers.parametersFromParameterList(parameters), returnTypeAnnotation, block, context); - - this.checkThatNonVoidFunctionHasReturnExpressionOrThrowStatement(funcDecl, returnTypeAnnotation, funcDecl.getSignatureSymbol().returnType, block, context); - - if (funcDecl.kind === 16384 /* Function */) { - this.checkNameForCompilerGeneratedDeclarationCollision(funcDeclAST, true, name, context); - } - - this.typeCheckCallBacks.push(function (context) { - _this.typeCheckFunctionOverloads(funcDeclAST, context); - }); - }; - - PullTypeResolver.prototype.checkThatNonVoidFunctionHasReturnExpressionOrThrowStatement = function (functionDecl, returnTypeAnnotation, returnTypeSymbol, block, context) { - var hasReturn = TypeScript.hasFlag(functionDecl.flags, 4194304 /* HasReturnStatement */); - - if (block !== null && returnTypeAnnotation !== null && !hasReturn) { - var isVoidOrAny = this.isAnyOrEquivalent(returnTypeSymbol) || returnTypeSymbol === this.semanticInfoChain.voidTypeSymbol; - - if (!isVoidOrAny && !this.containsSingleThrowStatement(block)) { - var funcName = functionDecl.getDisplayName() || TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, TypeScript.DiagnosticCode.Function_declared_a_non_void_return_type_but_has_no_return_expression)); - } - } - }; - - PullTypeResolver.prototype.typeCheckIndexSignature = function (funcDeclAST, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - this.resolveAST(funcDeclAST.parameter, false, context); - - var enclosingDecl = this.getEnclosingDecl(funcDecl); - - this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, TypeScript.ASTHelpers.getType(funcDeclAST), context); - this.validateVariableDeclarationGroups(funcDecl, context); - - this.checkFunctionTypePrivacy(funcDeclAST, false, null, TypeScript.ASTHelpers.parametersFromParameter(funcDeclAST.parameter), TypeScript.ASTHelpers.getType(funcDeclAST), null, context); - - var signature = funcDecl.getSignatureSymbol(); - - this.typeCheckCallBacks.push(function (context) { - var parentSymbol = funcDecl.getSignatureSymbol().getContainer(); - var allIndexSignatures = _this.getBothKindsOfIndexSignaturesExcludingAugmentedType(parentSymbol, context); - var stringIndexSignature = allIndexSignatures.stringSignature; - var numberIndexSignature = allIndexSignatures.numericSignature; - var isNumericIndexer = numberIndexSignature === signature; - - if (numberIndexSignature && stringIndexSignature && (isNumericIndexer || stringIndexSignature.getDeclarations()[0].getParentDecl() !== numberIndexSignature.getDeclarations()[0].getParentDecl())) { - var comparisonInfo = new TypeComparisonInfo(); - - if (!_this.sourceIsAssignableToTarget(numberIndexSignature.returnType, stringIndexSignature.returnType, funcDeclAST, context, comparisonInfo)) { - var enclosingSymbol = _this.getEnclosingSymbolForAST(funcDeclAST); - if (comparisonInfo.message) { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1_NL_2, [numberIndexSignature.returnType.toString(enclosingSymbol), stringIndexSignature.returnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1, [numberIndexSignature.returnType.toString(enclosingSymbol), stringIndexSignature.returnType.toString(enclosingSymbol)])); - } - } - } - - var allMembers = parentSymbol.type.getAllMembers(536869887 /* All */, 0 /* all */); - for (var i = 0; i < allMembers.length; i++) { - var member = allMembers[i]; - var name = member.name; - if (name || (member.kind === 4096 /* Property */ && name === "")) { - if (!allMembers[i].isResolved) { - _this.resolveDeclaredSymbol(allMembers[i], context); - } - - if (parentSymbol !== allMembers[i].getContainer()) { - var isMemberNumeric = TypeScript.PullHelpers.isNameNumeric(name); - var indexerKindMatchesMemberNameKind = isNumericIndexer === isMemberNumeric; - var onlyStringIndexerIsPresent = !numberIndexSignature; - - if (indexerKindMatchesMemberNameKind || onlyStringIndexerIsPresent) { - var comparisonInfo = new TypeComparisonInfo(); - if (!_this.sourceIsAssignableToTarget(allMembers[i].type, signature.returnType, funcDeclAST, context, comparisonInfo, false)) { - _this.reportErrorThatMemberIsNotSubtypeOfIndexer(allMembers[i], signature, funcDeclAST, context, comparisonInfo); - } - } - } - } - } - }); - }; - - PullTypeResolver.prototype.postTypeCheckFunctionDeclaration = function (funcDeclAST, context) { - this.checkThisCaptureVariableCollides(funcDeclAST, true, context); - }; - - PullTypeResolver.prototype.resolveReturnTypeAnnotationOfFunctionDeclaration = function (funcDeclAST, returnTypeAnnotation, context) { - var returnTypeSymbol = null; - - if (returnTypeAnnotation) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - returnTypeSymbol = this.resolveTypeReference(returnTypeAnnotation, context); - - if (!returnTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, TypeScript.DiagnosticCode.Cannot_resolve_return_type_reference)); - } else { - var isConstructor = funcDeclAST.kind() === 137 /* ConstructorDeclaration */ || funcDeclAST.kind() === 143 /* ConstructSignature */; - if (isConstructor && returnTypeSymbol === this.semanticInfoChain.voidTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Constructors_cannot_have_a_return_type_of_void)); - } - } - } - - return returnTypeSymbol; - }; - - PullTypeResolver.prototype.resolveMemberFunctionDeclaration = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - }; - - PullTypeResolver.prototype.resolveCallSignature = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, false, null, funcDecl.typeParameterList, funcDecl.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.resolveConstructSignature = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, false, null, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.resolveMethodSignature = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, false, funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.resolveAnyFunctionDeclaration = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.identifier, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - }; - - PullTypeResolver.prototype.resolveFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcDecl, funcDecl.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveSimpleArrowFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcDecl, null, TypeScript.ASTHelpers.parametersFromIdentifier(funcDecl.identifier), null, funcDecl.block, funcDecl.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveParenthesizedArrowFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcDecl, funcDecl.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, funcDecl.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.getEnclosingClassDeclaration = function (ast) { - while (ast) { - if (ast.kind() === 131 /* ClassDeclaration */) { - return ast; - } - - ast = ast.parent; - } - - return null; - }; - - PullTypeResolver.prototype.resolveConstructorDeclaration = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcSymbol = funcDecl.getSymbol(); - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckConstructorDeclaration(funcDeclAST, context); - } - return funcSymbol; - } - - if (!signature.inResolution) { - var classAST = this.getEnclosingClassDeclaration(funcDeclAST); - - if (classAST) { - var classDecl = this.semanticInfoChain.getDeclForAST(classAST); - var classSymbol = classDecl.getSymbol(); - - if (!classSymbol.isResolved && !classSymbol.inResolution) { - this.resolveDeclaredSymbol(classSymbol, context); - } - } - } - - var functionTypeSymbol = funcSymbol && funcSymbol.type; - - if (signature.inResolution) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - return funcSymbol; - } - - if (funcSymbol) { - funcSymbol.startResolving(); - } - signature.startResolving(); - - var prevInTypeCheck = context.inTypeCheck; - - context.inTypeCheck = false; - - for (var i = 0; i < funcDeclAST.callSignature.parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(funcDeclAST.callSignature.parameterList.parameters.nonSeparatorAt(i), context); - } - - context.inTypeCheck = prevInTypeCheck; - - if (signature.isGeneric()) { - if (funcSymbol) { - funcSymbol.type.setHasGenericSignature(); - } - } - - if (!hadError) { - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - } - } - - if (funcSymbol) { - this.resolveOtherDeclarations(funcDeclAST, context); - } - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckConstructorDeclaration(funcDeclAST, context); - } - - return funcSymbol; - }; - - PullTypeResolver.prototype.resolveIndexMemberDeclaration = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - } - - return this.resolveIndexSignature(ast.indexSignature, context); - }; - - PullTypeResolver.prototype.resolveIndexSignature = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcSymbol = funcDecl.getSymbol(); - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckIndexSignature(funcDeclAST, context); - } - return funcSymbol; - } - - var functionTypeSymbol = funcSymbol && funcSymbol.type; - - if (signature.inResolution) { - if (funcDeclAST.typeAnnotation) { - var returnTypeSymbol = this.resolveTypeReference(TypeScript.ASTHelpers.getType(funcDeclAST), context); - if (!returnTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(TypeScript.ASTHelpers.getType(funcDeclAST), TypeScript.DiagnosticCode.Cannot_resolve_return_type_reference)); - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - } - - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - return funcSymbol; - } - - if (funcSymbol) { - funcSymbol.startResolving(); - } - signature.startResolving(); - - if (funcDeclAST.parameter) { - var prevInTypeCheck = context.inTypeCheck; - - context.inTypeCheck = false; - this.resolveParameter(funcDeclAST.parameter, context); - context.inTypeCheck = prevInTypeCheck; - } - - if (funcDeclAST.typeAnnotation) { - returnTypeSymbol = this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, TypeScript.ASTHelpers.getType(funcDeclAST), context); - - if (!returnTypeSymbol) { - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - } - - if (!hadError) { - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - } - } - - if (funcSymbol) { - this.resolveOtherDeclarations(funcDeclAST, context); - } - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckIndexSignature(funcDeclAST, context); - } - - return funcSymbol; - }; - - PullTypeResolver.prototype.resolveFunctionDeclaration = function (funcDeclAST, isStatic, name, typeParameters, parameterList, returnTypeAnnotation, block, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcSymbol = funcDecl.getSymbol(); - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - var isConstructor = funcDeclAST.kind() === 143 /* ConstructSignature */; - - if (signature) { - if (signature.isResolved) { - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckAnyFunctionDeclaration(funcDeclAST, isStatic, name, typeParameters, parameterList, returnTypeAnnotation, block, context); - } - return funcSymbol; - } - - if (isConstructor && !signature.inResolution) { - var classAST = this.getEnclosingClassDeclaration(funcDeclAST); - - if (classAST) { - var classDecl = this.semanticInfoChain.getDeclForAST(classAST); - var classSymbol = classDecl.getSymbol(); - - if (!classSymbol.isResolved && !classSymbol.inResolution) { - this.resolveDeclaredSymbol(classSymbol, context); - } - } - } - - var functionTypeSymbol = funcSymbol && funcSymbol.type; - - if (signature.inResolution) { - if (returnTypeAnnotation) { - var returnTypeSymbol = this.resolveTypeReference(returnTypeAnnotation, context); - if (!returnTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, TypeScript.DiagnosticCode.Cannot_resolve_return_type_reference)); - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - - if (isConstructor && returnTypeSymbol === this.semanticInfoChain.voidTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Constructors_cannot_have_a_return_type_of_void)); - } - } - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - } - - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - return funcSymbol; - } - - if (funcSymbol) { - funcSymbol.startResolving(); - } - signature.startResolving(); - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - if (parameterList) { - var prevInTypeCheck = context.inTypeCheck; - - context.inTypeCheck = false; - - for (var i = 0; i < parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(parameterList.parameters.nonSeparatorAt(i), context); - } - - context.inTypeCheck = prevInTypeCheck; - } - - if (returnTypeAnnotation) { - returnTypeSymbol = this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, returnTypeAnnotation, context); - - if (!returnTypeSymbol) { - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else if (funcDecl.kind !== 2097152 /* ConstructSignature */) { - if (TypeScript.hasFlag(funcDecl.flags, 2048 /* Signature */)) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - var parentDeclFlags = 0 /* None */; - if (TypeScript.hasFlag(funcDecl.kind, 65536 /* Method */) || TypeScript.hasFlag(funcDecl.kind, 32768 /* ConstructorMethod */)) { - var parentDecl = funcDecl.getParentDecl(); - parentDeclFlags = parentDecl.flags; - } - - if (this.compilationSettings.noImplicitAny() && (!TypeScript.hasFlag(parentDeclFlags, 8 /* Ambient */) || (TypeScript.hasFlag(parentDeclFlags, 8 /* Ambient */) && !TypeScript.hasFlag(funcDecl.flags, 2 /* Private */)))) { - var funcDeclASTName = name; - if (funcDeclASTName) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type, [funcDeclASTName.text()])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Lambda_Function_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - } else { - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, null, signature, false, funcDecl, context); - } - } else if (funcDecl.kind === 2097152 /* ConstructSignature */) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - - if (this.compilationSettings.noImplicitAny()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Constructor_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - - if (!hadError) { - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - } - } - - if (funcSymbol) { - this.resolveOtherDeclarations(funcDeclAST, context); - } - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckAnyFunctionDeclaration(funcDeclAST, isStatic, name, typeParameters, parameterList, returnTypeAnnotation, block, context); - } - - return funcSymbol; - }; - - PullTypeResolver.prototype.resolveGetterReturnTypeAnnotation = function (getterFunctionDeclarationAst, enclosingDecl, context) { - if (getterFunctionDeclarationAst && getterFunctionDeclarationAst.typeAnnotation) { - return this.resolveTypeReference(TypeScript.ASTHelpers.getType(getterFunctionDeclarationAst), context); - } - - return null; - }; - - PullTypeResolver.prototype.resolveSetterArgumentTypeAnnotation = function (setterFunctionDeclarationAst, enclosingDecl, context) { - if (setterFunctionDeclarationAst && setterFunctionDeclarationAst.parameterList && setterFunctionDeclarationAst.parameterList.parameters.nonSeparatorCount() > 0) { - var parameter = setterFunctionDeclarationAst.parameterList.parameters.nonSeparatorAt(0); - return this.resolveTypeReference(TypeScript.ASTHelpers.getType(parameter), context); - } - - return null; - }; - - PullTypeResolver.prototype.resolveAccessorDeclaration = function (funcDeclAst, context) { - var functionDeclaration = this.semanticInfoChain.getDeclForAST(funcDeclAst); - var accessorSymbol = functionDeclaration.getSymbol(); - - if (accessorSymbol.inResolution) { - accessorSymbol.type = this.semanticInfoChain.anyTypeSymbol; - accessorSymbol.setResolved(); - - return accessorSymbol; - } - - if (accessorSymbol.isResolved) { - if (!accessorSymbol.type) { - accessorSymbol.type = this.semanticInfoChain.anyTypeSymbol; - } - } else { - var getterSymbol = accessorSymbol.getGetter(); - var getterFunctionDeclarationAst = getterSymbol ? getterSymbol.getDeclarations()[0].ast() : null; - var hasGetter = getterSymbol !== null; - - var setterSymbol = accessorSymbol.getSetter(); - var setterFunctionDeclarationAst = setterSymbol ? setterSymbol.getDeclarations()[0].ast() : null; - var hasSetter = setterSymbol !== null; - - var getterAnnotatedType = this.resolveGetterReturnTypeAnnotation(getterFunctionDeclarationAst, functionDeclaration, context); - var getterHasTypeAnnotation = getterAnnotatedType !== null; - - var setterAnnotatedType = this.resolveSetterArgumentTypeAnnotation(setterFunctionDeclarationAst, functionDeclaration, context); - var setterHasTypeAnnotation = setterAnnotatedType !== null; - - accessorSymbol.startResolving(); - - if (hasGetter) { - getterSymbol = this.resolveGetAccessorDeclaration(getterFunctionDeclarationAst, getterFunctionDeclarationAst.parameterList, TypeScript.ASTHelpers.getType(getterFunctionDeclarationAst), getterFunctionDeclarationAst.block, setterAnnotatedType, context); - } - - if (hasSetter) { - setterSymbol = this.resolveSetAccessorDeclaration(setterFunctionDeclarationAst, setterFunctionDeclarationAst.parameterList, context); - } - - if (hasGetter && hasSetter) { - var setterSig = setterSymbol.type.getCallSignatures()[0]; - var setterParameters = setterSig.parameters; - var setterHasParameters = setterParameters.length > 0; - var getterSig = getterSymbol.type.getCallSignatures()[0]; - - var setterSuppliedTypeSymbol = setterHasParameters ? setterParameters[0].type : null; - var getterSuppliedTypeSymbol = getterSig.returnType; - - if (setterHasTypeAnnotation && !getterHasTypeAnnotation) { - getterSuppliedTypeSymbol = setterSuppliedTypeSymbol; - getterSig.returnType = setterSuppliedTypeSymbol; - } else if ((getterHasTypeAnnotation && !setterHasTypeAnnotation) || (!getterHasTypeAnnotation && !setterHasTypeAnnotation)) { - setterSuppliedTypeSymbol = getterSuppliedTypeSymbol; - - if (setterHasParameters) { - setterParameters[0].type = getterSuppliedTypeSymbol; - } - } - - if (!this.typesAreIdentical(setterSuppliedTypeSymbol, getterSuppliedTypeSymbol, context)) { - accessorSymbol.type = this.getNewErrorTypeSymbol(); - } else { - accessorSymbol.type = getterSuppliedTypeSymbol; - } - } else if (hasSetter) { - var setterSig = setterSymbol.type.getCallSignatures()[0]; - var setterParameters = setterSig.parameters; - var setterHasParameters = setterParameters.length > 0; - - accessorSymbol.type = setterHasParameters ? setterParameters[0].type : this.semanticInfoChain.anyTypeSymbol; - } else { - var getterSig = getterSymbol.type.getCallSignatures()[0]; - accessorSymbol.type = getterSig.returnType; - } - - accessorSymbol.setResolved(); - } - - if (this.canTypeCheckAST(funcDeclAst, context)) { - this.typeCheckAccessorDeclaration(funcDeclAst, context); - } - - return accessorSymbol; - }; - - PullTypeResolver.prototype.typeCheckAccessorDeclaration = function (funcDeclAst, context) { - this.setTypeChecked(funcDeclAst, context); - var functionDeclaration = this.semanticInfoChain.getDeclForAST(funcDeclAst); - var accessorSymbol = functionDeclaration.getSymbol(); - var getterSymbol = accessorSymbol.getGetter(); - var setterSymbol = accessorSymbol.getSetter(); - - var isGetter = funcDeclAst.kind() === 139 /* GetAccessor */; - if (isGetter) { - var getterFunctionDeclarationAst = funcDeclAst; - context.pushNewContextualType(getterSymbol.type); - this.typeCheckGetAccessorDeclaration(getterFunctionDeclarationAst, context); - context.popAnyContextualType(); - } else { - var setterFunctionDeclarationAst = funcDeclAst; - this.typeCheckSetAccessorDeclaration(setterFunctionDeclarationAst, context); - } - }; - - PullTypeResolver.prototype.resolveGetAccessorDeclaration = function (funcDeclAST, parameters, returnTypeAnnotation, block, setterAnnotatedType, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - var getterSymbol = accessorSymbol.getGetter(); - var getterTypeSymbol = getterSymbol.type; - - var signature = getterTypeSymbol.getCallSignatures()[0]; - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - return getterSymbol; - } - - if (signature.inResolution) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - signature.setResolved(); - - return getterSymbol; - } - - signature.startResolving(); - - if (returnTypeAnnotation) { - var returnTypeSymbol = this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, returnTypeAnnotation, context); - - if (!returnTypeSymbol) { - signature.returnType = this.getNewErrorTypeSymbol(); - - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else { - if (!setterAnnotatedType) { - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, null, signature, false, funcDecl, context); - } else { - signature.returnType = setterAnnotatedType; - } - } - - if (!hadError) { - signature.setResolved(); - } - } - - return getterSymbol; - }; - - PullTypeResolver.prototype.checkIfGetterAndSetterTypeMatch = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - var getter = accessorSymbol.getGetter(); - var setter = accessorSymbol.getSetter(); - - if (getter && setter) { - var getterAST = getter.getDeclarations()[0].ast(); - var setterAST = setter.getDeclarations()[0].ast(); - - if (getterAST.typeAnnotation && PullTypeResolver.hasSetAccessorParameterTypeAnnotation(setterAST)) { - var setterSig = setter.type.getCallSignatures()[0]; - var setterParameters = setterSig.parameters; - - var getter = accessorSymbol.getGetter(); - var getterSig = getter.type.getCallSignatures()[0]; - - var setterSuppliedTypeSymbol = setterParameters[0].type; - var getterSuppliedTypeSymbol = getterSig.returnType; - - if (!this.typesAreIdentical(setterSuppliedTypeSymbol, getterSuppliedTypeSymbol, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.get_and_set_accessor_must_have_the_same_type)); - } - } - } - }; - - PullTypeResolver.prototype.typeCheckGetAccessorDeclaration = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, TypeScript.ASTHelpers.getType(funcDeclAST), context); - - this.resolveAST(funcDeclAST.block, false, context); - - this.validateVariableDeclarationGroups(funcDecl, context); - - var enclosingDecl = this.getEnclosingDecl(funcDecl); - - var hasReturn = (funcDecl.flags & (2048 /* Signature */ | 4194304 /* HasReturnStatement */)) !== 0; - var funcNameAST = funcDeclAST.propertyName; - - if (!hasReturn && !this.containsSingleThrowStatement(funcDeclAST.block)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcNameAST, TypeScript.DiagnosticCode.Getters_must_return_a_value)); - } - - var setter = accessorSymbol.getSetter(); - if (setter) { - var setterDecl = setter.getDeclarations()[0]; - var setterIsPrivate = TypeScript.hasFlag(setterDecl.flags, 2 /* Private */); - var getterIsPrivate = TypeScript.hasModifier(funcDeclAST.modifiers, 2 /* Private */); - - if (getterIsPrivate !== setterIsPrivate) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcNameAST, TypeScript.DiagnosticCode.Getter_and_setter_accessors_do_not_agree_in_visibility)); - } - - this.checkIfGetterAndSetterTypeMatch(funcDeclAST, context); - } - - this.checkFunctionTypePrivacy(funcDeclAST, TypeScript.hasModifier(funcDeclAST.modifiers, 16 /* Static */), null, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), TypeScript.ASTHelpers.getType(funcDeclAST), funcDeclAST.block, context); - }; - - PullTypeResolver.hasSetAccessorParameterTypeAnnotation = function (setAccessor) { - return setAccessor.parameterList && setAccessor.parameterList.parameters.nonSeparatorCount() > 0 && setAccessor.parameterList.parameters.nonSeparatorAt(0).typeAnnotation !== null; - }; - - PullTypeResolver.prototype.resolveSetAccessorDeclaration = function (funcDeclAST, parameterList, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - var setterSymbol = accessorSymbol.getSetter(); - var setterTypeSymbol = setterSymbol.type; - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - return setterSymbol; - } - - if (signature.inResolution) { - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - signature.setResolved(); - return setterSymbol; - } - - signature.startResolving(); - - if (parameterList) { - for (var i = 0; i < parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(parameterList.parameters.nonSeparatorAt(i), context); - } - } - - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - - if (!hadError) { - signature.setResolved(); - } - } - - return setterSymbol; - }; - - PullTypeResolver.prototype.typeCheckSetAccessorDeclaration = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - if (funcDeclAST.parameterList) { - for (var i = 0; i < funcDeclAST.parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(funcDeclAST.parameterList.parameters.nonSeparatorAt(i), context); - } - } - - this.resolveAST(funcDeclAST.block, false, context); - - this.validateVariableDeclarationGroups(funcDecl, context); - - var hasReturn = (funcDecl.flags & (2048 /* Signature */ | 4194304 /* HasReturnStatement */)) !== 0; - - var getter = accessorSymbol.getGetter(); - - var funcNameAST = funcDeclAST.propertyName; - - if (getter) { - var getterDecl = getter.getDeclarations()[0]; - var getterIsPrivate = TypeScript.hasFlag(getterDecl.flags, 2 /* Private */); - var setterIsPrivate = TypeScript.hasModifier(funcDeclAST.modifiers, 2 /* Private */); - - if (getterIsPrivate !== setterIsPrivate) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcNameAST, TypeScript.DiagnosticCode.Getter_and_setter_accessors_do_not_agree_in_visibility)); - } - - this.checkIfGetterAndSetterTypeMatch(funcDeclAST, context); - } else { - if (this.compilationSettings.noImplicitAny()) { - var setterFunctionDeclarationAst = funcDeclAST; - if (!PullTypeResolver.hasSetAccessorParameterTypeAnnotation(setterFunctionDeclarationAst) && accessorSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_get_accessor_and_parameter_type_annotation_on_set_accessor_implicitly_has_an_any_type, [setterFunctionDeclarationAst.propertyName.text()])); - } - } - } - - this.checkFunctionTypePrivacy(funcDeclAST, TypeScript.hasModifier(funcDeclAST.modifiers, 16 /* Static */), null, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), null, funcDeclAST.block, context); - }; - - PullTypeResolver.prototype.resolveList = function (list, context) { - if (this.canTypeCheckAST(list, context)) { - this.setTypeChecked(list, context); - - for (var i = 0, n = list.childCount(); i < n; i++) { - this.resolveAST(list.childAt(i), false, context); - } - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveSeparatedList = function (list, context) { - if (this.canTypeCheckAST(list, context)) { - this.setTypeChecked(list, context); - - for (var i = 0, n = list.nonSeparatorCount(); i < n; i++) { - this.resolveAST(list.nonSeparatorAt(i), false, context); - } - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveVoidExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.undefinedTypeSymbol; - }; - - PullTypeResolver.prototype.resolveLogicalOperation = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckLogicalOperation(ast, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckLogicalOperation = function (binex, context) { - this.setTypeChecked(binex, context); - - var leftType = this.resolveAST(binex.left, false, context).type; - var rightType = this.resolveAST(binex.right, false, context).type; - - var comparisonInfo = new TypeComparisonInfo(); - if (!this.sourceIsAssignableToTarget(leftType, rightType, binex, context, comparisonInfo) && !this.sourceIsAssignableToTarget(rightType, leftType, binex, context, comparisonInfo)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(binex); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binex, TypeScript.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2, [ - TypeScript.SyntaxFacts.getText(TypeScript.SyntaxFacts.getOperatorTokenFromBinaryExpression(binex.kind())), - leftType.toString(enclosingSymbol), rightType.toString(enclosingSymbol)])); - } - }; - - PullTypeResolver.prototype.resolveLogicalNotExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.operand, false, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.resolveUnaryArithmeticOperation = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckUnaryArithmeticOperation(ast, context); - } - - return this.semanticInfoChain.numberTypeSymbol; - }; - - PullTypeResolver.prototype.resolvePostfixUnaryExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckPostfixUnaryExpression(ast, context); - } - - return this.semanticInfoChain.numberTypeSymbol; - }; - - PullTypeResolver.prototype.isAnyOrNumberOrEnum = function (type) { - return this.isAnyOrEquivalent(type) || type === this.semanticInfoChain.numberTypeSymbol || TypeScript.PullHelpers.symbolIsEnum(type); - }; - - PullTypeResolver.prototype.typeCheckUnaryArithmeticOperation = function (unaryExpression, context) { - this.setTypeChecked(unaryExpression, context); - - var nodeType = unaryExpression.kind(); - var expression = this.resolveAST(unaryExpression.operand, false, context); - - if (nodeType === 164 /* PlusExpression */ || nodeType == 165 /* NegateExpression */ || nodeType == 166 /* BitwiseNotExpression */) { - return; - } - - TypeScript.Debug.assert(nodeType === 168 /* PreIncrementExpression */ || nodeType === 169 /* PreDecrementExpression */); - - var operandType = expression.type; - if (!this.isAnyOrNumberOrEnum(operandType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_type_of_a_unary_arithmetic_operation_operand_must_be_of_type_any_number_or_an_enum_type)); - } - - if (!this.isReference(unaryExpression.operand, expression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer)); - } - }; - - PullTypeResolver.prototype.typeCheckPostfixUnaryExpression = function (unaryExpression, context) { - this.setTypeChecked(unaryExpression, context); - - var nodeType = unaryExpression.kind(); - var expression = this.resolveAST(unaryExpression.operand, false, context); - - TypeScript.Debug.assert(nodeType === 210 /* PostIncrementExpression */ || nodeType === 211 /* PostDecrementExpression */); - - var operandType = expression.type; - if (!this.isAnyOrNumberOrEnum(operandType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_type_of_a_unary_arithmetic_operation_operand_must_be_of_type_any_number_or_an_enum_type)); - } - - if (!this.isReference(unaryExpression.operand, expression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer)); - } - }; - - PullTypeResolver.prototype.resolveBinaryArithmeticExpression = function (binaryExpression, context) { - if (this.canTypeCheckAST(binaryExpression, context)) { - this.typeCheckBinaryArithmeticExpression(binaryExpression, context); - } - - return this.semanticInfoChain.numberTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckBinaryArithmeticExpression = function (binaryExpression, context) { - this.setTypeChecked(binaryExpression, context); - - var lhsSymbol = this.resolveAST(binaryExpression.left, false, context); - - var lhsType = lhsSymbol.type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - if (lhsType === this.semanticInfoChain.nullTypeSymbol || lhsType === this.semanticInfoChain.undefinedTypeSymbol) { - lhsType = rhsType; - } - - if (rhsType === this.semanticInfoChain.nullTypeSymbol || rhsType === this.semanticInfoChain.undefinedTypeSymbol) { - rhsType = lhsType; - } - - var lhsIsFit = this.isAnyOrNumberOrEnum(lhsType); - var rhsIsFit = this.isAnyOrNumberOrEnum(rhsType); - - if (!rhsIsFit) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.right, TypeScript.DiagnosticCode.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type)); - } - - if (!lhsIsFit) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type)); - } - - if (lhsIsFit && rhsIsFit) { - switch (binaryExpression.kind()) { - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - if (!this.isReference(binaryExpression.left, lhsSymbol)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_of_assignment_expression)); - } - - this.checkAssignability(binaryExpression.left, rhsType, lhsType, context); - } - } - }; - - PullTypeResolver.prototype.resolveTypeOfExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.stringTypeSymbol; - }; - - PullTypeResolver.prototype.resolveThrowStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveDeleteExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.resolveInstanceOfExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckInstanceOfExpression(ast, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckInstanceOfExpression = function (binaryExpression, context) { - this.setTypeChecked(binaryExpression, context); - - var lhsType = this.resolveAST(binaryExpression.left, false, context).type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - var enclosingSymbol = this.getEnclosingSymbolForAST(binaryExpression); - var isValidLHS = this.isAnyOrEquivalent(lhsType) || lhsType.isObject() || lhsType.isTypeParameter(); - var isValidRHS = this.isAnyOrEquivalent(rhsType) || this.typeIsAssignableToFunction(rhsType, binaryExpression, context); - - if (!isValidLHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter)); - } - - if (!isValidRHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.right, TypeScript.DiagnosticCode.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type)); - } - }; - - PullTypeResolver.prototype.resolveCommaExpression = function (commaExpression, context) { - if (this.canTypeCheckAST(commaExpression, context)) { - this.setTypeChecked(commaExpression, context); - - this.resolveAST(commaExpression.left, false, context); - } - - return this.resolveAST(commaExpression.right, false, context).type; - }; - - PullTypeResolver.prototype.resolveInExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckInExpression(ast, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckInExpression = function (binaryExpression, context) { - this.setTypeChecked(binaryExpression, context); - - var lhsType = this.resolveAST(binaryExpression.left, false, context).type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - var isValidLHS = this.isAnyOrEquivalent(lhsType.type) || lhsType.type === this.semanticInfoChain.stringTypeSymbol || lhsType.type === this.semanticInfoChain.numberTypeSymbol; - - var isValidRHS = this.isAnyOrEquivalent(rhsType) || rhsType.isObject() || rhsType.isTypeParameter(); - - if (!isValidLHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number)); - } - - if (!isValidRHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.right, TypeScript.DiagnosticCode.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter)); - } - }; - - PullTypeResolver.prototype.resolveForStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.variableDeclaration, false, context); - this.resolveAST(ast.initializer, false, context); - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.incrementor, false, context); - this.resolveAST(ast.statement, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveForInStatement = function (forInStatement, context) { - if (this.canTypeCheckAST(forInStatement, context)) { - this.typeCheckForInStatement(forInStatement, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckForInStatement = function (forInStatement, context) { - this.setTypeChecked(forInStatement, context); - - if (forInStatement.variableDeclaration) { - var declaration = forInStatement.variableDeclaration; - - if (declaration.declarators.nonSeparatorCount() === 1) { - var varDecl = declaration.declarators.nonSeparatorAt(0); - - if (varDecl.typeAnnotation) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(declaration, TypeScript.DiagnosticCode.Variable_declarations_of_a_for_statement_cannot_use_a_type_annotation)); - } - } - } else { - var varSym = this.resolveAST(forInStatement.left, false, context); - var isStringOrNumber = varSym.type === this.semanticInfoChain.stringTypeSymbol || this.isAnyOrEquivalent(varSym.type); - - if (!isStringOrNumber) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(forInStatement.left, TypeScript.DiagnosticCode.Variable_declarations_of_a_for_statement_must_be_of_types_string_or_any)); - } - } - - var rhsType = this.resolveAST(forInStatement.expression, false, context).type; - var isValidRHS = rhsType && (this.isAnyOrEquivalent(rhsType) || rhsType.isObject() || rhsType.isTypeParameter()); - - if (!isValidRHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(forInStatement.expression, TypeScript.DiagnosticCode.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter)); - } - - this.resolveAST(forInStatement.statement, false, context); - }; - - PullTypeResolver.prototype.resolveWhileStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckWhileStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckWhileStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.resolveDoStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckDoStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckDoStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.resolveIfStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckIfStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckIfStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.statement, false, context); - this.resolveAST(ast.elseClause, false, context); - }; - - PullTypeResolver.prototype.resolveElseClause = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckElseClause(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckElseClause = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.resolveBlock = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.statements, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveVariableStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.declaration, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveVariableDeclarationList = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.declarators, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveWithStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckWithStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckWithStatement = function (ast, context) { - this.setTypeChecked(ast, context); - var withStatement = ast; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(withStatement.condition, TypeScript.DiagnosticCode.All_symbols_within_a_with_block_will_be_resolved_to_any)); - }; - - PullTypeResolver.prototype.resolveTryStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckTryStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckTryStatement = function (ast, context) { - this.setTypeChecked(ast, context); - var tryStatement = ast; - - this.resolveAST(tryStatement.block, false, context); - this.resolveAST(tryStatement.catchClause, false, context); - this.resolveAST(tryStatement.finallyClause, false, context); - }; - - PullTypeResolver.prototype.resolveCatchClause = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckCatchClause(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckCatchClause = function (ast, context) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.block, false, context); - - var catchDecl = this.semanticInfoChain.getDeclForAST(ast); - this.validateVariableDeclarationGroups(catchDecl, context); - }; - - PullTypeResolver.prototype.resolveFinallyClause = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckFinallyClause(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckFinallyClause = function (ast, context) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.block, false, context); - }; - - PullTypeResolver.prototype.getEnclosingFunctionDeclaration = function (ast) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - - while (enclosingDecl) { - if (enclosingDecl.kind & 1032192 /* SomeFunction */) { - return enclosingDecl; - } - - enclosingDecl = enclosingDecl.getParentDecl(); - } - - return null; - }; - - PullTypeResolver.prototype.resolveReturnExpression = function (expression, enclosingFunction, context) { - if (enclosingFunction) { - enclosingFunction.setFlag(4194304 /* HasReturnStatement */); - } - - var isContextuallyTyped = false; - - if (enclosingFunction) { - var enclosingDeclAST = this.getASTForDecl(enclosingFunction); - var typeAnnotation = TypeScript.ASTHelpers.getType(enclosingDeclAST); - if (typeAnnotation) { - var returnTypeAnnotationSymbol = this.resolveTypeReference(typeAnnotation, context); - if (returnTypeAnnotationSymbol) { - isContextuallyTyped = true; - context.pushNewContextualType(returnTypeAnnotationSymbol); - } - } else { - var currentContextualType = context.getContextualType(); - if (currentContextualType && currentContextualType.isFunction()) { - var contextualSignatures = currentContextualType.kind == 33554432 /* ConstructorType */ ? currentContextualType.getConstructSignatures() : currentContextualType.getCallSignatures(); - var currentContextualTypeSignatureSymbol = contextualSignatures[0]; - - var currentContextualTypeReturnTypeSymbol = currentContextualTypeSignatureSymbol.returnType; - if (currentContextualTypeReturnTypeSymbol) { - isContextuallyTyped = true; - context.propagateContextualType(currentContextualTypeReturnTypeSymbol); - } - } - } - } - - var result = this.resolveAST(expression, isContextuallyTyped, context).type; - if (isContextuallyTyped) { - context.popAnyContextualType(); - } - - return result; - }; - - PullTypeResolver.prototype.typeCheckReturnExpression = function (expression, expressionType, enclosingFunction, context) { - if (enclosingFunction && enclosingFunction.kind === 32768 /* ConstructorMethod */) { - var classDecl = enclosingFunction.getParentDecl(); - if (classDecl) { - var classSymbol = classDecl.getSymbol(); - this.resolveDeclaredSymbol(classSymbol, context); - - var comparisonInfo = new TypeComparisonInfo(); - var isAssignable = this.sourceIsAssignableToTarget(expressionType, classSymbol.type, expression, context, comparisonInfo); - if (!isAssignable) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class)); - } - } - } - - if (enclosingFunction && enclosingFunction.kind === 524288 /* SetAccessor */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Setters_cannot_return_a_value)); - } - - if (enclosingFunction) { - var enclosingDeclAST = this.getASTForDecl(enclosingFunction); - var typeAnnotation = TypeScript.ASTHelpers.getType(enclosingDeclAST); - if (typeAnnotation || enclosingFunction.kind === 262144 /* GetAccessor */) { - var signatureSymbol = enclosingFunction.getSignatureSymbol(); - var sigReturnType = signatureSymbol.returnType; - - if (expressionType && sigReturnType) { - var comparisonInfo = new TypeComparisonInfo(); - var upperBound = null; - - this.resolveDeclaredSymbol(expressionType, context); - this.resolveDeclaredSymbol(sigReturnType, context); - - var isAssignable = this.sourceIsAssignableToTarget(expressionType, sigReturnType, expression, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(expression); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [expressionType.toString(enclosingSymbol), sigReturnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [expressionType.toString(enclosingSymbol), sigReturnType.toString(enclosingSymbol)])); - } - } - } - } - } - }; - - PullTypeResolver.prototype.resolveReturnStatement = function (returnAST, context) { - var enclosingFunction = this.getEnclosingFunctionDeclaration(returnAST); - if (enclosingFunction) { - enclosingFunction.setFlag(4194304 /* HasReturnStatement */); - } - - var returnType = this.getSymbolForAST(returnAST, context); - var canTypeCheckAST = this.canTypeCheckAST(returnAST, context); - if (!returnType || canTypeCheckAST) { - var returnExpr = returnAST.expression; - - var resolvedReturnType = returnExpr === null ? this.semanticInfoChain.voidTypeSymbol : this.resolveReturnExpression(returnExpr, enclosingFunction, context); - - if (!returnType) { - returnType = resolvedReturnType; - this.setSymbolForAST(returnAST, resolvedReturnType, context); - } - - if (returnExpr && canTypeCheckAST) { - this.setTypeChecked(returnExpr, context); - this.typeCheckReturnExpression(returnExpr, resolvedReturnType, enclosingFunction, context); - } - } - - return returnType; - }; - - PullTypeResolver.prototype.resolveSwitchStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckSwitchStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckSwitchStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - var expressionType = this.resolveAST(ast.expression, false, context).type; - - for (var i = 0, n = ast.switchClauses.childCount(); i < n; i++) { - var switchClause = ast.switchClauses.childAt(i); - if (switchClause.kind() === 233 /* CaseSwitchClause */) { - var caseSwitchClause = switchClause; - - var caseClauseExpressionType = this.resolveAST(caseSwitchClause.expression, false, context).type; - this.resolveAST(caseSwitchClause.statements, false, context); - - var comparisonInfo = new TypeComparisonInfo(); - if (!this.sourceIsAssignableToTarget(expressionType, caseClauseExpressionType, caseSwitchClause.expression, context, comparisonInfo) && !this.sourceIsAssignableToTarget(caseClauseExpressionType, expressionType, caseSwitchClause.expression, context, comparisonInfo)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(caseSwitchClause.expression); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(caseSwitchClause.expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [caseClauseExpressionType.toString(enclosingSymbol), expressionType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(caseSwitchClause.expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [caseClauseExpressionType.toString(enclosingSymbol), expressionType.toString(enclosingSymbol)])); - } - } - } else { - var defaultSwitchClause = switchClause; - this.resolveAST(defaultSwitchClause.statements, false, context); - } - } - }; - - PullTypeResolver.prototype.resolveLabeledStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckLabeledStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckLabeledStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - var labelIdentifier = ast.identifier.valueText(); - - var breakableLabels = this.getEnclosingLabels(ast, true, false); - - var matchingLabel = TypeScript.ArrayUtilities.firstOrDefault(breakableLabels, function (s) { - return s.identifier.valueText() === labelIdentifier; - }); - if (matchingLabel) { - context.postDiagnostic(this.semanticInfoChain.duplicateIdentifierDiagnosticFromAST(ast.identifier, labelIdentifier, matchingLabel)); - } - - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.labelIsOnContinuableConstruct = function (statement) { - switch (statement.kind()) { - case 160 /* LabeledStatement */: - return this.labelIsOnContinuableConstruct(statement.statement); - - case 158 /* WhileStatement */: - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 161 /* DoStatement */: - return true; - - default: - return false; - } - }; - - PullTypeResolver.prototype.resolveContinueStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckContinueStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.isIterationStatement = function (ast) { - switch (ast.kind()) { - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 158 /* WhileStatement */: - case 161 /* DoStatement */: - return true; - } - - return false; - }; - - PullTypeResolver.prototype.isAnyFunctionExpressionOrDeclaration = function (ast) { - switch (ast.kind()) { - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 129 /* FunctionDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 241 /* FunctionPropertyAssignment */: - case 137 /* ConstructorDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - return true; - } - - return false; - }; - - PullTypeResolver.prototype.inSwitchStatement = function (ast) { - while (ast) { - if (ast.kind() === 151 /* SwitchStatement */) { - return true; - } - - if (this.isAnyFunctionExpressionOrDeclaration(ast)) { - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inIterationStatement = function (ast, crossFunctions) { - while (ast) { - if (this.isIterationStatement(ast)) { - return true; - } - - if (!crossFunctions && this.isAnyFunctionExpressionOrDeclaration(ast)) { - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.getEnclosingLabels = function (ast, breakable, crossFunctions) { - var result = []; - - ast = ast.parent; - while (ast) { - if (ast.kind() === 160 /* LabeledStatement */) { - var labeledStatement = ast; - if (breakable) { - result.push(labeledStatement); - } else { - if (this.labelIsOnContinuableConstruct(labeledStatement.statement)) { - result.push(labeledStatement); - } - } - } - - if (!crossFunctions && this.isAnyFunctionExpressionOrDeclaration(ast)) { - break; - } - - ast = ast.parent; - } - - return result; - }; - - PullTypeResolver.prototype.typeCheckContinueStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - if (!this.inIterationStatement(ast, false)) { - if (this.inIterationStatement(ast, true)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.continue_statement_can_only_be_used_within_an_enclosing_iteration_statement)); - } - } else if (ast.identifier) { - var continuableLabels = this.getEnclosingLabels(ast, false, false); - - if (!TypeScript.ArrayUtilities.any(continuableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - var continuableLabels = this.getEnclosingLabels(ast, false, true); - - if (TypeScript.ArrayUtilities.any(continuableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_not_found)); - } - } - } - }; - - PullTypeResolver.prototype.resolveBreakStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckBreakStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckBreakStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - if (ast.identifier) { - var breakableLabels = this.getEnclosingLabels(ast, true, false); - - if (!TypeScript.ArrayUtilities.any(breakableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - var breakableLabels = this.getEnclosingLabels(ast, true, true); - if (TypeScript.ArrayUtilities.any(breakableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_not_found)); - } - } - } else if (!this.inIterationStatement(ast, false) && !this.inSwitchStatement(ast)) { - if (this.inIterationStatement(ast, true)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement)); - } - } - }; - - PullTypeResolver.prototype.resolveAST = function (ast, isContextuallyTyped, context) { - if (!ast) { - return; - } - - var symbol = this.getSymbolForAST(ast, context); - if (symbol && symbol.isResolved) { - this.typeCheckAST(ast, isContextuallyTyped, context); - return symbol; - } - - if (ast.isExpression() && !isTypesOnlyLocation(ast)) { - return this.resolveExpressionAST(ast, isContextuallyTyped, context); - } - - var nodeType = ast.kind(); - - switch (nodeType) { - case 124 /* ArrayType */: - case 126 /* GenericType */: - case 122 /* ObjectType */: - case 127 /* TypeQuery */: - case 125 /* ConstructorType */: - case 123 /* FunctionType */: - return this.resolveTypeReference(ast, context); - - case 1 /* List */: - return this.resolveList(ast, context); - - case 2 /* SeparatedList */: - return this.resolveSeparatedList(ast, context); - - case 120 /* SourceUnit */: - return this.resolveSourceUnit(ast, context); - - case 132 /* EnumDeclaration */: - return this.resolveEnumDeclaration(ast, context); - - case 130 /* ModuleDeclaration */: - return this.resolveModuleDeclaration(ast, context); - - case 128 /* InterfaceDeclaration */: - return this.resolveInterfaceDeclaration(ast, context); - - case 131 /* ClassDeclaration */: - return this.resolveClassDeclaration(ast, context); - - case 224 /* VariableDeclaration */: - return this.resolveVariableDeclarationList(ast, context); - - case 136 /* MemberVariableDeclaration */: - return this.resolveMemberVariableDeclaration(ast, context); - - case 225 /* VariableDeclarator */: - return this.resolveVariableDeclarator(ast, context); - - case 141 /* PropertySignature */: - return this.resolvePropertySignature(ast, context); - - case 227 /* ParameterList */: - return this.resolveParameterList(ast, context); - - case 242 /* Parameter */: - return this.resolveParameter(ast, context); - - case 243 /* EnumElement */: - return this.resolveEnumElement(ast, context); - - case 232 /* EqualsValueClause */: - return this.resolveEqualsValueClause(ast, isContextuallyTyped, context); - - case 238 /* TypeParameter */: - return this.resolveTypeParameterDeclaration(ast, context); - - case 239 /* Constraint */: - return this.resolveConstraint(ast, context); - - case 133 /* ImportDeclaration */: - return this.resolveImportDeclaration(ast, context); - - case 240 /* SimplePropertyAssignment */: - return this.resolveSimplePropertyAssignment(ast, isContextuallyTyped, context); - - case 241 /* FunctionPropertyAssignment */: - return this.resolveFunctionPropertyAssignment(ast, isContextuallyTyped, context); - - case 11 /* IdentifierName */: - TypeScript.Debug.assert(isTypesOnlyLocation(ast)); - return this.resolveTypeNameExpression(ast, context); - - case 121 /* QualifiedName */: - return this.resolveQualifiedName(ast, context); - - case 137 /* ConstructorDeclaration */: - return this.resolveConstructorDeclaration(ast, context); - - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - return this.resolveAccessorDeclaration(ast, context); - - case 138 /* IndexMemberDeclaration */: - return this.resolveIndexMemberDeclaration(ast, context); - - case 144 /* IndexSignature */: - return this.resolveIndexSignature(ast, context); - - case 135 /* MemberFunctionDeclaration */: - return this.resolveMemberFunctionDeclaration(ast, context); - - case 142 /* CallSignature */: - return this.resolveCallSignature(ast, context); - - case 143 /* ConstructSignature */: - return this.resolveConstructSignature(ast, context); - - case 145 /* MethodSignature */: - return this.resolveMethodSignature(ast, context); - - case 129 /* FunctionDeclaration */: - return this.resolveAnyFunctionDeclaration(ast, context); - - case 244 /* TypeAnnotation */: - return this.resolveTypeAnnotation(ast, context); - - case 134 /* ExportAssignment */: - return this.resolveExportAssignmentStatement(ast, context); - - case 157 /* ThrowStatement */: - return this.resolveThrowStatement(ast, context); - - case 149 /* ExpressionStatement */: - return this.resolveExpressionStatement(ast, context); - - case 154 /* ForStatement */: - return this.resolveForStatement(ast, context); - - case 155 /* ForInStatement */: - return this.resolveForInStatement(ast, context); - - case 158 /* WhileStatement */: - return this.resolveWhileStatement(ast, context); - - case 161 /* DoStatement */: - return this.resolveDoStatement(ast, context); - - case 147 /* IfStatement */: - return this.resolveIfStatement(ast, context); - - case 235 /* ElseClause */: - return this.resolveElseClause(ast, context); - - case 146 /* Block */: - return this.resolveBlock(ast, context); - - case 148 /* VariableStatement */: - return this.resolveVariableStatement(ast, context); - - case 163 /* WithStatement */: - return this.resolveWithStatement(ast, context); - - case 159 /* TryStatement */: - return this.resolveTryStatement(ast, context); - - case 236 /* CatchClause */: - return this.resolveCatchClause(ast, context); - - case 237 /* FinallyClause */: - return this.resolveFinallyClause(ast, context); - - case 150 /* ReturnStatement */: - return this.resolveReturnStatement(ast, context); - - case 151 /* SwitchStatement */: - return this.resolveSwitchStatement(ast, context); - - case 153 /* ContinueStatement */: - return this.resolveContinueStatement(ast, context); - - case 152 /* BreakStatement */: - return this.resolveBreakStatement(ast, context); - - case 160 /* LabeledStatement */: - return this.resolveLabeledStatement(ast, context); - } - - return this.semanticInfoChain.anyTypeSymbol; - }; - - PullTypeResolver.prototype.resolveExpressionAST = function (ast, isContextuallyOrInferentiallyTyped, context) { - var expressionSymbol = this.resolveExpressionWorker(ast, isContextuallyOrInferentiallyTyped, context); - - if (isContextuallyOrInferentiallyTyped && context.isInferentiallyTyping()) { - return this.alterPotentialGenericFunctionTypeToInstantiatedFunctionTypeForTypeArgumentInference(expressionSymbol, context); - } else { - return expressionSymbol; - } - }; - - PullTypeResolver.prototype.resolveExpressionWorker = function (ast, isContextuallyTyped, context) { - switch (ast.kind()) { - case 215 /* ObjectLiteralExpression */: - return this.resolveObjectLiteralExpression(ast, isContextuallyTyped, context); - - case 11 /* IdentifierName */: - return this.resolveNameExpression(ast, context); - - case 212 /* MemberAccessExpression */: - return this.resolveMemberAccessExpression(ast, context); - - case 222 /* FunctionExpression */: - return this.resolveFunctionExpression(ast, isContextuallyTyped, context); - - case 219 /* SimpleArrowFunctionExpression */: - return this.resolveSimpleArrowFunctionExpression(ast, isContextuallyTyped, context); - - case 218 /* ParenthesizedArrowFunctionExpression */: - return this.resolveParenthesizedArrowFunctionExpression(ast, isContextuallyTyped, context); - - case 214 /* ArrayLiteralExpression */: - return this.resolveArrayLiteralExpression(ast, isContextuallyTyped, context); - - case 35 /* ThisKeyword */: - return this.resolveThisExpression(ast, context); - - case 50 /* SuperKeyword */: - return this.resolveSuperExpression(ast, context); - - case 213 /* InvocationExpression */: - return this.resolveInvocationExpression(ast, context); - - case 216 /* ObjectCreationExpression */: - return this.resolveObjectCreationExpression(ast, context); - - case 220 /* CastExpression */: - return this.resolveCastExpression(ast, context); - - case 13 /* NumericLiteral */: - return this.semanticInfoChain.numberTypeSymbol; - - case 14 /* StringLiteral */: - return this.semanticInfoChain.stringTypeSymbol; - - case 32 /* NullKeyword */: - return this.semanticInfoChain.nullTypeSymbol; - - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - return this.semanticInfoChain.booleanTypeSymbol; - - case 172 /* VoidExpression */: - return this.resolveVoidExpression(ast, context); - - case 174 /* AssignmentExpression */: - return this.resolveAssignmentExpression(ast, context); - - case 167 /* LogicalNotExpression */: - return this.resolveLogicalNotExpression(ast, context); - - case 193 /* NotEqualsWithTypeConversionExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 196 /* LessThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 197 /* GreaterThanExpression */: - return this.resolveLogicalOperation(ast, context); - - case 208 /* AddExpression */: - case 175 /* AddAssignmentExpression */: - return this.resolveBinaryAdditionOperation(ast, context); - - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - case 166 /* BitwiseNotExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - return this.resolveUnaryArithmeticOperation(ast, context); - - case 210 /* PostIncrementExpression */: - case 211 /* PostDecrementExpression */: - return this.resolvePostfixUnaryExpression(ast, context); - - case 209 /* SubtractExpression */: - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 189 /* BitwiseOrExpression */: - case 191 /* BitwiseAndExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - return this.resolveBinaryArithmeticExpression(ast, context); - - case 221 /* ElementAccessExpression */: - return this.resolveElementAccessExpression(ast, context); - - case 187 /* LogicalOrExpression */: - return this.resolveLogicalOrExpression(ast, isContextuallyTyped, context); - - case 188 /* LogicalAndExpression */: - return this.resolveLogicalAndExpression(ast, context); - - case 171 /* TypeOfExpression */: - return this.resolveTypeOfExpression(ast, context); - - case 170 /* DeleteExpression */: - return this.resolveDeleteExpression(ast, context); - - case 186 /* ConditionalExpression */: - return this.resolveConditionalExpression(ast, isContextuallyTyped, context); - - case 12 /* RegularExpressionLiteral */: - return this.resolveRegularExpressionLiteral(); - - case 217 /* ParenthesizedExpression */: - return this.resolveParenthesizedExpression(ast, context); - - case 200 /* InstanceOfExpression */: - return this.resolveInstanceOfExpression(ast, context); - - case 173 /* CommaExpression */: - return this.resolveCommaExpression(ast, context); - - case 201 /* InExpression */: - return this.resolveInExpression(ast, context); - - case 223 /* OmittedExpression */: - return this.semanticInfoChain.undefinedTypeSymbol; - } - - TypeScript.Debug.fail("resolveExpressionASTWorker: Missing expression kind: " + TypeScript.SyntaxKind[ast.kind()]); - }; - - PullTypeResolver.prototype.typeCheckAST = function (ast, isContextuallyTyped, context) { - if (!this.canTypeCheckAST(ast, context)) { - return; - } - - var nodeType = ast.kind(); - switch (nodeType) { - case 120 /* SourceUnit */: - this.typeCheckSourceUnit(ast, context); - return; - - case 132 /* EnumDeclaration */: - this.typeCheckEnumDeclaration(ast, context); - return; - - case 130 /* ModuleDeclaration */: - this.typeCheckModuleDeclaration(ast, context); - return; - - case 128 /* InterfaceDeclaration */: - this.typeCheckInterfaceDeclaration(ast, context); - return; - - case 131 /* ClassDeclaration */: - this.typeCheckClassDeclaration(ast, context); - return; - - case 243 /* EnumElement */: - this.typeCheckEnumElement(ast, context); - return; - - case 136 /* MemberVariableDeclaration */: - this.typeCheckMemberVariableDeclaration(ast, context); - return; - - case 225 /* VariableDeclarator */: - this.typeCheckVariableDeclarator(ast, context); - return; - - case 141 /* PropertySignature */: - this.typeCheckPropertySignature(ast, context); - return; - - case 242 /* Parameter */: - this.typeCheckParameter(ast, context); - return; - - case 133 /* ImportDeclaration */: - this.typeCheckImportDeclaration(ast, context); - return; - - case 215 /* ObjectLiteralExpression */: - this.resolveObjectLiteralExpression(ast, isContextuallyTyped, context); - return; - - case 241 /* FunctionPropertyAssignment */: - this.typeCheckFunctionPropertyAssignment(ast, isContextuallyTyped, context); - return; - - case 11 /* IdentifierName */: - if (isTypesOnlyLocation(ast)) { - this.resolveTypeNameExpression(ast, context); - } else { - this.resolveNameExpression(ast, context); - } - return; - - case 212 /* MemberAccessExpression */: - this.resolveMemberAccessExpression(ast, context); - return; - - case 121 /* QualifiedName */: - this.resolveQualifiedName(ast, context); - return; - - case 222 /* FunctionExpression */: - this.typeCheckFunctionExpression(ast, isContextuallyTyped, context); - return; - - case 137 /* ConstructorDeclaration */: - this.typeCheckConstructorDeclaration(ast, context); - return; - - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - this.typeCheckAccessorDeclaration(ast, context); - return; - - case 135 /* MemberFunctionDeclaration */: - this.typeCheckMemberFunctionDeclaration(ast, context); - return; - - case 145 /* MethodSignature */: - this.typeCheckMethodSignature(ast, context); - return; - - case 144 /* IndexSignature */: - this.typeCheckIndexSignature(ast, context); - break; - - case 142 /* CallSignature */: - this.typeCheckCallSignature(ast, context); - return; - - case 143 /* ConstructSignature */: - this.typeCheckConstructSignature(ast, context); - return; - - case 129 /* FunctionDeclaration */: { - var funcDecl = ast; - this.typeCheckAnyFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.identifier, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - return; - } - - case 219 /* SimpleArrowFunctionExpression */: - this.typeCheckSimpleArrowFunctionExpression(ast, isContextuallyTyped, context); - return; - - case 218 /* ParenthesizedArrowFunctionExpression */: - this.typeCheckParenthesizedArrowFunctionExpression(ast, isContextuallyTyped, context); - return; - - case 214 /* ArrayLiteralExpression */: - this.resolveArrayLiteralExpression(ast, isContextuallyTyped, context); - return; - - case 213 /* InvocationExpression */: - this.typeCheckInvocationExpression(ast, context); - return; - - case 216 /* ObjectCreationExpression */: - this.typeCheckObjectCreationExpression(ast, context); - return; - - case 150 /* ReturnStatement */: - this.resolveReturnStatement(ast, context); - return; - - default: - TypeScript.Debug.assert(false, "Failure nodeType: " + TypeScript.SyntaxKind[ast.kind()] + ". Implement typeCheck when symbol is set for the ast as part of resolution."); - } - }; - - PullTypeResolver.prototype.processPostTypeCheckWorkItems = function (context) { - while (this.postTypeCheckWorkitems.length) { - var ast = this.postTypeCheckWorkitems.pop(); - this.postTypeCheck(ast, context); - } - }; - - PullTypeResolver.prototype.postTypeCheck = function (ast, context) { - var nodeType = ast.kind(); - - switch (nodeType) { - case 242 /* Parameter */: - case 225 /* VariableDeclarator */: - this.postTypeCheckVariableDeclaratorOrParameter(ast, context); - return; - - case 131 /* ClassDeclaration */: - this.postTypeCheckClassDeclaration(ast, context); - return; - - case 129 /* FunctionDeclaration */: - this.postTypeCheckFunctionDeclaration(ast, context); - return; - - case 130 /* ModuleDeclaration */: - this.postTypeCheckModuleDeclaration(ast, context); - return; - - case 132 /* EnumDeclaration */: - this.postTypeCheckEnumDeclaration(ast, context); - return; - - case 133 /* ImportDeclaration */: - this.postTypeCheckImportDeclaration(ast, context); - return; - - case 11 /* IdentifierName */: - this.postTypeCheckNameExpression(ast, context); - return; - - default: - TypeScript.Debug.assert(false, "Implement postTypeCheck clause to handle the postTypeCheck work, nodeType: " + TypeScript.SyntaxKind[ast.kind()]); - } - }; - - PullTypeResolver.prototype.resolveRegularExpressionLiteral = function () { - if (this.cachedRegExpInterfaceType()) { - return this.cachedRegExpInterfaceType(); - } else { - return this.semanticInfoChain.anyTypeSymbol; - } - }; - - PullTypeResolver.prototype.postTypeCheckNameExpression = function (nameAST, context) { - this.checkThisCaptureVariableCollides(nameAST, false, context); - }; - - PullTypeResolver.prototype.typeCheckNameExpression = function (nameAST, context) { - this.setTypeChecked(nameAST, context); - this.checkNameForCompilerGeneratedDeclarationCollision(nameAST, false, nameAST, context); - }; - - PullTypeResolver.prototype.resolveNameExpression = function (nameAST, context) { - var nameSymbol = this.getSymbolForAST(nameAST, context); - var foundCached = nameSymbol !== null; - - if (!foundCached || this.canTypeCheckAST(nameAST, context)) { - if (this.canTypeCheckAST(nameAST, context)) { - this.typeCheckNameExpression(nameAST, context); - } - nameSymbol = this.computeNameExpression(nameAST, context); - } - - this.resolveDeclaredSymbol(nameSymbol, context); - - if (nameSymbol && (nameSymbol.type !== this.semanticInfoChain.anyTypeSymbol || nameSymbol.anyDeclHasFlag(16777216 /* IsAnnotatedWithAny */ | 1 /* Exported */))) { - this.setSymbolForAST(nameAST, nameSymbol, context); - } - - return nameSymbol; - }; - - PullTypeResolver.prototype.isInEnumDecl = function (decl) { - if (decl.kind & 64 /* Enum */) { - return true; - } - - var declPath = decl.getParentPath(); - - var disallowedKinds = 164 /* SomeContainer */ | 58728795 /* SomeType */; - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - - if (decl.kind & 64 /* Enum */) { - return true; - } - - if (decl.kind & disallowedKinds) { - return false; - } - } - return false; - }; - - PullTypeResolver.prototype.getSomeInnermostFunctionScopeDecl = function (declPath) { - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - if (decl.kind & 1032192 /* SomeFunction */) { - return decl; - } - } - - return null; - }; - - PullTypeResolver.prototype.isFromFunctionScope = function (nameSymbol, functionScopeDecl) { - var _this = this; - return TypeScript.ArrayUtilities.any(nameSymbol.getDeclarations(), function (nameSymbolDecl) { - return _this.getSomeInnermostFunctionScopeDecl(nameSymbolDecl.getParentPath()) === functionScopeDecl; - }); - }; - - PullTypeResolver.prototype.findConstructorDeclOfEnclosingType = function (decl) { - var current = decl; - while (current) { - if (TypeScript.hasFlag(current.kind, 4096 /* Property */)) { - var parentDecl = current.getParentDecl(); - if (TypeScript.hasFlag(parentDecl.kind, 8 /* Class */)) { - return TypeScript.ArrayUtilities.lastOrDefault(parentDecl.getChildDecls(), function (decl) { - return TypeScript.hasFlag(decl.kind, 32768 /* ConstructorMethod */); - }); - } - } - - if (TypeScript.hasFlag(current.kind, 164 /* SomeContainer */)) { - return null; - } - - current = current.getParentDecl(); - } - return null; - }; - - PullTypeResolver.prototype.checkNameAsPartOfInitializerExpressionForInstanceMemberVariable = function (nameAST, nameSymbol, context) { - var id = nameAST.valueText(); - if (id.length === 0) { - return false; - } - - var memberVariableDeclarationAST = TypeScript.ASTHelpers.getEnclosingMemberVariableDeclaration(nameAST); - if (memberVariableDeclarationAST) { - var memberVariableDecl = this.semanticInfoChain.getDeclForAST(memberVariableDeclarationAST); - if (!TypeScript.hasFlag(memberVariableDecl.flags, 16 /* Static */)) { - var constructorDecl = this.findConstructorDeclOfEnclosingType(memberVariableDecl); - - if (constructorDecl) { - var childDecls = constructorDecl.searchChildDecls(id, 68147712 /* SomeValue */); - if (childDecls.length) { - if (TypeScript.PullHelpers.isSymbolDeclaredInScopeChain(nameSymbol, constructorDecl.getSymbol().getContainer())) { - var memberVariableSymbol = memberVariableDecl.getSymbol(); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, [memberVariableSymbol.getScopedName(constructorDecl.getSymbol()), nameAST.text()])); - return true; - } - } - } - } - } - return false; - }; - - PullTypeResolver.prototype.computeNameExpression = function (nameAST, context) { - var id = nameAST.valueText(); - if (id.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var nameSymbol = null; - var enclosingDecl = this.getEnclosingDeclForAST(nameAST); - - if (TypeScript.hasFlag(enclosingDecl.flags, 8388608 /* PropertyParameter */)) { - var valueDecl = enclosingDecl.getValueDecl(); - if (valueDecl && TypeScript.hasFlag(valueDecl.kind, 2048 /* Parameter */)) { - enclosingDecl = valueDecl; - } - } - - var isDeclarationASTOrDeclarationNameAST = TypeScript.ASTHelpers.isDeclarationASTOrDeclarationNameAST(nameAST); - if (isDeclarationASTOrDeclarationNameAST) { - nameSymbol = this.semanticInfoChain.getDeclForAST(nameAST.parent).getSymbol(); - } - - var declPath = enclosingDecl.getParentPath(); - - if (!nameSymbol) { - var searchKind = 68147712 /* SomeValue */; - - if (!this.isInEnumDecl(enclosingDecl)) { - searchKind = searchKind & ~(67108864 /* EnumMember */); - } - - var nameSymbol = this.getSymbolFromDeclPath(id, declPath, searchKind); - } - - if (id === "arguments") { - var functionScopeDecl = this.getSomeInnermostFunctionScopeDecl(declPath); - if (functionScopeDecl) { - if (!nameSymbol || !this.isFromFunctionScope(nameSymbol, functionScopeDecl)) { - nameSymbol = this.cachedFunctionArgumentsSymbol(); - this.resolveDeclaredSymbol(this.cachedIArgumentsInterfaceType(), context); - } - } - } - - var aliasSymbol = null; - if (nameSymbol && nameSymbol.isAlias() && !isDeclarationASTOrDeclarationNameAST) { - aliasSymbol = nameSymbol; - if (!this.inTypeQuery(nameAST)) { - aliasSymbol.setIsUsedAsValue(); - } - - this.resolveDeclaredSymbol(nameSymbol, context); - - this.resolveDeclaredSymbol(aliasSymbol.assignedValue(), context); - this.resolveDeclaredSymbol(aliasSymbol.assignedContainer(), context); - - nameSymbol = aliasSymbol.getExportAssignedValueSymbol(); - if (!nameSymbol) { - aliasSymbol = null; - } - } - - if (!nameSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Could_not_find_symbol_0, [nameAST.text()])); - return this.getNewErrorTypeSymbol(id); - } else if (this.checkNameAsPartOfInitializerExpressionForInstanceMemberVariable(nameAST, nameSymbol, context)) { - return this.getNewErrorTypeSymbol(id); - } - - var nameDeclaration = nameSymbol.getDeclarations()[0]; - var nameParentDecl = nameDeclaration.getParentDecl(); - if (nameParentDecl && (nameParentDecl.kind & 1032192 /* SomeFunction */) && (nameParentDecl.flags & 33554432 /* HasDefaultArgs */)) { - var enclosingFunctionAST = this.semanticInfoChain.getASTForDecl(nameParentDecl); - var currentParameterIndex = this.getCurrentParameterIndexForFunction(nameAST, enclosingFunctionAST); - - var parameterList = TypeScript.ASTHelpers.getParameterList(enclosingFunctionAST); - - if (currentParameterIndex >= 0) { - var matchingParameter; - if (parameterList) { - for (var i = 0; i <= currentParameterIndex; i++) { - var candidateParameter = parameterList.parameters.nonSeparatorAt(i); - if (candidateParameter && candidateParameter.identifier.valueText() === id) { - matchingParameter = candidateParameter; - break; - } - } - } - - if (!matchingParameter) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, [parameterList.parameters.nonSeparatorAt(currentParameterIndex).identifier.text(), nameAST.text()])); - return this.getNewErrorTypeSymbol(id); - } else if (matchingParameter === TypeScript.ASTHelpers.getEnclosingParameterForInitializer(nameAST)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Parameter_0_cannot_be_referenced_in_its_initializer, [parameterList.parameters.nonSeparatorAt(currentParameterIndex).identifier.text()])); - return this.getNewErrorTypeSymbol(id); - } - } - } - - if (aliasSymbol) { - this.semanticInfoChain.setAliasSymbolForAST(nameAST, aliasSymbol); - } - - return nameSymbol; - }; - - PullTypeResolver.prototype.getCurrentParameterIndexForFunction = function (parameter, funcDecl) { - var parameterList = TypeScript.ASTHelpers.getParameterList(funcDecl); - if (parameterList) { - while (parameter && parameter.parent) { - if (parameter.parent.parent === parameterList) { - return parameterList.parameters.nonSeparatorIndexOf(parameter); - } - - parameter = parameter.parent; - } - } - - return -1; - }; - - PullTypeResolver.prototype.resolveMemberAccessExpression = function (dottedNameAST, context) { - return this.resolveDottedNameExpression(dottedNameAST, dottedNameAST.expression, dottedNameAST.name, context); - }; - - PullTypeResolver.prototype.resolveDottedNameExpression = function (dottedNameAST, expression, name, context) { - var symbol = this.getSymbolForAST(dottedNameAST, context); - var foundCached = symbol !== null; - - if (!foundCached || this.canTypeCheckAST(dottedNameAST, context)) { - var canTypeCheckDottedNameAST = this.canTypeCheckAST(dottedNameAST, context); - if (canTypeCheckDottedNameAST) { - this.setTypeChecked(dottedNameAST, context); - } - - symbol = this.computeDottedNameExpression(expression, name, context, canTypeCheckDottedNameAST); - } - - this.resolveDeclaredSymbol(symbol, context); - - if (symbol && (symbol.type !== this.semanticInfoChain.anyTypeSymbol || symbol.anyDeclHasFlag(16777216 /* IsAnnotatedWithAny */ | 1 /* Exported */))) { - this.setSymbolForAST(dottedNameAST, symbol, context); - this.setSymbolForAST(name, symbol, context); - } - - return symbol; - }; - - PullTypeResolver.prototype.computeDottedNameExpression = function (expression, name, context, checkSuperPrivateAndStaticAccess) { - var rhsName = name.valueText(); - if (rhsName.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var lhs = this.resolveAST(expression, false, context); - return this.computeDottedNameExpressionFromLHS(lhs, expression, name, context, checkSuperPrivateAndStaticAccess); - }; - - PullTypeResolver.prototype.computeDottedNameExpressionFromLHS = function (lhs, expression, name, context, checkSuperPrivateAndStaticAccess) { - var rhsName = name.valueText(); - if (rhsName.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var lhsType = lhs.type; - - if (lhs.isAlias()) { - var lhsAlias = lhs; - if (!this.inTypeQuery(expression)) { - lhsAlias.setIsUsedAsValue(); - } - lhsType = lhsAlias.getExportAssignedTypeSymbol(); - } - - if (lhsType.isAlias()) { - lhsType = lhsType.getExportAssignedTypeSymbol(); - } - - if (!lhsType) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode.Could_not_find_enclosing_symbol_for_dotted_name_0, [name.text()])); - return this.getNewErrorTypeSymbol(); - } - - if (!lhsType.isResolved) { - var potentiallySpecializedType = this.resolveDeclaredSymbol(lhsType, context); - - if (potentiallySpecializedType !== lhsType) { - if (!lhs.isType()) { - context.setTypeInContext(lhs, potentiallySpecializedType); - } - - lhsType = potentiallySpecializedType; - } - } - - if (lhsType.isContainer() && !lhsType.isAlias() && !lhsType.isEnum()) { - var instanceSymbol = lhsType.getInstanceSymbol(); - - if (instanceSymbol) { - lhsType = instanceSymbol.type; - } - } - - var originalLhsTypeForErrorReporting = lhsType; - - lhsType = this.getApparentType(lhsType).widenedType(this, expression, context); - - if (this.isAnyOrEquivalent(lhsType)) { - return lhsType; - } - - var nameSymbol = this._getNamedPropertySymbolOfAugmentedType(rhsName, lhsType); - - if (!nameSymbol) { - if (lhsType.kind === 32 /* DynamicModule */) { - var container = lhsType; - var associatedInstance = container.getInstanceSymbol(); - - if (associatedInstance) { - var instanceType = associatedInstance.type; - - nameSymbol = this.getNamedPropertySymbol(rhsName, 68147712 /* SomeValue */, instanceType); - } - } else { - var associatedType = lhsType.getAssociatedContainerType(); - - if (associatedType && !associatedType.isClass()) { - nameSymbol = this.getNamedPropertySymbol(rhsName, 68147712 /* SomeValue */, associatedType); - } - } - - if (!nameSymbol) { - var enclosingDecl = this.getEnclosingDeclForAST(expression); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode.The_property_0_does_not_exist_on_value_of_type_1, [name.text(), originalLhsTypeForErrorReporting.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - return this.getNewErrorTypeSymbol(rhsName); - } - } - - if (checkSuperPrivateAndStaticAccess) { - this.checkForSuperMemberAccess(expression, name, nameSymbol, context) || this.checkForPrivateMemberAccess(name, lhsType, nameSymbol, context); - } - - return nameSymbol; - }; - - PullTypeResolver.prototype.resolveTypeNameExpression = function (nameAST, context) { - var typeNameSymbol = this.getSymbolForAST(nameAST, context); - - if (!typeNameSymbol || !typeNameSymbol.isType() || this.canTypeCheckAST(nameAST, context)) { - if (this.canTypeCheckAST(nameAST, context)) { - this.setTypeChecked(nameAST, context); - } - typeNameSymbol = this.computeTypeNameExpression(nameAST, context); - this.setSymbolForAST(nameAST, typeNameSymbol, context); - } - - this.resolveDeclaredSymbol(typeNameSymbol, context); - - return typeNameSymbol; - }; - - PullTypeResolver.prototype.computeTypeNameExpression = function (nameAST, context) { - var id = nameAST.valueText(); - if (id.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var enclosingDecl = this.getEnclosingDeclForAST(nameAST); - - var declPath = enclosingDecl.getParentPath(); - - var onLeftOfDot = this.isLeftSideOfQualifiedName(nameAST); - - var kindToCheckFirst = onLeftOfDot ? 164 /* SomeContainer */ : 58728795 /* SomeType */; - var kindToCheckSecond = onLeftOfDot ? 58728795 /* SomeType */ : 164 /* SomeContainer */; - - var typeNameSymbol = this.getSymbolFromDeclPath(id, declPath, kindToCheckFirst); - - if (!typeNameSymbol) { - typeNameSymbol = this.getSymbolFromDeclPath(id, declPath, kindToCheckSecond); - } - - if (!typeNameSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Could_not_find_symbol_0, [nameAST.text()])); - return this.getNewErrorTypeSymbol(id); - } - - var typeNameSymbolAlias = null; - if (typeNameSymbol.isAlias()) { - typeNameSymbolAlias = typeNameSymbol; - this.resolveDeclaredSymbol(typeNameSymbol, context); - - var aliasedType = typeNameSymbolAlias.getExportAssignedTypeSymbol(); - - this.resolveDeclaredSymbol(aliasedType, context); - } - - if (typeNameSymbol.isTypeParameter()) { - if (this.isInStaticMemberContext(enclosingDecl)) { - var parentDecl = typeNameSymbol.getDeclarations()[0].getParentDecl(); - - if (parentDecl.kind === 8 /* Class */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Static_members_cannot_reference_class_type_parameters)); - return this.getNewErrorTypeSymbol(); - } - } - } - - if (!typeNameSymbol.isGeneric() && (typeNameSymbol.isClass() || typeNameSymbol.isInterface())) { - typeNameSymbol = TypeScript.PullTypeReferenceSymbol.createTypeReference(typeNameSymbol); - } - - return typeNameSymbol; - }; - - PullTypeResolver.prototype.isInStaticMemberContext = function (decl) { - while (decl) { - if (TypeScript.hasFlag(decl.kind, 1032192 /* SomeFunction */ | 4096 /* Property */) && TypeScript.hasFlag(decl.flags, 16 /* Static */)) { - return true; - } - - if (TypeScript.hasFlag(decl.kind, 164 /* SomeContainer */)) { - return false; - } - - decl = decl.getParentDecl(); - } - - return false; - }; - - PullTypeResolver.prototype.isLeftSideOfQualifiedName = function (ast) { - return ast && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.left === ast; - }; - - PullTypeResolver.prototype.resolveGenericTypeReference = function (genericTypeAST, context) { - var _this = this; - var genericTypeSymbol = this.resolveAST(genericTypeAST.name, false, context).type; - - if (genericTypeSymbol.isError()) { - return genericTypeSymbol; - } - - if (!genericTypeSymbol.inResolution && !genericTypeSymbol.isResolved) { - this.resolveDeclaredSymbol(genericTypeSymbol, context); - } - - if (genericTypeSymbol.isAlias()) { - if (this.inClassExtendsHeritageClause(genericTypeAST) && !this.inTypeArgumentList(genericTypeAST)) { - genericTypeSymbol.setIsUsedAsValue(); - } - genericTypeSymbol = genericTypeSymbol.getExportAssignedTypeSymbol(); - } - - var typeParameters = genericTypeSymbol.getTypeParameters(); - if (typeParameters.length === 0) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(genericTypeAST, TypeScript.DiagnosticCode.Type_0_does_not_have_type_parameters, [genericTypeSymbol.toString()])); - return this.getNewErrorTypeSymbol(); - } - - var typeArgs = []; - - if (genericTypeAST.typeArgumentList && genericTypeAST.typeArgumentList.typeArguments.nonSeparatorCount()) { - for (var i = 0; i < genericTypeAST.typeArgumentList.typeArguments.nonSeparatorCount(); i++) { - typeArgs[i] = this.resolveTypeReference(genericTypeAST.typeArgumentList.typeArguments.nonSeparatorAt(i), context); - - if (typeArgs[i].isError()) { - typeArgs[i] = this.semanticInfoChain.anyTypeSymbol; - } - } - } - - if (typeArgs.length && typeArgs.length !== typeParameters.length) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(genericTypeAST, TypeScript.DiagnosticCode.Generic_type_0_requires_1_type_argument_s, [genericTypeSymbol.toString(), genericTypeSymbol.getTypeParameters().length])); - return this.getNewErrorTypeSymbol(); - } - - if (!genericTypeSymbol.isResolved) { - var typeDecls = genericTypeSymbol.getDeclarations(); - var childDecls = null; - - for (var i = 0; i < typeDecls.length; i++) { - childDecls = typeDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - } - - var specializedSymbol = this.createInstantiatedType(genericTypeSymbol, typeArgs); - - var upperBound = null; - - typeParameters = specializedSymbol.getTypeParameters(); - - var typeConstraintSubstitutionMap = []; - - var instantiatedSubstitutionMap = specializedSymbol.getTypeParameterArgumentMap(); - - for (var i = 0; i < typeParameters.length; i++) { - typeConstraintSubstitutionMap[typeParameters[i].pullSymbolID] = typeParameters[i]; - } - - for (var id in instantiatedSubstitutionMap) { - typeConstraintSubstitutionMap[id] = instantiatedSubstitutionMap[id]; - } - - for (var iArg = 0; (iArg < typeArgs.length) && (iArg < typeParameters.length); iArg++) { - var typeArg = typeArgs[iArg]; - var typeParameter = typeParameters[iArg]; - var typeConstraint = typeParameter.getConstraint(); - - typeConstraintSubstitutionMap[typeParameter.pullSymbolID] = typeArg; - - if (typeConstraint) { - if (typeConstraint.isTypeParameter()) { - for (var j = 0; j < typeParameters.length && j < typeArgs.length; j++) { - if (typeParameters[j] === typeConstraint) { - typeConstraint = typeArgs[j]; - } - } - } else if (typeConstraint.isGeneric()) { - typeConstraint = this.instantiateType(typeConstraint, typeConstraintSubstitutionMap); - } - - if (typeArg.isTypeParameter()) { - upperBound = typeArg.getConstraint(); - - if (upperBound) { - typeArg = upperBound; - } - } - - if (typeArg.inResolution || (typeArg.isTypeReference() && typeArg.referencedTypeSymbol.inResolution)) { - return specializedSymbol; - } - - if (context.canTypeCheckAST(genericTypeAST)) { - this.typeCheckCallBacks.push(function (context) { - if (!_this.sourceIsAssignableToTarget(typeArg, typeConstraint, genericTypeAST, context)) { - var enclosingSymbol = _this.getEnclosingSymbolForAST(genericTypeAST); - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(genericTypeAST, TypeScript.DiagnosticCode.Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2, [typeArg.toString(enclosingSymbol, true), typeConstraint.toString(enclosingSymbol, true), typeParameter.toString(enclosingSymbol, true)])); - } - }); - } - } - } - - return specializedSymbol; - }; - - PullTypeResolver.prototype.resolveQualifiedName = function (dottedNameAST, context) { - if (this.inTypeQuery(dottedNameAST)) { - return this.resolveDottedNameExpression(dottedNameAST, dottedNameAST.left, dottedNameAST.right, context).type; - } - - var symbol = this.getSymbolForAST(dottedNameAST, context); - if (!symbol || this.canTypeCheckAST(dottedNameAST, context)) { - var canTypeCheck = this.canTypeCheckAST(dottedNameAST, context); - if (canTypeCheck) { - this.setTypeChecked(dottedNameAST, context); - } - - symbol = this.computeQualifiedName(dottedNameAST, context); - this.setSymbolForAST(dottedNameAST, symbol, context); - } - - this.resolveDeclaredSymbol(symbol, context); - - return symbol; - }; - - PullTypeResolver.prototype.isLastNameOfModuleNameModuleReference = function (ast) { - return ast.kind() === 11 /* IdentifierName */ && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.right === ast && ast.parent.parent && ast.parent.parent.kind() === 246 /* ModuleNameModuleReference */; - }; - - PullTypeResolver.prototype.computeQualifiedName = function (dottedNameAST, context) { - var rhsName = dottedNameAST.right.valueText(); - if (rhsName.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var enclosingDecl = this.getEnclosingDeclForAST(dottedNameAST); - var lhs = this.resolveAST(dottedNameAST.left, false, context); - - var lhsType = lhs.isAlias() ? lhs.getExportAssignedContainerSymbol() : lhs.type; - - if (this.inClassExtendsHeritageClause(dottedNameAST) && !this.inTypeArgumentList(dottedNameAST)) { - if (lhs.isAlias()) { - lhs.setIsUsedAsValue(); - } - } - - if (!lhsType) { - return this.getNewErrorTypeSymbol(); - } - - if (this.isAnyOrEquivalent(lhsType)) { - return lhsType; - } - - var onLeftOfDot = this.isLeftSideOfQualifiedName(dottedNameAST); - var isNameOfModule = dottedNameAST.parent.kind() === 130 /* ModuleDeclaration */ && dottedNameAST.parent.name === dottedNameAST; - - var memberKind = (onLeftOfDot || isNameOfModule) ? 164 /* SomeContainer */ : 58728795 /* SomeType */; - - var childTypeSymbol = this.getNamedPropertySymbol(rhsName, memberKind, lhsType); - - if (!childTypeSymbol && !isNameOfModule && this.isLastNameOfModuleNameModuleReference(dottedNameAST.right)) { - childTypeSymbol = this.getNamedPropertySymbol(rhsName, 68147712 /* SomeValue */, lhsType); - } - - if (!childTypeSymbol && lhsType.isContainer()) { - var exportedContainer = lhsType.getExportAssignedContainerSymbol(); - - if (exportedContainer) { - childTypeSymbol = this.getNamedPropertySymbol(rhsName, memberKind, exportedContainer); - } - } - - if (!childTypeSymbol && enclosingDecl) { - var parentDecl = enclosingDecl; - - while (parentDecl) { - if (parentDecl.kind & 164 /* SomeContainer */) { - break; - } - - parentDecl = parentDecl.getParentDecl(); - } - - if (parentDecl) { - var enclosingSymbolType = parentDecl.getSymbol().type; - - if (enclosingSymbolType === lhsType) { - childTypeSymbol = this.getNamedPropertySymbol(rhsName, memberKind, lhsType); - } - } - } - - if (!childTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(dottedNameAST.right, TypeScript.DiagnosticCode.The_property_0_does_not_exist_on_value_of_type_1, [dottedNameAST.right.text(), lhsType.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - return this.getNewErrorTypeSymbol(rhsName); - } - - return childTypeSymbol; - }; - - PullTypeResolver.prototype.shouldContextuallyTypeAnyFunctionExpression = function (functionExpressionAST, typeParameters, parameters, returnTypeAnnotation, context) { - if (typeParameters && typeParameters.typeParameters.nonSeparatorCount() > 0) { - return false; - } - - if (returnTypeAnnotation) { - return false; - } - - if (parameters) { - for (var i = 0, n = parameters.length; i < n; i++) { - if (parameters.typeAt(i)) { - return false; - } - } - } - - var contextualFunctionTypeSymbol = context.getContextualType(); - - if (contextualFunctionTypeSymbol) { - this.resolveDeclaredSymbol(contextualFunctionTypeSymbol, context); - var callSignatures = contextualFunctionTypeSymbol.getCallSignatures(); - var exactlyOneCallSignature = callSignatures && callSignatures.length === 1; - if (!exactlyOneCallSignature) { - return false; - } - - var callSignatureIsGeneric = callSignatures[0].getTypeParameters().length > 0; - return !callSignatureIsGeneric; - } - - return false; - }; - - PullTypeResolver.prototype.resolveAnyFunctionExpression = function (funcDeclAST, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, isContextuallyTyped, context) { - var funcDeclSymbol = null; - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - TypeScript.Debug.assert(functionDecl); - - if (functionDecl && functionDecl.hasSymbol()) { - funcDeclSymbol = functionDecl.getSymbol(); - if (funcDeclSymbol.isResolved || funcDeclSymbol.inResolution) { - return funcDeclSymbol; - } - } - - funcDeclSymbol = functionDecl.getSymbol(); - TypeScript.Debug.assert(funcDeclSymbol); - - var funcDeclType = funcDeclSymbol.type; - var signature = funcDeclType.getCallSignatures()[0]; - funcDeclSymbol.startResolving(); - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - var assigningFunctionSignature = null; - if (isContextuallyTyped && this.shouldContextuallyTypeAnyFunctionExpression(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, context)) { - assigningFunctionSignature = context.getContextualType().getCallSignatures()[0]; - } - - this.resolveAnyFunctionExpressionParameters(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, isContextuallyTyped, context); - - if (returnTypeAnnotation) { - signature.returnType = this.resolveTypeReference(returnTypeAnnotation, context); - } else { - if (assigningFunctionSignature) { - var returnType = assigningFunctionSignature.returnType; - - if (returnType) { - context.propagateContextualType(returnType); - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, bodyExpression, signature, true, functionDecl, context); - context.popAnyContextualType(); - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - - if (this.compilationSettings.noImplicitAny()) { - var functionExpressionName = functionDecl.getFunctionExpressionName(); - - if (functionExpressionName != "") { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type, [functionExpressionName])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - } - } else { - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, bodyExpression, signature, false, functionDecl, context); - } - } - - context.setTypeInContext(funcDeclSymbol, funcDeclType); - funcDeclSymbol.setResolved(); - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckAnyFunctionExpression(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, isContextuallyTyped, context); - } - - return funcDeclSymbol; - }; - - PullTypeResolver.prototype.resolveAnyFunctionExpressionParameters = function (funcDeclAST, typeParameters, parameters, returnTypeAnnotation, isContextuallyTyped, context) { - if (!parameters) { - return; - } - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var contextParams = []; - - var assigningFunctionSignature = null; - if (isContextuallyTyped && this.shouldContextuallyTypeAnyFunctionExpression(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, context)) { - assigningFunctionSignature = context.getContextualType().getCallSignatures()[0]; - } - - if (assigningFunctionSignature) { - contextParams = assigningFunctionSignature.parameters; - } - - var contextualParametersCount = contextParams.length; - for (var i = 0, n = parameters.length; i < n; i++) { - var actualParameterIsVarArgParameter = (i === (n - 1)) && parameters.lastParameterIsRest(); - var correspondingContextualParameter = null; - var contextualParameterType = null; - - if (i < contextualParametersCount) { - correspondingContextualParameter = contextParams[i]; - } else if (contextualParametersCount && contextParams[contextualParametersCount - 1].isVarArg) { - correspondingContextualParameter = contextParams[contextualParametersCount - 1]; - } - - if (correspondingContextualParameter) { - if (correspondingContextualParameter.isVarArg === actualParameterIsVarArgParameter) { - contextualParameterType = correspondingContextualParameter.type; - } else if (correspondingContextualParameter.isVarArg) { - contextualParameterType = correspondingContextualParameter.type.getElementType(); - } - } - - this.resolveFunctionExpressionParameter(parameters.astAt(i), parameters.identifierAt(i), parameters.typeAt(i), parameters.initializerAt(i), contextualParameterType, functionDecl, context); - } - }; - - PullTypeResolver.prototype.typeCheckSimpleArrowFunctionExpression = function (arrowFunction, isContextuallyTyped, context) { - return this.typeCheckAnyFunctionExpression(arrowFunction, null, TypeScript.ASTHelpers.parametersFromIdentifier(arrowFunction.identifier), null, arrowFunction.block, arrowFunction.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckParenthesizedArrowFunctionExpression = function (arrowFunction, isContextuallyTyped, context) { - return this.typeCheckAnyFunctionExpression(arrowFunction, arrowFunction.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(arrowFunction.callSignature.parameterList), TypeScript.ASTHelpers.getType(arrowFunction), arrowFunction.block, arrowFunction.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckAnyFunctionExpression = function (funcDeclAST, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, isContextuallyTyped, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcDeclSymbol = functionDecl.getSymbol(); - var funcDeclType = funcDeclSymbol.type; - var signature = funcDeclType.getCallSignatures()[0]; - var returnTypeSymbol = signature.returnType; - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - this.resolveAnyFunctionExpressionParameters(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, isContextuallyTyped, context); - - context.pushNewContextualType(null); - if (block) { - this.resolveAST(block, false, context); - } else { - var bodyExpressionType = this.resolveReturnExpression(bodyExpression, functionDecl, context); - this.typeCheckReturnExpression(bodyExpression, bodyExpressionType, functionDecl, context); - } - - context.popAnyContextualType(); - - this.checkThatNonVoidFunctionHasReturnExpressionOrThrowStatement(functionDecl, returnTypeAnnotation, returnTypeSymbol, block, context); - - this.validateVariableDeclarationGroups(functionDecl, context); - - this.typeCheckCallBacks.push(function (context) { - _this.typeCheckFunctionOverloads(funcDeclAST, context); - }); - }; - - PullTypeResolver.prototype.resolveThisExpression = function (thisExpression, context) { - var enclosingDecl = this.getEnclosingDeclForAST(thisExpression); - var thisTypeSymbol = this.getContextualClassSymbolForEnclosingDecl(thisExpression, enclosingDecl) || this.semanticInfoChain.anyTypeSymbol; - - if (this.canTypeCheckAST(thisExpression, context)) { - this.typeCheckThisExpression(thisExpression, context, enclosingDecl); - } - - return thisTypeSymbol; - }; - - PullTypeResolver.prototype.inTypeArgumentList = function (ast) { - var previous = null; - var current = ast; - - while (current) { - switch (current.kind()) { - case 126 /* GenericType */: - var genericType = current; - if (genericType.typeArgumentList === previous) { - return true; - } - break; - - case 226 /* ArgumentList */: - var argumentList = current; - return argumentList.typeArgumentList === previous; - } - - previous = current; - current = current.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inClassExtendsHeritageClause = function (ast) { - while (ast) { - switch (ast.kind()) { - case 230 /* ExtendsHeritageClause */: - var heritageClause = ast; - - return heritageClause.parent.parent.kind() === 131 /* ClassDeclaration */; - - case 137 /* ConstructorDeclaration */: - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inTypeQuery = function (ast) { - while (ast) { - switch (ast.kind()) { - case 127 /* TypeQuery */: - return true; - case 129 /* FunctionDeclaration */: - case 213 /* InvocationExpression */: - case 137 /* ConstructorDeclaration */: - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inArgumentListOfSuperInvocation = function (ast) { - var previous = null; - var current = ast; - while (current) { - switch (current.kind()) { - case 213 /* InvocationExpression */: - var invocationExpression = current; - if (previous === invocationExpression.argumentList && invocationExpression.expression.kind() === 50 /* SuperKeyword */) { - return true; - } - break; - - case 137 /* ConstructorDeclaration */: - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - previous = current; - current = current.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inConstructorParameterList = function (ast) { - var previous = null; - var current = ast; - while (current) { - switch (current.kind()) { - case 142 /* CallSignature */: - var callSignature = current; - if (previous === callSignature.parameterList && callSignature.parent.kind() === 137 /* ConstructorDeclaration */) { - return true; - } - - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - previous = current; - current = current.parent; - } - - return false; - }; - PullTypeResolver.prototype.isFunctionAccessorOrNonArrowFunctionExpression = function (decl) { - if (decl.kind === 262144 /* GetAccessor */ || decl.kind === 524288 /* SetAccessor */) { - return true; - } - - return this.isFunctionOrNonArrowFunctionExpression(decl); - }; - - PullTypeResolver.prototype.isFunctionOrNonArrowFunctionExpression = function (decl) { - if (decl.kind === 16384 /* Function */) { - return true; - } else if (decl.kind === 131072 /* FunctionExpression */ && !TypeScript.hasFlag(decl.flags, 8192 /* ArrowFunction */)) { - return true; - } - - return false; - }; - - PullTypeResolver.prototype.typeCheckThisExpression = function (thisExpression, context, enclosingDecl) { - this.checkForThisCaptureInArrowFunction(thisExpression); - - if (this.inConstructorParameterList(thisExpression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_constructor_arguments)); - return; - } - - for (var currentDecl = enclosingDecl; currentDecl !== null; currentDecl = currentDecl.getParentDecl()) { - if (this.isFunctionAccessorOrNonArrowFunctionExpression(currentDecl)) { - return; - } else if (currentDecl.kind === 4 /* Container */ || currentDecl.kind === 32 /* DynamicModule */) { - if (currentDecl.getParentDecl() === null) { - return; - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_within_module_bodies)); - return; - } - } else if (currentDecl.kind === 64 /* Enum */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_current_location)); - return; - } else if (currentDecl.kind === 32768 /* ConstructorMethod */) { - if (this.inArgumentListOfSuperInvocation(thisExpression) && this.superCallMustBeFirstStatementInConstructor(currentDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_current_location)); - } - - return; - } else if (currentDecl.kind === 8 /* Class */) { - if (this.inStaticMemberVariableDeclaration(thisExpression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_static_initializers_in_a_class_body)); - } - - return; - } - } - }; - - PullTypeResolver.prototype.getContextualClassSymbolForEnclosingDecl = function (ast, enclosingDecl) { - var declPath = enclosingDecl.getParentPath(); - - if (declPath.length) { - var isStaticContext = false; - - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - var declKind = decl.kind; - var declFlags = decl.flags; - - if (declFlags & 16 /* Static */) { - isStaticContext = true; - } else if (declKind === 131072 /* FunctionExpression */ && !TypeScript.hasFlag(declFlags, 8192 /* ArrowFunction */)) { - return null; - } else if (declKind === 16384 /* Function */) { - return null; - } else if (declKind === 8 /* Class */) { - if (this.inStaticMemberVariableDeclaration(ast)) { - return this.getNewErrorTypeSymbol(); - } else { - var classSymbol = decl.getSymbol(); - if (isStaticContext) { - var constructorSymbol = classSymbol.getConstructorMethod(); - return constructorSymbol.type; - } else { - return classSymbol; - } - } - } - } - } - - return null; - }; - - PullTypeResolver.prototype.inStaticMemberVariableDeclaration = function (ast) { - while (ast) { - if (ast.kind() === 136 /* MemberVariableDeclaration */ && TypeScript.hasModifier(ast.modifiers, 16 /* Static */)) { - return true; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.resolveSuperExpression = function (ast, context) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - var superType = this.semanticInfoChain.anyTypeSymbol; - - var classSymbol = this.getContextualClassSymbolForEnclosingDecl(ast, enclosingDecl); - - if (classSymbol) { - this.resolveDeclaredSymbol(classSymbol, context); - - var parents = classSymbol.getExtendedTypes(); - - if (parents.length) { - superType = parents[0]; - } - } - - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckSuperExpression(ast, context, enclosingDecl); - } - - return superType; - }; - - PullTypeResolver.prototype.typeCheckSuperExpression = function (ast, context, enclosingDecl) { - this.setTypeChecked(ast, context); - - this.checkForThisCaptureInArrowFunction(ast); - - var isSuperCall = ast.parent.kind() === 213 /* InvocationExpression */; - var isSuperPropertyAccess = ast.parent.kind() === 212 /* MemberAccessExpression */; - TypeScript.Debug.assert(isSuperCall || isSuperPropertyAccess); - - if (isSuperPropertyAccess) { - for (var currentDecl = enclosingDecl; currentDecl !== null; currentDecl = currentDecl.getParentDecl()) { - if (this.isFunctionOrNonArrowFunctionExpression(currentDecl)) { - break; - } else if (currentDecl.kind === 8 /* Class */) { - if (!this.enclosingClassIsDerived(currentDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_non_derived_classes)); - return; - } else if (this.inConstructorParameterList(ast)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_constructor_arguments)); - return; - } else if (this.inStaticMemberVariableDeclaration(ast)) { - break; - } - - return; - } - } - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class)); - return; - } else { - if (enclosingDecl.kind === 32768 /* ConstructorMethod */) { - var classDecl = enclosingDecl.getParentDecl(); - - if (!this.enclosingClassIsDerived(classDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_non_derived_classes)); - return; - } else if (this.inConstructorParameterList(ast)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_constructor_arguments)); - return; - } - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors)); - } - } - }; - - PullTypeResolver.prototype.resolveSimplePropertyAssignment = function (propertyAssignment, isContextuallyTyped, context) { - return this.resolveAST(propertyAssignment.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveFunctionPropertyAssignment = function (funcProp, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcProp, funcProp.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcProp.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcProp), funcProp.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckFunctionPropertyAssignment = function (funcProp, isContextuallyTyped, context) { - this.typeCheckAnyFunctionExpression(funcProp, funcProp.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcProp.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcProp), funcProp.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveObjectLiteralExpression = function (expressionAST, isContextuallyTyped, context, additionalResults) { - var symbol = this.getSymbolForAST(expressionAST, context); - var hasResolvedSymbol = symbol && symbol.isResolved; - - if (!hasResolvedSymbol || additionalResults || this.canTypeCheckAST(expressionAST, context)) { - if (this.canTypeCheckAST(expressionAST, context)) { - this.setTypeChecked(expressionAST, context); - } - symbol = this.computeObjectLiteralExpression(expressionAST, isContextuallyTyped, context, additionalResults); - this.setSymbolForAST(expressionAST, symbol, context); - } - - return symbol; - }; - - PullTypeResolver.prototype.bindObjectLiteralMembers = function (objectLiteralDeclaration, objectLiteralTypeSymbol, objectLiteralMembers, isUsingExistingSymbol, pullTypeContext) { - var boundMemberSymbols = []; - var memberSymbol; - for (var i = 0, len = objectLiteralMembers.nonSeparatorCount(); i < len; i++) { - var propertyAssignment = objectLiteralMembers.nonSeparatorAt(i); - - var id = this.getPropertyAssignmentName(propertyAssignment); - var assignmentText = getPropertyAssignmentNameTextFromIdentifier(id); - - var isAccessor = propertyAssignment.kind() === 139 /* GetAccessor */ || propertyAssignment.kind() === 140 /* SetAccessor */; - var decl = this.semanticInfoChain.getDeclForAST(propertyAssignment); - TypeScript.Debug.assert(decl); - - if (propertyAssignment.kind() === 240 /* SimplePropertyAssignment */) { - if (!isUsingExistingSymbol) { - memberSymbol = new TypeScript.PullSymbol(assignmentText.memberName, 4096 /* Property */); - memberSymbol.addDeclaration(decl); - decl.setSymbol(memberSymbol); - } else { - memberSymbol = decl.getSymbol(); - } - } else if (propertyAssignment.kind() === 241 /* FunctionPropertyAssignment */) { - memberSymbol = decl.getSymbol(); - } else { - TypeScript.Debug.assert(isAccessor); - memberSymbol = decl.getSymbol(); - } - - if (!isUsingExistingSymbol && !isAccessor) { - var existingMember = objectLiteralTypeSymbol.findMember(memberSymbol.name, true); - if (existingMember) { - pullTypeContext.postDiagnostic(this.semanticInfoChain.duplicateIdentifierDiagnosticFromAST(propertyAssignment, assignmentText.actualText, existingMember.getDeclarations()[0].ast())); - } - - objectLiteralTypeSymbol.addMember(memberSymbol); - } - - boundMemberSymbols.push(memberSymbol); - } - - return boundMemberSymbols; - }; - - PullTypeResolver.prototype.resolveObjectLiteralMembers = function (objectLiteralDeclaration, objectLiteralTypeSymbol, objectLiteralContextualType, objectLiteralMembers, stringIndexerSignature, numericIndexerSignature, allMemberTypes, allNumericMemberTypes, boundMemberSymbols, isUsingExistingSymbol, pullTypeContext, additionalResults) { - for (var i = 0, len = objectLiteralMembers.nonSeparatorCount(); i < len; i++) { - var propertyAssignment = objectLiteralMembers.nonSeparatorAt(i); - - var acceptedContextualType = false; - var assigningSymbol = null; - - var id = this.getPropertyAssignmentName(propertyAssignment); - var memberSymbol = boundMemberSymbols[i]; - var contextualMemberType = null; - - if (objectLiteralContextualType) { - assigningSymbol = this.getNamedPropertySymbol(memberSymbol.name, 68147712 /* SomeValue */, objectLiteralContextualType); - - if (!assigningSymbol) { - if (numericIndexerSignature && TypeScript.PullHelpers.isNameNumeric(memberSymbol.name)) { - assigningSymbol = numericIndexerSignature; - } else if (stringIndexerSignature) { - assigningSymbol = stringIndexerSignature; - } - } - - if (assigningSymbol) { - this.resolveDeclaredSymbol(assigningSymbol, pullTypeContext); - - contextualMemberType = assigningSymbol.kind === 4194304 /* IndexSignature */ ? assigningSymbol.returnType : assigningSymbol.type; - pullTypeContext.propagateContextualType(contextualMemberType); - - acceptedContextualType = true; - - if (additionalResults) { - additionalResults.membersContextTypeSymbols[i] = contextualMemberType; - } - } - } - - var memberSymbolType = this.resolveAST(propertyAssignment, contextualMemberType !== null, pullTypeContext).type; - - if (memberSymbolType) { - if (memberSymbolType.isGeneric()) { - objectLiteralTypeSymbol.setHasGenericMember(); - } - - if (stringIndexerSignature) { - allMemberTypes.push(memberSymbolType); - } - if (numericIndexerSignature && TypeScript.PullHelpers.isNameNumeric(memberSymbol.name)) { - allNumericMemberTypes.push(memberSymbolType); - } - } - - if (acceptedContextualType) { - pullTypeContext.popAnyContextualType(); - } - - var isAccessor = propertyAssignment.kind() === 140 /* SetAccessor */ || propertyAssignment.kind() === 139 /* GetAccessor */; - if (!memberSymbol.isResolved) { - if (isAccessor) { - this.setSymbolForAST(id, memberSymbolType, pullTypeContext); - } else { - pullTypeContext.setTypeInContext(memberSymbol, memberSymbolType); - memberSymbol.setResolved(); - - this.setSymbolForAST(id, memberSymbol, pullTypeContext); - } - } - } - }; - - PullTypeResolver.prototype.computeObjectLiteralExpression = function (objectLitAST, isContextuallyTyped, context, additionalResults) { - var objectLitDecl = this.semanticInfoChain.getDeclForAST(objectLitAST); - TypeScript.Debug.assert(objectLitDecl); - - var typeSymbol = this.getSymbolForAST(objectLitAST, context); - var isUsingExistingSymbol = !!typeSymbol; - - if (!typeSymbol) { - typeSymbol = new TypeScript.PullTypeSymbol("", 256 /* ObjectLiteral */); - typeSymbol.addDeclaration(objectLitDecl); - this.setSymbolForAST(objectLitAST, typeSymbol, context); - objectLitDecl.setSymbol(typeSymbol); - } - - var propertyAssignments = objectLitAST.propertyAssignments; - var contextualType = null; - - if (isContextuallyTyped) { - contextualType = context.getContextualType(); - this.resolveDeclaredSymbol(contextualType, context); - } - - var stringIndexerSignature = null; - var numericIndexerSignature = null; - var allMemberTypes = null; - var allNumericMemberTypes = null; - - if (contextualType) { - var indexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(contextualType, context); - - stringIndexerSignature = indexSignatures.stringSignature; - numericIndexerSignature = indexSignatures.numericSignature; - - var inInferentialTyping = context.isInferentiallyTyping(); - if (stringIndexerSignature) { - allMemberTypes = inInferentialTyping ? [] : [stringIndexerSignature.returnType]; - } - - if (numericIndexerSignature) { - allNumericMemberTypes = inInferentialTyping ? [] : [numericIndexerSignature.returnType]; - } - } - - if (propertyAssignments) { - if (additionalResults) { - additionalResults.membersContextTypeSymbols = []; - } - - var boundMemberSymbols = this.bindObjectLiteralMembers(objectLitDecl, typeSymbol, propertyAssignments, isUsingExistingSymbol, context); - - this.resolveObjectLiteralMembers(objectLitDecl, typeSymbol, contextualType, propertyAssignments, stringIndexerSignature, numericIndexerSignature, allMemberTypes, allNumericMemberTypes, boundMemberSymbols, isUsingExistingSymbol, context, additionalResults); - - if (!isUsingExistingSymbol) { - this.stampObjectLiteralWithIndexSignature(typeSymbol, allMemberTypes, stringIndexerSignature, context); - this.stampObjectLiteralWithIndexSignature(typeSymbol, allNumericMemberTypes, numericIndexerSignature, context); - } - } - - typeSymbol.setResolved(); - return typeSymbol; - }; - - PullTypeResolver.prototype.getPropertyAssignmentName = function (propertyAssignment) { - if (propertyAssignment.kind() === 240 /* SimplePropertyAssignment */) { - return propertyAssignment.propertyName; - } else if (propertyAssignment.kind() === 241 /* FunctionPropertyAssignment */) { - return propertyAssignment.propertyName; - } else if (propertyAssignment.kind() === 139 /* GetAccessor */) { - return propertyAssignment.propertyName; - } else if (propertyAssignment.kind() === 140 /* SetAccessor */) { - return propertyAssignment.propertyName; - } else { - TypeScript.Debug.assert(false); - } - }; - - PullTypeResolver.prototype.stampObjectLiteralWithIndexSignature = function (objectLiteralSymbol, indexerTypeCandidates, contextualIndexSignature, context) { - if (contextualIndexSignature) { - var typeCollection = { - getLength: function () { - return indexerTypeCandidates.length; - }, - getTypeAtIndex: function (index) { - return indexerTypeCandidates[index]; - } - }; - var decl = objectLiteralSymbol.getDeclarations()[0]; - var indexerReturnType = this.findBestCommonType(typeCollection, context).widenedType(this, null, context); - if (indexerReturnType === contextualIndexSignature.returnType) { - objectLiteralSymbol.addIndexSignature(contextualIndexSignature); - } else { - this.semanticInfoChain.addSyntheticIndexSignature(decl, objectLiteralSymbol, this.getASTForDecl(decl), contextualIndexSignature.parameters[0].name, contextualIndexSignature.parameters[0].type, indexerReturnType); - } - } - }; - - PullTypeResolver.prototype.resolveArrayLiteralExpression = function (arrayLit, isContextuallyTyped, context) { - var symbol = this.getSymbolForAST(arrayLit, context); - if (!symbol || this.canTypeCheckAST(arrayLit, context)) { - if (this.canTypeCheckAST(arrayLit, context)) { - this.setTypeChecked(arrayLit, context); - } - symbol = this.computeArrayLiteralExpressionSymbol(arrayLit, isContextuallyTyped, context); - this.setSymbolForAST(arrayLit, symbol, context); - } - - return symbol; - }; - - PullTypeResolver.prototype.computeArrayLiteralExpressionSymbol = function (arrayLit, isContextuallyTyped, context) { - var elements = arrayLit.expressions; - var elementType = null; - var elementTypes = []; - var comparisonInfo = new TypeComparisonInfo(); - var contextualElementType = null; - comparisonInfo.onlyCaptureFirstError = true; - - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - - this.resolveDeclaredSymbol(contextualType, context); - - if (contextualType) { - var indexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(contextualType, context); - if (indexSignatures.numericSignature) { - contextualElementType = indexSignatures.numericSignature.returnType; - } - } - } - - if (elements) { - if (contextualElementType) { - context.propagateContextualType(contextualElementType); - } - - for (var i = 0, n = elements.nonSeparatorCount(); i < n; i++) { - elementTypes.push(this.resolveAST(elements.nonSeparatorAt(i), contextualElementType !== null, context).type); - } - - if (contextualElementType) { - context.popAnyContextualType(); - } - } - - if (elementTypes.length) { - elementType = elementTypes[0]; - } - var collection; - - if (contextualElementType && !context.isInferentiallyTyping()) { - if (!elementType) { - elementType = contextualElementType; - } - - collection = { - getLength: function () { - return elements.nonSeparatorCount() + 1; - }, - getTypeAtIndex: function (index) { - return index === 0 ? contextualElementType : elementTypes[index - 1]; - } - }; - } else { - collection = { - getLength: function () { - return elements.nonSeparatorCount(); - }, - getTypeAtIndex: function (index) { - return elementTypes[index]; - } - }; - } - - elementType = elementType ? this.findBestCommonType(collection, context, comparisonInfo) : elementType; - - if (!elementType) { - elementType = this.semanticInfoChain.undefinedTypeSymbol; - } - - return this.getArrayType(elementType); - }; - - PullTypeResolver.prototype.resolveElementAccessExpression = function (callEx, context) { - var symbolAndDiagnostic = this.computeElementAccessExpressionSymbolAndDiagnostic(callEx, context); - - if (this.canTypeCheckAST(callEx, context)) { - this.typeCheckElementAccessExpression(callEx, context, symbolAndDiagnostic); - } - - return symbolAndDiagnostic.symbol; - }; - - PullTypeResolver.prototype.typeCheckElementAccessExpression = function (callEx, context, symbolAndDiagnostic) { - this.setTypeChecked(callEx, context); - context.postDiagnostic(symbolAndDiagnostic.diagnostic); - }; - - PullTypeResolver.prototype.computeElementAccessExpressionSymbolAndDiagnostic = function (callEx, context) { - var targetSymbol = this.resolveAST(callEx.expression, false, context); - var indexType = this.resolveAST(callEx.argumentExpression, false, context).type; - - var targetTypeSymbol = targetSymbol.type; - - targetTypeSymbol = this.getApparentType(targetTypeSymbol); - - if (this.isAnyOrEquivalent(targetTypeSymbol)) { - return { symbol: targetTypeSymbol }; - } - - var elementType = targetTypeSymbol.getElementType(); - - var isNumberIndex = indexType === this.semanticInfoChain.numberTypeSymbol || TypeScript.PullHelpers.symbolIsEnum(indexType); - - if (elementType && isNumberIndex) { - return { symbol: elementType }; - } - - if (callEx.argumentExpression.kind() === 14 /* StringLiteral */ || callEx.argumentExpression.kind() === 13 /* NumericLiteral */) { - var memberName = callEx.argumentExpression.kind() === 14 /* StringLiteral */ ? TypeScript.stripStartAndEndQuotes(callEx.argumentExpression.text()) : callEx.argumentExpression.valueText(); - - var member = this._getNamedPropertySymbolOfAugmentedType(memberName, targetTypeSymbol); - - if (member) { - this.resolveDeclaredSymbol(member, context); - - return { symbol: member.type }; - } - } - - var signatures = this.getBothKindsOfIndexSignaturesIncludingAugmentedType(targetTypeSymbol, context); - - var stringSignature = signatures.stringSignature; - var numberSignature = signatures.numericSignature; - - if (numberSignature && (isNumberIndex || indexType === this.semanticInfoChain.anyTypeSymbol)) { - return { symbol: numberSignature.returnType || this.semanticInfoChain.anyTypeSymbol }; - } else if (stringSignature && (isNumberIndex || indexType === this.semanticInfoChain.anyTypeSymbol || indexType === this.semanticInfoChain.stringTypeSymbol)) { - return { symbol: stringSignature.returnType || this.semanticInfoChain.anyTypeSymbol }; - } else if (isNumberIndex || indexType === this.semanticInfoChain.anyTypeSymbol || indexType === this.semanticInfoChain.stringTypeSymbol) { - if (this.compilationSettings.noImplicitAny()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(callEx.argumentExpression, TypeScript.DiagnosticCode.Index_signature_of_object_type_implicitly_has_an_any_type)); - } - return { symbol: this.semanticInfoChain.anyTypeSymbol }; - } else { - return { - symbol: this.getNewErrorTypeSymbol(), - diagnostic: this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.Value_of_type_0_is_not_indexable_by_type_1, [targetTypeSymbol.toString(), indexType.toString()]) - }; - } - }; - - PullTypeResolver.prototype.getBothKindsOfIndexSignaturesIncludingAugmentedType = function (enclosingType, context) { - return this._getBothKindsOfIndexSignatures(enclosingType, context, true); - }; - - PullTypeResolver.prototype.getBothKindsOfIndexSignaturesExcludingAugmentedType = function (enclosingType, context) { - return this._getBothKindsOfIndexSignatures(enclosingType, context, false); - }; - - PullTypeResolver.prototype._getBothKindsOfIndexSignatures = function (enclosingType, context, includeAugmentedType) { - var signatures = includeAugmentedType ? enclosingType.getIndexSignaturesOfAugmentedType(this, this.cachedFunctionInterfaceType(), this.cachedObjectInterfaceType()) : enclosingType.getIndexSignatures(); - - var stringSignature = null; - var numberSignature = null; - var signature = null; - var paramSymbols; - var paramType; - - for (var i = 0; i < signatures.length; i++) { - if (stringSignature && numberSignature) { - break; - } - - signature = signatures[i]; - if (!signature.isResolved) { - this.resolveDeclaredSymbol(signature, context); - } - - paramSymbols = signature.parameters; - - if (paramSymbols.length) { - paramType = paramSymbols[0].type; - - if (!stringSignature && paramType === this.semanticInfoChain.stringTypeSymbol) { - stringSignature = signature; - continue; - } else if (!numberSignature && paramType === this.semanticInfoChain.numberTypeSymbol) { - numberSignature = signature; - continue; - } - } - } - - return { - numericSignature: numberSignature, - stringSignature: stringSignature - }; - }; - - PullTypeResolver.prototype._addUnhiddenSignaturesFromBaseType = function (derivedTypeSignatures, baseTypeSignatures, signaturesBeingAggregated) { - var _this = this; - if (!derivedTypeSignatures) { - signaturesBeingAggregated.push.apply(signaturesBeingAggregated, baseTypeSignatures); - return; - } - - var context = new TypeScript.PullTypeResolutionContext(this); - for (var i = 0; i < baseTypeSignatures.length; i++) { - var baseSignature = baseTypeSignatures[i]; - - var signatureIsHidden = TypeScript.ArrayUtilities.any(derivedTypeSignatures, function (sig) { - return _this.signaturesAreIdenticalWithNewEnclosingTypes(baseSignature, sig, context, false); - }); - - if (!signatureIsHidden) { - signaturesBeingAggregated.push(baseSignature); - } - } - }; - - PullTypeResolver.prototype.resolveBinaryAdditionOperation = function (binaryExpression, context) { - var lhsExpression = this.resolveAST(binaryExpression.left, false, context); - var lhsType = lhsExpression.type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - if (TypeScript.PullHelpers.symbolIsEnum(lhsType)) { - lhsType = this.semanticInfoChain.numberTypeSymbol; - } - - if (TypeScript.PullHelpers.symbolIsEnum(rhsType)) { - rhsType = this.semanticInfoChain.numberTypeSymbol; - } - - var isLhsTypeNullOrUndefined = lhsType === this.semanticInfoChain.nullTypeSymbol || lhsType === this.semanticInfoChain.undefinedTypeSymbol; - var isRhsTypeNullOrUndefined = rhsType === this.semanticInfoChain.nullTypeSymbol || rhsType === this.semanticInfoChain.undefinedTypeSymbol; - - if (isLhsTypeNullOrUndefined) { - if (isRhsTypeNullOrUndefined) { - lhsType = rhsType = this.semanticInfoChain.anyTypeSymbol; - } else { - lhsType = rhsType; - } - } else if (isRhsTypeNullOrUndefined) { - rhsType = lhsType; - } - - var exprType = null; - - if (lhsType === this.semanticInfoChain.stringTypeSymbol || rhsType === this.semanticInfoChain.stringTypeSymbol) { - exprType = this.semanticInfoChain.stringTypeSymbol; - } else if (this.isAnyOrEquivalent(lhsType) || this.isAnyOrEquivalent(rhsType)) { - exprType = this.semanticInfoChain.anyTypeSymbol; - } else if (rhsType === this.semanticInfoChain.numberTypeSymbol && lhsType === this.semanticInfoChain.numberTypeSymbol) { - exprType = this.semanticInfoChain.numberTypeSymbol; - } - - if (this.canTypeCheckAST(binaryExpression, context)) { - this.setTypeChecked(binaryExpression, context); - - if (exprType) { - if (binaryExpression.kind() === 175 /* AddAssignmentExpression */) { - if (!this.isReference(binaryExpression.left, lhsExpression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_of_assignment_expression)); - } - - this.checkAssignability(binaryExpression.left, exprType, lhsType, context); - } - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_expression_types_not_known_to_support_the_addition_operator)); - } - } - - if (!exprType) { - exprType = this.semanticInfoChain.anyTypeSymbol; - } - - return exprType; - }; - - PullTypeResolver.prototype.bestCommonTypeOfTwoTypes = function (type1, type2, context) { - return this.findBestCommonType({ - getLength: function () { - return 2; - }, - getTypeAtIndex: function (index) { - switch (index) { - case 0: - return type1; - case 1: - return type2; - } - } - }, context); - }; - - PullTypeResolver.prototype.bestCommonTypeOfThreeTypes = function (type1, type2, type3, context) { - return this.findBestCommonType({ - getLength: function () { - return 3; - }, - getTypeAtIndex: function (index) { - switch (index) { - case 0: - return type1; - case 1: - return type2; - case 2: - return type3; - } - } - }, context); - }; - - PullTypeResolver.prototype.resolveLogicalOrExpression = function (binex, isContextuallyTyped, context) { - if (this.canTypeCheckAST(binex, context)) { - this.setTypeChecked(binex, context); - } - - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - var leftType = this.resolveAST(binex.left, isContextuallyTyped, context).type; - var rightType = this.resolveAST(binex.right, isContextuallyTyped, context).type; - - return context.isInferentiallyTyping() ? this.bestCommonTypeOfTwoTypes(leftType, rightType, context) : this.bestCommonTypeOfThreeTypes(contextualType, leftType, rightType, context); - } else { - var leftType = this.resolveAST(binex.left, false, context).type; - - context.pushNewContextualType(leftType); - var rightType = this.resolveAST(binex.right, true, context).type; - context.popAnyContextualType(); - - return this.bestCommonTypeOfTwoTypes(leftType, rightType, context); - } - }; - - PullTypeResolver.prototype.resolveLogicalAndExpression = function (binex, context) { - if (this.canTypeCheckAST(binex, context)) { - this.setTypeChecked(binex, context); - - this.resolveAST(binex.left, false, context); - } - - return this.resolveAST(binex.right, false, context).type; - }; - - PullTypeResolver.prototype.computeTypeOfConditionalExpression = function (leftType, rightType, isContextuallyTyped, context) { - if (isContextuallyTyped && !context.isInferentiallyTyping()) { - var contextualType = context.getContextualType(); - return this.bestCommonTypeOfThreeTypes(contextualType, leftType, rightType, context); - } else { - return this.bestCommonTypeOfTwoTypes(leftType, rightType, context); - } - }; - - PullTypeResolver.prototype.resolveConditionalExpression = function (trinex, isContextuallyTyped, context) { - var leftType = this.resolveAST(trinex.whenTrue, isContextuallyTyped, context).type; - var rightType = this.resolveAST(trinex.whenFalse, isContextuallyTyped, context).type; - - var expressionType = this.computeTypeOfConditionalExpression(leftType, rightType, isContextuallyTyped, context); - - var conditionalTypesAreValid = this.conditionExpressionTypesAreValid(leftType, rightType, expressionType, isContextuallyTyped, context); - - if (this.canTypeCheckAST(trinex, context)) { - this.setTypeChecked(trinex, context); - this.resolveAST(trinex.condition, false, context); - - if (!this.conditionExpressionTypesAreValid(leftType, rightType, expressionType, isContextuallyTyped, context)) { - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(trinex, TypeScript.DiagnosticCode.Type_of_conditional_0_must_be_identical_to_1_2_or_3, [expressionType.toString(), leftType.toString(), rightType.toString(), contextualType.toString()])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(trinex, TypeScript.DiagnosticCode.Type_of_conditional_0_must_be_identical_to_1_or_2, [expressionType.toString(), leftType.toString(), rightType.toString()])); - } - } - } - - if (!conditionalTypesAreValid) { - return this.getNewErrorTypeSymbol(); - } - - return expressionType; - }; - - PullTypeResolver.prototype.conditionExpressionTypesAreValid = function (leftType, rightType, expressionType, isContextuallyTyped, context) { - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - if (this.typesAreIdentical(expressionType, leftType, context) || this.typesAreIdentical(expressionType, rightType, context) || this.typesAreIdentical(expressionType, contextualType, context)) { - return true; - } - } else { - if (this.typesAreIdentical(expressionType, leftType, context) || this.typesAreIdentical(expressionType, rightType, context)) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.resolveParenthesizedExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - } - - return this.resolveAST(ast.expression, false, context); - }; - - PullTypeResolver.prototype.resolveExpressionStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveInvocationExpression = function (callEx, context, additionalResults) { - var symbol = this.getSymbolForAST(callEx, context); - - if (!symbol || !symbol.isResolved) { - if (!additionalResults) { - additionalResults = new PullAdditionalCallResolutionData(); - } - symbol = this.computeInvocationExpressionSymbol(callEx, context, additionalResults); - if (this.canTypeCheckAST(callEx, context)) { - this.setTypeChecked(callEx, context); - } - if (symbol !== this.semanticInfoChain.anyTypeSymbol) { - this.setSymbolForAST(callEx, symbol, context); - } - this.semanticInfoChain.setCallResolutionDataForAST(callEx, additionalResults); - } else { - if (this.canTypeCheckAST(callEx, context)) { - this.typeCheckInvocationExpression(callEx, context); - } - - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - if (additionalResults && (callResolutionData !== additionalResults)) { - additionalResults.actualParametersContextTypeSymbols = callResolutionData.actualParametersContextTypeSymbols; - additionalResults.candidateSignature = callResolutionData.candidateSignature; - additionalResults.resolvedSignatures = callResolutionData.resolvedSignatures; - additionalResults.targetSymbol = callResolutionData.targetSymbol; - } - } - - return symbol; - }; - - PullTypeResolver.prototype.typeCheckInvocationExpression = function (callEx, context) { - this.setTypeChecked(callEx, context); - var targetSymbol = this.resolveAST(callEx.expression, false, context); - - if (callEx.argumentList.arguments) { - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - - var len = callEx.argumentList.arguments.nonSeparatorCount(); - for (var i = 0; i < len; i++) { - var contextualType = callResolutionData.actualParametersContextTypeSymbols ? callResolutionData.actualParametersContextTypeSymbols[i] : null; - if (contextualType) { - context.pushNewContextualType(contextualType); - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - for (var i = 0; i < callResolutionData.diagnosticsFromOverloadResolution.length; i++) { - context.postDiagnostic(callResolutionData.diagnosticsFromOverloadResolution[i]); - } - }; - - PullTypeResolver.prototype.computeInvocationExpressionSymbol = function (callEx, context, additionalResults) { - var targetSymbol = this.resolveAST(callEx.expression, false, context); - var targetAST = this.getCallTargetErrorSpanAST(callEx); - - var targetTypeSymbol = targetSymbol.type; - if (this.isAnyOrEquivalent(targetTypeSymbol)) { - this.resolveAST(callEx.argumentList.arguments, false, context); - - if (callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()) { - if (targetTypeSymbol === this.semanticInfoChain.anyTypeSymbol) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Untyped_function_calls_may_not_accept_type_arguments), additionalResults, context); - return this.getNewErrorTypeSymbol(); - } - } - - return this.semanticInfoChain.anyTypeSymbol; - } - - var isSuperCall = false; - - if (callEx.expression.kind() === 50 /* SuperKeyword */) { - isSuperCall = true; - - if (targetTypeSymbol.isClass()) { - targetSymbol = targetTypeSymbol.getConstructorMethod(); - this.resolveDeclaredSymbol(targetSymbol, context); - targetTypeSymbol = targetSymbol.type; - } else { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Calls_to_super_are_only_valid_inside_a_class), additionalResults, context); - this.resolveAST(callEx.argumentList.arguments, false, context); - - return this.getNewErrorTypeSymbol(); - } - } - - var signatures = isSuperCall ? targetTypeSymbol.getConstructSignatures() : targetTypeSymbol.getCallSignatures(); - - if (!signatures.length && (targetTypeSymbol.kind === 33554432 /* ConstructorType */)) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, [targetTypeSymbol.toString()]), additionalResults, context); - } - - var explicitTypeArgs = null; - var couldNotFindGenericOverload = false; - var couldNotAssignToConstraint; - var constraintDiagnostic = null; - var typeArgumentCountDiagnostic = null; - var diagnostics = []; - - if (callEx.argumentList.typeArgumentList) { - explicitTypeArgs = []; - - if (callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()) { - for (var i = 0; i < callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount(); i++) { - explicitTypeArgs[i] = this.resolveTypeReference(callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorAt(i), context); - } - } - } - - var triedToInferTypeArgs = false; - - var resolvedSignatures = []; - var inferredOrExplicitTypeArgs; - var specializedSignature; - var typeParameters; - var typeConstraint = null; - var beforeResolutionSignatures = signatures; - var targetTypeReplacementMap = targetTypeSymbol.getTypeParameterArgumentMap(); - - for (var i = 0; i < signatures.length; i++) { - typeParameters = signatures[i].getTypeParameters(); - couldNotAssignToConstraint = false; - - if (signatures[i].isGeneric() && typeParameters.length) { - if (isSuperCall && targetTypeSymbol.isGeneric() && !callEx.argumentList.typeArgumentList) { - explicitTypeArgs = signatures[i].returnType.getTypeArguments(); - } - - if (explicitTypeArgs) { - if (explicitTypeArgs.length === typeParameters.length) { - inferredOrExplicitTypeArgs = explicitTypeArgs; - } else { - typeArgumentCountDiagnostic = typeArgumentCountDiagnostic || this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Signature_expected_0_type_arguments_got_1_instead, [typeParameters.length, explicitTypeArgs.length]); - continue; - } - } else { - TypeScript.Debug.assert(callEx.argumentList); - var typeArgumentInferenceContext = new TypeScript.InvocationTypeArgumentInferenceContext(this, context, signatures[i], callEx.argumentList.arguments); - inferredOrExplicitTypeArgs = this.inferArgumentTypesForSignature(typeArgumentInferenceContext, new TypeComparisonInfo(), context); - triedToInferTypeArgs = true; - } - - TypeScript.Debug.assert(inferredOrExplicitTypeArgs && inferredOrExplicitTypeArgs.length == typeParameters.length); - - var mutableTypeReplacementMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(targetTypeReplacementMap ? targetTypeReplacementMap : []); - TypeScript.PullInstantiationHelpers.updateMutableTypeParameterArgumentMap(typeParameters, inferredOrExplicitTypeArgs, mutableTypeReplacementMap); - var typeReplacementMap = mutableTypeReplacementMap.typeParameterArgumentMap; - - if (explicitTypeArgs) { - for (var j = 0; j < typeParameters.length; j++) { - typeConstraint = typeParameters[j].getConstraint(); - - if (typeConstraint) { - if (typeConstraint.isGeneric()) { - typeConstraint = this.instantiateType(typeConstraint, typeReplacementMap); - } - - if (!this.sourceIsAssignableToTarget(inferredOrExplicitTypeArgs[j], typeConstraint, targetAST, context, null, true)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(targetAST); - constraintDiagnostic = this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2, [inferredOrExplicitTypeArgs[j].toString(enclosingSymbol, true), typeConstraint.toString(enclosingSymbol, true), typeParameters[j].toString(enclosingSymbol, true)]); - couldNotAssignToConstraint = true; - } - - if (couldNotAssignToConstraint) { - break; - } - } - } - } - - if (couldNotAssignToConstraint) { - continue; - } - - specializedSignature = this.instantiateSignature(signatures[i], typeReplacementMap); - - if (specializedSignature) { - resolvedSignatures[resolvedSignatures.length] = specializedSignature; - } - } else { - if (!(callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount())) { - resolvedSignatures[resolvedSignatures.length] = signatures[i]; - } - } - } - - if (signatures.length && !resolvedSignatures.length) { - couldNotFindGenericOverload = true; - } - - signatures = resolvedSignatures; - - var errorCondition = null; - if (!signatures.length) { - additionalResults.targetSymbol = targetSymbol; - additionalResults.resolvedSignatures = beforeResolutionSignatures; - additionalResults.candidateSignature = beforeResolutionSignatures && beforeResolutionSignatures.length ? beforeResolutionSignatures[0] : null; - - additionalResults.actualParametersContextTypeSymbols = actualParametersContextTypeSymbols; - - this.resolveAST(callEx.argumentList.arguments, false, context); - - if (!couldNotFindGenericOverload) { - if (this.cachedFunctionInterfaceType() && this.sourceIsAssignableToTarget(targetTypeSymbol, this.cachedFunctionInterfaceType(), targetAST, context)) { - if (callEx.argumentList.typeArgumentList) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Non_generic_functions_may_not_accept_type_arguments), additionalResults, context); - } - return this.semanticInfoChain.anyTypeSymbol; - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature), additionalResults, context); - } else if (constraintDiagnostic) { - this.postOverloadResolutionDiagnostics(constraintDiagnostic, additionalResults, context); - } else if (typeArgumentCountDiagnostic) { - this.postOverloadResolutionDiagnostics(typeArgumentCountDiagnostic, additionalResults, context); - } else { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.Could_not_select_overload_for_call_expression), additionalResults, context); - } - - return this.getNewErrorTypeSymbol(); - } - - var signature = this.resolveOverloads(callEx, signatures, callEx.argumentList.typeArgumentList !== null, context, diagnostics); - var useBeforeResolutionSignatures = signature == null; - - if (!signature) { - for (var i = 0; i < diagnostics.length; i++) { - this.postOverloadResolutionDiagnostics(diagnostics[i], additionalResults, context); - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Could_not_select_overload_for_call_expression), additionalResults, context); - - errorCondition = this.getNewErrorTypeSymbol(); - - if (!signatures.length) { - return errorCondition; - } - - signature = signatures[0]; - } - - var rootSignature = signature.getRootSymbol(); - if (!rootSignature.isGeneric() && callEx.argumentList.typeArgumentList) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Non_generic_functions_may_not_accept_type_arguments), additionalResults, context); - } else if (rootSignature.isGeneric() && callEx.argumentList.typeArgumentList && rootSignature.getTypeParameters() && (callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount() !== rootSignature.getTypeParameters().length)) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Signature_expected_0_type_arguments_got_1_instead, [rootSignature.getTypeParameters().length, callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()]), additionalResults, context); - } - - var returnType = isSuperCall ? this.semanticInfoChain.voidTypeSymbol : signature.returnType; - - var actualParametersContextTypeSymbols = []; - if (callEx.argumentList.arguments) { - var len = callEx.argumentList.arguments.nonSeparatorCount(); - var params = signature.parameters; - var contextualType = null; - var signatureDecl = signature.getDeclarations()[0]; - - for (var i = 0; i < len; i++) { - if (params.length) { - if (i < params.length - 1 || (i < params.length && !signature.hasVarArgs)) { - this.resolveDeclaredSymbol(params[i], context); - contextualType = params[i].type; - } else if (signature.hasVarArgs) { - contextualType = params[params.length - 1].type; - if (contextualType.isArrayNamedTypeReference()) { - contextualType = contextualType.getElementType(); - } - } - } - - if (contextualType) { - context.pushNewContextualType(contextualType); - actualParametersContextTypeSymbols[i] = contextualType; - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - additionalResults.targetSymbol = targetSymbol; - if (useBeforeResolutionSignatures && beforeResolutionSignatures) { - additionalResults.resolvedSignatures = beforeResolutionSignatures; - additionalResults.candidateSignature = beforeResolutionSignatures[0]; - } else { - additionalResults.resolvedSignatures = signatures; - additionalResults.candidateSignature = signature; - } - additionalResults.actualParametersContextTypeSymbols = actualParametersContextTypeSymbols; - - if (errorCondition) { - return errorCondition; - } - - if (!returnType) { - returnType = this.semanticInfoChain.anyTypeSymbol; - } - - return returnType; - }; - - PullTypeResolver.prototype.resolveObjectCreationExpression = function (callEx, context, additionalResults) { - var symbol = this.getSymbolForAST(callEx, context); - - if (!symbol || !symbol.isResolved) { - if (!additionalResults) { - additionalResults = new PullAdditionalCallResolutionData(); - } - symbol = this.computeObjectCreationExpressionSymbol(callEx, context, additionalResults); - if (this.canTypeCheckAST(callEx, context)) { - this.setTypeChecked(callEx, context); - } - this.setSymbolForAST(callEx, symbol, context); - this.semanticInfoChain.setCallResolutionDataForAST(callEx, additionalResults); - } else { - if (this.canTypeCheckAST(callEx, context)) { - this.typeCheckObjectCreationExpression(callEx, context); - } - - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - if (additionalResults && (callResolutionData !== additionalResults)) { - additionalResults.actualParametersContextTypeSymbols = callResolutionData.actualParametersContextTypeSymbols; - additionalResults.candidateSignature = callResolutionData.candidateSignature; - additionalResults.resolvedSignatures = callResolutionData.resolvedSignatures; - additionalResults.targetSymbol = callResolutionData.targetSymbol; - } - } - - return symbol; - }; - - PullTypeResolver.prototype.typeCheckObjectCreationExpression = function (callEx, context) { - this.setTypeChecked(callEx, context); - this.resolveAST(callEx.expression, false, context); - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - if (callEx.argumentList) { - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - var len = callEx.argumentList.arguments.nonSeparatorCount(); - - for (var i = 0; i < len; i++) { - var contextualType = callResolutionData.actualParametersContextTypeSymbols ? callResolutionData.actualParametersContextTypeSymbols[i] : null; - if (contextualType) { - context.pushNewContextualType(contextualType); - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - for (var i = 0; i < callResolutionData.diagnosticsFromOverloadResolution.length; i++) { - context.postDiagnostic(callResolutionData.diagnosticsFromOverloadResolution[i]); - } - }; - - PullTypeResolver.prototype.postOverloadResolutionDiagnostics = function (diagnostic, additionalResults, context) { - if (!context.inProvisionalResolution()) { - additionalResults.diagnosticsFromOverloadResolution.push(diagnostic); - } - context.postDiagnostic(diagnostic); - }; - - PullTypeResolver.prototype.computeObjectCreationExpressionSymbol = function (callEx, context, additionalResults) { - var _this = this; - var returnType = null; - - var targetSymbol = this.resolveAST(callEx.expression, false, context); - var targetTypeSymbol = targetSymbol.isType() ? targetSymbol : targetSymbol.type; - - var targetAST = this.getCallTargetErrorSpanAST(callEx); - - var constructSignatures = targetTypeSymbol.getConstructSignatures(); - - var explicitTypeArgs = null; - var usedCallSignaturesInstead = false; - var couldNotAssignToConstraint; - var constraintDiagnostic = null; - var typeArgumentCountDiagnostic = null; - var diagnostics = []; - - if (this.isAnyOrEquivalent(targetTypeSymbol)) { - if (callEx.argumentList) { - this.resolveAST(callEx.argumentList.arguments, false, context); - } - - return targetTypeSymbol; - } - - if (!constructSignatures.length) { - constructSignatures = targetTypeSymbol.getCallSignatures(); - usedCallSignaturesInstead = true; - - if (this.compilationSettings.noImplicitAny()) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.new_expression_which_lacks_a_constructor_signature_implicitly_has_an_any_type), additionalResults, context); - } - } - - if (constructSignatures.length) { - if (callEx.argumentList && callEx.argumentList.typeArgumentList) { - explicitTypeArgs = []; - - if (callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()) { - for (var i = 0; i < callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount(); i++) { - explicitTypeArgs[i] = this.resolveTypeReference(callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorAt(i), context); - } - } - } - - if (targetTypeSymbol.isGeneric()) { - var resolvedSignatures = []; - var inferredOrExplicitTypeArgs; - var specializedSignature; - var typeParameters; - var typeConstraint = null; - var triedToInferTypeArgs; - var targetTypeReplacementMap = targetTypeSymbol.getTypeParameterArgumentMap(); - - for (var i = 0; i < constructSignatures.length; i++) { - couldNotAssignToConstraint = false; - - if (constructSignatures[i].isGeneric()) { - typeParameters = constructSignatures[i].getTypeParameters(); - - if (explicitTypeArgs) { - if (explicitTypeArgs.length === typeParameters.length) { - inferredOrExplicitTypeArgs = explicitTypeArgs; - } else { - typeArgumentCountDiagnostic = typeArgumentCountDiagnostic || this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Signature_expected_0_type_arguments_got_1_instead, [typeParameters.length, explicitTypeArgs.length]); - continue; - } - } else if (callEx.argumentList) { - var typeArgumentInferenceContext = new TypeScript.InvocationTypeArgumentInferenceContext(this, context, constructSignatures[i], callEx.argumentList.arguments); - inferredOrExplicitTypeArgs = this.inferArgumentTypesForSignature(typeArgumentInferenceContext, new TypeComparisonInfo(), context); - triedToInferTypeArgs = true; - } else { - inferredOrExplicitTypeArgs = TypeScript.ArrayUtilities.select(typeParameters, function (typeParameter) { - return typeParameter.getDefaultConstraint(_this.semanticInfoChain); - }); - } - - TypeScript.Debug.assert(inferredOrExplicitTypeArgs && inferredOrExplicitTypeArgs.length == typeParameters.length); - - var mutableTypeReplacementMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(targetTypeReplacementMap ? targetTypeReplacementMap : []); - TypeScript.PullInstantiationHelpers.updateMutableTypeParameterArgumentMap(typeParameters, inferredOrExplicitTypeArgs, mutableTypeReplacementMap); - var typeReplacementMap = mutableTypeReplacementMap.typeParameterArgumentMap; - - if (explicitTypeArgs) { - for (var j = 0; j < typeParameters.length; j++) { - typeConstraint = typeParameters[j].getConstraint(); - - if (typeConstraint) { - if (typeConstraint.isGeneric()) { - typeConstraint = this.instantiateType(typeConstraint, typeReplacementMap); - } - - if (!this.sourceIsAssignableToTarget(inferredOrExplicitTypeArgs[j], typeConstraint, targetAST, context, null, true)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(targetAST); - constraintDiagnostic = this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2, [inferredOrExplicitTypeArgs[j].toString(enclosingSymbol, true), typeConstraint.toString(enclosingSymbol, true), typeParameters[j].toString(enclosingSymbol, true)]); - couldNotAssignToConstraint = true; - } - - if (couldNotAssignToConstraint) { - break; - } - } - } - } - - if (couldNotAssignToConstraint) { - continue; - } - - specializedSignature = this.instantiateSignature(constructSignatures[i], typeReplacementMap); - - if (specializedSignature) { - resolvedSignatures[resolvedSignatures.length] = specializedSignature; - } - } else { - if (!(callEx.argumentList && callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount())) { - resolvedSignatures[resolvedSignatures.length] = constructSignatures[i]; - } - } - } - - constructSignatures = resolvedSignatures; - } - - var signature = this.resolveOverloads(callEx, constructSignatures, callEx.argumentList && callEx.argumentList.typeArgumentList !== null, context, diagnostics); - - additionalResults.targetSymbol = targetSymbol; - additionalResults.resolvedSignatures = constructSignatures; - additionalResults.candidateSignature = signature; - additionalResults.actualParametersContextTypeSymbols = []; - - if (!constructSignatures.length) { - if (constraintDiagnostic) { - this.postOverloadResolutionDiagnostics(constraintDiagnostic, additionalResults, context); - } else if (typeArgumentCountDiagnostic) { - this.postOverloadResolutionDiagnostics(typeArgumentCountDiagnostic, additionalResults, context); - } - - return this.getNewErrorTypeSymbol(); - } - - var errorCondition = null; - - if (!signature) { - for (var i = 0; i < diagnostics.length; i++) { - this.postOverloadResolutionDiagnostics(diagnostics[i], additionalResults, context); - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Could_not_select_overload_for_new_expression), additionalResults, context); - - errorCondition = this.getNewErrorTypeSymbol(); - - if (!constructSignatures.length) { - return errorCondition; - } - - signature = constructSignatures[0]; - } - - returnType = signature.returnType; - - if (returnType && !signature.isGeneric() && returnType.isGeneric() && !returnType.getIsSpecialized()) { - if (explicitTypeArgs && explicitTypeArgs.length) { - returnType = this.createInstantiatedType(returnType, explicitTypeArgs); - } else { - returnType = this.instantiateTypeToAny(returnType, context); - } - } - - if (usedCallSignaturesInstead) { - if (returnType !== this.semanticInfoChain.voidTypeSymbol) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Call_signatures_used_in_a_new_expression_must_have_a_void_return_type), additionalResults, context); - - return this.getNewErrorTypeSymbol(); - } else { - returnType = this.semanticInfoChain.anyTypeSymbol; - } - } - - if (!returnType) { - returnType = signature.returnType; - - if (!returnType) { - returnType = targetTypeSymbol; - } - } - - var actualParametersContextTypeSymbols = []; - if (callEx.argumentList && callEx.argumentList.arguments) { - var len = callEx.argumentList.arguments.nonSeparatorCount(); - var params = signature.parameters; - var contextualType = null; - var signatureDecl = signature.getDeclarations()[0]; - - for (var i = 0; i < len; i++) { - if (params.length) { - if (i < params.length - 1 || (i < params.length && !signature.hasVarArgs)) { - this.resolveDeclaredSymbol(params[i], context); - contextualType = params[i].type; - } else if (signature.hasVarArgs) { - contextualType = params[params.length - 1].type; - if (contextualType.isArrayNamedTypeReference()) { - contextualType = contextualType.getElementType(); - } - } - } - - if (contextualType) { - context.pushNewContextualType(contextualType); - actualParametersContextTypeSymbols[i] = contextualType; - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - additionalResults.targetSymbol = targetSymbol; - additionalResults.resolvedSignatures = constructSignatures; - additionalResults.candidateSignature = signature; - additionalResults.actualParametersContextTypeSymbols = actualParametersContextTypeSymbols; - - if (errorCondition) { - return errorCondition; - } - - if (!returnType) { - returnType = this.semanticInfoChain.anyTypeSymbol; - } - - return returnType; - } else if (callEx.argumentList) { - this.resolveAST(callEx.argumentList.arguments, false, context); - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Invalid_new_expression), additionalResults, context); - - return this.getNewErrorTypeSymbol(); - }; - - PullTypeResolver.prototype.instantiateSignatureInContext = function (signatureAToInstantiate, contextualSignatureB, context, shouldFixContextualSignatureParameterTypes) { - var typeReplacementMap = []; - var inferredTypeArgs; - var specializedSignature; - var typeParameters = signatureAToInstantiate.getTypeParameters(); - var typeConstraint = null; - - var typeArgumentInferenceContext = new TypeScript.ContextualSignatureInstantiationTypeArgumentInferenceContext(this, context, signatureAToInstantiate, contextualSignatureB, shouldFixContextualSignatureParameterTypes); - inferredTypeArgs = this.inferArgumentTypesForSignature(typeArgumentInferenceContext, new TypeComparisonInfo(), context); - - var functionTypeA = signatureAToInstantiate.functionType; - var functionTypeB = contextualSignatureB.functionType; - var enclosingTypeParameterMap; - - if (functionTypeA) { - enclosingTypeParameterMap = functionTypeA.getTypeParameterArgumentMap(); - - for (var id in enclosingTypeParameterMap) { - typeReplacementMap[id] = enclosingTypeParameterMap[id]; - } - } - - if (functionTypeB) { - enclosingTypeParameterMap = functionTypeB.getTypeParameterArgumentMap(); - - for (var id in enclosingTypeParameterMap) { - typeReplacementMap[id] = enclosingTypeParameterMap[id]; - } - } - - TypeScript.PullInstantiationHelpers.updateTypeParameterArgumentMap(typeParameters, inferredTypeArgs, typeReplacementMap); - - return this.instantiateSignature(signatureAToInstantiate, typeReplacementMap); - }; - - PullTypeResolver.prototype.resolveCastExpression = function (assertionExpression, context) { - var typeAssertionType = this.resolveTypeReference(assertionExpression.type, context).type; - - if (this.canTypeCheckAST(assertionExpression, context)) { - this.typeCheckCastExpression(assertionExpression, context, typeAssertionType); - } - - return typeAssertionType; - }; - - PullTypeResolver.prototype.typeCheckCastExpression = function (assertionExpression, context, typeAssertionType) { - this.setTypeChecked(assertionExpression, context); - - context.pushNewContextualType(typeAssertionType); - var exprType = this.resolveAST(assertionExpression.expression, true, context).type; - context.popAnyContextualType(); - - this.resolveDeclaredSymbol(typeAssertionType, context); - this.resolveDeclaredSymbol(exprType, context); - - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(exprType, typeAssertionType, assertionExpression, context, comparisonInfo); - - if (!isAssignable) { - var widenedExprType = exprType.widenedType(this, assertionExpression.expression, context); - isAssignable = this.sourceIsAssignableToTarget(typeAssertionType, widenedExprType, assertionExpression, context, comparisonInfo); - } - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(assertionExpression); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(assertionExpression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [exprType.toString(enclosingSymbol), typeAssertionType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(assertionExpression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [exprType.toString(enclosingSymbol), typeAssertionType.toString(enclosingSymbol)])); - } - } - }; - - PullTypeResolver.prototype.resolveAssignmentExpression = function (binaryExpression, context) { - var leftExpr = this.resolveAST(binaryExpression.left, false, context); - var leftType = leftExpr.type; - - context.pushNewContextualType(leftType); - var rightType = this.resolveAST(binaryExpression.right, true, context).type; - context.popAnyContextualType(); - - rightType = this.getInstanceTypeForAssignment(binaryExpression.left, rightType, context); - - if (this.canTypeCheckAST(binaryExpression, context)) { - this.setTypeChecked(binaryExpression, context); - - if (!this.isReference(binaryExpression.left, leftExpr)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_of_assignment_expression)); - } else { - this.checkAssignability(binaryExpression.left, rightType, leftExpr.type, context); - } - } - - return rightType; - }; - - PullTypeResolver.prototype.getInstanceTypeForAssignment = function (lhs, type, context) { - var typeToReturn = type; - if (typeToReturn && typeToReturn.isAlias()) { - typeToReturn = typeToReturn.getExportAssignedTypeSymbol(); - } - - if (typeToReturn && typeToReturn.isContainer() && !typeToReturn.isEnum()) { - var instanceTypeSymbol = typeToReturn.getInstanceType(); - - if (!instanceTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(lhs, TypeScript.DiagnosticCode.Tried_to_set_variable_type_to_uninitialized_module_type_0, [type.toString()])); - typeToReturn = null; - } else { - typeToReturn = instanceTypeSymbol; - } - } - - return typeToReturn; - }; - - PullTypeResolver.prototype.widenType = function (type, ast, context) { - if (type === this.semanticInfoChain.undefinedTypeSymbol || type === this.semanticInfoChain.nullTypeSymbol || type.isError()) { - return this.semanticInfoChain.anyTypeSymbol; - } - - if (type.isArrayNamedTypeReference()) { - return this.widenArrayType(type, ast, context); - } else if (type.kind === 256 /* ObjectLiteral */) { - return this.widenObjectLiteralType(type, ast, context); - } - - return type; - }; - - PullTypeResolver.prototype.widenArrayType = function (type, ast, context) { - var elementType = type.getElementType().widenedType(this, ast, context); - - if (this.compilationSettings.noImplicitAny() && ast) { - if (elementType === this.semanticInfoChain.anyTypeSymbol && type.getElementType() !== this.semanticInfoChain.anyTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Array_Literal_implicitly_has_an_any_type_from_widening)); - } - } - - return this.getArrayType(elementType); - }; - - PullTypeResolver.prototype.widenObjectLiteralType = function (type, ast, context) { - if (!this.needsToWidenObjectLiteralType(type, ast, context)) { - return type; - } - - TypeScript.Debug.assert(type.name === ""); - var newObjectTypeSymbol = new TypeScript.PullTypeSymbol(type.name, type.kind); - var declsOfObjectType = type.getDeclarations(); - TypeScript.Debug.assert(declsOfObjectType.length === 1); - newObjectTypeSymbol.addDeclaration(declsOfObjectType[0]); - var members = type.getMembers(); - - for (var i = 0; i < members.length; i++) { - var memberType = members[i].type; - - var widenedMemberType = members[i].type.widenedType(this, ast, context); - var newMember = new TypeScript.PullSymbol(members[i].name, members[i].kind); - - var declsOfMember = members[i].getDeclarations(); - - newMember.addDeclaration(declsOfMember[0]); - newMember.type = widenedMemberType; - newObjectTypeSymbol.addMember(newMember); - newMember.setResolved(); - - if (this.compilationSettings.noImplicitAny() && ast && widenedMemberType === this.semanticInfoChain.anyTypeSymbol && memberType !== this.semanticInfoChain.anyTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Object_literal_s_property_0_implicitly_has_an_any_type_from_widening, [members[i].name])); - } - } - - var indexers = type.getIndexSignatures(); - for (var i = 0; i < indexers.length; i++) { - var newIndexer = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - var parameter = indexers[i].parameters[0]; - var newParameter = new TypeScript.PullSymbol(parameter.name, parameter.kind); - newParameter.type = parameter.type; - newIndexer.addParameter(newParameter); - newIndexer.returnType = indexers[i].returnType; - newObjectTypeSymbol.addIndexSignature(newIndexer); - } - - return newObjectTypeSymbol; - }; - - PullTypeResolver.prototype.needsToWidenObjectLiteralType = function (type, ast, context) { - var members = type.getMembers(); - for (var i = 0; i < members.length; i++) { - var memberType = members[i].type; - if (memberType !== memberType.widenedType(this, ast, context)) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.findBestCommonType = function (collection, context, comparisonInfo) { - var len = collection.getLength(); - - for (var i = 0; i < len; i++) { - var candidateType = collection.getTypeAtIndex(i); - if (this.typeIsBestCommonTypeCandidate(candidateType, collection, context)) { - return candidateType; - } - } - - return this.semanticInfoChain.emptyTypeSymbol; - }; - - PullTypeResolver.prototype.typeIsBestCommonTypeCandidate = function (candidateType, collection, context) { - for (var i = 0; i < collection.getLength(); i++) { - var otherType = collection.getTypeAtIndex(i); - if (candidateType === otherType) { - continue; - } - - if (!this.sourceIsSubtypeOfTarget(otherType, candidateType, null, context)) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.typesAreIdenticalInEnclosingTypes = function (t1, t2, context) { - t1 = this.getSymbolForRelationshipCheck(t1); - t2 = this.getSymbolForRelationshipCheck(t2); - - if (t1 === t2) { - return true; - } - - if (t1 && t2) { - if (context.oneOfClassificationsIsInfinitelyExpanding()) { - return this.infinitelyExpandingTypesAreIdentical(t1, t2, context); - } - } - - return this.typesAreIdentical(t1, t2, context); - }; - - PullTypeResolver.prototype.typesAreIdenticalWithNewEnclosingTypes = function (t1, t2, context) { - var enclosingTypeWalkerStates = context.resetEnclosingTypeWalkerStates(); - var areTypesIdentical = this.typesAreIdentical(t1, t2, context); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areTypesIdentical; - }; - - PullTypeResolver.prototype.typesAreIdentical = function (t1, t2, context) { - t1 = this.getSymbolForRelationshipCheck(t1); - t2 = this.getSymbolForRelationshipCheck(t2); - - if (t1 === t2) { - return true; - } - - if (!t1 || !t2) { - return false; - } - - if (TypeScript.hasFlag(t1.kind, 64 /* Enum */) || TypeScript.hasFlag(t2.kind, 64 /* Enum */)) { - return false; - } - - if (t1.isPrimitive() && t1.isStringConstant() && t2.isPrimitive() && t2.isStringConstant()) { - return TypeScript.stripStartAndEndQuotes(t1.name) === TypeScript.stripStartAndEndQuotes(t2.name); - } - - if (t1.isPrimitive() || t2.isPrimitive()) { - return false; - } - - if (t1.isError() && t2.isError()) { - return true; - } - - var isIdentical = this.identicalCache.valueAt(t1.pullSymbolID, t2.pullSymbolID); - if (isIdentical != undefined) { - return isIdentical; - } - - if (t1.isTypeParameter() !== t2.isTypeParameter()) { - return false; - } else if (t1.isTypeParameter()) { - var t1ParentDeclaration = t1.getDeclarations()[0].getParentDecl(); - var t2ParentDeclaration = t2.getDeclarations()[0].getParentDecl(); - - if (t1ParentDeclaration === t2ParentDeclaration) { - return this.symbolsShareDeclaration(t1, t2); - } else { - return false; - } - } - - if (t1.isPrimitive() !== t2.isPrimitive()) { - return false; - } - - this.identicalCache.setValueAt(t1.pullSymbolID, t2.pullSymbolID, true); - var statesWhenStartedWalkingTypes = context.startWalkingTypes(t1, t2); - isIdentical = this.typesAreIdenticalWorker(t1, t2, context); - context.endWalkingTypes(statesWhenStartedWalkingTypes); - this.identicalCache.setValueAt(t1.pullSymbolID, t2.pullSymbolID, isIdentical); - - return isIdentical; - }; - - PullTypeResolver.prototype.typesAreIdenticalWorker = function (t1, t2, context) { - if (t1.getIsSpecialized() && t2.getIsSpecialized()) { - if (TypeScript.PullHelpers.getRootType(t1) === TypeScript.PullHelpers.getRootType(t2) && TypeScript.PullHelpers.getRootType(t1).isNamedTypeSymbol()) { - var t1TypeArguments = t1.getTypeArguments(); - var t2TypeArguments = t2.getTypeArguments(); - - if (t1TypeArguments && t2TypeArguments) { - for (var i = 0; i < t1TypeArguments.length; i++) { - if (!this.typesAreIdenticalWithNewEnclosingTypes(t1TypeArguments[i], t2TypeArguments[i], context)) { - return false; - } - } - } - - return true; - } - } - - if (t1.hasMembers() && t2.hasMembers()) { - var t1Members = t1.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - var t2Members = t2.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - - if (t1Members.length !== t2Members.length) { - return false; - } - - var t1MemberSymbol = null; - var t2MemberSymbol = null; - - var t1MemberType = null; - var t2MemberType = null; - - for (var iMember = 0; iMember < t1Members.length; iMember++) { - t1MemberSymbol = t1Members[iMember]; - t2MemberSymbol = this.getNamedPropertySymbol(t1MemberSymbol.name, 68147712 /* SomeValue */, t2); - - if (!this.propertiesAreIdentical(t1MemberSymbol, t2MemberSymbol, context)) { - return false; - } - } - } else if (t1.hasMembers() || t2.hasMembers()) { - return false; - } - - var t1CallSigs = t1.getCallSignatures(); - var t2CallSigs = t2.getCallSignatures(); - - var t1ConstructSigs = t1.getConstructSignatures(); - var t2ConstructSigs = t2.getConstructSignatures(); - - var t1IndexSigs = t1.getIndexSignatures(); - var t2IndexSigs = t2.getIndexSignatures(); - - if (!this.signatureGroupsAreIdentical(t1CallSigs, t2CallSigs, context)) { - return false; - } - - if (!this.signatureGroupsAreIdentical(t1ConstructSigs, t2ConstructSigs, context)) { - return false; - } - - if (!this.signatureGroupsAreIdentical(t1IndexSigs, t2IndexSigs, context)) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.propertiesAreIdentical = function (propertySymbol1, propertySymbol2, context) { - if (!propertySymbol2 || (propertySymbol1.isOptional !== propertySymbol2.isOptional)) { - return false; - } - - var t1MemberSymbolIsPrivate = propertySymbol1.anyDeclHasFlag(2 /* Private */); - var t2MemberSymbolIsPrivate = propertySymbol2.anyDeclHasFlag(2 /* Private */); - - if (t1MemberSymbolIsPrivate !== t2MemberSymbolIsPrivate) { - return false; - } else if (t2MemberSymbolIsPrivate && t1MemberSymbolIsPrivate) { - var t1MemberSymbolDecl = propertySymbol1.getDeclarations()[0]; - var sourceDecl = propertySymbol2.getDeclarations()[0]; - if (t1MemberSymbolDecl !== sourceDecl) { - return false; - } - } - - var t1MemberType = propertySymbol1.type; - var t2MemberType = propertySymbol2.type; - - context.walkMemberTypes(propertySymbol1.name); - var areMemberTypesIdentical = this.typesAreIdenticalInEnclosingTypes(t1MemberType, t2MemberType, context); - context.postWalkMemberTypes(); - return areMemberTypesIdentical; - }; - - PullTypeResolver.prototype.propertiesAreIdenticalWithNewEnclosingTypes = function (type1, type2, property1, property2, context) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(type1, type2); - var arePropertiesIdentical = this.propertiesAreIdentical(property1, property2, context); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return arePropertiesIdentical; - }; - - PullTypeResolver.prototype.signatureGroupsAreIdentical = function (sg1, sg2, context) { - if (sg1 === sg2) { - return true; - } - - if (!sg1 || !sg2) { - return false; - } - - if (sg1.length !== sg2.length) { - return false; - } - - for (var i = 0; i < sg1.length; i++) { - context.walkSignatures(sg1[i].kind, i); - var areSignaturesIdentical = this.signaturesAreIdentical(sg1[i], sg2[i], context, true); - context.postWalkSignatures(); - if (!areSignaturesIdentical) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.typeParametersAreIdentical = function (tp1, tp2, context) { - var typeParamsAreIdentical = this.typeParametersAreIdenticalWorker(tp1, tp2, context); - - this.setTypeParameterIdentity(tp1, tp2, undefined); - - return typeParamsAreIdentical; - }; - - PullTypeResolver.prototype.typeParametersAreIdenticalWorker = function (tp1, tp2, context) { - if (!!(tp1 && tp1.length) !== !!(tp2 && tp2.length)) { - return false; - } - - if (tp1 && tp2 && (tp1.length !== tp2.length)) { - return false; - } - - if (tp1 && tp2) { - for (var i = 0; i < tp1.length; i++) { - context.walkTypeParameterConstraints(i); - var areConstraintsIdentical = this.typesAreIdentical(tp1[i].getConstraint(), tp2[i].getConstraint(), context); - context.postWalkTypeParameterConstraints(); - if (!areConstraintsIdentical) { - return false; - } - } - } - - return true; - }; - - PullTypeResolver.prototype.setTypeParameterIdentity = function (tp1, tp2, val) { - if (tp1 && tp2 && tp1.length === tp2.length) { - for (var i = 0; i < tp1.length; i++) { - this.identicalCache.setValueAt(tp1[i].pullSymbolID, tp2[i].pullSymbolID, val); - } - } - }; - - PullTypeResolver.prototype.signaturesAreIdenticalWithNewEnclosingTypes = function (s1, s2, context, includingReturnType) { - if (typeof includingReturnType === "undefined") { includingReturnType = true; } - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(s1, s2); - var areSignaturesIdentical = this.signaturesAreIdentical(s1, s2, context, includingReturnType); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSignaturesIdentical; - }; - - PullTypeResolver.prototype.signaturesAreIdentical = function (s1, s2, context, includingReturnType) { - if (typeof includingReturnType === "undefined") { includingReturnType = true; } - if (s1 === s2) { - return true; - } - - var signaturesIdentical = this.identicalCache.valueAt(s1.pullSymbolID, s2.pullSymbolID); - if (signaturesIdentical || (signaturesIdentical != undefined && includingReturnType)) { - return signaturesIdentical; - } - - var oldValue = signaturesIdentical; - this.identicalCache.setValueAt(s1.pullSymbolID, s2.pullSymbolID, true); - - signaturesIdentical = this.signaturesAreIdenticalWorker(s1, s2, context, includingReturnType); - - if (includingReturnType) { - this.identicalCache.setValueAt(s1.pullSymbolID, s2.pullSymbolID, signaturesIdentical); - } else { - this.identicalCache.setValueAt(s1.pullSymbolID, s2.pullSymbolID, oldValue); - } - - return signaturesIdentical; - }; - - PullTypeResolver.prototype.signaturesAreIdenticalWorker = function (s1, s2, context, includingReturnType) { - if (typeof includingReturnType === "undefined") { includingReturnType = true; } - if (s1.hasVarArgs !== s2.hasVarArgs) { - return false; - } - - if (s1.nonOptionalParamCount !== s2.nonOptionalParamCount) { - return false; - } - - if (s1.parameters.length !== s2.parameters.length) { - return false; - } - - var s1TypeParameters = s1.getTypeParameters(); - var s2TypeParameters = s2.getTypeParameters(); - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, true); - - var typeParametersParametersAndReturnTypesAreIdentical = this.signatureTypeParametersParametersAndReturnTypesAreIdentical(s1, s2, context, includingReturnType); - - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, undefined); - return typeParametersParametersAndReturnTypesAreIdentical; - }; - - PullTypeResolver.prototype.signatureTypeParametersParametersAndReturnTypesAreIdentical = function (s1, s2, context, includingReturnType) { - if (!this.typeParametersAreIdenticalWorker(s1.getTypeParameters(), s2.getTypeParameters(), context)) { - return false; - } - - if (includingReturnType) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s1); - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s2); - context.walkReturnTypes(); - var areReturnTypesIdentical = this.typesAreIdenticalInEnclosingTypes(s1.returnType, s2.returnType, context); - context.postWalkReturnTypes(); - if (!areReturnTypesIdentical) { - return false; - } - } - - var s1Params = s1.parameters; - var s2Params = s2.parameters; - - for (var iParam = 0; iParam < s1Params.length; iParam++) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s1Params[iParam]); - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s2Params[iParam]); - context.walkParameterTypes(iParam); - var areParameterTypesIdentical = this.typesAreIdenticalInEnclosingTypes(s1Params[iParam].type, s2Params[iParam].type, context); - context.postWalkParameterTypes(); - - if (!areParameterTypesIdentical) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.signatureReturnTypesAreIdentical = function (s1, s2, context) { - var s1TypeParameters = s1.getTypeParameters(); - var s2TypeParameters = s2.getTypeParameters(); - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, true); - - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(s1, s2); - context.walkReturnTypes(); - var returnTypeIsIdentical = this.typesAreIdenticalInEnclosingTypes(s1.returnType, s2.returnType, context); - - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, undefined); - - return returnTypeIsIdentical; - }; - - PullTypeResolver.prototype.symbolsShareDeclaration = function (symbol1, symbol2) { - var decls1 = symbol1.getDeclarations(); - var decls2 = symbol2.getDeclarations(); - - if (decls1.length && decls2.length) { - return decls1[0] === decls2[0]; - } - - return false; - }; - - PullTypeResolver.prototype.sourceIsSubtypeOfTarget = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - return this.sourceIsRelatableToTarget(source, target, false, this.subtypeCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.sourceMembersAreAssignableToTargetMembers = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceMembersAreAssignableToTargetMembers = this.sourceMembersAreRelatableToTargetMembers(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceMembersAreAssignableToTargetMembers; - }; - - PullTypeResolver.prototype.sourcePropertyIsAssignableToTargetProperty = function (source, target, sourceProp, targetProp, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var isSourcePropertyIsAssignableToTargetProperty = this.sourcePropertyIsRelatableToTargetProperty(source, target, sourceProp, targetProp, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return isSourcePropertyIsAssignableToTargetProperty; - }; - - PullTypeResolver.prototype.sourceCallSignaturesAreAssignableToTargetCallSignatures = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceCallSignaturesAssignableToTargetCallSignatures = this.sourceCallSignaturesAreRelatableToTargetCallSignatures(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceCallSignaturesAssignableToTargetCallSignatures; - }; - - PullTypeResolver.prototype.sourceConstructSignaturesAreAssignableToTargetConstructSignatures = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceConstructSignaturesAssignableToTargetConstructSignatures = this.sourceConstructSignaturesAreRelatableToTargetConstructSignatures(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceConstructSignaturesAssignableToTargetConstructSignatures; - }; - - PullTypeResolver.prototype.sourceIndexSignaturesAreAssignableToTargetIndexSignatures = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceIndexSignaturesAssignableToTargetIndexSignatures = this.sourceIndexSignaturesAreRelatableToTargetIndexSignatures(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceIndexSignaturesAssignableToTargetIndexSignatures; - }; - - PullTypeResolver.prototype.typeIsAssignableToFunction = function (source, ast, context) { - if (source.isFunctionType()) { - return true; - } - - return this.cachedFunctionInterfaceType() && this.sourceIsAssignableToTarget(source, this.cachedFunctionInterfaceType(), ast, context); - }; - - PullTypeResolver.prototype.signatureIsAssignableToTarget = function (s1, s2, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(s1, s2); - var isSignatureIsAssignableToTarget = this.signatureIsRelatableToTarget(s1, s2, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return isSignatureIsAssignableToTarget; - }; - - PullTypeResolver.prototype.sourceIsAssignableToTarget = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - return this.sourceIsRelatableToTarget(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.sourceIsAssignableToTargetWithNewEnclosingTypes = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - return this.sourceIsRelatableToTargetWithNewEnclosingTypes(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.getSymbolForRelationshipCheck = function (symbol) { - if (symbol && symbol.isTypeReference()) { - return symbol.getReferencedTypeSymbol(); - } - - return symbol; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetInEnclosingTypes = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - source = this.getSymbolForRelationshipCheck(source); - target = this.getSymbolForRelationshipCheck(target); - - if (source === target) { - return true; - } - - if (source && target) { - if (context.oneOfClassificationsIsInfinitelyExpanding()) { - return this.infinitelyExpandingSourceTypeIsRelatableToTargetType(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - } - } - - return this.sourceIsRelatableToTarget(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetWithNewEnclosingTypes = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.resetEnclosingTypeWalkerStates(); - var isSourceRelatable = this.sourceIsRelatableToTarget(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return isSourceRelatable; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetInCache = function (source, target, comparisonCache, comparisonInfo) { - var isRelatable = comparisonCache.valueAt(source.pullSymbolID, target.pullSymbolID); - - if (isRelatable) { - return { isRelatable: isRelatable }; - } - - if (isRelatable != undefined && !comparisonInfo) { - return { isRelatable: isRelatable }; - } - - return null; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTarget = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - source = this.getSymbolForRelationshipCheck(source); - target = this.getSymbolForRelationshipCheck(target); - - if (source === target) { - return true; - } - - if (!(source && target)) { - return true; - } - - var sourceApparentType = this.getApparentType(source); - - var isRelatableInfo = this.sourceIsRelatableToTargetInCache(source, target, comparisonCache, comparisonInfo); - if (isRelatableInfo) { - return isRelatableInfo.isRelatable; - } - - if (source === this.semanticInfoChain.stringTypeSymbol && target.isPrimitive() && target.isStringConstant()) { - return comparisonInfo && comparisonInfo.stringConstantVal && (comparisonInfo.stringConstantVal.kind() === 14 /* StringLiteral */) && (TypeScript.stripStartAndEndQuotes(comparisonInfo.stringConstantVal.text()) === TypeScript.stripStartAndEndQuotes(target.name)); - } - - if (assignableTo) { - if (this.isAnyOrEquivalent(source) || this.isAnyOrEquivalent(target)) { - return true; - } - } else { - if (this.isAnyOrEquivalent(target)) { - return true; - } - } - - if (target === this.semanticInfoChain.stringTypeSymbol && source.isPrimitive() && source.isStringConstant()) { - return true; - } - - if (source.isPrimitive() && source.isStringConstant() && target.isPrimitive() && target.isStringConstant()) { - return TypeScript.stripStartAndEndQuotes(source.name) === TypeScript.stripStartAndEndQuotes(target.name); - } - - if (source === this.semanticInfoChain.undefinedTypeSymbol) { - return true; - } - - if ((source === this.semanticInfoChain.nullTypeSymbol) && (target !== this.semanticInfoChain.undefinedTypeSymbol && target != this.semanticInfoChain.voidTypeSymbol)) { - return true; - } - - if (target === this.semanticInfoChain.voidTypeSymbol) { - if (source === this.semanticInfoChain.undefinedTypeSymbol || source == this.semanticInfoChain.nullTypeSymbol) { - return true; - } - - return false; - } else if (source === this.semanticInfoChain.voidTypeSymbol) { - if (target === this.semanticInfoChain.anyTypeSymbol) { - return true; - } - - return false; - } - - if (target === this.semanticInfoChain.numberTypeSymbol && TypeScript.PullHelpers.symbolIsEnum(source)) { - return true; - } - - if (source === this.semanticInfoChain.numberTypeSymbol && TypeScript.PullHelpers.symbolIsEnum(target)) { - return assignableTo; - } - - if (TypeScript.PullHelpers.symbolIsEnum(target) && TypeScript.PullHelpers.symbolIsEnum(source)) { - return this.symbolsShareDeclaration(target, source); - } - - if ((source.kind & 64 /* Enum */) || (target.kind & 64 /* Enum */)) { - return false; - } - - if (source.getIsSpecialized() && target.getIsSpecialized()) { - if (TypeScript.PullHelpers.getRootType(source) === TypeScript.PullHelpers.getRootType(target) && TypeScript.PullHelpers.getRootType(source).isNamedTypeSymbol()) { - var sourceTypeArguments = source.getTypeArguments(); - var targetTypeArguments = target.getTypeArguments(); - - if (sourceTypeArguments && targetTypeArguments) { - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, true); - - for (var i = 0; i < sourceTypeArguments.length; i++) { - if (!this.sourceIsRelatableToTargetWithNewEnclosingTypes(sourceTypeArguments[i], targetTypeArguments[i], assignableTo, comparisonCache, ast, context, null, isComparingInstantiatedSignatures)) { - break; - } - } - - if (i === sourceTypeArguments.length) { - return true; - } else { - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, undefined); - } - } - } - } - - if (target.isTypeParameter()) { - if (source.isTypeParameter()) { - if (!source.getConstraint()) { - return this.typesAreIdentical(target, source, context); - } else { - return this.isSourceTypeParameterConstrainedToTargetTypeParameter(source, target); - } - } else { - if (isComparingInstantiatedSignatures) { - target = target.getBaseConstraint(this.semanticInfoChain); - } else { - return this.typesAreIdentical(target, sourceApparentType, context); - } - } - } - - if (sourceApparentType.isPrimitive() || target.isPrimitive()) { - return false; - } - - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, true); - - var symbolsWhenStartedWalkingTypes = context.startWalkingTypes(sourceApparentType, target); - var isRelatable = this.sourceIsRelatableToTargetWorker(sourceApparentType, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.endWalkingTypes(symbolsWhenStartedWalkingTypes); - - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, isRelatable); - return isRelatable; - }; - - PullTypeResolver.prototype.isSourceTypeParameterConstrainedToTargetTypeParameter = function (source, target) { - var current = source; - while (current && current.isTypeParameter()) { - if (current === target) { - return true; - } - - current = current.getConstraint(); - } - return false; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetWorker = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - if (target.hasMembers() && !this.sourceMembersAreRelatableToTargetMembers(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - if (!this.sourceCallSignaturesAreRelatableToTargetCallSignatures(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - if (!this.sourceConstructSignaturesAreRelatableToTargetConstructSignatures(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - if (!this.sourceIndexSignaturesAreRelatableToTargetIndexSignatures(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.sourceMembersAreRelatableToTargetMembers = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetProps = target.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - - for (var itargetProp = 0; itargetProp < targetProps.length; itargetProp++) { - var targetProp = targetProps[itargetProp]; - - var sourceProp = this._getNamedPropertySymbolOfAugmentedType(targetProp.name, source); - - this.resolveDeclaredSymbol(targetProp, context); - - var targetPropType = targetProp.type; - - if (!sourceProp) { - if (!(targetProp.isOptional)) { - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.flags |= 2 /* RequiredPropertyIsMissing */; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_0_is_missing_property_1_from_type_2, [source.toString(enclosingSymbol), targetProp.getScopedNameEx().toString(), target.toString(enclosingSymbol)])); - } - return false; - } - continue; - } - - if (!this.sourcePropertyIsRelatableToTargetProperty(source, target, sourceProp, targetProp, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.infinitelyExpandingSourceTypeIsRelatableToTargetType = function (sourceType, targetType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var widenedTargetType = targetType.widenedType(this, null, context); - var widenedSourceType = sourceType.widenedType(this, null, context); - - if ((widenedSourceType !== this.semanticInfoChain.anyTypeSymbol) && (widenedTargetType !== this.semanticInfoChain.anyTypeSymbol)) { - var sourceTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(sourceType); - var targetTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(targetType); - - if (sourceTypeNamedTypeReference !== targetTypeNamedTypeReference) { - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_do_not_refer_to_same_named_type, [sourceType.getScopedNameEx(enclosingSymbol).toString(), targetType.toString(enclosingSymbol)])); - } - return false; - } - - var sourceTypeArguments = sourceType.getTypeArguments(); - var targetTypeArguments = targetType.getTypeArguments(); - - if (!sourceTypeArguments && !targetTypeArguments) { - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, true); - return true; - } - - if (!(sourceTypeArguments && targetTypeArguments) || sourceTypeArguments.length !== targetTypeArguments.length) { - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments, [sourceType.toString(enclosingSymbol), targetType.toString(enclosingSymbol)])); - } - return false; - } - - var comparisonInfoTypeArgumentsCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoTypeArgumentsCheck = new TypeComparisonInfo(comparisonInfo); - } - var isRelatable = true; - for (var i = 0; i < sourceTypeArguments.length && isRelatable; i++) { - context.walkTypeArgument(i); - - if (!this.sourceIsRelatableToTargetInEnclosingTypes(sourceTypeArguments[i], targetTypeArguments[i], assignableTo, comparisonCache, ast, context, comparisonInfoTypeArgumentsCheck, isComparingInstantiatedSignatures)) { - isRelatable = false; - if (comparisonInfo) { - var message; - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - - if (comparisonInfoTypeArgumentsCheck && comparisonInfoTypeArgumentsCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments_NL_2, [sourceType.toString(enclosingSymbol), targetType.toString(enclosingSymbol), comparisonInfoTypeArgumentsCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments, [sourceType.toString(enclosingSymbol), targetType.toString(enclosingSymbol)]); - } - comparisonInfo.addMessage(message); - } - } - - context.postWalkTypeArgument(); - } - } - - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, isRelatable); - return isRelatable; - }; - - PullTypeResolver.prototype.infinitelyExpandingTypesAreIdentical = function (sourceType, targetType, context) { - var widenedTargetType = targetType.widenedType(this, null, null); - var widenedSourceType = sourceType.widenedType(this, null, null); - - if ((widenedSourceType !== this.semanticInfoChain.anyTypeSymbol) && (widenedTargetType !== this.semanticInfoChain.anyTypeSymbol)) { - var sourceTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(sourceType); - var targetTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(targetType); - if (sourceTypeNamedTypeReference !== targetTypeNamedTypeReference) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - return false; - } - - var sourceTypeArguments = sourceType.getTypeArguments(); - var targetTypeArguments = targetType.getTypeArguments(); - - if (!sourceTypeArguments && !targetTypeArguments) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, true); - return true; - } - - if (!(sourceTypeArguments && targetTypeArguments) || sourceTypeArguments.length !== targetTypeArguments.length) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - return false; - } - - for (var i = 0; i < sourceTypeArguments.length; i++) { - context.walkTypeArgument(i); - var areIdentical = this.typesAreIdenticalInEnclosingTypes(sourceTypeArguments[i], targetTypeArguments[i], context); - context.postWalkTypeArgument(); - - if (!areIdentical) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - return false; - } - } - } - - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, true); - return true; - }; - - PullTypeResolver.prototype.sourcePropertyIsRelatableToTargetProperty = function (source, target, sourceProp, targetProp, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var _this = this; - var sourceAndTargetAreConstructors = source.isConstructor() && target.isConstructor(); - - var getNames = function (takeTypesFromPropertyContainers) { - var enclosingSymbol = _this.getEnclosingSymbolForAST(ast); - var sourceType = takeTypesFromPropertyContainers ? sourceProp.getContainer() : source; - var targetType = takeTypesFromPropertyContainers ? targetProp.getContainer() : target; - if (sourceAndTargetAreConstructors) { - sourceType = sourceType.getAssociatedContainerType(); - targetType = targetType.getAssociatedContainerType(); - } - return { - propertyName: targetProp.getScopedNameEx().toString(), - sourceTypeName: sourceType.toString(enclosingSymbol), - targetTypeName: targetType.toString(enclosingSymbol) - }; - }; - - var targetPropIsPrivate = targetProp.anyDeclHasFlag(2 /* Private */); - var sourcePropIsPrivate = sourceProp.anyDeclHasFlag(2 /* Private */); - - if (targetPropIsPrivate !== sourcePropIsPrivate) { - if (comparisonInfo) { - var names = getNames(true); - var code; - if (targetPropIsPrivate) { - code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Static_property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2 : TypeScript.DiagnosticCode.Property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2; - } else { - code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Static_property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2 : TypeScript.DiagnosticCode.Property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2; - } - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(code, [names.propertyName, names.sourceTypeName, names.targetTypeName])); - comparisonInfo.flags |= 128 /* InconsistantPropertyAccesibility */; - } - return false; - } else if (sourcePropIsPrivate && targetPropIsPrivate) { - var targetDecl = targetProp.getDeclarations()[0]; - var sourceDecl = sourceProp.getDeclarations()[0]; - - if (targetDecl !== sourceDecl) { - if (comparisonInfo) { - var names = getNames(true); - - comparisonInfo.flags |= 128 /* InconsistantPropertyAccesibility */; - var code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Types_0_and_1_define_static_property_2_as_private : TypeScript.DiagnosticCode.Types_0_and_1_define_property_2_as_private; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(code, [names.sourceTypeName, names.targetTypeName, names.propertyName])); - } - - return false; - } - } - - if (sourceProp.isOptional && !targetProp.isOptional) { - if (comparisonInfo) { - var names = getNames(true); - comparisonInfo.flags |= 2 /* RequiredPropertyIsMissing */; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Property_0_defined_as_optional_in_type_1_but_is_required_in_type_2, [names.propertyName, names.sourceTypeName, names.targetTypeName])); - } - return false; - } - - this.resolveDeclaredSymbol(sourceProp, context); - - var sourcePropType = sourceProp.type; - var targetPropType = targetProp.type; - - var isRelatableInfo = this.sourceIsRelatableToTargetInCache(sourcePropType, targetPropType, comparisonCache, comparisonInfo); - if (isRelatableInfo) { - return isRelatableInfo.isRelatable; - } - - var comparisonInfoPropertyTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoPropertyTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - context.walkMemberTypes(targetProp.name); - var isSourcePropertyRelatableToTargetProperty = this.sourceIsRelatableToTargetInEnclosingTypes(sourcePropType, targetPropType, assignableTo, comparisonCache, ast, context, comparisonInfoPropertyTypeCheck, isComparingInstantiatedSignatures); - context.postWalkMemberTypes(); - - if (!isSourcePropertyRelatableToTargetProperty && comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.flags |= 32 /* IncompatiblePropertyTypes */; - var message; - var names = getNames(false); - if (comparisonInfoPropertyTypeCheck && comparisonInfoPropertyTypeCheck.message) { - var code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Types_of_static_property_0_of_class_1_and_class_2_are_incompatible_NL_3 : TypeScript.DiagnosticCode.Types_of_property_0_of_types_1_and_2_are_incompatible_NL_3; - message = TypeScript.getDiagnosticMessage(code, [names.propertyName, names.sourceTypeName, names.targetTypeName, comparisonInfoPropertyTypeCheck.message]); - } else { - var code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Types_of_static_property_0_of_class_1_and_class_2_are_incompatible : TypeScript.DiagnosticCode.Types_of_property_0_of_types_1_and_2_are_incompatible; - message = TypeScript.getDiagnosticMessage(code, [names.propertyName, names.sourceTypeName, names.targetTypeName]); - } - comparisonInfo.addMessage(message); - } - - return isSourcePropertyRelatableToTargetProperty; - }; - - PullTypeResolver.prototype.sourceCallSignaturesAreRelatableToTargetCallSignatures = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetCallSigs = target.getCallSignatures(); - - if (targetCallSigs.length) { - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - var sourceCallSigs = source.getCallSignatures(); - if (!this.signatureGroupIsRelatableToTarget(source, target, sourceCallSigs, targetCallSigs, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures)) { - if (comparisonInfo) { - var message; - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - if (sourceCallSigs.length && targetCallSigs.length) { - if (comparisonInfoSignatuesTypeCheck && comparisonInfoSignatuesTypeCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Call_signatures_of_types_0_and_1_are_incompatible_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfoSignatuesTypeCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Call_signatures_of_types_0_and_1_are_incompatible, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)]); - } - } else { - var hasSig = targetCallSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - var lacksSig = !targetCallSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_0_requires_a_call_signature_but_type_1_lacks_one, [hasSig, lacksSig]); - } - comparisonInfo.flags |= 4 /* IncompatibleSignatures */; - comparisonInfo.addMessage(message); - } - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.sourceConstructSignaturesAreRelatableToTargetConstructSignatures = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetConstructSigs = target.getConstructSignatures(); - if (targetConstructSigs.length) { - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - var sourceConstructSigs = source.getConstructSignatures(); - if (!this.signatureGroupIsRelatableToTarget(source, target, sourceConstructSigs, targetConstructSigs, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures)) { - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - var message; - if (sourceConstructSigs.length && targetConstructSigs.length) { - if (comparisonInfoSignatuesTypeCheck && comparisonInfoSignatuesTypeCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Construct_signatures_of_types_0_and_1_are_incompatible_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfoSignatuesTypeCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Construct_signatures_of_types_0_and_1_are_incompatible, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)]); - } - } else { - var hasSig = targetConstructSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - var lacksSig = !targetConstructSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_0_requires_a_construct_signature_but_type_1_lacks_one, [hasSig, lacksSig]); - } - comparisonInfo.flags |= 4 /* IncompatibleSignatures */; - comparisonInfo.addMessage(message); - } - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.sourceIndexSignaturesAreRelatableToTargetIndexSignatures = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetIndexSigs = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(target, context); - var targetStringSig = targetIndexSigs.stringSignature; - var targetNumberSig = targetIndexSigs.numericSignature; - - if (targetStringSig || targetNumberSig) { - var sourceIndexSigs = this.getBothKindsOfIndexSignaturesIncludingAugmentedType(source, context); - var enclosingTypeIndexSigs = context.getBothKindOfIndexSignatures(true, false); - var sourceStringSig = sourceIndexSigs.stringSignature; - var sourceNumberSig = sourceIndexSigs.numericSignature; - - var comparable = true; - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - if (targetStringSig) { - if (sourceStringSig) { - context.walkIndexSignatureReturnTypes(enclosingTypeIndexSigs, true, true); - comparable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceStringSig.returnType, targetStringSig.returnType, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures); - context.postWalkIndexSignatureReturnTypes(); - } else { - comparable = false; - } - } - - if (comparable && targetNumberSig) { - if (sourceNumberSig) { - context.walkIndexSignatureReturnTypes(enclosingTypeIndexSigs, false, false); - comparable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceNumberSig.returnType, targetNumberSig.returnType, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures); - context.postWalkIndexSignatureReturnTypes(); - } else if (sourceStringSig) { - context.walkIndexSignatureReturnTypes(enclosingTypeIndexSigs, true, false); - comparable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceStringSig.returnType, targetNumberSig.returnType, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures); - context.postWalkIndexSignatureReturnTypes(); - } else { - comparable = false; - } - } - - if (!comparable) { - if (comparisonInfo) { - var message; - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - if (comparisonInfoSignatuesTypeCheck && comparisonInfoSignatuesTypeCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Index_signatures_of_types_0_and_1_are_incompatible_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfoSignatuesTypeCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Index_signatures_of_types_0_and_1_are_incompatible, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)]); - } - comparisonInfo.flags |= 4 /* IncompatibleSignatures */; - comparisonInfo.addMessage(message); - } - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.signatureGroupIsRelatableToTarget = function (source, target, sourceSG, targetSG, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - if (sourceSG === targetSG) { - return true; - } - - if (!(sourceSG.length && targetSG.length)) { - return false; - } - - var foundMatch = false; - - var targetExcludeDefinition = targetSG.length > 1; - var sourceExcludeDefinition = sourceSG.length > 1; - var sigsCompared = 0; - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo, true); - comparisonInfoSignatuesTypeCheck.message = comparisonInfo.message; - } - for (var iMSig = 0; iMSig < targetSG.length; iMSig++) { - var mSig = targetSG[iMSig]; - - if (mSig.isStringConstantOverloadSignature() || (targetExcludeDefinition && mSig.isDefinition())) { - continue; - } - - for (var iNSig = 0; iNSig < sourceSG.length; iNSig++) { - var nSig = sourceSG[iNSig]; - - if (nSig.isStringConstantOverloadSignature() || (sourceExcludeDefinition && nSig.isDefinition())) { - continue; - } - - context.walkSignatures(nSig.kind, iNSig, iMSig); - var isSignatureRelatableToTarget = this.signatureIsRelatableToTarget(nSig, mSig, assignableTo, comparisonCache, ast, context, sigsCompared == 0 ? comparisonInfoSignatuesTypeCheck : null, isComparingInstantiatedSignatures); - context.postWalkSignatures(); - - sigsCompared++; - - if (isSignatureRelatableToTarget) { - foundMatch = true; - break; - } - } - - if (foundMatch) { - foundMatch = false; - continue; - } - - if (comparisonInfo && sigsCompared == 1) { - comparisonInfo.message = comparisonInfoSignatuesTypeCheck.message; - } - - return false; - } - - return true; - }; - - PullTypeResolver.prototype.signatureIsRelatableToTarget = function (sourceSig, targetSig, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var isRelatableInfo = this.sourceIsRelatableToTargetInCache(sourceSig, targetSig, comparisonCache, comparisonInfo); - if (isRelatableInfo) { - return isRelatableInfo.isRelatable; - } - - comparisonCache.setValueAt(sourceSig.pullSymbolID, targetSig.pullSymbolID, true); - var isRelatable = this.signatureIsRelatableToTargetWorker(sourceSig, targetSig, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - comparisonCache.setValueAt(sourceSig.pullSymbolID, targetSig.pullSymbolID, isRelatable); - return isRelatable; - }; - - PullTypeResolver.prototype.signatureIsRelatableToTargetWorker = function (sourceSig, targetSig, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var _this = this; - var sourceParameters = sourceSig.parameters; - var targetParameters = targetSig.parameters; - - if (!sourceParameters || !targetParameters) { - return false; - } - - var targetNonOptionalParamCount = targetSig.nonOptionalParamCount; - var sourceNonOptionalParamCount = sourceSig.nonOptionalParamCount; - - if (!targetSig.hasVarArgs && sourceNonOptionalParamCount > targetParameters.length) { - if (comparisonInfo) { - comparisonInfo.flags |= 3 /* SourceSignatureHasTooManyParameters */; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Call_signature_expects_0_or_fewer_parameters, [targetParameters.length])); - } - return false; - } - - if (this.signaturesAreIdentical(sourceSig, targetSig, context)) { - return true; - } - - if (targetSig.isGeneric()) { - targetSig = this.instantiateSignatureToAny(targetSig); - } - - if (sourceSig.isGeneric()) { - sourceSig = this.instantiateSignatureToAny(sourceSig); - } - - var sourceReturnType = sourceSig.returnType; - var targetReturnType = targetSig.returnType; - - if (targetReturnType !== this.semanticInfoChain.voidTypeSymbol) { - context.walkReturnTypes(); - var returnTypesAreRelatable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceReturnType, targetReturnType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.postWalkReturnTypes(); - if (!returnTypesAreRelatable) { - if (comparisonInfo) { - comparisonInfo.flags |= 16 /* IncompatibleReturnTypes */; - } - - return false; - } - } - - return targetSig.forAllCorrespondingParameterTypesInThisAndOtherSignature(sourceSig, function (targetParamType, sourceParamType, iParam) { - context.walkParameterTypes(iParam); - var areParametersRelatable = _this.sourceIsRelatableToTargetInEnclosingTypes(sourceParamType, targetParamType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - if (!areParametersRelatable) { - context.swapEnclosingTypeWalkers(); - areParametersRelatable = _this.sourceIsRelatableToTargetInEnclosingTypes(targetParamType, sourceParamType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.swapEnclosingTypeWalkers(); - } - context.postWalkParameterTypes(); - - if (!areParametersRelatable) { - if (comparisonInfo) { - comparisonInfo.flags |= 64 /* IncompatibleParameterTypes */; - } - } - - return areParametersRelatable; - }); - }; - - PullTypeResolver.prototype.resolveOverloads = function (application, group, haveTypeArgumentsAtCallSite, context, diagnostics) { - var _this = this; - var hasOverloads = group.length > 1; - var comparisonInfo = new TypeComparisonInfo(); - var args = application.argumentList ? application.argumentList.arguments : null; - - var initialCandidates = TypeScript.ArrayUtilities.where(group, function (signature) { - if (hasOverloads && signature.isDefinition()) { - return false; - } - - var rootSignature = signature.getRootSymbol(); - if (haveTypeArgumentsAtCallSite && !rootSignature.isGeneric()) { - return false; - } - - return _this.overloadHasCorrectArity(signature, args); - }); - - var firstAssignableButNotSupertypeSignature = null; - var firstAssignableWithProvisionalErrorsSignature = null; - - for (var i = 0; i < initialCandidates.length; i++) { - var applicability = this.overloadIsApplicable(initialCandidates[i], args, context, comparisonInfo); - if (applicability === 3 /* Subtype */) { - return initialCandidates[i]; - } else if (applicability === 2 /* AssignableWithNoProvisionalErrors */ && !firstAssignableButNotSupertypeSignature) { - firstAssignableButNotSupertypeSignature = initialCandidates[i]; - } else if (applicability === 1 /* AssignableButWithProvisionalErrors */ && !firstAssignableWithProvisionalErrorsSignature) { - firstAssignableWithProvisionalErrorsSignature = initialCandidates[i]; - } - } - - if (firstAssignableButNotSupertypeSignature || firstAssignableWithProvisionalErrorsSignature) { - return firstAssignableButNotSupertypeSignature || firstAssignableWithProvisionalErrorsSignature; - } else { - var target = this.getCallTargetErrorSpanAST(application); - if (comparisonInfo.message) { - diagnostics.push(this.semanticInfoChain.diagnosticFromAST(target, TypeScript.DiagnosticCode.Supplied_parameters_do_not_match_any_signature_of_call_target_NL_0, [comparisonInfo.message])); - } else { - diagnostics.push(this.semanticInfoChain.diagnosticFromAST(target, TypeScript.DiagnosticCode.Supplied_parameters_do_not_match_any_signature_of_call_target, null)); - } - } - - return null; - }; - - PullTypeResolver.prototype.getCallTargetErrorSpanAST = function (callEx) { - return (callEx.expression.kind() === 212 /* MemberAccessExpression */) ? callEx.expression.name : callEx.expression; - }; - - PullTypeResolver.prototype.overloadHasCorrectArity = function (signature, args) { - if (args == null) { - return signature.nonOptionalParamCount === 0; - } - - var numberOfArgs = (args.nonSeparatorCount() && args.nonSeparatorCount() === args.separatorCount()) ? args.separatorCount() + 1 : args.nonSeparatorCount(); - if (numberOfArgs < signature.nonOptionalParamCount) { - return false; - } - if (!signature.hasVarArgs && numberOfArgs > signature.parameters.length) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.overloadIsApplicable = function (signature, args, context, comparisonInfo) { - if (args === null) { - return 3 /* Subtype */; - } - - var isInVarArg = false; - var parameters = signature.parameters; - var paramType = null; - - var overloadApplicability = 3 /* Subtype */; - - for (var i = 0; i < args.nonSeparatorCount(); i++) { - if (!isInVarArg) { - this.resolveDeclaredSymbol(parameters[i], context); - - if (parameters[i].isVarArg) { - paramType = parameters[i].type.getElementType() || this.getNewErrorTypeSymbol(parameters[i].type.getName()); - isInVarArg = true; - } else { - paramType = parameters[i].type; - } - } - - var statusOfCurrentArgument = this.overloadIsApplicableForArgument(paramType, args.nonSeparatorAt(i), i, context, comparisonInfo); - - if (statusOfCurrentArgument === 0 /* NotAssignable */) { - return 0 /* NotAssignable */; - } else if (statusOfCurrentArgument === 1 /* AssignableButWithProvisionalErrors */) { - overloadApplicability = 1 /* AssignableButWithProvisionalErrors */; - } else if (overloadApplicability !== 1 /* AssignableButWithProvisionalErrors */ && statusOfCurrentArgument === 2 /* AssignableWithNoProvisionalErrors */) { - overloadApplicability = 2 /* AssignableWithNoProvisionalErrors */; - } - } - - return overloadApplicability; - }; - - PullTypeResolver.prototype.overloadIsApplicableForArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - if (paramType.isAny()) { - return 3 /* Subtype */; - } else if (paramType.isError()) { - return 1 /* AssignableButWithProvisionalErrors */; - } else if (arg.kind() === 219 /* SimpleArrowFunctionExpression */) { - var simpleArrowFunction = arg; - return this.overloadIsApplicableForAnyFunctionExpressionArgument(paramType, arg, null, TypeScript.ASTHelpers.parametersFromIdentifier(simpleArrowFunction.identifier), null, simpleArrowFunction.block, simpleArrowFunction.expression, argIndex, context, comparisonInfo); - } else if (arg.kind() === 218 /* ParenthesizedArrowFunctionExpression */) { - var arrowFunction = arg; - return this.overloadIsApplicableForAnyFunctionExpressionArgument(paramType, arg, arrowFunction.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(arrowFunction.callSignature.parameterList), TypeScript.ASTHelpers.getType(arrowFunction), arrowFunction.block, arrowFunction.expression, argIndex, context, comparisonInfo); - } else if (arg.kind() === 222 /* FunctionExpression */) { - var functionExpression = arg; - return this.overloadIsApplicableForAnyFunctionExpressionArgument(paramType, arg, functionExpression.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(functionExpression.callSignature.parameterList), TypeScript.ASTHelpers.getType(functionExpression), functionExpression.block, null, argIndex, context, comparisonInfo); - } else if (arg.kind() === 215 /* ObjectLiteralExpression */) { - return this.overloadIsApplicableForObjectLiteralArgument(paramType, arg, argIndex, context, comparisonInfo); - } else if (arg.kind() === 214 /* ArrayLiteralExpression */) { - return this.overloadIsApplicableForArrayLiteralArgument(paramType, arg, argIndex, context, comparisonInfo); - } else { - return this.overloadIsApplicableForOtherArgument(paramType, arg, argIndex, context, comparisonInfo); - } - }; - - PullTypeResolver.prototype.overloadIsApplicableForAnyFunctionExpressionArgument = function (paramType, arg, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, argIndex, context, comparisonInfo) { - if (this.cachedFunctionInterfaceType() && paramType === this.cachedFunctionInterfaceType()) { - return 2 /* AssignableWithNoProvisionalErrors */; - } - - context.pushProvisionalType(paramType); - - var argSym = this.resolveAnyFunctionExpression(arg, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, true, context); - - var applicabilityStatus = this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - - context.popAnyContextualType(); - - return applicabilityStatus; - }; - - PullTypeResolver.prototype.overloadIsApplicableForObjectLiteralArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - if (this.cachedObjectInterfaceType() && paramType === this.cachedObjectInterfaceType()) { - return 2 /* AssignableWithNoProvisionalErrors */; - } - - context.pushProvisionalType(paramType); - var argSym = this.resolveObjectLiteralExpression(arg, true, context); - - var applicabilityStatus = this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - - context.popAnyContextualType(); - - return applicabilityStatus; - }; - - PullTypeResolver.prototype.overloadIsApplicableForArrayLiteralArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - if (paramType === this.cachedArrayInterfaceType()) { - return 2 /* AssignableWithNoProvisionalErrors */; - } - - context.pushProvisionalType(paramType); - var argSym = this.resolveArrayLiteralExpression(arg, true, context); - - var applicabilityStatus = this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - - context.popAnyContextualType(); - - return applicabilityStatus; - }; - - PullTypeResolver.prototype.overloadIsApplicableForOtherArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - var argSym = this.resolveAST(arg, false, context); - - if (argSym.type.isAlias()) { - var aliasSym = argSym.type; - argSym = aliasSym.getExportAssignedTypeSymbol(); - } - - comparisonInfo.stringConstantVal = arg; - return this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - }; - - PullTypeResolver.prototype.overloadIsApplicableForArgumentHelper = function (paramType, argSym, argumentIndex, comparisonInfo, arg, context) { - var tempComparisonInfo = new TypeComparisonInfo(); - tempComparisonInfo.stringConstantVal = comparisonInfo.stringConstantVal; - if (!context.hasProvisionalErrors() && this.sourceIsSubtypeOfTarget(argSym.type, paramType, arg, context, tempComparisonInfo)) { - return 3 /* Subtype */; - } - - if (this.sourceIsAssignableToTarget(argSym.type, paramType, arg, context, comparisonInfo.message ? tempComparisonInfo : comparisonInfo)) { - return context.hasProvisionalErrors() ? 1 /* AssignableButWithProvisionalErrors */ : 2 /* AssignableWithNoProvisionalErrors */; - } - - if (!comparisonInfo.message) { - var enclosingSymbol = this.getEnclosingSymbolForAST(arg); - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Could_not_apply_type_0_to_argument_1_which_is_of_type_2, [paramType.toString(enclosingSymbol), (argumentIndex + 1), argSym.getTypeName(enclosingSymbol)])); - } - - return 0 /* NotAssignable */; - }; - - PullTypeResolver.prototype.inferArgumentTypesForSignature = function (argContext, comparisonInfo, context) { - var inferenceResultTypes = argContext.inferTypeArguments(); - var typeParameters = argContext.signatureBeingInferred.getTypeParameters(); - TypeScript.Debug.assert(typeParameters.length == inferenceResultTypes.length); - - var typeReplacementMapForConstraints = null; - for (var i = 0; i < inferenceResultTypes.length; i++) { - if (typeParameters[i].getConstraint()) { - typeReplacementMapForConstraints = typeReplacementMapForConstraints || TypeScript.PullInstantiationHelpers.createTypeParameterArgumentMap(typeParameters, inferenceResultTypes); - var associatedConstraint = this.instantiateType(typeParameters[i].getConstraint(), typeReplacementMapForConstraints); - if (!this.sourceIsAssignableToTargetWithNewEnclosingTypes(inferenceResultTypes[i], associatedConstraint, null, context, null, false)) { - inferenceResultTypes[i] = associatedConstraint; - } - } - } - - if (argContext.isInvocationInferenceContext()) { - var invocationContext = argContext; - if (!this.typeParametersAreInScopeAtArgumentList(typeParameters, invocationContext.argumentASTs)) { - for (var i = 0; i < inferenceResultTypes.length; i++) { - if (inferenceResultTypes[i].wrapsSomeTypeParameter(argContext.candidateCache)) { - inferenceResultTypes[i] = this.semanticInfoChain.anyTypeSymbol; - } - } - } - } - - return inferenceResultTypes; - }; - - PullTypeResolver.prototype.typeParametersAreInScopeAtArgumentList = function (typeParameters, args) { - var enclosingDecl = this.getEnclosingDeclForAST(args); - var typeParameterParentDecl = typeParameters[0].getDeclarations()[0].getParentDecl(); - return enclosingDecl.getParentPath().indexOf(typeParameterParentDecl) > -1; - }; - - PullTypeResolver.prototype.relateTypeToTypeParametersInEnclosingType = function (expressionType, parameterType, argContext, context) { - if (expressionType && parameterType) { - if (context.oneOfClassificationsIsInfinitelyExpanding()) { - this.relateInifinitelyExpandingTypeToTypeParameters(expressionType, parameterType, argContext, context); - return; - } - } - this.relateTypeToTypeParameters(expressionType, parameterType, argContext, context); - }; - - PullTypeResolver.prototype.relateTypeToTypeParametersWithNewEnclosingTypes = function (expressionType, parameterType, argContext, context) { - var enclosingTypeWalkerStates = context.resetEnclosingTypeWalkerStates(); - this.relateTypeToTypeParameters(expressionType, parameterType, argContext, context); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - }; - - PullTypeResolver.prototype.relateTypeToTypeParameters = function (expressionType, parameterType, argContext, context) { - if (!expressionType || !parameterType) { - return; - } - - if (expressionType.isError()) { - expressionType = this.semanticInfoChain.anyTypeSymbol; - } - - if (parameterType.isTypeParameter()) { - var typeParameter = parameterType; - argContext.addCandidateForInference(typeParameter, expressionType); - return; - } - - if (parameterType.isNamedTypeSymbol() && !parameterType.isGeneric() && !parameterType.getTypeArguments()) { - return; - } - - if (TypeScript.PullInstantiationHelpers.twoTypesAreInstantiationsOfSameNamedGenericType(expressionType, parameterType)) { - this.relateTypeArgumentsOfTypeToTypeParameters(expressionType, parameterType, argContext, context); - } else { - var symbolsWhenStartedWalkingTypes = context.startWalkingTypes(expressionType, parameterType); - this.relateObjectTypeToTypeParameters(expressionType, parameterType, argContext, context); - context.endWalkingTypes(symbolsWhenStartedWalkingTypes); - } - }; - - PullTypeResolver.prototype.relateTypeArgumentsOfTypeToTypeParameters = function (expressionType, parameterType, argContext, context) { - var parameterSideTypeArguments = parameterType.getTypeArguments(); - var argumentSideTypeArguments = expressionType.getTypeArguments(); - - TypeScript.Debug.assert(parameterSideTypeArguments && argumentSideTypeArguments && parameterSideTypeArguments.length === argumentSideTypeArguments.length); - for (var i = 0; i < parameterSideTypeArguments.length; i++) { - this.relateTypeToTypeParametersWithNewEnclosingTypes(argumentSideTypeArguments[i], parameterSideTypeArguments[i], argContext, context); - } - }; - - PullTypeResolver.prototype.relateInifinitelyExpandingTypeToTypeParameters = function (expressionType, parameterType, argContext, context) { - if (!expressionType || !parameterType) { - return; - } - - var expressionTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(expressionType); - var parameterTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(parameterType); - if (expressionTypeNamedTypeReference !== parameterTypeNamedTypeReference) { - return; - } - - var expressionTypeTypeArguments = expressionType.getTypeArguments(); - var parameterTypeArguments = parameterType.getTypeArguments(); - - if (expressionTypeTypeArguments && parameterTypeArguments && expressionTypeTypeArguments.length === parameterTypeArguments.length) { - for (var i = 0; i < expressionTypeTypeArguments.length; i++) { - this.relateTypeArgumentsOfTypeToTypeParameters(expressionType, parameterType, argContext, context); - } - } - }; - - PullTypeResolver.prototype.relateFunctionSignatureToTypeParameters = function (expressionSignature, parameterSignature, argContext, context) { - var _this = this; - var expressionReturnType = expressionSignature.returnType; - var parameterReturnType = parameterSignature.returnType; - - parameterSignature.forAllCorrespondingParameterTypesInThisAndOtherSignature(expressionSignature, function (parameterSignatureParameterType, expressionSignatureParameterType, i) { - context.walkParameterTypes(i); - _this.relateTypeToTypeParametersInEnclosingType(expressionSignatureParameterType, parameterSignatureParameterType, argContext, context); - context.postWalkParameterTypes(); - return true; - }); - - context.walkReturnTypes(); - this.relateTypeToTypeParametersInEnclosingType(expressionReturnType, parameterReturnType, argContext, context); - context.postWalkReturnTypes(); - }; - - PullTypeResolver.prototype.relateObjectTypeToTypeParameters = function (objectType, parameterType, argContext, context) { - var parameterTypeMembers = parameterType.getMembers(); - var parameterSignatures; - - var objectMember; - var objectSignatures; - - if (argContext.alreadyRelatingTypes(objectType, parameterType)) { - return; - } - - for (var i = 0; i < parameterTypeMembers.length; i++) { - objectMember = this.getNamedPropertySymbol(parameterTypeMembers[i].name, 68147712 /* SomeValue */, objectType); - if (objectMember) { - this.resolveDeclaredSymbol(objectMember); - this.resolveDeclaredSymbol(parameterTypeMembers[i]); - context.walkMemberTypes(parameterTypeMembers[i].name); - this.relateTypeToTypeParametersInEnclosingType(objectMember.type, parameterTypeMembers[i].type, argContext, context); - context.postWalkMemberTypes(); - } - } - - this.relateSignatureGroupToTypeParameters(objectType.getCallSignatures(), parameterType.getCallSignatures(), 1048576 /* CallSignature */, argContext, context); - - this.relateSignatureGroupToTypeParameters(objectType.getConstructSignatures(), parameterType.getConstructSignatures(), 2097152 /* ConstructSignature */, argContext, context); - - var parameterIndexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(parameterType, context); - var objectIndexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(objectType, context); - var indexSigInfo = context.getBothKindOfIndexSignatures(false, false); - - if (parameterIndexSignatures.stringSignature && objectIndexSignatures.stringSignature) { - context.walkIndexSignatureReturnTypes(indexSigInfo, true, true, true); - this.relateFunctionSignatureToTypeParameters(objectIndexSignatures.stringSignature, parameterIndexSignatures.stringSignature, argContext, context); - context.postWalkIndexSignatureReturnTypes(true); - } - if (parameterIndexSignatures.numericSignature && objectIndexSignatures.numericSignature) { - context.walkIndexSignatureReturnTypes(indexSigInfo, false, false, true); - this.relateFunctionSignatureToTypeParameters(objectIndexSignatures.numericSignature, parameterIndexSignatures.numericSignature, argContext, context); - context.postWalkIndexSignatureReturnTypes(true); - } - }; - - PullTypeResolver.prototype.relateSignatureGroupToTypeParameters = function (argumentSignatures, parameterSignatures, signatureKind, argContext, context) { - for (var i = 0; i < parameterSignatures.length; i++) { - var paramSignature = parameterSignatures[i]; - if (argumentSignatures.length > 0 && paramSignature.isGeneric()) { - paramSignature = this.instantiateSignatureToAny(paramSignature); - } - for (var j = 0; j < argumentSignatures.length; j++) { - var argumentSignature = argumentSignatures[j]; - if (argumentSignature.nonOptionalParamCount > paramSignature.nonOptionalParamCount) { - continue; - } - - if (argumentSignature.isGeneric()) { - argumentSignature = this.instantiateSignatureToAny(argumentSignature); - } - - context.walkSignatures(signatureKind, j, i); - this.relateFunctionSignatureToTypeParameters(argumentSignature, paramSignature, argContext, context); - context.postWalkSignatures(); - } - } - }; - - PullTypeResolver.prototype.alterPotentialGenericFunctionTypeToInstantiatedFunctionTypeForTypeArgumentInference = function (expressionSymbol, context) { - var inferentialType = context.getContextualType(); - TypeScript.Debug.assert(inferentialType); - var expressionType = expressionSymbol.type; - if (this.isFunctionTypeWithExactlyOneCallSignatureAndNoOtherMembers(expressionType, true) && this.isFunctionTypeWithExactlyOneCallSignatureAndNoOtherMembers(inferentialType, false)) { - var genericExpressionSignature = expressionType.getCallSignatures()[0]; - var contextualSignature = inferentialType.getCallSignatures()[0]; - - var instantiatedSignature = this.instantiateSignatureInContext(genericExpressionSignature, contextualSignature, context, true); - if (instantiatedSignature === null) { - return expressionSymbol; - } - - var newType = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - newType.appendCallSignature(instantiatedSignature); - return newType; - } - - return expressionSymbol; - }; - - PullTypeResolver.prototype.isFunctionTypeWithExactlyOneCallSignatureAndNoOtherMembers = function (type, callSignatureShouldBeGeneric) { - TypeScript.Debug.assert(type); - if (type.getCallSignatures().length !== 1) { - return false; - } - - var callSignatureIsGeneric = type.getCallSignatures()[0].isGeneric(); - if (callSignatureIsGeneric !== callSignatureShouldBeGeneric) { - return false; - } - - var typeHasOtherMembers = type.getConstructSignatures().length || type.getIndexSignatures().length || type.getAllMembers(68147712 /* SomeValue */, 0 /* all */).length; - if (typeHasOtherMembers) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.instantiateTypeToAny = function (typeToSpecialize, context) { - var typeParameters = typeToSpecialize.getTypeParameters(); - - if (!typeParameters.length) { - return typeToSpecialize; - } - - var typeArguments = null; - - if (!this._cachedAnyTypeArgs) { - this._cachedAnyTypeArgs = [ - [this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol] - ]; - } - - if (typeParameters.length < this._cachedAnyTypeArgs.length) { - typeArguments = this._cachedAnyTypeArgs[typeParameters.length - 1]; - } else { - typeArguments = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeArguments[typeArguments.length] = this.semanticInfoChain.anyTypeSymbol; - } - } - - var type = this.createInstantiatedType(typeToSpecialize, typeArguments); - - return type; - }; - - PullTypeResolver.prototype.instantiateSignatureToAny = function (signature) { - var typeParameters = signature.getTypeParameters(); - if (!this._cachedAnyTypeArgs) { - this._cachedAnyTypeArgs = [ - [this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol] - ]; + } + ts.createCompilerHost = createCompilerHost; + function parsingContextErrors(context) { + switch (context) { + case 0 /* SourceElements */: return ts.Diagnostics.Declaration_or_statement_expected; + case 1 /* ModuleElements */: return ts.Diagnostics.Declaration_or_statement_expected; + case 2 /* BlockStatements */: return ts.Diagnostics.Statement_expected; + case 3 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected; + case 4 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected; + case 5 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected; + case 6 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected; + case 8 /* TypeReferences */: return ts.Diagnostics.Type_reference_expected; + case 9 /* VariableDeclarations */: return ts.Diagnostics.Variable_declaration_expected; + case 10 /* ArgumentExpressions */: return ts.Diagnostics.Argument_expression_expected; + case 11 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected; + case 12 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected; + case 13 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected; + case 14 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; + case 15 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 16 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; + case 17 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected; + } + } + ; + function modifierToFlag(token) { + switch (token) { + case 107 /* StaticKeyword */: return 128 /* Static */; + case 106 /* PublicKeyword */: return 16 /* Public */; + case 105 /* ProtectedKeyword */: return 64 /* Protected */; + case 104 /* PrivateKeyword */: return 32 /* Private */; + case 76 /* ExportKeyword */: return 1 /* Export */; + case 112 /* DeclareKeyword */: return 2 /* Ambient */; + case 68 /* ConstKeyword */: return 4096 /* Const */; + } + return 0; + } + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 63 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); + } + function isUseStrictPrologueDirective(sourceFile, node) { + ts.Debug.assert(ts.isPrologueDirective(node)); + var nodeText = ts.getSourceTextOfNodeFromSourceFile(sourceFile, node.expression); + return nodeText === '"use strict"' || nodeText === "'use strict'"; + } + function createSourceFile(filename, sourceText, languageVersion, version, isOpen) { + if (isOpen === void 0) { isOpen = false; } + var token; + var parsingContext; + var identifiers = {}; + var identifierCount = 0; + var nodeCount = 0; + var lineStarts; + var contextFlags = 0; + var parseErrorBeforeNextFinishedNode = false; + function setContextFlag(val, flag) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } + } + function setStrictModeContext(val) { + setContextFlag(val, 1 /* StrictMode */); + } + function setDisallowInContext(val) { + setContextFlag(val, 2 /* DisallowIn */); + } + function setYieldContext(val) { + setContextFlag(val, 4 /* Yield */); + } + function setGeneratorParameterContext(val) { + setContextFlag(val, 8 /* GeneratorParameter */); + } + function allowInAnd(func) { + if (contextFlags & 2 /* DisallowIn */) { + setDisallowInContext(false); + var result = func(); + setDisallowInContext(true); + return result; } - - if (typeParameters.length < this._cachedAnyTypeArgs.length) { - var typeArguments = this._cachedAnyTypeArgs[typeParameters.length - 1]; - } else { - var typeArguments = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeArguments[typeArguments.length] = this.semanticInfoChain.anyTypeSymbol; - } + return func(); + } + function disallowInAnd(func) { + if (contextFlags & 2 /* DisallowIn */) { + return func(); } - - var typeParameterArgumentMap = TypeScript.PullInstantiationHelpers.createTypeParameterArgumentMap(typeParameters, typeArguments); - return this.instantiateSignature(signature, typeParameterArgumentMap); - }; - - PullTypeResolver.typeCheck = function (compilationSettings, semanticInfoChain, document) { - var sourceUnit = document.sourceUnit(); - - var resolver = semanticInfoChain.getResolver(); - var context = new TypeScript.PullTypeResolutionContext(resolver, true, sourceUnit.fileName()); - - if (resolver.canTypeCheckAST(sourceUnit, context)) { - resolver.resolveAST(sourceUnit, false, context); - resolver.validateVariableDeclarationGroups(semanticInfoChain.getDeclForAST(sourceUnit), context); - - while (resolver.typeCheckCallBacks.length) { - var callBack = resolver.typeCheckCallBacks.pop(); - callBack(context); - } - - resolver.processPostTypeCheckWorkItems(context); + setDisallowInContext(true); + var result = func(); + setDisallowInContext(false); + return result; + } + function doInYieldContext(func) { + if (contextFlags & 4 /* Yield */) { + return func(); } - }; - - PullTypeResolver.prototype.validateVariableDeclarationGroups = function (enclosingDecl, context) { - var _this = this; - this.scanVariableDeclarationGroups(enclosingDecl, function (_) { - }, function (subsequentDecl, firstSymbol) { - if (TypeScript.hasFlag(subsequentDecl.kind, 2048 /* Parameter */) || TypeScript.hasFlag(subsequentDecl.flags, 8388608 /* PropertyParameter */)) { - return; - } - - var boundDeclAST = _this.semanticInfoChain.getASTForDecl(subsequentDecl); - - var symbol = subsequentDecl.getSymbol(); - var symbolType = symbol.type; - var firstSymbolType = firstSymbol.type; - - if (symbolType && firstSymbolType && symbolType !== firstSymbolType && !_this.typesAreIdentical(symbolType, firstSymbolType, context)) { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(boundDeclAST, TypeScript.DiagnosticCode.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, [symbol.getScopedName(), firstSymbolType.toString(firstSymbol), symbolType.toString(symbol)])); - } - }); - }; - - PullTypeResolver.prototype.typeCheckFunctionOverloads = function (funcDecl, context, signature, allSignatures) { - if (!signature) { - var functionSignatureInfo = TypeScript.PullHelpers.getSignatureForFuncDecl(this.semanticInfoChain.getDeclForAST(funcDecl)); - signature = functionSignatureInfo.signature; - allSignatures = functionSignatureInfo.allSignatures; - } - var functionDeclaration = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSymbol = functionDeclaration.getSymbol(); - - var definitionSignature = null; - for (var i = allSignatures.length - 1; i >= 0; i--) { - if (allSignatures[i].isDefinition()) { - definitionSignature = allSignatures[i]; - break; - } + setYieldContext(true); + var result = func(); + setYieldContext(false); + return result; + } + function doOutsideOfYieldContext(func) { + if (contextFlags & 4 /* Yield */) { + setYieldContext(false); + var result = func(); + setYieldContext(true); + return result; } - - if (!signature.isDefinition()) { - var signatureParentDecl = signature.getDeclarations()[0].getParentDecl(); - for (var i = 0; i < allSignatures.length; i++) { - if (allSignatures[i] === signature) { - break; - } - - var allSignaturesParentDecl = allSignatures[i].getDeclarations()[0].getParentDecl(); - if (allSignaturesParentDecl !== signatureParentDecl) { - continue; - } - - if (this.signaturesAreIdenticalWithNewEnclosingTypes(allSignatures[i], signature, context, false)) { - if (!this.signatureReturnTypesAreIdentical(allSignatures[i], signature, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overloads_cannot_differ_only_by_return_type)); - } else if (funcDecl.kind() === 137 /* ConstructorDeclaration */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_constructor_overload_signature)); - } else if (functionDeclaration.kind === 2097152 /* ConstructSignature */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_overload_construct_signature)); - } else if (functionDeclaration.kind === 1048576 /* CallSignature */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_overload_call_signature)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_overload_signature_for_0, [funcSymbol.getScopedNameEx().toString()])); - } - - break; - } - } + return func(); + } + function inYieldContext() { + return (contextFlags & 4 /* Yield */) !== 0; + } + function inStrictModeContext() { + return (contextFlags & 1 /* StrictMode */) !== 0; + } + function inGeneratorParameterContext() { + return (contextFlags & 8 /* GeneratorParameter */) !== 0; + } + function inDisallowInContext() { + return (contextFlags & 2 /* DisallowIn */) !== 0; + } + function getLineStarts() { + return lineStarts || (lineStarts = ts.computeLineStarts(sourceText)); + } + function getLineAndCharacterFromSourcePosition(position) { + return ts.getLineAndCharacterOfPosition(getLineStarts(), position); + } + function getPositionFromSourceLineAndCharacter(line, character) { + return ts.getPositionFromLineAndCharacter(getLineStarts(), line, character); + } + function parseErrorAtCurrentToken(message, arg0) { + var start = scanner.getTokenPos(); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); + } + function parseErrorAtPosition(start, length, message, arg0) { + var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); + if (!lastError || start !== lastError.start) { + sourceFile.parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)); } - - var isConstantOverloadSignature = signature.isStringConstantOverloadSignature(); - if (isConstantOverloadSignature) { - if (signature.isDefinition()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overload_signature_implementation_cannot_use_specialized_type)); - } else { - var foundSubtypeSignature = false; - for (var i = 0; i < allSignatures.length; i++) { - if (allSignatures[i].isDefinition() || allSignatures[i] === signature) { - continue; - } - - if (!allSignatures[i].isResolved) { - this.resolveDeclaredSymbol(allSignatures[i], context); - } - - if (allSignatures[i].isStringConstantOverloadSignature()) { - continue; - } - - if (this.signatureIsAssignableToTarget(signature, allSignatures[i], null, context)) { - foundSubtypeSignature = true; - break; - } - } - - if (!foundSubtypeSignature) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature)); - } - } - } else if (definitionSignature && definitionSignature !== signature) { - var comparisonInfo = new TypeComparisonInfo(); - - if (!definitionSignature.isResolved) { - this.resolveDeclaredSymbol(definitionSignature, context); - } - - if (!this.signatureIsAssignableToTarget(definitionSignature, signature, funcDecl, context, comparisonInfo)) { - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overload_signature_is_not_compatible_with_function_definition_NL_0, [comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overload_signature_is_not_compatible_with_function_definition)); - } - } + parseErrorBeforeNextFinishedNode = true; + } + function scanError(message) { + var pos = scanner.getTextPos(); + parseErrorAtPosition(pos, 0, message); + } + function getNodePos() { + return scanner.getStartPos(); + } + function getNodeEnd() { + return scanner.getStartPos(); + } + function nextToken() { + return token = scanner.scan(); + } + function getTokenPos(pos) { + return ts.skipTrivia(sourceText, pos); + } + function reScanGreaterToken() { + return token = scanner.reScanGreaterToken(); + } + function reScanSlashToken() { + return token = scanner.reScanSlashToken(); + } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } + function speculationHelper(callback, isLookAhead) { + var saveToken = token; + var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var saveContextFlags = contextFlags; + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + ts.Debug.assert(saveContextFlags === contextFlags); + if (!result || isLookAhead) { + token = saveToken; + sourceFile.parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; } - - var signatureForVisibilityCheck = definitionSignature; - if (!definitionSignature) { - if (allSignatures[0] === signature) { - return; - } - signatureForVisibilityCheck = allSignatures[0]; + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryParse(callback) { + return speculationHelper(callback, false); + } + function isIdentifier() { + if (token === 63 /* Identifier */) { + return true; } - - if (funcDecl.kind() !== 137 /* ConstructorDeclaration */ && functionDeclaration.kind !== 2097152 /* ConstructSignature */ && signatureForVisibilityCheck && signature !== signatureForVisibilityCheck) { - var errorCode; - - if (signatureForVisibilityCheck.anyDeclHasFlag(2 /* Private */) !== signature.anyDeclHasFlag(2 /* Private */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_public_or_private; - } else if (signatureForVisibilityCheck.anyDeclHasFlag(1 /* Exported */) !== signature.anyDeclHasFlag(1 /* Exported */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_exported_or_not_exported; - } else if (signatureForVisibilityCheck.anyDeclHasFlag(8 /* Ambient */) !== signature.anyDeclHasFlag(8 /* Ambient */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_ambient_or_non_ambient; - } else if (signatureForVisibilityCheck.anyDeclHasFlag(128 /* Optional */) !== signature.anyDeclHasFlag(128 /* Optional */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_optional_or_required; - } - - if (errorCode) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, errorCode)); - } + if (token === 108 /* YieldKeyword */ && inYieldContext()) { + return false; } - }; - - PullTypeResolver.prototype.checkSymbolPrivacy = function (declSymbol, symbol, privacyErrorReporter) { - if (!symbol || symbol.kind === 2 /* Primitive */) { - return; + return inStrictModeContext() ? token > 108 /* LastFutureReservedWord */ : token > 99 /* LastReservedWord */; + } + function parseExpected(kind, diagnosticMessage, arg0) { + if (token === kind) { + nextToken(); + return true; } - - if (symbol.isType()) { - var typeSymbol = symbol; - var isNamedType = typeSymbol.isNamedTypeSymbol(); - - if (typeSymbol.isArrayNamedTypeReference()) { - this.checkSymbolPrivacy(declSymbol, typeSymbol.getElementType(), privacyErrorReporter); - return; - } - - if (!isNamedType) { - var typeOfSymbol = typeSymbol.getTypeOfSymbol(); - if (typeOfSymbol) { - this.checkSymbolPrivacy(declSymbol, typeOfSymbol, privacyErrorReporter); - return; - } - } - - if (typeSymbol.inSymbolPrivacyCheck) { - return; - } - - typeSymbol.inSymbolPrivacyCheck = true; - - var typars = typeSymbol.getTypeArgumentsOrTypeParameters(); - if (typars) { - for (var i = 0; i < typars.length; i++) { - this.checkSymbolPrivacy(declSymbol, typars[i], privacyErrorReporter); - } - } - - if (!isNamedType) { - var members = typeSymbol.getMembers(); - for (var i = 0; i < members.length; i++) { - this.checkSymbolPrivacy(declSymbol, members[i].type, privacyErrorReporter); - } - - this.checkTypePrivacyOfSignatures(declSymbol, typeSymbol.getCallSignatures(), privacyErrorReporter); - this.checkTypePrivacyOfSignatures(declSymbol, typeSymbol.getConstructSignatures(), privacyErrorReporter); - this.checkTypePrivacyOfSignatures(declSymbol, typeSymbol.getIndexSignatures(), privacyErrorReporter); - } else if (typeSymbol.kind === 8192 /* TypeParameter */) { - this.checkSymbolPrivacy(declSymbol, typeSymbol.getConstraint(), privacyErrorReporter); - } - - typeSymbol.inSymbolPrivacyCheck = false; - - if (!isNamedType) { - return; - } + if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage, arg0); } - - if (declSymbol.isExternallyVisible()) { - var symbolIsVisible = symbol.isExternallyVisible(); - - if (symbolIsVisible && symbol.kind !== 8192 /* TypeParameter */) { - var symbolPath = symbol.pathToRoot(); - var declSymbolPath = declSymbol.pathToRoot(); - - if (symbolPath[symbolPath.length - 1].kind === 32 /* DynamicModule */ && declSymbolPath[declSymbolPath.length - 1].kind === 32 /* DynamicModule */ && declSymbolPath[declSymbolPath.length - 1] !== symbolPath[symbolPath.length - 1]) { - symbolIsVisible = false; - var declSymbolScope = declSymbolPath[declSymbolPath.length - 1]; - for (var i = symbolPath.length - 1; i >= 0; i--) { - var aliasSymbols = symbolPath[i].getExternalAliasedSymbols(declSymbolScope); - if (aliasSymbols) { - symbolIsVisible = true; - aliasSymbols[0].setTypeUsedExternally(); - break; - } - } - symbol = symbolPath[symbolPath.length - 1]; - } - } else if (symbol.kind === 128 /* TypeAlias */) { - var aliasSymbol = symbol; - symbolIsVisible = true; - aliasSymbol.setTypeUsedExternally(); - } - - if (!symbolIsVisible) { - privacyErrorReporter(symbol); - } + else { + parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); } - }; - - PullTypeResolver.prototype.checkTypePrivacyOfSignatures = function (declSymbol, signatures, privacyErrorReporter) { - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; - if (signatures.length > 1 && signature.isDefinition()) { - continue; - } - - var typeParams = signature.getTypeParameters(); - for (var j = 0; j < typeParams.length; j++) { - this.checkSymbolPrivacy(declSymbol, typeParams[j], privacyErrorReporter); - } - - var params = signature.parameters; - for (var j = 0; j < params.length; j++) { - var paramType = params[j].type; - this.checkSymbolPrivacy(declSymbol, paramType, privacyErrorReporter); - } - - var returnType = signature.returnType; - this.checkSymbolPrivacy(declSymbol, returnType, privacyErrorReporter); + return false; + } + function parseOptional(t) { + if (token === t) { + nextToken(); + return true; } - }; - - PullTypeResolver.prototype.typeParameterOfTypeDeclarationPrivacyErrorReporter = function (classOrInterface, typeParameterAST, typeParameter, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - var messageCode; - - var typeParameters = classOrInterface.kind() === 131 /* ClassDeclaration */ ? classOrInterface.typeParameterList : classOrInterface.typeParameterList; - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_interface_is_using_inaccessible_module_1; - } - } else { - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_interface_has_or_is_using_private_type_1; - } + return false; + } + function parseOptionalToken(t) { + if (token === t) { + var node = createNode(t); + nextToken(); + return finishNode(node); } - - var messageArguments = [typeParameter.getScopedName(enclosingSymbol, false, true), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeParameterAST, messageCode, messageArguments)); - }; - - PullTypeResolver.prototype.baseListPrivacyErrorReporter = function (classOrInterface, declSymbol, baseAst, isExtendedType, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - var messageCode; - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - if (isExtendedType) { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_extends_class_from_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_implements_interface_from_inaccessible_module_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_interface_0_extends_interface_from_inaccessible_module_1; - } - } else { - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - if (isExtendedType) { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_extends_private_class_1; - } else { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_implements_private_interface_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_interface_0_extends_private_interface_1; + return undefined; + } + function canParseSemicolon() { + if (token === 21 /* SemicolonToken */) { + return true; + } + return token === 14 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + } + function parseSemicolon(diagnosticMessage) { + if (canParseSemicolon()) { + if (token === 21 /* SemicolonToken */) { + nextToken(); } + return true; } - - var messageArguments = [declSymbol.getScopedName(enclosingSymbol), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseAst, messageCode, messageArguments)); - }; - - PullTypeResolver.prototype.variablePrivacyErrorReporter = function (declAST, declSymbol, symbol, context) { - var typeSymbol = symbol; - var enclosingDecl = this.getEnclosingDecl(declSymbol.getDeclarations()[0]); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - - var isProperty = declSymbol.kind === 4096 /* Property */; - var isPropertyOfClass = false; - var declParent = declSymbol.getContainer(); - if (declParent && (declParent.kind === 8 /* Class */ || declParent.kind === 32768 /* ConstructorMethod */)) { - isPropertyOfClass = true; + else { + return parseExpected(21 /* SemicolonToken */, diagnosticMessage); } - - var messageCode; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (declSymbol.anyDeclHasFlag(16 /* Static */)) { - messageCode = TypeScript.DiagnosticCode.Public_static_property_0_of_exported_class_is_using_inaccessible_module_1; - } else if (isProperty) { - if (isPropertyOfClass) { - messageCode = TypeScript.DiagnosticCode.Public_property_0_of_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Property_0_of_exported_interface_is_using_inaccessible_module_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_variable_0_is_using_inaccessible_module_1; - } - } else { - if (declSymbol.anyDeclHasFlag(16 /* Static */)) { - messageCode = TypeScript.DiagnosticCode.Public_static_property_0_of_exported_class_has_or_is_using_private_type_1; - } else if (isProperty) { - if (isPropertyOfClass) { - messageCode = TypeScript.DiagnosticCode.Public_property_0_of_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.Property_0_of_exported_interface_has_or_is_using_private_type_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_variable_0_has_or_is_using_private_type_1; - } + } + function createNode(kind, pos) { + nodeCount++; + var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(); + if (!(pos >= 0)) { + pos = scanner.getStartPos(); } - - var messageArguments = [declSymbol.getScopedName(enclosingSymbol), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(declAST, messageCode, messageArguments)); - }; - - PullTypeResolver.prototype.checkFunctionTypePrivacy = function (funcDeclAST, isStatic, typeParameters, parameters, returnTypeAnnotation, block, context) { - var _this = this; - if (funcDeclAST.kind() === 222 /* FunctionExpression */ || funcDeclAST.kind() === 241 /* FunctionPropertyAssignment */ || (funcDeclAST.kind() === 139 /* GetAccessor */ && funcDeclAST.parent.parent.kind() === 215 /* ObjectLiteralExpression */) || (funcDeclAST.kind() === 140 /* SetAccessor */ && funcDeclAST.parent.parent.kind() === 215 /* ObjectLiteralExpression */)) { - return; + node.pos = pos; + node.end = pos; + return node; + } + function finishNode(node) { + node.end = scanner.getStartPos(); + if (contextFlags) { + node.parserContextFlags = contextFlags; } - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var functionSymbol = functionDecl.getSymbol(); - ; - var functionSignature; - - var isGetter = funcDeclAST.kind() === 139 /* GetAccessor */; - var isSetter = funcDeclAST.kind() === 140 /* SetAccessor */; - var isIndexSignature = functionDecl.kind === 4194304 /* IndexSignature */; - - if (isGetter || isSetter) { - var accessorSymbol = functionSymbol; - functionSignature = (isGetter ? accessorSymbol.getGetter() : accessorSymbol.getSetter()).type.getCallSignatures()[0]; - } else { - if (!functionSymbol) { - var parentDecl = functionDecl.getParentDecl(); - functionSymbol = parentDecl.getSymbol(); - if (functionSymbol && functionSymbol.isType() && !functionSymbol.isNamedTypeSymbol()) { - return; - } - } else if (functionSymbol.kind === 65536 /* Method */ && !isStatic && !functionSymbol.getContainer().isNamedTypeSymbol()) { - return; - } - functionSignature = functionDecl.getSignatureSymbol(); + if (parseErrorBeforeNextFinishedNode) { + parseErrorBeforeNextFinishedNode = false; + node.parserContextFlags |= 16 /* ContainsError */; } - - if (typeParameters && !isGetter && !isSetter && !isIndexSignature && funcDeclAST.kind() !== 137 /* ConstructorDeclaration */) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - var typeParameterAST = typeParameters.typeParameters.nonSeparatorAt(i); - var typeParameter = this.resolveTypeParameterDeclaration(typeParameterAST, context); - this.checkSymbolPrivacy(functionSymbol, typeParameter, function (symbol) { - return _this.functionTypeArgumentArgumentTypePrivacyErrorReporter(funcDeclAST, isStatic, typeParameterAST, typeParameter, symbol, context); - }); - } + return node; + } + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + if (reportAtCurrentPosition) { + parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); } - - if (!isGetter && !isIndexSignature) { - var funcParams = functionSignature.parameters; - for (var i = 0; i < funcParams.length; i++) { - this.checkSymbolPrivacy(functionSymbol, funcParams[i].type, function (symbol) { - return _this.functionArgumentTypePrivacyErrorReporter(funcDeclAST, isStatic, parameters, i, funcParams[i], symbol, context); - }); - } + else { + parseErrorAtCurrentToken(diagnosticMessage, arg0); } - - if (!isSetter) { - this.checkSymbolPrivacy(functionSymbol, functionSignature.returnType, function (symbol) { - return _this.functionReturnTypePrivacyErrorReporter(funcDeclAST, isStatic, returnTypeAnnotation, block, functionSignature.returnType, symbol, context); - }); + var result = createNode(kind, scanner.getStartPos()); + result.text = ""; + return finishNode(result); + } + function internIdentifier(text) { + text = ts.escapeIdentifier(text); + return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); + } + function createIdentifier(isIdentifier, diagnosticMessage) { + identifierCount++; + if (isIdentifier) { + var node = createNode(63 /* Identifier */); + node.text = internIdentifier(scanner.getTokenValue()); + nextToken(); + return finishNode(node); } - }; - - PullTypeResolver.prototype.functionTypeArgumentArgumentTypePrivacyErrorReporter = function (declAST, isStatic, typeParameterAST, typeParameter, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(declAST); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - - var isMethod = decl.kind === 65536 /* Method */; - var isMethodOfClass = false; - var declParent = decl.getParentDecl(); - if (declParent && (declParent.kind === 8 /* Class */ || isStatic)) { - isMethodOfClass = true; + return createMissingNode(63 /* Identifier */, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + } + function parseIdentifier(diagnosticMessage) { + return createIdentifier(isIdentifier(), diagnosticMessage); + } + function parseIdentifierName() { + return createIdentifier(isIdentifierOrKeyword()); + } + function isLiteralPropertyName() { + return isIdentifierOrKeyword() || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; + } + function parsePropertyName() { + if (token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { + return parseLiteralNode(true); } - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - var messageCode; - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_function_is_using_inaccessible_module_1; - } - } else { - if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_function_has_or_is_using_private_type_1; - } + if (token === 17 /* OpenBracketToken */) { + return parseComputedPropertyName(); } - - if (messageCode) { - var messageArgs = [typeParameter.getScopedName(enclosingSymbol, false, true), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeParameterAST, messageCode, messageArgs)); + return parseIdentifierName(); + } + function parseComputedPropertyName() { + var node = createNode(121 /* ComputedPropertyName */); + parseExpected(17 /* OpenBracketToken */); + var yieldContext = inYieldContext(); + if (inGeneratorParameterContext()) { + setYieldContext(false); } - }; - - PullTypeResolver.prototype.functionArgumentTypePrivacyErrorReporter = function (declAST, isStatic, parameters, argIndex, paramSymbol, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(declAST); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - - var isGetter = declAST.kind() === 139 /* GetAccessor */; - var isSetter = declAST.kind() === 140 /* SetAccessor */; - var isMethod = decl.kind === 65536 /* Method */; - var isMethodOfClass = false; - var declParent = decl.getParentDecl(); - if (declParent && (declParent.kind === 8 /* Class */ || isStatic)) { - isMethodOfClass = true; + node.expression = allowInAnd(parseExpression); + if (inGeneratorParameterContext()) { + setYieldContext(yieldContext); } - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - var messageCode; - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (declAST.kind() === 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_from_exported_class_is_using_inaccessible_module_1; - } else if (isSetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_property_setter_from_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_property_setter_from_exported_class_is_using_inaccessible_module_1; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1; - } - } else if (!isGetter) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_exported_function_is_using_inaccessible_module_1; - } - } else { - if (declAST.kind() === 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_type_1; - } else if (isSetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_type_1; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1; - } - } else if (!isGetter && decl.kind !== 4194304 /* IndexSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_exported_function_has_or_is_using_private_type_1; - } + parseExpected(18 /* CloseBracketToken */); + return finishNode(node); + } + function parseContextualModifier(t) { + return token === t && tryParse(nextTokenCanFollowModifier); + } + function nextTokenCanFollowModifier() { + nextToken(); + return canFollowModifier(); + } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); + } + function nextTokenCanFollowContextualModifier() { + if (token === 68 /* ConstKeyword */) { + return nextToken() === 75 /* EnumKeyword */; } - - if (messageCode) { - var parameter = parameters.astAt(argIndex); - - var messageArgs = [paramSymbol.getScopedName(enclosingSymbol), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(parameter, messageCode, messageArgs)); + nextToken(); + return canFollowModifier(); + } + function canFollowModifier() { + return token === 17 /* OpenBracketToken */ || token === 34 /* AsteriskToken */ || isLiteralPropertyName(); + } + function isListElement(kind, inErrorRecovery) { + switch (kind) { + case 0 /* SourceElements */: + case 1 /* ModuleElements */: + return isSourceElement(inErrorRecovery); + case 2 /* BlockStatements */: + case 4 /* SwitchClauseStatements */: + return isStatement(inErrorRecovery); + case 3 /* SwitchClauses */: + return token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; + case 5 /* TypeMembers */: + return isStartOfTypeMember(); + case 6 /* ClassMembers */: + return lookAhead(isClassMemberStart); + case 7 /* EnumMembers */: + return token === 17 /* OpenBracketToken */ || isLiteralPropertyName(); + case 11 /* ObjectLiteralMembers */: + return token === 17 /* OpenBracketToken */ || token === 34 /* AsteriskToken */ || isLiteralPropertyName(); + case 8 /* TypeReferences */: + return isIdentifier() && !isNotHeritageClauseTypeName(); + case 9 /* VariableDeclarations */: + case 14 /* TypeParameters */: + return isIdentifier(); + case 10 /* ArgumentExpressions */: + return token === 22 /* CommaToken */ || isStartOfExpression(); + case 12 /* ArrayLiteralMembers */: + return token === 22 /* CommaToken */ || isStartOfExpression(); + case 13 /* Parameters */: + return isStartOfParameter(); + case 15 /* TypeArguments */: + case 16 /* TupleElementTypes */: + return token === 22 /* CommaToken */ || isStartOfType(); + case 17 /* HeritageClauses */: + return isHeritageClause(); + } + ts.Debug.fail("Non-exhaustive case in 'isListElement'."); + } + function nextTokenIsIdentifier() { + nextToken(); + return isIdentifier(); + } + function isNotHeritageClauseTypeName() { + if (token === 100 /* ImplementsKeyword */ || token === 77 /* ExtendsKeyword */) { + return lookAhead(nextTokenIsIdentifier); } - }; - - PullTypeResolver.prototype.functionReturnTypePrivacyErrorReporter = function (declAST, isStatic, returnTypeAnnotation, block, funcReturnType, symbol, context) { - var _this = this; - var decl = this.semanticInfoChain.getDeclForAST(declAST); - var enclosingDecl = this.getEnclosingDecl(decl); - - var isGetter = declAST.kind() === 139 /* GetAccessor */; - var isSetter = declAST.kind() === 140 /* SetAccessor */; - var isMethod = decl.kind === 65536 /* Method */; - var isMethodOfClass = false; - var declParent = decl.getParentDecl(); - if (declParent && (declParent.kind === 8 /* Class */ || isStatic)) { - isMethodOfClass = true; + return false; + } + function isListTerminator(kind) { + if (token === 1 /* EndOfFileToken */) { + return true; } - - var messageCode = null; - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (isGetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_property_getter_from_exported_class_is_using_inaccessible_module_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_property_getter_from_exported_class_is_using_inaccessible_module_0; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_0; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_call_signature_from_exported_interface_is_using_inaccessible_module_0; - } else if (decl.kind === 4194304 /* IndexSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_index_signature_from_exported_interface_is_using_inaccessible_module_0; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_method_from_exported_class_is_using_inaccessible_module_0; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_method_from_exported_class_is_using_inaccessible_module_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_method_from_exported_interface_is_using_inaccessible_module_0; - } - } else if (!isSetter && declAST.kind() !== 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_exported_function_is_using_inaccessible_module_0; - } - } else { - if (isGetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_type_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_type_0; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_0; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_type_0; - } else if (decl.kind === 4194304 /* IndexSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_type_0; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_type_0; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_method_from_exported_class_has_or_is_using_private_type_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_method_from_exported_interface_has_or_is_using_private_type_0; - } - } else if (!isSetter && declAST.kind() !== 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_exported_function_has_or_is_using_private_type_0; - } + switch (kind) { + case 1 /* ModuleElements */: + case 2 /* BlockStatements */: + case 3 /* SwitchClauses */: + case 5 /* TypeMembers */: + case 6 /* ClassMembers */: + case 7 /* EnumMembers */: + case 11 /* ObjectLiteralMembers */: + return token === 14 /* CloseBraceToken */; + case 4 /* SwitchClauseStatements */: + return token === 14 /* CloseBraceToken */ || token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; + case 8 /* TypeReferences */: + return token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; + case 9 /* VariableDeclarations */: + return isVariableDeclaratorListTerminator(); + case 14 /* TypeParameters */: + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */ || token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; + case 10 /* ArgumentExpressions */: + return token === 16 /* CloseParenToken */ || token === 21 /* SemicolonToken */; + case 12 /* ArrayLiteralMembers */: + case 16 /* TupleElementTypes */: + return token === 18 /* CloseBracketToken */; + case 13 /* Parameters */: + return token === 16 /* CloseParenToken */ || token === 18 /* CloseBracketToken */ || token === 13 /* OpenBraceToken */; + case 15 /* TypeArguments */: + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */; + case 17 /* HeritageClauses */: + return token === 13 /* OpenBraceToken */ || token === 14 /* CloseBraceToken */; + } + } + function isVariableDeclaratorListTerminator() { + if (canParseSemicolon()) { + return true; } - - if (messageCode) { - var messageArguments = [typeSymbolName]; - var reportOnFuncDecl = false; - - if (returnTypeAnnotation) { - var returnExpressionSymbol = this.resolveTypeReference(returnTypeAnnotation, context); - - if (TypeScript.PullHelpers.typeSymbolsAreIdentical(returnExpressionSymbol, funcReturnType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, messageCode, messageArguments)); - } - } - - if (block) { - var reportErrorOnReturnExpressions = function (ast, walker) { - var go = true; - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - go = false; - break; - - case 150 /* ReturnStatement */: - var returnStatement = ast; - var returnExpressionSymbol = _this.resolveAST(returnStatement.expression, false, context).type; - - if (TypeScript.PullHelpers.typeSymbolsAreIdentical(returnExpressionSymbol, funcReturnType)) { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(returnStatement, messageCode, messageArguments)); - } else { - reportOnFuncDecl = true; - } - go = false; - break; - - default: - break; - } - - walker.options.goChildren = go; - return ast; - }; - - TypeScript.getAstWalkerFactory().walk(block, reportErrorOnReturnExpressions); - } - - if (reportOnFuncDecl) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(declAST, messageCode, messageArguments)); - } + if (token === 84 /* InKeyword */) { + return true; } - }; - - PullTypeResolver.prototype.enclosingClassIsDerived = function (classDecl) { - TypeScript.Debug.assert(classDecl.kind === 8 /* Class */); - - var classSymbol = classDecl.getSymbol(); - return classSymbol.getExtendedTypes().length > 0; - }; - - PullTypeResolver.prototype.isSuperInvocationExpression = function (ast) { - if (ast.kind() === 213 /* InvocationExpression */) { - var invocationExpression = ast; - if (invocationExpression.expression.kind() === 50 /* SuperKeyword */) { - return true; - } + if (token === 31 /* EqualsGreaterThanToken */) { + return true; } - return false; - }; - - PullTypeResolver.prototype.isSuperInvocationExpressionStatement = function (node) { - if (node && node.kind() === 149 /* ExpressionStatement */) { - var expressionStatement = node; - if (this.isSuperInvocationExpression(expressionStatement.expression)) { - return true; + } + function isInSomeParsingContext() { + for (var kind = 0; kind < 18 /* Count */; kind++) { + if (parsingContext & (1 << kind)) { + if (isListElement(kind, true) || isListTerminator(kind)) { + return true; + } } } return false; - }; - - PullTypeResolver.prototype.getFirstStatementOfBlockOrNull = function (block) { - if (block && block.statements && block.statements.childCount() > 0) { - return block.statements.childAt(0); - } - - return null; - }; - - PullTypeResolver.prototype.superCallMustBeFirstStatementInConstructor = function (constructorDecl) { - TypeScript.Debug.assert(constructorDecl.kind === 32768 /* ConstructorMethod */); - - if (constructorDecl) { - var enclosingClass = constructorDecl.getParentDecl(); - - var classSymbol = enclosingClass.getSymbol(); - if (classSymbol.getExtendedTypes().length === 0) { - return false; - } - - var classMembers = classSymbol.getMembers(); - for (var i = 0, n1 = classMembers.length; i < n1; i++) { - var member = classMembers[i]; - - if (member.kind === 4096 /* Property */) { - var declarations = member.getDeclarations(); - for (var j = 0, n2 = declarations.length; j < n2; j++) { - var declaration = declarations[j]; - var ast = this.semanticInfoChain.getASTForDecl(declaration); - if (ast.kind() === 242 /* Parameter */) { - return true; - } - - if (ast.kind() === 136 /* MemberVariableDeclaration */) { - var variableDeclarator = ast; - if (variableDeclarator.variableDeclarator.equalsValueClause) { - return true; - } + } + function parseList(kind, checkForStrictMode, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var savedStrictModeContext = inStrictModeContext(); + while (!isListTerminator(kind)) { + if (isListElement(kind, false)) { + var element = parseElement(); + result.push(element); + if (checkForStrictMode && !inStrictModeContext()) { + if (ts.isPrologueDirective(element)) { + if (isUseStrictPrologueDirective(sourceFile, element)) { + setStrictModeContext(true); + checkForStrictMode = false; } } + else { + checkForStrictMode = false; + } } + continue; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; } } - + setStrictModeContext(savedStrictModeContext); + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function abortParsingListOrMoveToNextToken(kind) { + parseErrorAtCurrentToken(parsingContextErrors(kind)); + if (isInSomeParsingContext()) { + return true; + } + nextToken(); return false; - }; - - PullTypeResolver.prototype.checkForThisCaptureInArrowFunction = function (expression) { - var enclosingDecl = this.getEnclosingDeclForAST(expression); - - var declPath = enclosingDecl.getParentPath(); - - if (declPath.length) { - var inArrowFunction = false; - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - var declKind = decl.kind; - var declFlags = decl.flags; - - if (declKind === 131072 /* FunctionExpression */ && TypeScript.hasFlag(declFlags, 8192 /* ArrowFunction */)) { - inArrowFunction = true; + } + function parseDelimitedList(kind, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var commaStart = -1; + while (true) { + if (isListElement(kind, false)) { + result.push(parseElement()); + commaStart = scanner.getTokenPos(); + if (parseOptional(22 /* CommaToken */)) { continue; } - - if (inArrowFunction) { - if (declKind === 16384 /* Function */ || declKind === 65536 /* Method */ || declKind === 32768 /* ConstructorMethod */ || declKind === 262144 /* GetAccessor */ || declKind === 524288 /* SetAccessor */ || declKind === 131072 /* FunctionExpression */ || declKind === 8 /* Class */ || declKind === 4 /* Container */ || declKind === 32 /* DynamicModule */ || declKind === 1 /* Script */) { - decl.setFlags(decl.flags | 262144 /* MustCaptureThis */); - - if (declKind === 8 /* Class */) { - var constructorSymbol = decl.getSymbol().getConstructorMethod(); - var constructorDecls = constructorSymbol.getDeclarations(); - for (var i = 0; i < constructorDecls.length; i++) { - constructorDecls[i].flags = constructorDecls[i].flags | 262144 /* MustCaptureThis */; - } - } - break; - } - } else if (declKind === 16384 /* Function */ || declKind === 131072 /* FunctionExpression */) { + commaStart = -1; + if (isListTerminator(kind)) { break; } + parseExpected(22 /* CommaToken */); + continue; + } + if (isListTerminator(kind)) { + break; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; } } - }; - - PullTypeResolver.prototype.typeCheckMembersAgainstIndexer = function (containerType, containerTypeDecl, context) { - var indexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(containerType, context); - var stringSignature = indexSignatures.stringSignature; - var numberSignature = indexSignatures.numericSignature; - - if (stringSignature || numberSignature) { - var members = containerTypeDecl.getChildDecls(); - for (var i = 0; i < members.length; i++) { - var member = members[i]; - if ((member.name || (member.kind === 4096 /* Property */ && member.name === "")) && member.kind !== 32768 /* ConstructorMethod */ && !TypeScript.hasFlag(member.flags, 16 /* Static */)) { - var memberSymbol = member.getSymbol(); - var relevantSignature = this.determineRelevantIndexerForMember(memberSymbol, numberSignature, stringSignature); - if (relevantSignature) { - var comparisonInfo = new TypeComparisonInfo(); - if (!this.sourceIsAssignableToTarget(memberSymbol.type, relevantSignature.returnType, member.ast(), context, comparisonInfo)) { - this.reportErrorThatMemberIsNotSubtypeOfIndexer(memberSymbol, relevantSignature, member.ast(), context, comparisonInfo); - } - } - } - } - } - }; - - PullTypeResolver.prototype.determineRelevantIndexerForMember = function (member, numberIndexSignature, stringIndexSignature) { - if (numberIndexSignature && TypeScript.PullHelpers.isNameNumeric(member.name)) { - return numberIndexSignature; - } else if (stringIndexSignature) { - return stringIndexSignature; + if (commaStart >= 0) { + result.hasTrailingComma = true; } - - return null; - }; - - PullTypeResolver.prototype.reportErrorThatMemberIsNotSubtypeOfIndexer = function (member, indexSignature, astForError, context, comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(astForError); - if (indexSignature.parameters[0].type === this.semanticInfoChain.numberTypeSymbol) { - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0_NL_1, [indexSignature.returnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0, [indexSignature.returnType.toString(enclosingSymbol)])); - } - } else { - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_named_properties_must_be_assignable_to_string_indexer_type_0_NL_1, [indexSignature.returnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_named_properties_must_be_assignable_to_string_indexer_type_0, [indexSignature.returnType.toString(enclosingSymbol)])); + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function createMissingList() { + var pos = getNodePos(); + var result = []; + result.pos = pos; + result.end = pos; + return result; + } + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { + var result = parseDelimitedList(kind, parseElement); + parseExpected(close); + return result; + } + return createMissingList(); + } + function parseEntityName(allowReservedWords, diagnosticMessage) { + var entity = parseIdentifier(diagnosticMessage); + while (parseOptional(19 /* DotToken */)) { + var node = createNode(120 /* QualifiedName */, entity.pos); + node.left = entity; + node.right = parseRightSideOfDot(allowReservedWords); + entity = finishNode(node); + } + return entity; + } + function parseRightSideOfDot(allowIdentifierNames) { + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { + var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + if (matchesPattern) { + return createMissingNode(63 /* Identifier */, true, ts.Diagnostics.Identifier_expected); } } - }; - - PullTypeResolver.prototype.typeCheckIfTypeMemberPropertyOkToOverride = function (typeSymbol, extendedType, typeMember, extendedTypeMember, enclosingDecl, comparisonInfo) { - if (!typeSymbol.isClass()) { - return true; + return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); + } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function parseTemplateExpression() { + var template = createNode(159 /* TemplateExpression */); + template.head = parseLiteralNode(); + ts.Debug.assert(template.head.kind === 10 /* TemplateHead */, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (templateSpans[templateSpans.length - 1].literal.kind === 11 /* TemplateMiddle */); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(162 /* TemplateSpan */); + span.expression = allowInAnd(parseExpression); + var literal; + if (token === 14 /* CloseBraceToken */) { + reScanTemplateToken(); + literal = parseLiteralNode(); + } + else { + literal = createMissingNode(12 /* TemplateTail */, false, ts.Diagnostics._0_expected, ts.tokenToString(14 /* CloseBraceToken */)); + } + span.literal = literal; + return finishNode(span); + } + function parseLiteralNode(internName) { + var node = createNode(token); + var text = scanner.getTokenValue(); + node.text = internName ? internIdentifier(text) : text; + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + var tokenPos = scanner.getTokenPos(); + nextToken(); + finishNode(node); + if (node.kind === 6 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + node.flags |= 8192 /* OctalLiteral */; } - - var typeMemberKind = typeMember.kind; - var extendedMemberKind = extendedTypeMember.kind; - - if (typeMemberKind === extendedMemberKind) { - return true; + return node; + } + function parseTypeReference() { + var node = createNode(132 /* TypeReference */); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); + if (!scanner.hasPrecedingLineBreak() && token === 23 /* LessThanToken */) { + node.typeArguments = parseBracketedList(15 /* TypeArguments */, parseType, 23 /* LessThanToken */, 24 /* GreaterThanToken */); } - - var errorCode; - if (typeMemberKind === 4096 /* Property */) { - if (typeMember.isAccessor()) { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; - } else { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + return finishNode(node); + } + function parseTypeQuery() { + var node = createNode(135 /* TypeQuery */); + parseExpected(95 /* TypeOfKeyword */); + node.exprName = parseEntityName(true); + return finishNode(node); + } + function parseTypeParameter() { + var node = createNode(122 /* TypeParameter */); + node.name = parseIdentifier(); + if (parseOptional(77 /* ExtendsKeyword */)) { + if (isStartOfType() || !isStartOfExpression()) { + node.constraint = parseType(); } - } else if (typeMemberKind === 65536 /* Method */) { - if (extendedTypeMember.isAccessor()) { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; - } else { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; + else { + node.expression = parseUnaryExpressionOrHigher(); } } - - var message = TypeScript.getDiagnosticMessage(errorCode, [typeSymbol.toString(), typeMember.getScopedNameEx().toString(), extendedType.toString()]); - comparisonInfo.addMessage(message); - return false; - }; - - PullTypeResolver.prototype.typeCheckIfTypeExtendsType = function (classOrInterface, name, typeSymbol, extendedType, enclosingDecl, context) { - var typeMembers = typeSymbol.getMembers(); - - var comparisonInfo = new TypeComparisonInfo(); - var foundError = false; - var foundError1 = false; - var foundError2 = false; - - for (var i = 0; i < typeMembers.length; i++) { - var propName = typeMembers[i].name; - var extendedTypeProp = extendedType.findMember(propName, true); - if (extendedTypeProp) { - this.resolveDeclaredSymbol(extendedTypeProp, context); - foundError1 = !this.typeCheckIfTypeMemberPropertyOkToOverride(typeSymbol, extendedType, typeMembers[i], extendedTypeProp, enclosingDecl, comparisonInfo); - - if (!foundError1) { - foundError2 = !this.sourcePropertyIsAssignableToTargetProperty(typeSymbol, extendedType, typeMembers[i], extendedTypeProp, classOrInterface, context, comparisonInfo); - } - - if (foundError1 || foundError2) { - foundError = true; - break; - } + return finishNode(node); + } + function parseTypeParameters() { + if (token === 23 /* LessThanToken */) { + return parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 23 /* LessThanToken */, 24 /* GreaterThanToken */); + } + } + function parseParameterType() { + if (parseOptional(50 /* ColonToken */)) { + return token === 7 /* StringLiteral */ ? parseLiteralNode(true) : parseType(); + } + return undefined; + } + function isStartOfParameter() { + return token === 20 /* DotDotDotToken */ || isIdentifier() || ts.isModifier(token); + } + function setModifiers(node, modifiers) { + if (modifiers) { + node.flags |= modifiers.flags; + node.modifiers = modifiers; + } + } + function parseParameter() { + var node = createNode(123 /* Parameter */); + setModifiers(node, parseModifiers()); + node.dotDotDotToken = parseOptionalToken(20 /* DotDotDotToken */); + node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifier) : parseIdentifier(); + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + nextToken(); + } + node.questionToken = parseOptionalToken(49 /* QuestionToken */); + node.type = parseParameterType(); + node.initializer = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseParameterInitializer) : parseParameterInitializer(); + return finishNode(node); + } + function parseParameterInitializer() { + return parseInitializer(true); + } + function fillSignature(returnToken, yieldAndGeneratorParameterContext, requireCompleteParameterList, signature) { + var returnTokenRequired = returnToken === 31 /* EqualsGreaterThanToken */; + signature.typeParameters = parseTypeParameters(); + signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList); + if (returnTokenRequired) { + parseExpected(returnToken); + signature.type = parseType(); + } + else if (parseOptional(returnToken)) { + signature.type = parseType(); + } + } + function parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList) { + if (parseExpected(15 /* OpenParenToken */)) { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(yieldAndGeneratorParameterContext); + setGeneratorParameterContext(yieldAndGeneratorParameterContext); + var result = parseDelimitedList(13 /* Parameters */, parseParameter); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + if (!parseExpected(16 /* CloseParenToken */) && requireCompleteParameterList) { + return undefined; } + return result; } - - if (!foundError && typeSymbol.hasOwnCallSignatures()) { - foundError = !this.sourceCallSignaturesAreAssignableToTargetCallSignatures(typeSymbol, extendedType, classOrInterface, context, comparisonInfo); + return requireCompleteParameterList ? undefined : createMissingList(); + } + function parseTypeMemberSemicolon() { + if (parseSemicolon()) { + return; } - - if (!foundError && typeSymbol.hasOwnConstructSignatures()) { - foundError = !this.sourceConstructSignaturesAreAssignableToTargetConstructSignatures(typeSymbol, extendedType, classOrInterface, context, comparisonInfo); + parseOptional(22 /* CommaToken */); + } + function parseSignatureMember(kind) { + var node = createNode(kind); + if (kind === 130 /* ConstructSignature */) { + parseExpected(86 /* NewKeyword */); } - - if (!foundError && typeSymbol.hasOwnIndexSignatures()) { - foundError = !this.sourceIndexSignaturesAreAssignableToTargetIndexSignatures(typeSymbol, extendedType, classOrInterface, context, comparisonInfo); + fillSignature(50 /* ColonToken */, false, false, node); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function isIndexSignature() { + if (token !== 17 /* OpenBracketToken */) { + return false; } - - if (!foundError && typeSymbol.isClass()) { - var typeConstructorType = typeSymbol.getConstructorMethod().type; - var typeConstructorTypeMembers = typeConstructorType.getMembers(); - if (typeConstructorTypeMembers.length) { - var extendedConstructorType = extendedType.getConstructorMethod().type; - var comparisonInfoForPropTypeCheck = new TypeComparisonInfo(comparisonInfo); - - for (var i = 0; i < typeConstructorTypeMembers.length; i++) { - var propName = typeConstructorTypeMembers[i].name; - var extendedConstructorTypeProp = extendedConstructorType.findMember(propName, true); - if (extendedConstructorTypeProp) { - if (!extendedConstructorTypeProp.isResolved) { - this.resolveDeclaredSymbol(extendedConstructorTypeProp, context); - } - - if (!this.sourcePropertyIsAssignableToTargetProperty(typeConstructorType, extendedConstructorType, typeConstructorTypeMembers[i], extendedConstructorTypeProp, classOrInterface, context, comparisonInfo)) { - foundError = true; - break; - } - } - } - } + return lookAhead(isUnambiguouslyIndexSignature); + } + function isUnambiguouslyIndexSignature() { + nextToken(); + if (token === 20 /* DotDotDotToken */ || token === 18 /* CloseBracketToken */) { + return true; } - - if (foundError) { - var errorCode; - if (typeSymbol.isClass()) { - errorCode = TypeScript.DiagnosticCode.Class_0_cannot_extend_class_1_NL_2; - } else { - if (extendedType.isClass()) { - errorCode = TypeScript.DiagnosticCode.Interface_0_cannot_extend_class_1_NL_2; - } else { - errorCode = TypeScript.DiagnosticCode.Interface_0_cannot_extend_interface_1_NL_2; - } + if (ts.isModifier(token)) { + nextToken(); + if (isIdentifier()) { + return true; } - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, errorCode, [typeSymbol.getScopedName(), extendedType.getScopedName(), comparisonInfo.message])); } - }; - - PullTypeResolver.prototype.typeCheckIfClassImplementsType = function (classDecl, classSymbol, implementedType, enclosingDecl, context) { - var comparisonInfo = new TypeComparisonInfo(); - var foundError = !this.sourceMembersAreAssignableToTargetMembers(classSymbol, implementedType, classDecl, context, comparisonInfo); - if (!foundError) { - foundError = !this.sourceCallSignaturesAreAssignableToTargetCallSignatures(classSymbol, implementedType, classDecl, context, comparisonInfo); - if (!foundError) { - foundError = !this.sourceConstructSignaturesAreAssignableToTargetConstructSignatures(classSymbol, implementedType, classDecl, context, comparisonInfo); - if (!foundError) { - foundError = !this.sourceIndexSignaturesAreAssignableToTargetIndexSignatures(classSymbol, implementedType, classDecl, context, comparisonInfo); + else if (!isIdentifier()) { + return false; + } + else { + nextToken(); + } + if (token === 50 /* ColonToken */ || token === 22 /* CommaToken */) { + return true; + } + if (token !== 49 /* QuestionToken */) { + return false; + } + nextToken(); + return token === 50 /* ColonToken */ || token === 22 /* CommaToken */ || token === 18 /* CloseBracketToken */; + } + function parseIndexSignatureDeclaration(fullStart, modifiers) { + var node = createNode(131 /* IndexSignature */, fullStart); + setModifiers(node, modifiers); + node.parameters = parseBracketedList(13 /* Parameters */, parseParameter, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); + node.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function parsePropertyOrMethodSignature() { + var fullStart = scanner.getStartPos(); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(49 /* QuestionToken */); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + var method = createNode(125 /* Method */, fullStart); + method.name = name; + method.questionToken = questionToken; + fillSignature(50 /* ColonToken */, false, false, method); + parseTypeMemberSemicolon(); + return finishNode(method); + } + else { + var property = createNode(124 /* Property */, fullStart); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(property); + } + } + function isStartOfTypeMember() { + switch (token) { + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 17 /* OpenBracketToken */: + return true; + default: + return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + } + } + function isTypeMemberWithLiteralPropertyName() { + nextToken(); + return token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */ || token === 49 /* QuestionToken */ || token === 50 /* ColonToken */ || canParseSemicolon(); + } + function parseTypeMember() { + switch (token) { + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + return parseSignatureMember(129 /* CallSignature */); + case 17 /* OpenBracketToken */: + return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined) : parsePropertyOrMethodSignature(); + case 86 /* NewKeyword */: + if (lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(130 /* ConstructSignature */); + } + case 7 /* StringLiteral */: + case 6 /* NumericLiteral */: + return parsePropertyOrMethodSignature(); + default: + if (isIdentifierOrKeyword()) { + return parsePropertyOrMethodSignature(); } - } } - - if (foundError) { - var enclosingSymbol = this.getEnclosingSymbolForAST(classDecl); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(classDecl.identifier, TypeScript.DiagnosticCode.Class_0_declares_interface_1_but_does_not_implement_it_NL_2, [classSymbol.getScopedName(enclosingSymbol), implementedType.getScopedName(enclosingSymbol), comparisonInfo.message])); + } + function isStartOfConstructSignature() { + nextToken(); + return token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */; + } + function parseTypeLiteral() { + var node = createNode(136 /* TypeLiteral */); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseObjectTypeMembers() { + var members; + if (parseExpected(13 /* OpenBraceToken */)) { + members = parseList(5 /* TypeMembers */, false, parseTypeMember); + parseExpected(14 /* CloseBraceToken */); } - }; - - PullTypeResolver.prototype.computeValueSymbolFromAST = function (valueDeclAST, context) { - var prevInTypeCheck = context.inTypeCheck; - context.inTypeCheck = false; - - var typeSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(valueDeclAST); - - if (valueDeclAST.kind() == 11 /* IdentifierName */) { - var valueSymbol = this.computeNameExpression(valueDeclAST, context); - } else { - TypeScript.Debug.assert(valueDeclAST.kind() == 121 /* QualifiedName */); - var qualifiedName = valueDeclAST; - - var lhs = this.computeValueSymbolFromAST(qualifiedName.left, context); - var valueSymbol = this.computeDottedNameExpressionFromLHS(lhs.symbol, qualifiedName.left, qualifiedName.right, context, false); + else { + members = createMissingList(); } - var valueSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(valueDeclAST); - - this.semanticInfoChain.setAliasSymbolForAST(valueDeclAST, typeSymbolAlias); - context.inTypeCheck = prevInTypeCheck; - - return { symbol: valueSymbol, alias: valueSymbolAlias }; - }; - - PullTypeResolver.prototype.hasClassTypeSymbolConflictAsValue = function (baseDeclAST, typeSymbol, enclosingDecl, context) { - var typeSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(baseDeclAST); - - var valueDeclAST = baseDeclAST.kind() == 126 /* GenericType */ ? baseDeclAST.name : baseDeclAST; - var valueSymbolInfo = this.computeValueSymbolFromAST(valueDeclAST, context); - var valueSymbol = valueSymbolInfo.symbol; - var valueSymbolAlias = valueSymbolInfo.alias; - - if (typeSymbolAlias && valueSymbolAlias) { - return typeSymbolAlias !== valueSymbolAlias; + return members; + } + function parseTupleType() { + var node = createNode(138 /* TupleType */); + node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); + return finishNode(node); + } + function parseParenthesizedType() { + var node = createNode(140 /* ParenthesizedType */); + parseExpected(15 /* OpenParenToken */); + node.type = parseType(); + parseExpected(16 /* CloseParenToken */); + return finishNode(node); + } + function parseFunctionOrConstructorType(kind) { + var node = createNode(kind); + if (kind === 134 /* ConstructorType */) { + parseExpected(86 /* NewKeyword */); + } + fillSignature(31 /* EqualsGreaterThanToken */, false, false, node); + return finishNode(node); + } + function parseKeywordAndNoDot() { + var node = parseTokenNode(); + return token === 19 /* DotToken */ ? undefined : node; + } + function parseNonArrayType() { + switch (token) { + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + var node = tryParse(parseKeywordAndNoDot); + return node || parseTypeReference(); + case 97 /* VoidKeyword */: + return parseTokenNode(); + case 95 /* TypeOfKeyword */: + return parseTypeQuery(); + case 13 /* OpenBraceToken */: + return parseTypeLiteral(); + case 17 /* OpenBracketToken */: + return parseTupleType(); + case 15 /* OpenParenToken */: + return parseParenthesizedType(); + default: + return parseTypeReference(); + } + } + function isStartOfType() { + switch (token) { + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: + case 95 /* TypeOfKeyword */: + case 13 /* OpenBraceToken */: + case 17 /* OpenBracketToken */: + case 23 /* LessThanToken */: + case 86 /* NewKeyword */: + return true; + case 15 /* OpenParenToken */: + return lookAhead(isStartOfParenthesizedOrFunctionType); + default: + return isIdentifier(); } - - if (!valueSymbol.anyDeclHasFlag(16384 /* ClassConstructorVariable */)) { - return true; + } + function isStartOfParenthesizedOrFunctionType() { + nextToken(); + return token === 16 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); + } + function parseArrayTypeOrHigher() { + var type = parseNonArrayType(); + while (!scanner.hasPrecedingLineBreak() && parseOptional(17 /* OpenBracketToken */)) { + parseExpected(18 /* CloseBracketToken */); + var node = createNode(137 /* ArrayType */, type.pos); + node.elementType = type; + type = finishNode(node); } - - var associatedContainerType = valueSymbol.type ? valueSymbol.type.getAssociatedContainerType() : null; - - if (associatedContainerType) { - return associatedContainerType !== typeSymbol.getRootSymbol(); + return type; + } + function parseUnionTypeOrHigher() { + var type = parseArrayTypeOrHigher(); + if (token === 43 /* BarToken */) { + var types = [type]; + types.pos = type.pos; + while (parseOptional(43 /* BarToken */)) { + types.push(parseArrayTypeOrHigher()); + } + types.end = getNodeEnd(); + var node = createNode(139 /* UnionType */, type.pos); + node.types = types; + type = finishNode(node); } - - return true; - }; - - PullTypeResolver.prototype.typeCheckBase = function (classOrInterface, name, typeSymbol, baseDeclAST, isExtendedType, enclosingDecl, context) { - var _this = this; - var typeDecl = this.semanticInfoChain.getDeclForAST(classOrInterface); - - var baseType = this.resolveTypeReference(baseDeclAST, context).type; - - if (!baseType) { - return; + return type; + } + function isStartOfFunctionType() { + if (token === 23 /* LessThanToken */) { + return true; } - - var typeDeclIsClass = typeSymbol.isClass(); - - if (!typeSymbol.isValidBaseKind(baseType, isExtendedType)) { - if (!baseType.isError()) { - if (isExtendedType) { - if (typeDeclIsClass) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.A_class_may_only_extend_another_class)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.An_interface_may_only_extend_another_class_or_interface)); - } - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.A_class_may_only_implement_another_class_or_interface)); + return token === 15 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); + } + function isUnambiguouslyStartOfFunctionType() { + nextToken(); + if (token === 16 /* CloseParenToken */ || token === 20 /* DotDotDotToken */) { + return true; + } + if (isIdentifier() || ts.isModifier(token)) { + nextToken(); + if (token === 50 /* ColonToken */ || token === 22 /* CommaToken */ || token === 49 /* QuestionToken */ || token === 51 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { + return true; + } + if (token === 16 /* CloseParenToken */) { + nextToken(); + if (token === 31 /* EqualsGreaterThanToken */) { + return true; } } - return; - } else if (typeDeclIsClass && isExtendedType) { - if (this.hasClassTypeSymbolConflictAsValue(baseDeclAST, baseType, enclosingDecl, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_1, [TypeScript.ASTHelpers.getNameOfIdenfierOrQualifiedName(baseDeclAST.kind() == 126 /* GenericType */ ? baseDeclAST.name : baseDeclAST), baseType.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); + } + return false; + } + function parseType() { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(false); + setGeneratorParameterContext(false); + var result = parseTypeWorker(); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + return result; + } + function parseTypeWorker() { + if (isStartOfFunctionType()) { + return parseFunctionOrConstructorType(133 /* FunctionType */); + } + if (token === 86 /* NewKeyword */) { + return parseFunctionOrConstructorType(134 /* ConstructorType */); + } + return parseUnionTypeOrHigher(); + } + function parseTypeAnnotation() { + return parseOptional(50 /* ColonToken */) ? parseType() : undefined; + } + function isStartOfExpression() { + switch (token) { + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 15 /* OpenParenToken */: + case 17 /* OpenBracketToken */: + case 13 /* OpenBraceToken */: + case 81 /* FunctionKeyword */: + case 86 /* NewKeyword */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: + case 95 /* TypeOfKeyword */: + case 97 /* VoidKeyword */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + case 23 /* LessThanToken */: + case 63 /* Identifier */: + case 108 /* YieldKeyword */: + return true; + default: + if (isBinaryOperator()) { + return true; + } + return isIdentifier(); + } + } + function isStartOfExpressionStatement() { + return token !== 13 /* OpenBraceToken */ && token !== 81 /* FunctionKeyword */ && isStartOfExpression(); + } + function parseExpression() { + var expr = parseAssignmentExpressionOrHigher(); + while (parseOptional(22 /* CommaToken */)) { + expr = makeBinaryExpression(expr, 22 /* CommaToken */, parseAssignmentExpressionOrHigher()); + } + return expr; + } + function parseInitializer(inParameter) { + if (token !== 51 /* EqualsToken */) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 13 /* OpenBraceToken */) || !isStartOfExpression()) { + return undefined; } } - - if (baseType.hasBase(typeSymbol)) { - typeSymbol.setHasBaseTypeConflict(); - baseType.setHasBaseTypeConflict(); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, typeDeclIsClass ? TypeScript.DiagnosticCode.Class_0_is_recursively_referenced_as_a_base_type_of_itself : TypeScript.DiagnosticCode.Interface_0_is_recursively_referenced_as_a_base_type_of_itself, [typeSymbol.getScopedName()])); - return; + parseExpected(51 /* EqualsToken */); + return parseAssignmentExpressionOrHigher(); + } + function parseAssignmentExpressionOrHigher() { + if (isYieldExpression()) { + return parseYieldExpression(); } - - if (isExtendedType) { - this.typeCheckCallBacks.push(function (context) { - return _this.typeCheckIfTypeExtendsType(classOrInterface, name, typeSymbol, baseType, enclosingDecl, context); - }); - } else { - TypeScript.Debug.assert(classOrInterface.kind() === 131 /* ClassDeclaration */); - - this.typeCheckCallBacks.push(function (context) { - return _this.typeCheckIfClassImplementsType(classOrInterface, typeSymbol, baseType, enclosingDecl, context); - }); + var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + if (arrowExpression) { + return arrowExpression; } - - this.checkSymbolPrivacy(typeSymbol, baseType, function (errorSymbol) { - return _this.baseListPrivacyErrorReporter(classOrInterface, typeSymbol, baseDeclAST, isExtendedType, errorSymbol, context); - }); - }; - - PullTypeResolver.prototype.typeCheckBases = function (classOrInterface, name, heritageClauses, typeSymbol, enclosingDecl, context) { - var _this = this; - var extendsClause = TypeScript.ASTHelpers.getExtendsHeritageClause(heritageClauses); - var implementsClause = TypeScript.ASTHelpers.getImplementsHeritageClause(heritageClauses); - if (!extendsClause && !implementsClause) { - return; + var expr = parseBinaryExpressionOrHigher(0); + if (expr.kind === 63 /* Identifier */ && token === 31 /* EqualsGreaterThanToken */) { + return parseSimpleArrowFunctionExpression(expr); } - - if (extendsClause) { - for (var i = 0; i < extendsClause.typeNames.nonSeparatorCount(); i++) { - this.typeCheckBase(classOrInterface, name, typeSymbol, extendsClause.typeNames.nonSeparatorAt(i), true, enclosingDecl, context); - } + if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { + var operator = token; + nextToken(); + return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); } - - if (typeSymbol.isClass()) { - if (implementsClause) { - for (var i = 0; i < implementsClause.typeNames.nonSeparatorCount(); i++) { - this.typeCheckBase(classOrInterface, name, typeSymbol, implementsClause.typeNames.nonSeparatorAt(i), false, enclosingDecl, context); - } - } - } else if (extendsClause && !typeSymbol.hasBaseTypeConflict() && typeSymbol.getExtendedTypes().length > 1) { - var firstInterfaceASTWithExtendsClause = TypeScript.ArrayUtilities.firstOrDefault(typeSymbol.getDeclarations(), function (decl) { - return decl.ast().heritageClauses !== null; - }).ast(); - if (classOrInterface === firstInterfaceASTWithExtendsClause) { - this.typeCheckCallBacks.push(function (context) { - _this.checkTypeCompatibilityBetweenBases(classOrInterface.identifier, typeSymbol, context); - }); + return parseConditionalExpressionRest(expr); + } + function isYieldExpression() { + if (token === 108 /* YieldKeyword */) { + if (inYieldContext()) { + return true; } + if (inStrictModeContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOnSameLine); } - }; - - PullTypeResolver.prototype.checkTypeCompatibilityBetweenBases = function (name, typeSymbol, context) { - var derivedIndexSignatures = typeSymbol.getOwnIndexSignatures(); - - var inheritedMembersMap = TypeScript.createIntrinsicsObject(); - var inheritedIndexSignatures = new InheritedIndexSignatureInfo(); - - var typeHasOwnNumberIndexer = false; - var typeHasOwnStringIndexer = false; - - if (typeSymbol.hasOwnIndexSignatures()) { - var ownIndexSignatures = typeSymbol.getOwnIndexSignatures(); - for (var i = 0; i < ownIndexSignatures.length; i++) { - if (ownIndexSignatures[i].parameters[0].type === this.semanticInfoChain.numberTypeSymbol) { - typeHasOwnNumberIndexer = true; - } else { - typeHasOwnStringIndexer = true; + return false; + } + function nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); + } + function parseYieldExpression() { + var node = createNode(160 /* YieldExpression */); + nextToken(); + if (!scanner.hasPrecedingLineBreak() && (token === 34 /* AsteriskToken */ || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + else { + return finishNode(node); + } + } + function parseSimpleArrowFunctionExpression(identifier) { + ts.Debug.assert(token === 31 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(151 /* ArrowFunction */, identifier.pos); + var parameter = createNode(123 /* Parameter */, identifier.pos); + parameter.name = identifier; + finishNode(parameter); + node.parameters = [parameter]; + node.parameters.pos = parameter.pos; + node.parameters.end = parameter.end; + parseExpected(31 /* EqualsGreaterThanToken */); + node.body = parseArrowFunctionExpressionBody(); + return finishNode(node); + } + function tryParseParenthesizedArrowFunctionExpression() { + var triState = isParenthesizedArrowFunctionExpression(); + if (triState === 0 /* False */) { + return undefined; + } + var arrowFunction = triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + if (!arrowFunction) { + return undefined; + } + if (parseExpected(31 /* EqualsGreaterThanToken */) || token === 13 /* OpenBraceToken */) { + arrowFunction.body = parseArrowFunctionExpressionBody(); + } + else { + arrowFunction.body = parseIdentifier(); + } + return finishNode(arrowFunction); + } + function isParenthesizedArrowFunctionExpression() { + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + return lookAhead(isParenthesizedArrowFunctionExpressionWorker); + } + if (token === 31 /* EqualsGreaterThanToken */) { + return 1 /* True */; + } + return 0 /* False */; + } + function isParenthesizedArrowFunctionExpressionWorker() { + var first = token; + var second = nextToken(); + if (first === 15 /* OpenParenToken */) { + if (second === 16 /* CloseParenToken */) { + var third = nextToken(); + switch (third) { + case 31 /* EqualsGreaterThanToken */: + case 50 /* ColonToken */: + case 13 /* OpenBraceToken */: + return 1 /* True */; + default: + return 0 /* False */; } } + if (second === 20 /* DotDotDotToken */) { + return 1 /* True */; + } + if (!isIdentifier()) { + return 0 /* False */; + } + if (nextToken() === 50 /* ColonToken */) { + return 1 /* True */; + } + return 2 /* Unknown */; } - var baseTypes = typeSymbol.getExtendedTypes(); - for (var i = 0; i < baseTypes.length; i++) { - if (this.checkNamedPropertyIdentityBetweenBases(name, typeSymbol, baseTypes[i], inheritedMembersMap, context) || this.checkIndexSignatureIdentityBetweenBases(name, typeSymbol, baseTypes[i], inheritedIndexSignatures, typeHasOwnNumberIndexer, typeHasOwnStringIndexer, context)) { - return; + else { + ts.Debug.assert(first === 23 /* LessThanToken */); + if (!isIdentifier()) { + return 0 /* False */; } + return 2 /* Unknown */; } - - if (this.checkThatInheritedNumberSignatureIsSubtypeOfInheritedStringSignature(name, typeSymbol, inheritedIndexSignatures, context)) { - return; + } + function parsePossibleParenthesizedArrowFunctionExpressionHead() { + return parseParenthesizedArrowFunctionExpressionHead(false); + } + function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { + var node = createNode(151 /* ArrowFunction */); + fillSignature(50 /* ColonToken */, false, !allowAmbiguity, node); + if (!node.parameters) { + return undefined; } - - this.checkInheritedMembersAgainstInheritedIndexSignatures(name, typeSymbol, inheritedIndexSignatures, inheritedMembersMap, context); - }; - - PullTypeResolver.prototype.checkNamedPropertyIdentityBetweenBases = function (interfaceName, interfaceSymbol, baseTypeSymbol, inheritedMembersMap, context) { - var baseMembers = baseTypeSymbol.getAllMembers(4096 /* Property */ | 65536 /* Method */, 0 /* all */); - for (var i = 0; i < baseMembers.length; i++) { - var member = baseMembers[i]; - var memberName = member.name; - - if (interfaceSymbol.findMember(memberName, false)) { - continue; + if (!allowAmbiguity && token !== 31 /* EqualsGreaterThanToken */ && token !== 13 /* OpenBraceToken */) { + return undefined; + } + return node; + } + function parseArrowFunctionExpressionBody() { + if (token === 13 /* OpenBraceToken */) { + return parseFunctionBlock(false, false); + } + if (isStatement(true) && !isStartOfExpressionStatement() && token !== 81 /* FunctionKeyword */) { + return parseFunctionBlock(false, true); + } + return parseAssignmentExpressionOrHigher(); + } + function parseConditionalExpressionRest(leftOperand) { + if (!parseOptional(49 /* QuestionToken */)) { + return leftOperand; + } + var node = createNode(158 /* ConditionalExpression */, leftOperand.pos); + node.condition = leftOperand; + node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(50 /* ColonToken */); + node.whenFalse = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseBinaryExpressionOrHigher(precedence) { + var leftOperand = parseUnaryExpressionOrHigher(); + return parseBinaryExpressionRest(precedence, leftOperand); + } + function parseBinaryExpressionRest(precedence, leftOperand) { + while (true) { + reScanGreaterToken(); + var newPrecedence = getBinaryOperatorPrecedence(); + if (newPrecedence <= precedence) { + break; } - - this.resolveDeclaredSymbol(member, context); - - if (inheritedMembersMap[memberName]) { - var prevMember = inheritedMembersMap[memberName]; - if (prevMember.baseOrigin !== baseTypeSymbol && !this.propertiesAreIdenticalWithNewEnclosingTypes(baseTypeSymbol, prevMember.baseOrigin, member, prevMember.memberSymbol, context)) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Named_properties_0_of_types_1_and_2_are_not_identical, [memberName, prevMember.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName()]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(), prevMember.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName(), innerDiagnostic])); - return true; - } - } else { - inheritedMembersMap[memberName] = new MemberWithBaseOrigin(member, baseTypeSymbol); + if (token === 84 /* InKeyword */ && inDisallowInContext()) { + break; } + var operator = token; + nextToken(); + leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); } - - return false; - }; - - PullTypeResolver.prototype.checkIndexSignatureIdentityBetweenBases = function (interfaceName, interfaceSymbol, baseTypeSymbol, allInheritedSignatures, derivedTypeHasOwnNumberSignature, derivedTypeHasOwnStringSignature, context) { - if (derivedTypeHasOwnNumberSignature && derivedTypeHasOwnStringSignature) { + return leftOperand; + } + function isBinaryOperator() { + if (inDisallowInContext() && token === 84 /* InKeyword */) { return false; } - - var indexSignaturesFromThisBaseType = baseTypeSymbol.getIndexSignatures(); - for (var i = 0; i < indexSignaturesFromThisBaseType.length; i++) { - var currentInheritedSignature = indexSignaturesFromThisBaseType[i]; - - var parameterTypeIsString = currentInheritedSignature.parameters[0].type === this.semanticInfoChain.stringTypeSymbol; - var parameterTypeIsNumber = currentInheritedSignature.parameters[0].type === this.semanticInfoChain.numberTypeSymbol; - - if (parameterTypeIsString && derivedTypeHasOwnStringSignature || parameterTypeIsNumber && derivedTypeHasOwnNumberSignature) { + return getBinaryOperatorPrecedence() > 0; + } + function getBinaryOperatorPrecedence() { + switch (token) { + case 48 /* BarBarToken */: + return 1; + case 47 /* AmpersandAmpersandToken */: + return 2; + case 43 /* BarToken */: + return 3; + case 44 /* CaretToken */: + return 4; + case 42 /* AmpersandToken */: + return 5; + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + return 6; + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + case 85 /* InstanceOfKeyword */: + case 84 /* InKeyword */: + return 7; + case 39 /* LessThanLessThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + return 8; + case 32 /* PlusToken */: + case 33 /* MinusToken */: + return 9; + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + return 10; + } + return -1; + } + function makeBinaryExpression(left, operator, right) { + var node = createNode(157 /* BinaryExpression */, left.pos); + node.left = left; + node.operator = operator; + node.right = right; + return finishNode(node); + } + function parsePrefixUnaryExpression() { + var node = createNode(155 /* PrefixUnaryExpression */); + node.operator = token; + nextToken(); + node.operand = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseDeleteExpression() { + var node = createNode(152 /* DeleteExpression */); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseTypeOfExpression() { + var node = createNode(153 /* TypeOfExpression */); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseVoidExpression() { + var node = createNode(154 /* VoidExpression */); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseUnaryExpressionOrHigher() { + switch (token) { + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + return parsePrefixUnaryExpression(); + case 72 /* DeleteKeyword */: + return parseDeleteExpression(); + case 95 /* TypeOfKeyword */: + return parseTypeOfExpression(); + case 97 /* VoidKeyword */: + return parseVoidExpression(); + case 23 /* LessThanToken */: + return parseTypeAssertion(); + default: + return parsePostfixExpressionOrHigher(); + } + } + function parsePostfixExpressionOrHigher() { + var expression = parseLeftHandSideExpressionOrHigher(); + ts.Debug.assert(isLeftHandSideExpression(expression)); + if ((token === 37 /* PlusPlusToken */ || token === 38 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(156 /* PostfixUnaryExpression */, expression.pos); + node.operand = expression; + node.operator = token; + nextToken(); + return finishNode(node); + } + return expression; + } + function parseLeftHandSideExpressionOrHigher() { + var expression = token === 89 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); + return parseCallExpressionRest(expression); + } + function parseMemberExpressionOrHigher() { + var expression = parsePrimaryExpression(); + return parseMemberExpressionRest(expression); + } + function parseSuperExpression() { + var expression = parseTokenNode(); + if (token === 15 /* OpenParenToken */ || token === 19 /* DotToken */) { + return expression; + } + var node = createNode(143 /* PropertyAccessExpression */, expression.pos); + node.expression = expression; + parseExpected(19 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(true); + return finishNode(node); + } + function parseTypeAssertion() { + var node = createNode(148 /* TypeAssertionExpression */); + parseExpected(23 /* LessThanToken */); + node.type = parseType(); + parseExpected(24 /* GreaterThanToken */); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseMemberExpressionRest(expression) { + while (true) { + var dotOrBracketStart = scanner.getTokenPos(); + if (parseOptional(19 /* DotToken */)) { + var propertyAccess = createNode(143 /* PropertyAccessExpression */, expression.pos); + propertyAccess.expression = expression; + propertyAccess.name = parseRightSideOfDot(true); + expression = finishNode(propertyAccess); continue; } - - if (parameterTypeIsString) { - if (allInheritedSignatures.stringSignatureWithBaseOrigin) { - if (allInheritedSignatures.stringSignatureWithBaseOrigin.baseOrigin !== baseTypeSymbol && !this.typesAreIdentical(allInheritedSignatures.stringSignatureWithBaseOrigin.signature.returnType, currentInheritedSignature.returnType, context)) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_of_string_indexer_of_types_0_and_1_are_not_identical, [allInheritedSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName()]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(), allInheritedSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName(), innerDiagnostic])); - return true; - } - } else { - allInheritedSignatures.stringSignatureWithBaseOrigin = new SignatureWithBaseOrigin(currentInheritedSignature, baseTypeSymbol); - } - } else if (parameterTypeIsNumber) { - if (allInheritedSignatures.numberSignatureWithBaseOrigin) { - if (allInheritedSignatures.numberSignatureWithBaseOrigin.baseOrigin !== baseTypeSymbol && !this.typesAreIdentical(allInheritedSignatures.numberSignatureWithBaseOrigin.signature.returnType, currentInheritedSignature.returnType, context)) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_of_number_indexer_of_types_0_and_1_are_not_identical, [allInheritedSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName()]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(), allInheritedSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName(), innerDiagnostic])); - return true; + if (parseOptional(17 /* OpenBracketToken */)) { + var indexedAccess = createNode(144 /* ElementAccessExpression */, expression.pos); + indexedAccess.expression = expression; + if (token !== 18 /* CloseBracketToken */) { + indexedAccess.argumentExpression = allowInAnd(parseExpression); + if (indexedAccess.argumentExpression.kind === 7 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 6 /* NumericLiteral */) { + var literal = indexedAccess.argumentExpression; + literal.text = internIdentifier(literal.text); } - } else { - allInheritedSignatures.numberSignatureWithBaseOrigin = new SignatureWithBaseOrigin(currentInheritedSignature, baseTypeSymbol); } + parseExpected(18 /* CloseBracketToken */); + expression = finishNode(indexedAccess); + continue; } - } - - return false; - }; - - PullTypeResolver.prototype.checkInheritedMembersAgainstInheritedIndexSignatures = function (interfaceName, interfaceSymbol, inheritedIndexSignatures, inheritedMembers, context) { - if (!inheritedIndexSignatures.stringSignatureWithBaseOrigin && !inheritedIndexSignatures.numberSignatureWithBaseOrigin) { - return false; - } - - var comparisonInfo = new TypeComparisonInfo(); - var stringSignature = inheritedIndexSignatures.stringSignatureWithBaseOrigin && inheritedIndexSignatures.stringSignatureWithBaseOrigin.signature; - var numberSignature = inheritedIndexSignatures.numberSignatureWithBaseOrigin && inheritedIndexSignatures.numberSignatureWithBaseOrigin.signature; - for (var memberName in inheritedMembers) { - var memberWithBaseOrigin = inheritedMembers[memberName]; - if (!memberWithBaseOrigin) { + if (token === 9 /* NoSubstitutionTemplateLiteral */ || token === 10 /* TemplateHead */) { + var tagExpression = createNode(147 /* TaggedTemplateExpression */, expression.pos); + tagExpression.tag = expression; + tagExpression.template = token === 9 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); + expression = finishNode(tagExpression); continue; } - - var relevantSignature = this.determineRelevantIndexerForMember(memberWithBaseOrigin.memberSymbol, numberSignature, stringSignature); - if (!relevantSignature) { + return expression; + } + } + function parseCallExpressionRest(expression) { + while (true) { + expression = parseMemberExpressionRest(expression); + if (token === 23 /* LessThanToken */) { + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (!typeArguments) { + return expression; + } + var callExpr = createNode(145 /* CallExpression */, expression.pos); + callExpr.expression = expression; + callExpr.typeArguments = typeArguments; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); continue; } - - var relevantSignatureIsNumberSignature = relevantSignature.parameters[0].type === this.semanticInfoChain.numberTypeSymbol; - var signatureBaseOrigin = relevantSignatureIsNumberSignature ? inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin : inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin; - - if (signatureBaseOrigin === memberWithBaseOrigin.baseOrigin) { + else if (token === 15 /* OpenParenToken */) { + var callExpr = createNode(145 /* CallExpression */, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); continue; } - - var memberIsSubtype = this.sourceIsAssignableToTarget(memberWithBaseOrigin.memberSymbol.type, relevantSignature.returnType, interfaceName, context, comparisonInfo); - - if (!memberIsSubtype) { - var enclosingSymbol = this.getEnclosingSymbolForAST(interfaceName); - if (relevantSignatureIsNumberSignature) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_of_property_0_in_type_1_is_not_assignable_to_number_indexer_type_in_type_2_NL_3, [memberName, memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), comparisonInfo.message]); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(enclosingSymbol), memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), innerDiagnostic])); - } else { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_of_property_0_in_type_1_is_not_assignable_to_string_indexer_type_in_type_2_NL_3, [memberName, memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), comparisonInfo.message]); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(enclosingSymbol), memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), innerDiagnostic])); - } - return true; - } + return expression; } - - return false; - }; - - PullTypeResolver.prototype.checkThatInheritedNumberSignatureIsSubtypeOfInheritedStringSignature = function (interfaceName, interfaceSymbol, inheritedIndexSignatures, context) { - if (inheritedIndexSignatures.numberSignatureWithBaseOrigin && inheritedIndexSignatures.stringSignatureWithBaseOrigin) { - if (inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin === inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin) { - return false; - } - - var comparisonInfo = new TypeComparisonInfo(); - var signatureIsSubtype = this.sourceIsAssignableToTarget(inheritedIndexSignatures.numberSignatureWithBaseOrigin.signature.returnType, inheritedIndexSignatures.stringSignatureWithBaseOrigin.signature.returnType, interfaceName, context, comparisonInfo); - - if (!signatureIsSubtype) { - var enclosingSymbol = this.getEnclosingSymbolForAST(interfaceName); - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_of_number_indexer_in_type_0_is_not_assignable_to_string_indexer_type_in_type_1_NL_2, [ - inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), - inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), comparisonInfo.message]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [ - interfaceSymbol.getDisplayName(enclosingSymbol), inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(), - inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), innerDiagnostic])); + } + function parseArgumentList() { + parseExpected(15 /* OpenParenToken */); + var result = parseDelimitedList(10 /* ArgumentExpressions */, parseArgumentExpression); + parseExpected(16 /* CloseParenToken */); + return result; + } + function parseTypeArgumentsInExpression() { + if (!parseOptional(23 /* LessThanToken */)) { + return undefined; + } + var typeArguments = parseDelimitedList(15 /* TypeArguments */, parseType); + if (!parseExpected(24 /* GreaterThanToken */)) { + return undefined; + } + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + } + function canFollowTypeArgumentsInExpression() { + switch (token) { + case 15 /* OpenParenToken */: + case 19 /* DotToken */: + case 16 /* CloseParenToken */: + case 18 /* CloseBracketToken */: + case 50 /* ColonToken */: + case 21 /* SemicolonToken */: + case 22 /* CommaToken */: + case 49 /* QuestionToken */: + case 27 /* EqualsEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 47 /* AmpersandAmpersandToken */: + case 48 /* BarBarToken */: + case 44 /* CaretToken */: + case 42 /* AmpersandToken */: + case 43 /* BarToken */: + case 14 /* CloseBraceToken */: + case 1 /* EndOfFileToken */: return true; - } + default: + return false; } - - return false; - }; - - PullTypeResolver.prototype.checkAssignability = function (ast, source, target, context) { - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(source, target, ast, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)])); - } + } + function parsePrimaryExpression() { + switch (token) { + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + return parseLiteralNode(); + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + return parseTokenNode(); + case 15 /* OpenParenToken */: + return parseParenthesizedExpression(); + case 17 /* OpenBracketToken */: + return parseArrayLiteralExpression(); + case 13 /* OpenBraceToken */: + return parseObjectLiteralExpression(); + case 81 /* FunctionKeyword */: + return parseFunctionExpression(); + case 86 /* NewKeyword */: + return parseNewExpression(); + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + if (reScanSlashToken() === 8 /* RegularExpressionLiteral */) { + return parseLiteralNode(); + } + break; + case 10 /* TemplateHead */: + return parseTemplateExpression(); + } + return parseIdentifier(ts.Diagnostics.Expression_expected); + } + function parseParenthesizedExpression() { + var node = createNode(149 /* ParenthesizedExpression */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + return finishNode(node); + } + function parseAssignmentExpressionOrOmittedExpression() { + return token === 22 /* CommaToken */ ? createNode(161 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); + } + function parseArrayLiteralElement() { + return parseAssignmentExpressionOrOmittedExpression(); + } + function parseArgumentExpression() { + return allowInAnd(parseAssignmentExpressionOrOmittedExpression); + } + function parseArrayLiteralExpression() { + var node = createNode(141 /* ArrayLiteralExpression */); + parseExpected(17 /* OpenBracketToken */); + if (scanner.hasPrecedingLineBreak()) + node.flags |= 256 /* MultiLine */; + node.elements = parseDelimitedList(12 /* ArrayLiteralMembers */, parseArrayLiteralElement); + parseExpected(18 /* CloseBracketToken */); + return finishNode(node); + } + function parseObjectLiteralElement() { + var fullStart = scanner.getStartPos(); + var initialToken = token; + if (parseContextualModifier(113 /* GetKeyword */) || parseContextualModifier(117 /* SetKeyword */)) { + var kind = initialToken === 113 /* GetKeyword */ ? 127 /* GetAccessor */ : 128 /* SetAccessor */; + return parseAccessorDeclaration(kind, fullStart, undefined); + } + var asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + var tokenIsIdentifier = isIdentifier(); + var nameToken = token; + var propertyName = parsePropertyName(); + if (asteriskToken || token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + return parseMethodDeclaration(fullStart, undefined, asteriskToken, propertyName, undefined, true); + } + var questionToken = parseOptionalToken(49 /* QuestionToken */); + if ((token === 22 /* CommaToken */ || token === 14 /* CloseBraceToken */) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(199 /* ShorthandPropertyAssignment */, fullStart); + shorthandDeclaration.name = propertyName; + shorthandDeclaration.questionToken = questionToken; + return finishNode(shorthandDeclaration); + } + else { + var propertyAssignment = createNode(198 /* PropertyAssignment */, fullStart); + propertyAssignment.name = propertyName; + propertyAssignment.questionToken = questionToken; + parseExpected(50 /* ColonToken */); + propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); + return finishNode(propertyAssignment); + } + } + function parseObjectLiteralExpression() { + var node = createNode(142 /* ObjectLiteralExpression */); + parseExpected(13 /* OpenBraceToken */); + if (scanner.hasPrecedingLineBreak()) { + node.flags |= 256 /* MultiLine */; + } + node.properties = parseDelimitedList(11 /* ObjectLiteralMembers */, parseObjectLiteralElement); + parseExpected(14 /* CloseBraceToken */); + return finishNode(node); + } + function parseFunctionExpression() { + var node = createNode(150 /* FunctionExpression */); + parseExpected(81 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); + fillSignature(50 /* ColonToken */, !!node.asteriskToken, false, node); + node.body = parseFunctionBlock(!!node.asteriskToken, false); + return finishNode(node); + } + function parseOptionalIdentifier() { + return isIdentifier() ? parseIdentifier() : undefined; + } + function parseNewExpression() { + var node = createNode(146 /* NewExpression */); + parseExpected(86 /* NewKeyword */); + node.expression = parseMemberExpressionOrHigher(); + node.typeArguments = tryParse(parseTypeArgumentsInExpression); + if (node.typeArguments || token === 15 /* OpenParenToken */) { + node.arguments = parseArgumentList(); + } + return finishNode(node); + } + function parseBlock(kind, ignoreMissingOpenBrace, checkForStrictMode) { + var node = createNode(kind); + if (parseExpected(13 /* OpenBraceToken */) || ignoreMissingOpenBrace) { + node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseFunctionBlock(allowYield, ignoreMissingOpenBrace) { + var savedYieldContext = inYieldContext(); + setYieldContext(allowYield); + var block = parseBlock(163 /* Block */, ignoreMissingOpenBrace, true); + setYieldContext(savedYieldContext); + return block; + } + function parseEmptyStatement() { + var node = createNode(165 /* EmptyStatement */); + parseExpected(21 /* SemicolonToken */); + return finishNode(node); + } + function parseIfStatement() { + var node = createNode(167 /* IfStatement */); + parseExpected(82 /* IfKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + node.thenStatement = parseStatement(); + node.elseStatement = parseOptional(74 /* ElseKeyword */) ? parseStatement() : undefined; + return finishNode(node); + } + function parseDoStatement() { + var node = createNode(168 /* DoStatement */); + parseExpected(73 /* DoKeyword */); + node.statement = parseStatement(); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + parseOptional(21 /* SemicolonToken */); + return finishNode(node); + } + function parseWhileStatement() { + var node = createNode(169 /* WhileStatement */); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + node.statement = parseStatement(); + return finishNode(node); + } + function parseForOrForInStatement() { + var pos = getNodePos(); + parseExpected(80 /* ForKeyword */); + parseExpected(15 /* OpenParenToken */); + if (token !== 21 /* SemicolonToken */) { + if (parseOptional(96 /* VarKeyword */)) { + var declarations = disallowInAnd(parseVariableDeclarationList); + } + else if (parseOptional(102 /* LetKeyword */)) { + var declarations = setFlag(disallowInAnd(parseVariableDeclarationList), 2048 /* Let */); + } + else if (parseOptional(68 /* ConstKeyword */)) { + var declarations = setFlag(disallowInAnd(parseVariableDeclarationList), 4096 /* Const */); + } + else { + var varOrInit = disallowInAnd(parseExpression); + } + } + var forOrForInStatement; + if (parseOptional(84 /* InKeyword */)) { + var forInStatement = createNode(171 /* ForInStatement */, pos); + if (declarations) { + forInStatement.declarations = declarations; + } + else { + forInStatement.variable = varOrInit; + } + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + forOrForInStatement = forInStatement; + } + else { + var forStatement = createNode(170 /* ForStatement */, pos); + if (declarations) { + forStatement.declarations = declarations; + } + if (varOrInit) { + forStatement.initializer = varOrInit; + } + parseExpected(21 /* SemicolonToken */); + if (token !== 21 /* SemicolonToken */ && token !== 16 /* CloseParenToken */) { + forStatement.condition = allowInAnd(parseExpression); + } + parseExpected(21 /* SemicolonToken */); + if (token !== 16 /* CloseParenToken */) { + forStatement.iterator = allowInAnd(parseExpression); + } + parseExpected(16 /* CloseParenToken */); + forOrForInStatement = forStatement; + } + forOrForInStatement.statement = parseStatement(); + return finishNode(forOrForInStatement); + } + function parseBreakOrContinueStatement(kind) { + var node = createNode(kind); + parseExpected(kind === 173 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); + if (!canParseSemicolon()) { + node.label = parseIdentifier(); + } + parseSemicolon(); + return finishNode(node); + } + function parseReturnStatement() { + var node = createNode(174 /* ReturnStatement */); + parseExpected(88 /* ReturnKeyword */); + if (!canParseSemicolon()) { + node.expression = allowInAnd(parseExpression); + } + parseSemicolon(); + return finishNode(node); + } + function parseWithStatement() { + var node = createNode(175 /* WithStatement */); + parseExpected(99 /* WithKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + node.statement = parseStatement(); + return finishNode(node); + } + function parseCaseClause() { + var node = createNode(194 /* CaseClause */); + parseExpected(65 /* CaseKeyword */); + node.expression = allowInAnd(parseExpression); + parseExpected(50 /* ColonToken */); + node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); + return finishNode(node); + } + function parseDefaultClause() { + var node = createNode(195 /* DefaultClause */); + parseExpected(71 /* DefaultKeyword */); + parseExpected(50 /* ColonToken */); + node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); + return finishNode(node); + } + function parseCaseOrDefaultClause() { + return token === 65 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + } + function parseSwitchStatement() { + var node = createNode(176 /* SwitchStatement */); + parseExpected(90 /* SwitchKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + parseExpected(13 /* OpenBraceToken */); + node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); + parseExpected(14 /* CloseBraceToken */); + return finishNode(node); + } + function parseThrowStatement() { + var node = createNode(178 /* ThrowStatement */); + parseExpected(92 /* ThrowKeyword */); + node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function parseTryStatement() { + var node = createNode(179 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */); + node.catchClause = token === 66 /* CatchKeyword */ ? parseCatchClause() : undefined; + node.finallyBlock = !node.catchClause || token === 79 /* FinallyKeyword */ ? parseTokenAndBlock(79 /* FinallyKeyword */) : undefined; + return finishNode(node); + } + function parseTokenAndBlock(token) { + var pos = getNodePos(); + parseExpected(token); + var result = parseBlock(token === 94 /* TryKeyword */ ? 180 /* TryBlock */ : 181 /* FinallyBlock */, false, false); + result.pos = pos; + return result; + } + function parseCatchClause() { + var result = createNode(197 /* CatchClause */); + parseExpected(66 /* CatchKeyword */); + parseExpected(15 /* OpenParenToken */); + result.name = parseIdentifier(); + result.type = parseTypeAnnotation(); + parseExpected(16 /* CloseParenToken */); + result.block = parseBlock(163 /* Block */, false, false); + return finishNode(result); + } + function parseDebuggerStatement() { + var node = createNode(182 /* DebuggerStatement */); + parseExpected(70 /* DebuggerKeyword */); + parseSemicolon(); + return finishNode(node); + } + function isLabel() { + return isIdentifier() && lookAhead(nextTokenIsColonToken); + } + function nextTokenIsColonToken() { + return nextToken() === 50 /* ColonToken */; + } + function parseLabeledStatement() { + var node = createNode(177 /* LabeledStatement */); + node.label = parseIdentifier(); + parseExpected(50 /* ColonToken */); + node.statement = parseStatement(); + return finishNode(node); + } + function parseExpressionStatement() { + var node = createNode(166 /* ExpressionStatement */); + node.expression = allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function isStatement(inErrorRecovery) { + switch (token) { + case 21 /* SemicolonToken */: + return !inErrorRecovery; + case 13 /* OpenBraceToken */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 81 /* FunctionKeyword */: + case 82 /* IfKeyword */: + case 73 /* DoKeyword */: + case 98 /* WhileKeyword */: + case 80 /* ForKeyword */: + case 69 /* ContinueKeyword */: + case 64 /* BreakKeyword */: + case 88 /* ReturnKeyword */: + case 99 /* WithKeyword */: + case 90 /* SwitchKeyword */: + case 92 /* ThrowKeyword */: + case 94 /* TryKeyword */: + case 70 /* DebuggerKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + return true; + case 68 /* ConstKeyword */: + var isConstEnum = lookAhead(nextTokenIsEnumKeyword); + return !isConstEnum; + case 101 /* InterfaceKeyword */: + case 67 /* ClassKeyword */: + case 114 /* ModuleKeyword */: + case 75 /* EnumKeyword */: + case 119 /* TypeKeyword */: + if (isDeclarationStart()) { + return false; + } + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) { + return false; + } + default: + return isStartOfExpression(); + } + } + function nextTokenIsEnumKeyword() { + nextToken(); + return token === 75 /* EnumKeyword */; + } + function nextTokenIsIdentifierOrKeywordOnSameLine() { + nextToken(); + return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + } + function parseStatement() { + switch (token) { + case 13 /* OpenBraceToken */: + return parseBlock(163 /* Block */, false, false); + case 96 /* VarKeyword */: + case 68 /* ConstKeyword */: + return parseVariableStatement(scanner.getStartPos(), undefined); + case 81 /* FunctionKeyword */: + return parseFunctionDeclaration(scanner.getStartPos(), undefined); + case 21 /* SemicolonToken */: + return parseEmptyStatement(); + case 82 /* IfKeyword */: + return parseIfStatement(); + case 73 /* DoKeyword */: + return parseDoStatement(); + case 98 /* WhileKeyword */: + return parseWhileStatement(); + case 80 /* ForKeyword */: + return parseForOrForInStatement(); + case 69 /* ContinueKeyword */: + return parseBreakOrContinueStatement(172 /* ContinueStatement */); + case 64 /* BreakKeyword */: + return parseBreakOrContinueStatement(173 /* BreakStatement */); + case 88 /* ReturnKeyword */: + return parseReturnStatement(); + case 99 /* WithKeyword */: + return parseWithStatement(); + case 90 /* SwitchKeyword */: + return parseSwitchStatement(); + case 92 /* ThrowKeyword */: + return parseThrowStatement(); + case 94 /* TryKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + return parseTryStatement(); + case 70 /* DebuggerKeyword */: + return parseDebuggerStatement(); + case 102 /* LetKeyword */: + if (isLetDeclaration()) { + return parseVariableStatement(scanner.getStartPos(), undefined); + } + default: + return isLabel() ? parseLabeledStatement() : parseExpressionStatement(); } - }; - - PullTypeResolver.prototype.isReference = function (ast, astSymbol) { - if (ast.kind() === 217 /* ParenthesizedExpression */) { - return this.isReference(ast.expression, astSymbol); + } + function parseFunctionBlockOrSemicolon(isGenerator) { + if (token === 13 /* OpenBraceToken */) { + return parseFunctionBlock(isGenerator, false); } - - if (ast.kind() !== 11 /* IdentifierName */ && ast.kind() !== 212 /* MemberAccessExpression */ && ast.kind() !== 221 /* ElementAccessExpression */) { - return false; + parseSemicolon(ts.Diagnostics.or_expected); + return undefined; + } + function parseVariableDeclaration() { + var node = createNode(183 /* VariableDeclaration */); + node.name = parseIdentifier(); + node.type = parseTypeAnnotation(); + node.initializer = parseInitializer(false); + return finishNode(node); + } + function setFlag(array, flag) { + for (var i = 0, n = array.length; i < n; i++) { + array[i].flags |= flag; + } + return array; + } + function parseVariableDeclarationList() { + return parseDelimitedList(9 /* VariableDeclarations */, parseVariableDeclaration); + } + function parseVariableStatement(fullStart, modifiers) { + var node = createNode(164 /* VariableStatement */, fullStart); + setModifiers(node, modifiers); + if (token === 102 /* LetKeyword */) { + node.flags |= 2048 /* Let */; + } + else if (token === 68 /* ConstKeyword */) { + node.flags |= 4096 /* Const */; + } + else { + ts.Debug.assert(token === 96 /* VarKeyword */); + } + nextToken(); + node.declarations = allowInAnd(parseVariableDeclarationList); + setFlag(node.declarations, node.flags); + parseSemicolon(); + return finishNode(node); + } + function parseFunctionDeclaration(fullStart, modifiers) { + var node = createNode(184 /* FunctionDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(81 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + node.name = parseIdentifier(); + fillSignature(50 /* ColonToken */, !!node.asteriskToken, false, node); + node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken); + return finishNode(node); + } + function parseConstructorDeclaration(pos, modifiers) { + var node = createNode(126 /* Constructor */, pos); + setModifiers(node, modifiers); + parseExpected(111 /* ConstructorKeyword */); + fillSignature(50 /* ColonToken */, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false); + return finishNode(node); + } + function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, requireBlock) { + var method = createNode(125 /* Method */, fullStart); + setModifiers(method, modifiers); + method.asteriskToken = asteriskToken; + method.name = name; + method.questionToken = questionToken; + fillSignature(50 /* ColonToken */, !!asteriskToken, false, method); + method.body = requireBlock ? parseFunctionBlock(!!asteriskToken, false) : parseFunctionBlockOrSemicolon(!!asteriskToken); + return finishNode(method); + } + function parsePropertyOrMethodDeclaration(fullStart, modifiers) { + var asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(49 /* QuestionToken */); + if (asteriskToken || token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, false); + } + else { + var property = createNode(124 /* Property */, fullStart); + setModifiers(property, modifiers); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + property.initializer = allowInAnd(parseNonParameterInitializer); + parseSemicolon(); + return finishNode(property); + } + } + function parseNonParameterInitializer() { + return parseInitializer(false); + } + function parseAccessorDeclaration(kind, fullStart, modifiers) { + var node = createNode(kind, fullStart); + setModifiers(node, modifiers); + node.name = parsePropertyName(); + fillSignature(50 /* ColonToken */, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false); + return finishNode(node); + } + function isClassMemberStart() { + var idToken; + while (ts.isModifier(token)) { + idToken = token; + nextToken(); + } + if (token === 34 /* AsteriskToken */) { + return true; } - - if (ast.kind() === 11 /* IdentifierName */) { - if (astSymbol.kind === 512 /* Variable */ && astSymbol.anyDeclHasFlag(4096 /* Enum */)) { - return false; - } - - if (astSymbol.kind === 512 /* Variable */ && astSymbol.anyDeclHasFlag(102400 /* SomeInitializedModule */)) { - return false; - } - - if (astSymbol.kind === 32768 /* ConstructorMethod */ || astSymbol.kind === 16384 /* Function */) { - return false; - } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); } - - if (ast.kind() === 212 /* MemberAccessExpression */ && astSymbol.kind === 67108864 /* EnumMember */) { - return false; + if (token === 17 /* OpenBracketToken */) { + return true; } - - return true; - }; - - PullTypeResolver.prototype.checkForSuperMemberAccess = function (expression, name, resolvedName, context) { - if (resolvedName) { - if (expression.kind() === 50 /* SuperKeyword */ && !resolvedName.isError() && resolvedName.kind !== 65536 /* Method */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode.Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword)); + if (idToken !== undefined) { + if (!ts.isKeyword(idToken) || idToken === 117 /* SetKeyword */ || idToken === 113 /* GetKeyword */) { return true; } - } - - return false; - }; - - PullTypeResolver.prototype.getEnclosingDeclForAST = function (ast) { - return this.semanticInfoChain.getEnclosingDecl(ast); - }; - - PullTypeResolver.prototype.getEnclosingSymbolForAST = function (ast) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - return enclosingDecl ? enclosingDecl.getSymbol() : null; - }; - - PullTypeResolver.prototype.checkForPrivateMemberAccess = function (name, expressionType, resolvedName, context) { - if (resolvedName) { - if (resolvedName.anyDeclHasFlag(2 /* Private */)) { - var memberContainer = resolvedName.getContainer(); - if (memberContainer && memberContainer.kind === 33554432 /* ConstructorType */) { - memberContainer = memberContainer.getAssociatedContainerType(); - } - - if (memberContainer && memberContainer.isClass()) { - var memberClass = memberContainer.getDeclarations()[0].ast(); - TypeScript.Debug.assert(memberClass); - - var containingClass = this.getEnclosingClassDeclaration(name); - - if (!containingClass || containingClass !== memberClass) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode._0_1_is_inaccessible, [memberContainer.toString(null, false), name.text()])); - return true; - } - } + switch (token) { + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 50 /* ColonToken */: + case 51 /* EqualsToken */: + case 49 /* QuestionToken */: + return true; + default: + return canParseSemicolon(); } } - return false; - }; - - PullTypeResolver.prototype.instantiateType = function (type, typeParameterArgumentMap) { - if (type.isPrimitive()) { - return type; - } - - if (type.isError()) { - return type; - } - - if (typeParameterArgumentMap[type.pullSymbolID]) { - return typeParameterArgumentMap[type.pullSymbolID]; + } + function parseModifiers() { + var flags = 0; + var modifiers; + while (true) { + var modifierStart = scanner.getStartPos(); + var modifierKind = token; + if (!parseAnyContextualModifier()) { + break; + } + if (!modifiers) { + modifiers = []; + modifiers.pos = modifierStart; + } + flags |= modifierToFlag(modifierKind); + modifiers.push(finishNode(createNode(modifierKind, modifierStart))); } - - type._resolveDeclaredSymbol(); - if (type.isTypeParameter()) { - return this.instantiateTypeParameter(type, typeParameterArgumentMap); + if (modifiers) { + modifiers.flags = flags; + modifiers.end = scanner.getStartPos(); } - - if (type.wrapsSomeTypeParameter(typeParameterArgumentMap)) { - return TypeScript.PullInstantiatedTypeReferenceSymbol.create(this, type, typeParameterArgumentMap); + return modifiers; + } + function parseClassElement() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (parseContextualModifier(113 /* GetKeyword */)) { + return parseAccessorDeclaration(127 /* GetAccessor */, fullStart, modifiers); } - - return type; - }; - - PullTypeResolver.prototype.instantiateTypeParameter = function (typeParameter, typeParameterArgumentMap) { - var constraint = typeParameter.getConstraint(); - if (!constraint) { - return typeParameter; + if (parseContextualModifier(117 /* SetKeyword */)) { + return parseAccessorDeclaration(128 /* SetAccessor */, fullStart, modifiers); } - - var instantiatedConstraint = this.instantiateType(constraint, typeParameterArgumentMap); - - if (instantiatedConstraint == constraint) { - return typeParameter; + if (token === 111 /* ConstructorKeyword */) { + return parseConstructorDeclaration(fullStart, modifiers); } - - var rootTypeParameter = typeParameter.getRootSymbol(); - var instantiation = rootTypeParameter.getSpecialization([instantiatedConstraint]); - if (instantiation) { - return instantiation; + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, modifiers); } - - instantiation = new TypeScript.PullInstantiatedTypeParameterSymbol(rootTypeParameter, instantiatedConstraint); - return instantiation; - }; - - PullTypeResolver.prototype.instantiateSignature = function (signature, typeParameterArgumentMap) { - if (!signature.wrapsSomeTypeParameter(typeParameterArgumentMap)) { - return signature; + if (isIdentifierOrKeyword() || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */ || token === 34 /* AsteriskToken */ || token === 17 /* OpenBracketToken */) { + return parsePropertyOrMethodDeclaration(fullStart, modifiers); } - - var rootSignature = signature.getRootSymbol(); - var mutableTypeParameterMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(typeParameterArgumentMap); - TypeScript.PullInstantiationHelpers.instantiateTypeArgument(this, signature, mutableTypeParameterMap); - - var instantiatedSignature = rootSignature.getSpecialization(mutableTypeParameterMap.typeParameterArgumentMap); - if (instantiatedSignature) { - return instantiatedSignature; + ts.Debug.fail("Should not have attempted to parse class member declaration."); + } + function parseClassDeclaration(fullStart, modifiers) { + var node = createNode(185 /* ClassDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(67 /* ClassKeyword */); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(true); + if (parseExpected(13 /* OpenBraceToken */)) { + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + parseExpected(14 /* CloseBraceToken */); } - - TypeScript.PullInstantiationHelpers.cleanUpTypeArgumentMap(signature, mutableTypeParameterMap); - typeParameterArgumentMap = mutableTypeParameterMap.typeParameterArgumentMap; - - instantiatedSignature = new TypeScript.PullInstantiatedSignatureSymbol(rootSignature, typeParameterArgumentMap); - - instantiatedSignature.returnType = this.instantiateType((rootSignature.returnType || this.semanticInfoChain.anyTypeSymbol), typeParameterArgumentMap); - instantiatedSignature.functionType = this.instantiateType(rootSignature.functionType, typeParameterArgumentMap); - - var parameters = rootSignature.parameters; - var parameter = null; - - if (parameters) { - for (var j = 0; j < parameters.length; j++) { - parameter = new TypeScript.PullSymbol(parameters[j].name, 2048 /* Parameter */); - parameter.setRootSymbol(parameters[j]); - - if (parameters[j].isOptional) { - parameter.isOptional = true; - } - if (parameters[j].isVarArg) { - parameter.isVarArg = true; - instantiatedSignature.hasVarArgs = true; - } - instantiatedSignature.addParameter(parameter, parameter.isOptional); - - parameter.type = this.instantiateType(parameters[j].type, typeParameterArgumentMap); - } + else { + node.members = createMissingList(); } - - return instantiatedSignature; - }; - PullTypeResolver.globalTypeCheckPhase = 0; - return PullTypeResolver; - })(); - TypeScript.PullTypeResolver = PullTypeResolver; - - var TypeComparisonInfo = (function () { - function TypeComparisonInfo(sourceComparisonInfo, useSameIndent) { - this.onlyCaptureFirstError = false; - this.flags = 0 /* SuccessfulComparison */; - this.message = ""; - this.stringConstantVal = null; - this.indent = 1; - if (sourceComparisonInfo) { - this.flags = sourceComparisonInfo.flags; - this.onlyCaptureFirstError = sourceComparisonInfo.onlyCaptureFirstError; - this.stringConstantVal = sourceComparisonInfo.stringConstantVal; - this.indent = sourceComparisonInfo.indent; - if (!useSameIndent) { - this.indent++; - } - } - } - TypeComparisonInfo.prototype.indentString = function () { - var result = ""; - - for (var i = 0; i < this.indent; i++) { - result += "\t"; + return finishNode(node); + } + function parseHeritageClauses(isClassHeritageClause) { + if (isHeritageClause()) { + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } - - return result; - }; - - TypeComparisonInfo.prototype.addMessage = function (message) { - if (!this.onlyCaptureFirstError && this.message) { - this.message = this.message + TypeScript.newLine() + this.indentString() + message; - } else { - this.message = this.indentString() + message; + return undefined; + } + function parseHeritageClausesWorker() { + return parseList(17 /* HeritageClauses */, false, parseHeritageClause); + } + function parseHeritageClause() { + if (token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */) { + var node = createNode(196 /* HeritageClause */); + node.token = token; + nextToken(); + node.types = parseDelimitedList(8 /* TypeReferences */, parseTypeReference); + return finishNode(node); } - }; - return TypeComparisonInfo; - })(); - TypeScript.TypeComparisonInfo = TypeComparisonInfo; - - function getPropertyAssignmentNameTextFromIdentifier(identifier) { - if (identifier.kind() === 11 /* IdentifierName */) { - return { actualText: identifier.text(), memberName: identifier.valueText() }; - } else if (identifier.kind() === 14 /* StringLiteral */) { - return { actualText: identifier.text(), memberName: identifier.valueText() }; - } else if (identifier.kind() === 13 /* NumericLiteral */) { - return { actualText: identifier.text(), memberName: identifier.valueText() }; - } else { - throw TypeScript.Errors.invalidOperation(); + return undefined; } - } - TypeScript.getPropertyAssignmentNameTextFromIdentifier = getPropertyAssignmentNameTextFromIdentifier; - - function isTypesOnlyLocation(ast) { - while (ast && ast.parent) { - switch (ast.parent.kind()) { - case 244 /* TypeAnnotation */: + function isHeritageClause() { + return token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; + } + function parseClassMembers() { + return parseList(6 /* ClassMembers */, false, parseClassElement); + } + function parseInterfaceDeclaration(fullStart, modifiers) { + var node = createNode(186 /* InterfaceDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(101 /* InterfaceKeyword */); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(false); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseTypeAliasDeclaration(fullStart, modifiers) { + var node = createNode(187 /* TypeAliasDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(119 /* TypeKeyword */); + node.name = parseIdentifier(); + parseExpected(51 /* EqualsToken */); + node.type = parseType(); + parseSemicolon(); + return finishNode(node); + } + function parseEnumMember() { + var node = createNode(200 /* EnumMember */, scanner.getStartPos()); + node.name = parsePropertyName(); + node.initializer = allowInAnd(parseNonParameterInitializer); + return finishNode(node); + } + function parseEnumDeclaration(fullStart, modifiers) { + var node = createNode(188 /* EnumDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(75 /* EnumKeyword */); + node.name = parseIdentifier(); + if (parseExpected(13 /* OpenBraceToken */)) { + node.members = parseDelimitedList(7 /* EnumMembers */, parseEnumMember); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseModuleBlock() { + var node = createNode(190 /* ModuleBlock */, scanner.getStartPos()); + if (parseExpected(13 /* OpenBraceToken */)) { + node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseInternalModuleTail(fullStart, modifiers, flags) { + var node = createNode(189 /* ModuleDeclaration */, fullStart); + setModifiers(node, modifiers); + node.flags |= flags; + node.name = parseIdentifier(); + node.body = parseOptional(19 /* DotToken */) ? parseInternalModuleTail(getNodePos(), undefined, 1 /* Export */) : parseModuleBlock(); + return finishNode(node); + } + function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { + var node = createNode(189 /* ModuleDeclaration */, fullStart); + setModifiers(node, modifiers); + node.name = parseLiteralNode(true); + node.body = parseModuleBlock(); + return finishNode(node); + } + function parseModuleDeclaration(fullStart, modifiers) { + parseExpected(114 /* ModuleKeyword */); + return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + } + function isExternalModuleReference() { + return token === 115 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); + } + function nextTokenIsOpenParen() { + return nextToken() === 15 /* OpenParenToken */; + } + function parseImportDeclaration(fullStart, modifiers) { + var node = createNode(191 /* ImportDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(83 /* ImportKeyword */); + node.name = parseIdentifier(); + parseExpected(51 /* EqualsToken */); + node.moduleReference = parseModuleReference(); + parseSemicolon(); + return finishNode(node); + } + function parseModuleReference() { + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + } + function parseExternalModuleReference() { + var node = createNode(193 /* ExternalModuleReference */); + parseExpected(115 /* RequireKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = parseExpression(); + if (node.expression.kind === 7 /* StringLiteral */) { + internIdentifier(node.expression.text); + } + parseExpected(16 /* CloseParenToken */); + return finishNode(node); + } + function parseExportAssignmentTail(fullStart, modifiers) { + var node = createNode(192 /* ExportAssignment */, fullStart); + setModifiers(node, modifiers); + node.exportName = parseIdentifier(); + parseSemicolon(); + return finishNode(node); + } + function isLetDeclaration() { + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + } + function isDeclarationStart() { + switch (token) { + case 96 /* VarKeyword */: + case 68 /* ConstKeyword */: + case 81 /* FunctionKeyword */: return true; - case 127 /* TypeQuery */: - return false; - case 125 /* ConstructorType */: - var constructorType = ast.parent; - if (constructorType.type === ast) { - return true; - } + case 102 /* LetKeyword */: + return isLetDeclaration(); + case 67 /* ClassKeyword */: + case 101 /* InterfaceKeyword */: + case 75 /* EnumKeyword */: + case 83 /* ImportKeyword */: + case 119 /* TypeKeyword */: + return lookAhead(nextTokenIsIdentifierOrKeyword); + case 114 /* ModuleKeyword */: + return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); + case 76 /* ExportKeyword */: + return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart); + case 112 /* DeclareKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + return lookAhead(nextTokenIsDeclarationStart); + } + } + function isIdentifierOrKeyword() { + return token >= 63 /* Identifier */; + } + function nextTokenIsIdentifierOrKeyword() { + nextToken(); + return isIdentifierOrKeyword(); + } + function nextTokenIsIdentifierOrKeywordOrStringLiteral() { + nextToken(); + return isIdentifierOrKeyword() || token === 7 /* StringLiteral */; + } + function nextTokenIsEqualsTokenOrDeclarationStart() { + nextToken(); + return token === 51 /* EqualsToken */ || isDeclarationStart(); + } + function nextTokenIsDeclarationStart() { + nextToken(); + return isDeclarationStart(); + } + function parseDeclaration() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (token === 76 /* ExportKeyword */) { + nextToken(); + if (parseOptional(51 /* EqualsToken */)) { + return parseExportAssignmentTail(fullStart, modifiers); + } + } + switch (token) { + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 68 /* ConstKeyword */: + return parseVariableStatement(fullStart, modifiers); + case 81 /* FunctionKeyword */: + return parseFunctionDeclaration(fullStart, modifiers); + case 67 /* ClassKeyword */: + return parseClassDeclaration(fullStart, modifiers); + case 101 /* InterfaceKeyword */: + return parseInterfaceDeclaration(fullStart, modifiers); + case 119 /* TypeKeyword */: + return parseTypeAliasDeclaration(fullStart, modifiers); + case 75 /* EnumKeyword */: + return parseEnumDeclaration(fullStart, modifiers); + case 114 /* ModuleKeyword */: + return parseModuleDeclaration(fullStart, modifiers); + case 83 /* ImportKeyword */: + return parseImportDeclaration(fullStart, modifiers); + default: + ts.Debug.fail("Mismatch between isDeclarationStart and parseDeclaration"); + } + } + function isSourceElement(inErrorRecovery) { + return isDeclarationStart() || isStatement(inErrorRecovery); + } + function parseSourceElement() { + return parseSourceElementOrModuleElement(); + } + function parseModuleElement() { + return parseSourceElementOrModuleElement(); + } + function parseSourceElementOrModuleElement() { + return isDeclarationStart() ? parseDeclaration() : parseStatement(); + } + function processReferenceComments() { + var triviaScanner = ts.createScanner(languageVersion, false, sourceText); + var referencedFiles = []; + var amdDependencies = []; + var amdModuleName; + while (true) { + var kind = triviaScanner.scan(); + if (kind === 5 /* WhitespaceTrivia */ || kind === 4 /* NewLineTrivia */ || kind === 3 /* MultiLineCommentTrivia */) { + continue; + } + if (kind !== 2 /* SingleLineCommentTrivia */) { break; - case 123 /* FunctionType */: - var functionType = ast.parent; - if (functionType.type === ast) { - return true; + } + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var comment = sourceText.substring(range.pos, range.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnosticMessage = referencePathMatchResult.diagnosticMessage; + if (fileReference) { + referencedFiles.push(fileReference); } - break; - case 239 /* Constraint */: - var constraint = ast.parent; - if (constraint.type === ast) { - return true; + if (diagnosticMessage) { + sourceFile.referenceDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); } - break; - case 220 /* CastExpression */: - var castExpression = ast.parent; - return castExpression.type === ast; - case 230 /* ExtendsHeritageClause */: - case 231 /* ImplementsHeritageClause */: - return true; - case 228 /* TypeArgumentList */: + } + else { + var amdModuleNameRegEx = /^\/\/\/\s* 0) { + syntacticDiagnostics = sourceFile.referenceDiagnostics.concat(sourceFile.parseDiagnostics); + } + else { + checkGrammar(sourceText, languageVersion, sourceFile); + syntacticDiagnostics = sourceFile.referenceDiagnostics.concat(sourceFile.grammarDiagnostics); + } + } + ts.Debug.assert(syntacticDiagnostics !== undefined); + return syntacticDiagnostics; + } + var rootNodeFlags = 0; + if (ts.fileExtensionIs(filename, ".d.ts")) { + rootNodeFlags = 1024 /* DeclarationFile */; + } + var sourceFile = createRootNode(201 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + sourceFile.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition; + sourceFile.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter; + sourceFile.getLineStarts = getLineStarts; + sourceFile.getSyntacticDiagnostics = getSyntacticDiagnostics; + sourceFile.filename = ts.normalizePath(filename); + sourceFile.text = sourceText; + sourceFile.referenceDiagnostics = []; + sourceFile.parseDiagnostics = []; + sourceFile.grammarDiagnostics = []; + sourceFile.semanticDiagnostics = []; + var referenceComments = processReferenceComments(); + sourceFile.referencedFiles = referenceComments.referencedFiles; + sourceFile.amdDependencies = referenceComments.amdDependencies; + sourceFile.amdModuleName = referenceComments.amdModuleName; + var scanner = ts.createScanner(languageVersion, true, sourceText, scanError); + nextToken(); + sourceFile.statements = parseList(0 /* SourceElements */, true, parseSourceElement); + ts.Debug.assert(token === 1 /* EndOfFileToken */); + sourceFile.endOfFileToken = parseTokenNode(); + sourceFile.externalModuleIndicator = getExternalModuleIndicator(); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.version = version; + sourceFile.isOpen = isOpen; + sourceFile.languageVersion = languageVersion; + sourceFile.identifiers = identifiers; + return sourceFile; + } + ts.createSourceFile = createSourceFile; + function isLeftHandSideExpression(expr) { + if (expr) { + switch (expr.kind) { + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 146 /* NewExpression */: + case 145 /* CallExpression */: + case 147 /* TaggedTemplateExpression */: + case 141 /* ArrayLiteralExpression */: + case 149 /* ParenthesizedExpression */: + case 142 /* ObjectLiteralExpression */: + case 150 /* FunctionExpression */: + case 63 /* Identifier */: + case 8 /* RegularExpressionLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 159 /* TemplateExpression */: + case 78 /* FalseKeyword */: + case 87 /* NullKeyword */: + case 91 /* ThisKeyword */: + case 93 /* TrueKeyword */: + case 89 /* SuperKeyword */: return true; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - case 129 /* FunctionDeclaration */: - case 145 /* MethodSignature */: - case 212 /* MemberAccessExpression */: - case 242 /* Parameter */: - return false; } - - ast = ast.parent; } - return false; } - TypeScript.isTypesOnlyLocation = isTypesOnlyLocation; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.declCacheHit = 0; - TypeScript.declCacheMiss = 0; - TypeScript.symbolCacheHit = 0; - TypeScript.symbolCacheMiss = 0; - - var sentinalEmptyArray = []; - - var SemanticInfoChain = (function () { - function SemanticInfoChain(compiler, logger) { - this.compiler = compiler; - this.logger = logger; - this.documents = []; - this.fileNameToDocument = TypeScript.createIntrinsicsObject(); - this.anyTypeDecl = null; - this.booleanTypeDecl = null; - this.numberTypeDecl = null; - this.stringTypeDecl = null; - this.nullTypeDecl = null; - this.undefinedTypeDecl = null; - this.voidTypeDecl = null; - this.undefinedValueDecl = null; - this.anyTypeSymbol = null; - this.booleanTypeSymbol = null; - this.numberTypeSymbol = null; - this.stringTypeSymbol = null; - this.nullTypeSymbol = null; - this.undefinedTypeSymbol = null; - this.voidTypeSymbol = null; - this.undefinedValueSymbol = null; - this.emptyTypeSymbol = null; - this.astSymbolMap = []; - this.astAliasSymbolMap = []; - this.astCallResolutionDataMap = []; - this.declSymbolMap = []; - this.declSignatureSymbolMap = []; - this.declCache = null; - this.symbolCache = null; - this.fileNameToDiagnostics = null; - this._binder = null; - this._resolver = null; - this._topLevelDecls = null; - this._fileNames = null; - var globalDecl = new TypeScript.RootPullDecl("", "", 0 /* Global */, 0 /* None */, this, false); - this.documents[0] = new TypeScript.Document(this.compiler, this, "", [], null, 0 /* None */, 0, false, null, globalDecl); - - this.anyTypeDecl = new TypeScript.NormalPullDecl("any", "any", 2 /* Primitive */, 0 /* None */, globalDecl); - this.booleanTypeDecl = new TypeScript.NormalPullDecl("boolean", "boolean", 2 /* Primitive */, 0 /* None */, globalDecl); - this.numberTypeDecl = new TypeScript.NormalPullDecl("number", "number", 2 /* Primitive */, 0 /* None */, globalDecl); - this.stringTypeDecl = new TypeScript.NormalPullDecl("string", "string", 2 /* Primitive */, 0 /* None */, globalDecl); - this.voidTypeDecl = new TypeScript.NormalPullDecl("void", "void", 2 /* Primitive */, 0 /* None */, globalDecl); - - this.nullTypeDecl = new TypeScript.RootPullDecl("null", "", 2 /* Primitive */, 0 /* None */, this, false); - this.undefinedTypeDecl = new TypeScript.RootPullDecl("undefined", "", 2 /* Primitive */, 0 /* None */, this, false); - this.undefinedValueDecl = new TypeScript.NormalPullDecl("undefined", "undefined", 512 /* Variable */, 8 /* Ambient */, globalDecl); - - this.invalidate(); - } - SemanticInfoChain.prototype.getDocument = function (fileName) { - var document = this.fileNameToDocument[fileName]; - return document || null; - }; - - SemanticInfoChain.prototype.lineMap = function (fileName) { - return this.getDocument(fileName).lineMap(); - }; - - SemanticInfoChain.prototype.fileNames = function () { - if (this._fileNames === null) { - this._fileNames = this.documents.slice(1).map(function (s) { - return s.fileName; - }); - } - - return this._fileNames; - }; - - SemanticInfoChain.prototype.bindPrimitiveSymbol = function (decl, newSymbol) { - newSymbol.addDeclaration(decl); - decl.setSymbol(newSymbol); - newSymbol.setResolved(); - - return newSymbol; - }; - - SemanticInfoChain.prototype.addPrimitiveTypeSymbol = function (decl) { - var newSymbol = new TypeScript.PullPrimitiveTypeSymbol(decl.name); - return this.bindPrimitiveSymbol(decl, newSymbol); - }; - - SemanticInfoChain.prototype.addPrimitiveValueSymbol = function (decl, type) { - var newSymbol = new TypeScript.PullSymbol(decl.name, 512 /* Variable */); - newSymbol.type = type; - return this.bindPrimitiveSymbol(decl, newSymbol); - }; - - SemanticInfoChain.prototype.resetGlobalSymbols = function () { - this.anyTypeSymbol = this.addPrimitiveTypeSymbol(this.anyTypeDecl); - this.booleanTypeSymbol = this.addPrimitiveTypeSymbol(this.booleanTypeDecl); - this.numberTypeSymbol = this.addPrimitiveTypeSymbol(this.numberTypeDecl); - this.stringTypeSymbol = this.addPrimitiveTypeSymbol(this.stringTypeDecl); - this.voidTypeSymbol = this.addPrimitiveTypeSymbol(this.voidTypeDecl); - this.nullTypeSymbol = this.addPrimitiveTypeSymbol(this.nullTypeDecl); - this.undefinedTypeSymbol = this.addPrimitiveTypeSymbol(this.undefinedTypeDecl); - this.undefinedValueSymbol = this.addPrimitiveValueSymbol(this.undefinedValueDecl, this.undefinedTypeSymbol); - - var emptyTypeDecl = new TypeScript.PullSynthesizedDecl("{}", "{}", 8388608 /* ObjectType */, 0 /* None */, null, this); - var emptyTypeSymbol = new TypeScript.PullTypeSymbol("{}", 8388608 /* ObjectType */); - emptyTypeDecl.setSymbol(emptyTypeSymbol); - emptyTypeSymbol.addDeclaration(emptyTypeDecl); - emptyTypeSymbol.setResolved(); - this.emptyTypeSymbol = emptyTypeSymbol; - }; - - SemanticInfoChain.prototype.addDocument = function (document) { - var fileName = document.fileName; - - var existingIndex = TypeScript.ArrayUtilities.indexOf(this.documents, function (u) { - return u.fileName === fileName; - }); - if (existingIndex < 0) { - this.documents.push(document); - } else { - this.documents[existingIndex] = document; + function isAssignmentOperator(token) { + return token >= 51 /* FirstAssignment */ && token <= 62 /* LastAssignment */; + } + function checkGrammar(sourceText, languageVersion, file) { + var grammarDiagnostics = file.grammarDiagnostics; + var scanner = ts.createScanner(languageVersion, true, sourceText); + var inAmbientContext = ts.fileExtensionIs(file.filename, ".d.ts"); + var inFunctionBlock = false; + var parent; + visitNode(file); + function visitNode(node) { + var savedParent = parent; + node.parent = parent; + parent = node; + if (!checkModifiers(node)) { + var savedInFunctionBlock = inFunctionBlock; + if (ts.isFunctionBlock(node)) { + inFunctionBlock = true; + } + var savedInAmbientContext = inAmbientContext; + if (node.flags & 2 /* Ambient */) { + inAmbientContext = true; + } + checkNodeAndChildren(node); + inAmbientContext = savedInAmbientContext; + inFunctionBlock = savedInFunctionBlock; + } + parent = savedParent; + } + function checkNodeAndChildren(node) { + var nodeKind = node.kind; + if (inAmbientContext && checkForStatementInAmbientContext(node, nodeKind)) { + return; } - - this.fileNameToDocument[fileName] = document; - - this.invalidate(); - }; - - SemanticInfoChain.prototype.removeDocument = function (fileName) { - TypeScript.Debug.assert(fileName !== "", "Can't remove the semantic info for the global decl."); - var index = TypeScript.ArrayUtilities.indexOf(this.documents, function (u) { - return u.fileName === fileName; - }); - if (index > 0) { - this.fileNameToDocument[fileName] = undefined; - this.documents.splice(index, 1); - this.invalidate(); + if (checkNode(node, nodeKind)) { + return; } - }; - - SemanticInfoChain.prototype.getDeclPathCacheID = function (declPath, declKind) { - var cacheID = ""; - - for (var i = 0; i < declPath.length; i++) { - cacheID += "#" + declPath[i]; + forEachChild(node, visitNode); + } + function checkNode(node, nodeKind) { + switch (nodeKind) { + case 151 /* ArrowFunction */: + case 129 /* CallSignature */: + case 134 /* ConstructorType */: + case 130 /* ConstructSignature */: + case 133 /* FunctionType */: + return checkAnySignatureDeclaration(node); + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + return checkBreakOrContinueStatement(node); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return checkCallOrNewExpression(node); + case 188 /* EnumDeclaration */: return checkEnumDeclaration(node); + case 157 /* BinaryExpression */: return checkBinaryExpression(node); + case 197 /* CatchClause */: return checkCatchClause(node); + case 185 /* ClassDeclaration */: return checkClassDeclaration(node); + case 121 /* ComputedPropertyName */: return checkComputedPropertyName(node); + case 126 /* Constructor */: return checkConstructor(node); + case 152 /* DeleteExpression */: return checkDeleteExpression(node); + case 144 /* ElementAccessExpression */: return checkElementAccessExpression(node); + case 192 /* ExportAssignment */: return checkExportAssignment(node); + case 193 /* ExternalModuleReference */: return checkExternalModuleReference(node); + case 171 /* ForInStatement */: return checkForInStatement(node); + case 170 /* ForStatement */: return checkForStatement(node); + case 184 /* FunctionDeclaration */: return checkFunctionDeclaration(node); + case 150 /* FunctionExpression */: return checkFunctionExpression(node); + case 127 /* GetAccessor */: return checkGetAccessor(node); + case 196 /* HeritageClause */: return checkHeritageClause(node); + case 131 /* IndexSignature */: return checkIndexSignature(node); + case 186 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); + case 177 /* LabeledStatement */: return checkLabeledStatement(node); + case 198 /* PropertyAssignment */: return checkPropertyAssignment(node); + case 125 /* Method */: return checkMethod(node); + case 189 /* ModuleDeclaration */: return checkModuleDeclaration(node); + case 142 /* ObjectLiteralExpression */: return checkObjectLiteralExpression(node); + case 6 /* NumericLiteral */: return checkNumericLiteral(node); + case 123 /* Parameter */: return checkParameter(node); + case 156 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); + case 155 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); + case 124 /* Property */: return checkProperty(node); + case 174 /* ReturnStatement */: return checkReturnStatement(node); + case 128 /* SetAccessor */: return checkSetAccessor(node); + case 201 /* SourceFile */: return checkSourceFile(node); + case 199 /* ShorthandPropertyAssignment */: return checkShorthandPropertyAssignment(node); + case 176 /* SwitchStatement */: return checkSwitchStatement(node); + case 147 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); + case 178 /* ThrowStatement */: return checkThrowStatement(node); + case 138 /* TupleType */: return checkTupleType(node); + case 122 /* TypeParameter */: return checkTypeParameter(node); + case 132 /* TypeReference */: return checkTypeReference(node); + case 183 /* VariableDeclaration */: return checkVariableDeclaration(node); + case 164 /* VariableStatement */: return checkVariableStatement(node); + case 175 /* WithStatement */: return checkWithStatement(node); + case 160 /* YieldExpression */: return checkYieldExpression(node); + } + } + function scanToken(pos) { + var start = ts.skipTrivia(sourceText, pos); + scanner.setTextPos(start); + scanner.scan(); + return start; + } + function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + var start = scanToken(node.pos); + grammarDiagnostics.push(ts.createFileDiagnostic(file, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + return true; + } + function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + scanToken(node.pos); + grammarDiagnostics.push(ts.createFileDiagnostic(file, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + return true; + } + function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + var span = ts.getErrorSpanForNode(node); + var start = span.end > span.pos ? ts.skipTrivia(file.text, span.pos) : span.pos; + var length = span.end - start; + grammarDiagnostics.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); + return true; + } + function grammarErrorAtPos(start, length, message, arg0, arg1, arg2) { + grammarDiagnostics.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); + return true; + } + function reportInvalidUseInStrictMode(node) { + var name = sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + return grammarErrorOnNode(node, ts.Diagnostics.Invalid_use_of_0_in_strict_mode, name); + } + function checkForStatementInAmbientContext(node, kind) { + switch (kind) { + case 163 /* Block */: + case 165 /* EmptyStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + case 174 /* ReturnStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 182 /* DebuggerStatement */: + case 177 /* LabeledStatement */: + case 166 /* ExpressionStatement */: + return grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + } + } + function checkAnySignatureDeclaration(node) { + return checkTypeParameterList(node.typeParameters) || checkParameterList(node.parameters); + } + function checkBinaryExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isEvalOrArgumentsIdentifier(node.left)) { + return reportInvalidUseInStrictMode(node.left); + } + } + } + } + function isIterationStatement(node, lookInLabeledStatements) { + switch (node.kind) { + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + return true; + case 177 /* LabeledStatement */: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } - - return cacheID + "#" + declKind.toString(); - }; - - SemanticInfoChain.prototype.findTopLevelSymbol = function (name, kind, doNotGoPastThisDecl) { - var cacheID = this.getDeclPathCacheID([name], kind); - - var symbol = this.symbolCache[cacheID]; - - if (!symbol) { - for (var i = 0, n = this.documents.length; i < n; i++) { - var topLevelDecl = this.documents[i].topLevelDecl(); - - var symbol = this.findTopLevelSymbolInDecl(topLevelDecl, name, kind, doNotGoPastThisDecl); - if (symbol) { - break; - } - - if (doNotGoPastThisDecl && topLevelDecl.name === doNotGoPastThisDecl.fileName()) { - return null; - } + return false; + } + function checkLabeledStatement(node) { + var current = node.parent; + while (current) { + if (ts.isAnyFunction(current)) { + break; } - - if (symbol) { - this.symbolCache[cacheID] = symbol; + if (current.kind === 177 /* LabeledStatement */ && current.label.text === node.label.text) { + return grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceText, node.label)); } + current = current.parent; } - - return symbol; - }; - - SemanticInfoChain.prototype.findTopLevelSymbolInDecl = function (topLevelDecl, name, kind, doNotGoPastThisDecl) { - var doNotGoPastThisPosition = doNotGoPastThisDecl && doNotGoPastThisDecl.fileName() === topLevelDecl.fileName() ? doNotGoPastThisDecl.ast().start() : -1; - - var foundDecls = topLevelDecl.searchChildDecls(name, kind); - - for (var j = 0; j < foundDecls.length; j++) { - var foundDecl = foundDecls[j]; - - if (doNotGoPastThisPosition !== -1 && foundDecl.ast() && foundDecl.ast().start() > doNotGoPastThisPosition) { - break; - } - - var symbol = foundDecls[j].getSymbol(); - if (symbol) { - return symbol; + } + function checkBreakOrContinueStatement(node) { + var current = node; + while (current) { + if (ts.isAnyFunction(current)) { + return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); + } + switch (current.kind) { + case 177 /* LabeledStatement */: + if (node.label && current.label.text === node.label.text) { + var isMisplacedContinueLabel = node.kind === 172 /* ContinueStatement */ && !isIterationStatement(current.statement, true); + if (isMisplacedContinueLabel) { + return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); + } + return false; + } + break; + case 176 /* SwitchStatement */: + if (node.kind === 173 /* BreakStatement */ && !node.label) { + return false; + } + break; + default: + if (isIterationStatement(current, false) && !node.label) { + return false; + } + break; } + current = current.parent; } - - return null; - }; - - SemanticInfoChain.prototype.findExternalModule = function (id) { - id = TypeScript.normalizePath(id); - - var tsFile = id + ".ts"; - var tsCacheID = this.getDeclPathCacheID([tsFile], 32 /* DynamicModule */); - symbol = this.symbolCache[tsCacheID]; - if (symbol != undefined) { - return symbol; + if (node.label) { + var message = node.kind === 173 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); } - - var dtsFile = id + ".d.ts"; - var dtsCacheID = this.getDeclPathCacheID([dtsFile], 32 /* DynamicModule */); - var symbol = this.symbolCache[dtsCacheID]; - if (symbol) { - return symbol; + else { + var message = node.kind === 173 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); } - - var dtsSymbol; - for (var i = 0; i < this.documents.length; i++) { - var document = this.documents[i]; - var topLevelDecl = document.topLevelDecl(); - - if (topLevelDecl.isExternalModule()) { - var isTsFile = document.fileName === tsFile; - if (isTsFile || document.fileName === dtsFile) { - var dynamicModuleDecl = topLevelDecl.getChildDecls()[0]; - symbol = dynamicModuleDecl.getSymbol(); - - if (isTsFile) { - this.symbolCache[tsCacheID] = symbol; - - return symbol; - } else { - dtsSymbol = symbol; - } + } + function checkCallOrNewExpression(node) { + return checkTypeArguments(node.typeArguments) || checkArguments(node.arguments); + } + function checkArguments(arguments) { + return checkForDisallowedTrailingComma(arguments) || checkForOmittedArgument(arguments); + } + function checkTypeArguments(typeArguments) { + return checkForDisallowedTrailingComma(typeArguments) || checkForAtLeastOneTypeArgument(typeArguments); + } + function checkForOmittedArgument(arguments) { + if (arguments) { + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === 161 /* OmittedExpression */) { + return grammarErrorAtPos(arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } - - if (dtsSymbol) { - this.symbolCache[dtsCacheID] = symbol; - return dtsSymbol; + } + function checkForAtLeastOneTypeArgument(typeArguments) { + if (typeArguments && typeArguments.length === 0) { + var start = typeArguments.pos - "<".length; + var end = ts.skipTrivia(sourceText, typeArguments.end) + ">".length; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); } - - this.symbolCache[dtsCacheID] = null; - this.symbolCache[tsCacheID] = null; - - return null; - }; - - SemanticInfoChain.prototype.findAmbientExternalModuleInGlobalContext = function (id) { - var cacheID = this.getDeclPathCacheID([id], 32 /* DynamicModule */); - - var symbol = this.symbolCache[cacheID]; - if (symbol == undefined) { - symbol = null; - for (var i = 0; i < this.documents.length; i++) { - var document = this.documents[i]; - var topLevelDecl = document.topLevelDecl(); - - if (!topLevelDecl.isExternalModule()) { - var dynamicModules = topLevelDecl.searchChildDecls(id, 32 /* DynamicModule */); - if (dynamicModules.length) { - symbol = dynamicModules[0].getSymbol(); - break; + } + function checkForDisallowedTrailingComma(list) { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + } + } + function checkCatchClause(node) { + if (node.type) { + var colonStart = ts.skipTrivia(sourceText, node.name.end); + return grammarErrorAtPos(colonStart, ":".length, ts.Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + } + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.name)) { + return reportInvalidUseInStrictMode(node.name); + } + } + function checkClassDeclaration(node) { + return checkClassDeclarationHeritageClauses(node); + } + function checkClassDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + var seenImplementsClause = false; + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 2); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 77 /* ExtendsKeyword */) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause); + } + if (heritageClause.types.length > 1) { + return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 100 /* ImplementsKeyword */); + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } + seenImplementsClause = true; } } - - this.symbolCache[cacheID] = symbol; } - - return symbol; - }; - - SemanticInfoChain.prototype.findDecls = function (declPath, declKind) { - var cacheID = this.getDeclPathCacheID(declPath, declKind); - - if (declPath.length) { - var cachedDecls = this.declCache[cacheID]; - - if (cachedDecls && cachedDecls.length) { - TypeScript.declCacheHit++; - return cachedDecls; - } + return false; + } + function checkForAtLeastOneHeritageClause(types, listType) { + if (types && types.length === 0) { + return grammarErrorAtPos(types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType); } - - TypeScript.declCacheMiss++; - - var declsToSearch = this.topLevelDecls(); - - var decls = TypeScript.sentinelEmptyArray; - var path; - var foundDecls = TypeScript.sentinelEmptyArray; - - for (var i = 0; i < declPath.length; i++) { - path = declPath[i]; - decls = TypeScript.sentinelEmptyArray; - - var kind = (i === declPath.length - 1) ? declKind : 164 /* SomeContainer */; - for (var j = 0; j < declsToSearch.length; j++) { - foundDecls = declsToSearch[j].searchChildDecls(path, kind); - - for (var k = 0; k < foundDecls.length; k++) { - if (decls === TypeScript.sentinelEmptyArray) { - decls = []; + } + function checkConstructor(node) { + return checkAnySignatureDeclaration(node) || checkConstructorTypeParameters(node) || checkConstructorTypeAnnotation(node) || checkForBodyInAmbientContext(node.body, true); + } + function checkConstructorTypeParameters(node) { + if (node.typeParameters) { + return grammarErrorAtPos(node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + function checkConstructorTypeAnnotation(node) { + if (node.type) { + return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + function checkDeleteExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */ && node.expression.kind === 63 /* Identifier */) { + return grammarErrorOnNode(node.expression, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); + } + } + function checkEnumDeclaration(enumDecl) { + var enumIsConst = (enumDecl.flags & 4096 /* Const */) !== 0; + var hasError = false; + if (!enumIsConst) { + var inConstantEnumMemberSection = true; + for (var i = 0, n = enumDecl.members.length; i < n; i++) { + var node = enumDecl.members[i]; + if (node.name.kind === 121 /* ComputedPropertyName */) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (inAmbientContext) { + if (node.initializer && !isIntegerLiteral(node.initializer)) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; } - decls[decls.length] = foundDecls[k]; } - } - - declsToSearch = decls; - - if (!declsToSearch) { - break; + else if (node.initializer) { + inConstantEnumMemberSection = isIntegerLiteral(node.initializer); + } + else if (!inConstantEnumMemberSection) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; + } } } - - if (decls.length) { - this.declCache[cacheID] = decls; + return hasError; + } + function isIntegerLiteral(expression) { + function isInteger(literalExpression) { + return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - - return decls; - }; - - SemanticInfoChain.prototype.findDeclsFromPath = function (declPath, declKind) { - var declString = []; - - for (var i = 0, n = declPath.length; i < n; i++) { - if (declPath[i].kind & 1 /* Script */) { - continue; + if (expression.kind === 155 /* PrefixUnaryExpression */) { + var unaryExpression = expression; + if (unaryExpression.operator === 32 /* PlusToken */ || unaryExpression.operator === 33 /* MinusToken */) { + expression = unaryExpression.operand; } - - declString.push(declPath[i].name); } - - return this.findDecls(declString, declKind); - }; - - SemanticInfoChain.prototype.findSymbol = function (declPath, declType) { - var cacheID = this.getDeclPathCacheID(declPath, declType); - - if (declPath.length) { - var cachedSymbol = this.symbolCache[cacheID]; - - if (cachedSymbol) { - TypeScript.symbolCacheHit++; - return cachedSymbol; - } + if (expression.kind === 6 /* NumericLiteral */) { + return isInteger(expression); } - - TypeScript.symbolCacheMiss++; - - var decls = this.findDecls(declPath, declType); - var symbol = null; - - if (decls.length) { - var decl = decls[0]; - if (TypeScript.hasFlag(decl.kind, 164 /* SomeContainer */)) { - var valueDecl = decl.getValueDecl(); - if (valueDecl) { - valueDecl.ensureSymbolIsBound(); - } - } - symbol = decl.getSymbol(); - - if (symbol) { - for (var i = 1; i < decls.length; i++) { - decls[i].ensureSymbolIsBound(); - } - - this.symbolCache[cacheID] = symbol; - } + return false; + } + function checkExportAssignment(node) { + if (node.flags & 243 /* Modifier */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - - return symbol; - }; - - SemanticInfoChain.prototype.cacheGlobalSymbol = function (symbol, kind) { - var cacheID1 = this.getDeclPathCacheID([symbol.name], kind); - var cacheID2 = this.getDeclPathCacheID([symbol.name], symbol.kind); - - if (!this.symbolCache[cacheID1]) { - this.symbolCache[cacheID1] = symbol; + } + function checkExternalModuleReference(node) { + if (node.expression.kind !== 7 /* StringLiteral */) { + return grammarErrorOnNode(node.expression, ts.Diagnostics.String_literal_expected); } - - if (!this.symbolCache[cacheID2]) { - this.symbolCache[cacheID2] = symbol; + } + function checkForInStatement(node) { + return checkVariableDeclarations(node.declarations) || checkForMoreThanOneDeclaration(node.declarations); + } + function checkForStatement(node) { + return checkVariableDeclarations(node.declarations); + } + function checkForMoreThanOneDeclaration(declarations) { + if (declarations && declarations.length > 1) { + return grammarErrorOnFirstToken(declarations[1], ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); } - }; - - SemanticInfoChain.prototype.invalidate = function (oldSettings, newSettings) { - if (typeof oldSettings === "undefined") { oldSettings = null; } - if (typeof newSettings === "undefined") { newSettings = null; } - TypeScript.PullTypeResolver.globalTypeCheckPhase++; - - var cleanStart = new Date().getTime(); - - this.astSymbolMap.length = 0; - this.astAliasSymbolMap.length = 0; - this.astCallResolutionDataMap.length = 0; - - this.declCache = TypeScript.createIntrinsicsObject(); - this.symbolCache = TypeScript.createIntrinsicsObject(); - this.fileNameToDiagnostics = TypeScript.createIntrinsicsObject(); - this._binder = null; - this._resolver = null; - this._topLevelDecls = null; - this._fileNames = null; - - this.declSymbolMap.length = 0; - this.declSignatureSymbolMap.length = 0; - - if (oldSettings && newSettings) { - if (this.settingsChangeAffectsSyntax(oldSettings, newSettings)) { - for (var i = 1, n = this.documents.length; i < n; i++) { - this.documents[i].invalidate(); - } + } + function checkFunctionDeclaration(node) { + return checkAnySignatureDeclaration(node) || checkFunctionName(node.name) || checkForBodyInAmbientContext(node.body, false) || checkForGenerator(node); + } + function checkForGenerator(node) { + if (node.asteriskToken) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_currently_supported); + } + } + function checkFunctionExpression(node) { + return checkAnySignatureDeclaration(node) || checkFunctionName(node.name) || checkForGenerator(node); + } + function checkFunctionName(name) { + if (name && name.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(name)) { + return reportInvalidUseInStrictMode(name); + } + } + function checkGetAccessor(node) { + return checkAnySignatureDeclaration(node) || checkAccessor(node); + } + function checkElementAccessExpression(node) { + if (!node.argumentExpression) { + if (node.parent.kind === 146 /* NewExpression */ && node.parent.expression === node) { + var start = ts.skipTrivia(sourceText, node.expression.end); + var end = node.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + } + else { + var start = node.end - "]".length; + var end = node.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Expression_expected); } } - - TypeScript.pullSymbolID = 0; - - this.resetGlobalSymbols(); - - var cleanEnd = new Date().getTime(); - }; - - SemanticInfoChain.prototype.settingsChangeAffectsSyntax = function (before, after) { - return before.allowAutomaticSemicolonInsertion() !== after.allowAutomaticSemicolonInsertion() || before.codeGenTarget() !== after.codeGenTarget() || before.propagateEnumConstants() !== after.propagateEnumConstants(); - }; - - SemanticInfoChain.prototype.setSymbolForAST = function (ast, symbol) { - this.astSymbolMap[ast.syntaxID()] = symbol; - }; - - SemanticInfoChain.prototype.getSymbolForAST = function (ast) { - return this.astSymbolMap[ast.syntaxID()] || null; - }; - - SemanticInfoChain.prototype.setAliasSymbolForAST = function (ast, symbol) { - this.astAliasSymbolMap[ast.syntaxID()] = symbol; - }; - - SemanticInfoChain.prototype.getAliasSymbolForAST = function (ast) { - return this.astAliasSymbolMap[ast.syntaxID()]; - }; - - SemanticInfoChain.prototype.getCallResolutionDataForAST = function (ast) { - return this.astCallResolutionDataMap[ast.syntaxID()]; - }; - - SemanticInfoChain.prototype.setCallResolutionDataForAST = function (ast, callResolutionData) { - if (callResolutionData) { - this.astCallResolutionDataMap[ast.syntaxID()] = callResolutionData; + } + function checkHeritageClause(node) { + return checkForDisallowedTrailingComma(node.types) || checkForAtLeastOneHeritageClause(node.types, ts.tokenToString(node.token)); + } + function checkIndexSignature(node) { + return checkIndexSignatureParameters(node) || checkForIndexSignatureModifiers(node); + } + function checkForIndexSignatureModifiers(node) { + if (node.flags & 243 /* Modifier */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); } - }; - - SemanticInfoChain.prototype.setSymbolForDecl = function (decl, symbol) { - this.declSymbolMap[decl.declID] = symbol; - }; - - SemanticInfoChain.prototype.getSymbolForDecl = function (decl) { - return this.declSymbolMap[decl.declID]; - }; - - SemanticInfoChain.prototype.setSignatureSymbolForDecl = function (decl, signatureSymbol) { - this.declSignatureSymbolMap[decl.declID] = signatureSymbol; - }; - - SemanticInfoChain.prototype.getSignatureSymbolForDecl = function (decl) { - return this.declSignatureSymbolMap[decl.declID]; - }; - - SemanticInfoChain.prototype.addDiagnostic = function (diagnostic) { - var fileName = diagnostic.fileName(); - var diagnostics = this.fileNameToDiagnostics[fileName]; - if (!diagnostics) { - diagnostics = []; - this.fileNameToDiagnostics[fileName] = diagnostics; + } + function checkIndexSignatureParameters(node) { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + else { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } } - - diagnostics.push(diagnostic); - }; - - SemanticInfoChain.prototype.getDiagnostics = function (fileName) { - var diagnostics = this.fileNameToDiagnostics[fileName]; - return diagnostics || []; - }; - - SemanticInfoChain.prototype.getBinder = function () { - if (!this._binder) { - this._binder = new TypeScript.PullSymbolBinder(this); + else if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - - return this._binder; - }; - - SemanticInfoChain.prototype.getResolver = function () { - if (!this._resolver) { - this._resolver = new TypeScript.PullTypeResolver(this.compiler.compilationSettings(), this); + else if (parameter.flags & 243 /* Modifier */) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - - return this._resolver; - }; - - SemanticInfoChain.prototype.addSyntheticIndexSignature = function (containingDecl, containingSymbol, ast, indexParamName, indexParamType, returnType) { - var indexSignature = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - var indexParameterSymbol = new TypeScript.PullSymbol(indexParamName, 2048 /* Parameter */); - indexParameterSymbol.type = indexParamType; - indexSignature.addParameter(indexParameterSymbol); - indexSignature.returnType = returnType; - indexSignature.setResolved(); - indexParameterSymbol.setResolved(); - - containingSymbol.addIndexSignature(indexSignature); - - var indexSigDecl = new TypeScript.PullSynthesizedDecl("", "", 4194304 /* IndexSignature */, 2048 /* Signature */, containingDecl, containingDecl.semanticInfoChain); - var indexParamDecl = new TypeScript.PullSynthesizedDecl(indexParamName, indexParamName, 2048 /* Parameter */, 0 /* None */, indexSigDecl, containingDecl.semanticInfoChain); - indexSigDecl.setSignatureSymbol(indexSignature); - indexParamDecl.setSymbol(indexParameterSymbol); - indexSignature.addDeclaration(indexSigDecl); - indexParameterSymbol.addDeclaration(indexParamDecl); - }; - - SemanticInfoChain.prototype.getDeclForAST = function (ast) { - var document = this.getDocument(ast.fileName()); - - if (document) { - return document._getDeclForAST(ast); + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - - return null; - }; - - SemanticInfoChain.prototype.getEnclosingDecl = function (ast) { - return this.getDocument(ast.fileName()).getEnclosingDecl(ast); - }; - - SemanticInfoChain.prototype.setDeclForAST = function (ast, decl) { - this.getDocument(decl.fileName())._setDeclForAST(ast, decl); - }; - - SemanticInfoChain.prototype.getASTForDecl = function (decl) { - var document = this.getDocument(decl.fileName()); - if (document) { - return document._getASTForDecl(decl); + else if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - - return null; - }; - - SemanticInfoChain.prototype.setASTForDecl = function (decl, ast) { - this.getDocument(decl.fileName())._setASTForDecl(decl, ast); - }; - - SemanticInfoChain.prototype.topLevelDecl = function (fileName) { - var document = this.getDocument(fileName); - if (document) { - return document.topLevelDecl(); + else if (!parameter.type) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - - return null; - }; - - SemanticInfoChain.prototype.topLevelDecls = function () { - if (!this._topLevelDecls) { - this._topLevelDecls = TypeScript.ArrayUtilities.select(this.documents, function (u) { - return u.topLevelDecl(); - }); + else if (parameter.type.kind !== 118 /* StringKeyword */ && parameter.type.kind !== 116 /* NumberKeyword */) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - - return this._topLevelDecls; - }; - - SemanticInfoChain.prototype.addDiagnosticFromAST = function (ast, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - this.addDiagnostic(this.diagnosticFromAST(ast, diagnosticKey, _arguments, additionalLocations)); - }; - - SemanticInfoChain.prototype.diagnosticFromAST = function (ast, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - return new TypeScript.Diagnostic(ast.fileName(), this.lineMap(ast.fileName()), ast.start(), ast.width(), diagnosticKey, _arguments, additionalLocations); - }; - - SemanticInfoChain.prototype.locationFromAST = function (ast) { - return new TypeScript.Location(ast.fileName(), this.lineMap(ast.fileName()), ast.start(), ast.width()); - }; - - SemanticInfoChain.prototype.duplicateIdentifierDiagnosticFromAST = function (ast, identifier, additionalLocationAST) { - return this.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Duplicate_identifier_0, [identifier], additionalLocationAST ? [this.locationFromAST(additionalLocationAST)] : null); - }; - - SemanticInfoChain.prototype.addDuplicateIdentifierDiagnosticFromAST = function (ast, identifier, additionalLocationAST) { - this.addDiagnostic(this.duplicateIdentifierDiagnosticFromAST(ast, identifier, additionalLocationAST)); - }; - return SemanticInfoChain; - })(); - TypeScript.SemanticInfoChain = SemanticInfoChain; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var DeclCollectionContext = (function () { - function DeclCollectionContext(document, semanticInfoChain, propagateEnumConstants) { - this.document = document; - this.semanticInfoChain = semanticInfoChain; - this.propagateEnumConstants = propagateEnumConstants; - this.isDeclareFile = false; - this.parentChain = []; - } - DeclCollectionContext.prototype.getParent = function () { - return this.parentChain ? this.parentChain[this.parentChain.length - 1] : null; - }; - - DeclCollectionContext.prototype.pushParent = function (parentDecl) { - if (parentDecl) { - this.parentChain[this.parentChain.length] = parentDecl; + else if (!node.type) { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } - }; - - DeclCollectionContext.prototype.popParent = function () { - this.parentChain.length--; - }; - return DeclCollectionContext; - })(); - - function moduleElementsHasExportAssignment(moduleElements) { - return moduleElements.any(function (m) { - return m.kind() === 134 /* ExportAssignment */; - }); - } - - function containingModuleHasExportAssignment(ast) { - ast = ast.parent; - while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { - var moduleDecl = ast; - return moduleElementsHasExportAssignment(moduleDecl.moduleElements); - } else if (ast.kind() === 120 /* SourceUnit */) { - var sourceUnit = ast; - return moduleElementsHasExportAssignment(sourceUnit.moduleElements); + } + function checkInterfaceDeclaration(node) { + return checkInterfaceDeclarationHeritageClauses(node); + } + function checkInterfaceDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 1); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 77 /* ExtendsKeyword */) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 100 /* ImplementsKeyword */); + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + } } - - ast = ast.parent; + return false; } - - return false; - } - - function isParsingAmbientModule(ast, context) { - ast = ast.parent; - while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { - if (TypeScript.hasModifier(ast.modifiers, 8 /* Ambient */)) { + function checkMethod(node) { + if (checkAnySignatureDeclaration(node) || checkForBodyInAmbientContext(node.body, false) || checkForGenerator(node)) { + return true; + } + if (node.parent.kind === 185 /* ClassDeclaration */) { + if (checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } + if (inAmbientContext) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + } + else if (!node.body) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + } } - - ast = ast.parent; - } - - return false; - } - - function preCollectImportDecls(ast, context) { - var importDecl = ast; - var declFlags = 0 /* None */; - - var parent = context.getParent(); - - if (TypeScript.hasModifier(importDecl.modifiers, 1 /* Exported */) && !containingModuleHasExportAssignment(ast)) { - declFlags |= 1 /* Exported */; - } - - var decl = new TypeScript.NormalPullDecl(importDecl.identifier.valueText(), importDecl.identifier.text(), 128 /* TypeAlias */, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - } - - function preCollectScriptDecls(sourceUnit, context) { - var fileName = sourceUnit.fileName(); - - var isExternalModule = context.document.isExternalModule(); - - var decl = new TypeScript.RootPullDecl(fileName, fileName, 1 /* Script */, 0 /* None */, context.semanticInfoChain, isExternalModule); - context.semanticInfoChain.setDeclForAST(sourceUnit, decl); - context.semanticInfoChain.setASTForDecl(decl, sourceUnit); - - context.isDeclareFile = context.document.isDeclareFile(); - - context.pushParent(decl); - - if (isExternalModule) { - var declFlags = 1 /* Exported */; - if (TypeScript.isDTSFile(fileName)) { - declFlags |= 8 /* Ambient */; + else if (node.parent.kind === 186 /* InterfaceDeclaration */) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); } - - var moduleContainsExecutableCode = containsExecutableCode(sourceUnit.moduleElements); - var kind = 32 /* DynamicModule */; - var valueText = TypeScript.quoteStr(fileName); - - var decl = new TypeScript.NormalPullDecl(valueText, fileName, kind, declFlags, context.getParent()); - - context.semanticInfoChain.setASTForDecl(decl, sourceUnit); - - context.semanticInfoChain.setDeclForAST(sourceUnit, decl); - - if (!moduleElementsHasExportAssignment(sourceUnit.moduleElements) || moduleContainsExecutableCode) { - createModuleVariableDecl(decl, sourceUnit, context); + else if (node.parent.kind === 136 /* TypeLiteral */) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); } - - context.pushParent(decl); - } - } - - function preCollectEnumDecls(enumDecl, context) { - var declFlags = 0 /* None */; - var enumName = enumDecl.identifier.valueText(); - - if ((TypeScript.hasModifier(enumDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(enumDecl, context)) && !containingModuleHasExportAssignment(enumDecl)) { - declFlags |= 1 /* Exported */; } - - if (TypeScript.hasModifier(enumDecl.modifiers, 8 /* Ambient */) || isParsingAmbientModule(enumDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; + function checkForBodyInAmbientContext(body, isConstructor) { + if (inAmbientContext && body && body.kind === 163 /* Block */) { + var diagnostic = isConstructor ? ts.Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : ts.Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; + return grammarErrorOnFirstToken(body, diagnostic); + } } - - declFlags |= 4096 /* Enum */; - var kind = 64 /* Enum */; - - var enumDeclaration = new TypeScript.NormalPullDecl(enumName, enumDecl.identifier.text(), kind, declFlags, context.getParent()); - context.semanticInfoChain.setDeclForAST(enumDecl, enumDeclaration); - context.semanticInfoChain.setASTForDecl(enumDeclaration, enumDecl); - - var valueDecl = new TypeScript.NormalPullDecl(enumDeclaration.name, enumDeclaration.getDisplayName(), 512 /* Variable */, enumDeclaration.flags, context.getParent()); - enumDeclaration.setValueDecl(valueDecl); - context.semanticInfoChain.setASTForDecl(valueDecl, enumDecl); - - context.pushParent(enumDeclaration); - } - - function createEnumElementDecls(propertyDecl, context) { - var parent = context.getParent(); - - var decl = new TypeScript.PullEnumElementDecl(propertyDecl.propertyName.valueText(), propertyDecl.propertyName.text(), parent); - context.semanticInfoChain.setDeclForAST(propertyDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyDecl); - } - - function preCollectModuleDecls(moduleDecl, context) { - var declFlags = 0 /* None */; - - var moduleContainsExecutableCode = containsExecutableCode(moduleDecl.moduleElements); - - var isDynamic = moduleDecl.stringLiteral !== null; - - if ((TypeScript.hasModifier(moduleDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(moduleDecl, context)) && !containingModuleHasExportAssignment(moduleDecl)) { - declFlags |= 1 /* Exported */; + function checkModuleDeclaration(node) { + return checkModuleDeclarationName(node) || checkModuleDeclarationStatements(node); } - - if (TypeScript.hasModifier(moduleDecl.modifiers, 8 /* Ambient */) || isParsingAmbientModule(moduleDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; + function checkModuleDeclarationName(node) { + if (!inAmbientContext && node.name.kind === 7 /* StringLiteral */) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); + } } - - var kind = isDynamic ? 32 /* DynamicModule */ : 4 /* Container */; - - if (moduleDecl.stringLiteral) { - var valueText = TypeScript.quoteStr(moduleDecl.stringLiteral.valueText()); - var text = moduleDecl.stringLiteral.text(); - - var decl = new TypeScript.NormalPullDecl(valueText, text, kind, declFlags, context.getParent()); - - context.semanticInfoChain.setDeclForAST(moduleDecl, decl); - context.semanticInfoChain.setDeclForAST(moduleDecl.stringLiteral, decl); - context.semanticInfoChain.setASTForDecl(decl, moduleDecl.stringLiteral); - - if (!moduleElementsHasExportAssignment(moduleDecl.moduleElements) || moduleContainsExecutableCode) { - createModuleVariableDecl(decl, moduleDecl.stringLiteral, context); + function checkModuleDeclarationStatements(node) { + if (node.name.kind === 63 /* Identifier */ && node.body.kind === 190 /* ModuleBlock */) { + var statements = node.body.statements; + for (var i = 0, n = statements.length; i < n; i++) { + var statement = statements[i]; + if (statement.kind === 192 /* ExportAssignment */) { + return grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + } + else if (ts.isExternalModuleImportDeclaration(statement)) { + return grammarErrorOnNode(ts.getExternalModuleImportDeclarationExpression(statement), ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + } + } } - - context.pushParent(decl); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(moduleDecl.name); - for (var i = 0, n = moduleNames.length; i < n; i++) { - var moduleName = moduleNames[i]; - - var specificFlags = declFlags; - if (i > 0) { - specificFlags |= 1 /* Exported */; + } + function checkObjectLiteralExpression(node) { + var seen = {}; + var Property = 1; + var GetAccessor = 2; + var SetAccesor = 4; + var GetOrSetAccessor = GetAccessor | SetAccesor; + var inStrictMode = (node.parserContextFlags & 1 /* StrictMode */) !== 0; + for (var i = 0, n = node.properties.length; i < n; i++) { + var prop = node.properties[i]; + var name = prop.name; + if (prop.kind === 161 /* OmittedExpression */ || name.kind === 121 /* ComputedPropertyName */) { + continue; } - - var decl = new TypeScript.NormalPullDecl(moduleName.valueText(), moduleName.text(), kind, specificFlags, context.getParent()); - - context.semanticInfoChain.setDeclForAST(moduleDecl, decl); - context.semanticInfoChain.setDeclForAST(moduleName, decl); - context.semanticInfoChain.setASTForDecl(decl, moduleName); - - if (moduleContainsExecutableCode) { - createModuleVariableDecl(decl, moduleName, context); + var currentKind; + if (prop.kind === 198 /* PropertyAssignment */ || prop.kind === 199 /* ShorthandPropertyAssignment */ || prop.kind === 125 /* Method */) { + currentKind = Property; + } + else if (prop.kind === 127 /* GetAccessor */) { + currentKind = GetAccessor; + } + else if (prop.kind === 128 /* SetAccessor */) { + currentKind = SetAccesor; + } + else { + ts.Debug.fail("Unexpected syntax kind:" + prop.kind); + } + if (!ts.hasProperty(seen, name.text)) { + seen[name.text] = currentKind; + } + else { + var existingKind = seen[name.text]; + if (currentKind === Property && existingKind === Property) { + if (inStrictMode) { + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + } + } + else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { + if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { + seen[name.text] = currentKind | existingKind; + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + } + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + } } - - context.pushParent(decl); } } - } - - function createModuleVariableDecl(decl, moduleNameAST, context) { - decl.setFlags(decl.flags | getInitializationFlag(decl)); - - var valueDecl = new TypeScript.NormalPullDecl(decl.name, decl.getDisplayName(), 512 /* Variable */, decl.flags, context.getParent()); - decl.setValueDecl(valueDecl); - context.semanticInfoChain.setASTForDecl(valueDecl, moduleNameAST); - } - - function containsExecutableCode(members) { - for (var i = 0, n = members.childCount(); i < n; i++) { - var member = members.childAt(i); - - if (member.kind() === 130 /* ModuleDeclaration */) { - var moduleDecl = member; - - if (containsExecutableCode(moduleDecl.moduleElements)) { - return true; + function checkNumericLiteral(node) { + if (node.flags & 8192 /* OctalLiteral */) { + if (node.parserContextFlags & 1 /* StrictMode */) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } - } else if (member.kind() === 133 /* ImportDeclaration */) { - if (TypeScript.hasModifier(member.modifiers, 1 /* Exported */)) { - return true; + else if (languageVersion >= 1 /* ES5 */) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } - } else if (member.kind() !== 128 /* InterfaceDeclaration */ && member.kind() !== 134 /* ExportAssignment */) { - return true; } } - - return false; - } - - function preCollectClassDecls(classDecl, context) { - var declFlags = 0 /* None */; - - if ((TypeScript.hasModifier(classDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(classDecl, context)) && !containingModuleHasExportAssignment(classDecl)) { - declFlags |= 1 /* Exported */; - } - - if (TypeScript.hasModifier(classDecl.modifiers, 8 /* Ambient */) || isParsingAmbientModule(classDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; + function checkModifiers(node) { + switch (node.kind) { + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 124 /* Property */: + case 125 /* Method */: + case 131 /* IndexSignature */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 189 /* ModuleDeclaration */: + case 188 /* EnumDeclaration */: + case 192 /* ExportAssignment */: + case 164 /* VariableStatement */: + case 184 /* FunctionDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 191 /* ImportDeclaration */: + case 123 /* Parameter */: + break; + default: + return false; + } + if (!node.modifiers) { + return; + } + var lastStatic, lastPrivate, lastProtected, lastDeclare; + var flags = 0; + for (var i = 0, n = node.modifiers.length; i < n; i++) { + var modifier = node.modifiers[i]; + switch (modifier.kind) { + case 106 /* PublicKeyword */: + case 105 /* ProtectedKeyword */: + case 104 /* PrivateKeyword */: + var text; + if (modifier.kind === 106 /* PublicKeyword */) { + text = "public"; + } + else if (modifier.kind === 105 /* ProtectedKeyword */) { + text = "protected"; + lastProtected = modifier; + } + else { + text = "private"; + lastPrivate = modifier; + } + if (flags & 112 /* AccessibilityModifier */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 128 /* Static */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (node.parent.kind === 190 /* ModuleBlock */ || node.parent.kind === 201 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + } + flags |= modifierToFlag(modifier.kind); + break; + case 107 /* StaticKeyword */: + if (flags & 128 /* Static */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); + } + else if (node.parent.kind === 190 /* ModuleBlock */ || node.parent.kind === 201 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + } + else if (node.kind === 123 /* Parameter */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + flags |= 128 /* Static */; + lastStatic = modifier; + break; + case 76 /* ExportKeyword */: + if (flags & 1 /* Export */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & 2 /* Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + } + else if (node.kind === 123 /* Parameter */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= 1 /* Export */; + break; + case 112 /* DeclareKeyword */: + if (flags & 2 /* Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + } + else if (node.kind === 123 /* Parameter */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } + else if (inAmbientContext && node.parent.kind === 190 /* ModuleBlock */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } + flags |= 2 /* Ambient */; + lastDeclare = modifier; + break; + } + } + if (node.kind === 126 /* Constructor */) { + if (flags & 128 /* Static */) { + return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + else if (flags & 64 /* Protected */) { + return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (flags & 32 /* Private */) { + return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); + } + } + else if (node.kind === 191 /* ImportDeclaration */ && flags & 2 /* Ambient */) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } + else if (node.kind === 186 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); + } } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(classDecl.identifier.valueText(), classDecl.identifier.text(), 8 /* Class */, declFlags, parent); - - var constructorDecl = new TypeScript.NormalPullDecl(classDecl.identifier.valueText(), classDecl.identifier.text(), 512 /* Variable */, declFlags | 16384 /* ClassConstructorVariable */, parent); - - decl.setValueDecl(constructorDecl); - - context.semanticInfoChain.setDeclForAST(classDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, classDecl); - context.semanticInfoChain.setASTForDecl(constructorDecl, classDecl); - - context.pushParent(decl); - } - - function preCollectObjectTypeDecls(objectType, context) { - if (objectType.parent.kind() === 128 /* InterfaceDeclaration */) { - return; + function checkParameter(node) { + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.name)) { + return reportInvalidUseInStrictMode(node.name); + } } - - var declFlags = 0 /* None */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkTypeParameterList(typeParameters) { + if (checkForDisallowedTrailingComma(typeParameters)) { + return true; + } + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var end = ts.skipTrivia(sourceText, typeParameters.end) + ">".length; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty); + } } - - var decl = new TypeScript.NormalPullDecl("", "", 8388608 /* ObjectType */, declFlags, parent); - context.semanticInfoChain.setDeclForAST(objectType, decl); - context.semanticInfoChain.setASTForDecl(decl, objectType); - - context.pushParent(decl); - } - - function preCollectInterfaceDecls(interfaceDecl, context) { - var declFlags = 0 /* None */; - - if ((TypeScript.hasModifier(interfaceDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(interfaceDecl, context)) && !containingModuleHasExportAssignment(interfaceDecl)) { - declFlags |= 1 /* Exported */; + function checkParameterList(parameters) { + if (checkForDisallowedTrailingComma(parameters)) { + return true; + } + var seenOptionalParameter = false; + var parameterCount = parameters.length; + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== (parameterCount - 1)) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } + else if (parameter.questionToken || parameter.initializer) { + seenOptionalParameter = true; + if (parameter.questionToken && parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } + else { + if (seenOptionalParameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(interfaceDecl.identifier.valueText(), interfaceDecl.identifier.text(), 16 /* Interface */, declFlags, parent); - context.semanticInfoChain.setDeclForAST(interfaceDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, interfaceDecl); - - context.pushParent(decl); - } - - function preCollectParameterDecl(argDecl, context) { - var declFlags = 0 /* None */; - - if (TypeScript.hasModifier(argDecl.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; + function checkPostfixUnaryExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.operand)) { + return reportInvalidUseInStrictMode(node.operand); + } } - - if (argDecl.questionToken !== null || argDecl.equalsValueClause !== null || argDecl.dotDotDotToken !== null) { - declFlags |= 128 /* Optional */; + function checkPrefixUnaryExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */) { + if ((node.operator === 37 /* PlusPlusToken */ || node.operator === 38 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(node.operand)) { + return reportInvalidUseInStrictMode(node.operand); + } + } } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkProperty(node) { + if (node.parent.kind === 185 /* ClassDeclaration */) { + if (checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + return true; + } + } + else if (node.parent.kind === 186 /* InterfaceDeclaration */) { + if (checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + return true; + } + } + else if (node.parent.kind === 136 /* TypeLiteral */) { + if (checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + return true; + } + } + return checkForInitializerInAmbientContext(node); } - - var decl = new TypeScript.NormalPullDecl(argDecl.identifier.valueText(), argDecl.identifier.text(), 2048 /* Parameter */, declFlags, parent); - - if (argDecl.equalsValueClause) { - parent.flags |= 33554432 /* HasDefaultArgs */; + function checkComputedPropertyName(node) { + return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_not_currently_supported); + if (languageVersion < 2 /* ES6 */) { + return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (node.expression.kind === 157 /* BinaryExpression */ && node.expression.operator === 22 /* CommaToken */) { + return grammarErrorOnNode(node.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } } - - if (parent.kind === 32768 /* ConstructorMethod */) { - decl.setFlag(67108864 /* ConstructorParameter */); + function checkForDisallowedComputedProperty(node, message) { + if (node.kind === 121 /* ComputedPropertyName */) { + return grammarErrorOnNode(node, message); + } } - - var isPublicOrPrivate = TypeScript.hasModifier(argDecl.modifiers, 4 /* Public */ | 2 /* Private */); - var isInConstructor = parent.kind === 32768 /* ConstructorMethod */; - if (isPublicOrPrivate && isInConstructor) { - var parentsParent = context.parentChain[context.parentChain.length - 2]; - - var propDeclFlags = declFlags & ~128 /* Optional */; - var propDecl = new TypeScript.NormalPullDecl(argDecl.identifier.valueText(), argDecl.identifier.text(), 4096 /* Property */, propDeclFlags, parentsParent); - propDecl.setValueDecl(decl); - decl.setFlag(8388608 /* PropertyParameter */); - propDecl.setFlag(8388608 /* PropertyParameter */); - - if (parent.kind === 32768 /* ConstructorMethod */) { - propDecl.setFlag(67108864 /* ConstructorParameter */); + function checkForInitializerInAmbientContext(node) { + if (inAmbientContext && node.initializer) { + return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } - - context.semanticInfoChain.setASTForDecl(decl, argDecl); - context.semanticInfoChain.setASTForDecl(propDecl, argDecl); - context.semanticInfoChain.setDeclForAST(argDecl, propDecl); - } else { - context.semanticInfoChain.setASTForDecl(decl, argDecl); - context.semanticInfoChain.setDeclForAST(argDecl, decl); } - - parent.addVariableDeclToGroup(decl); - } - - function preCollectTypeParameterDecl(typeParameterDecl, context) { - var declFlags = 0 /* None */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkPropertyAssignment(node) { + return checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); } - - var decl = new TypeScript.NormalPullDecl(typeParameterDecl.identifier.valueText(), typeParameterDecl.identifier.text(), 8192 /* TypeParameter */, declFlags, parent); - context.semanticInfoChain.setASTForDecl(decl, typeParameterDecl); - context.semanticInfoChain.setDeclForAST(typeParameterDecl, decl); - } - - function createPropertySignature(propertyDecl, context) { - var declFlags = 4 /* Public */; - var parent = context.getParent(); - var declType = 4096 /* Property */; - - if (propertyDecl.questionToken !== null) { - declFlags |= 128 /* Optional */; + function checkForInvalidQuestionMark(node, questionToken, message) { + if (questionToken) { + return grammarErrorOnNode(questionToken, message); + } } - - var decl = new TypeScript.NormalPullDecl(propertyDecl.propertyName.valueText(), propertyDecl.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(propertyDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyDecl); - } - - function createMemberVariableDeclaration(memberDecl, context) { - var declFlags = 0 /* None */; - var declType = 4096 /* Property */; - - if (TypeScript.hasModifier(memberDecl.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; + function checkReturnStatement(node) { + if (!inFunctionBlock) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } } - - if (TypeScript.hasModifier(memberDecl.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; + function checkSetAccessor(node) { + return checkAnySignatureDeclaration(node) || checkAccessor(node); } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(memberDecl.variableDeclarator.propertyName.valueText(), memberDecl.variableDeclarator.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(memberDecl, decl); - context.semanticInfoChain.setDeclForAST(memberDecl.variableDeclarator, decl); - context.semanticInfoChain.setASTForDecl(decl, memberDecl); - } - - function createVariableDeclaration(varDecl, context) { - var declFlags = 0 /* None */; - var declType = 512 /* Variable */; - - var modifiers = TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl); - if ((TypeScript.hasModifier(modifiers, 1 /* Exported */) || isParsingAmbientModule(varDecl, context)) && !containingModuleHasExportAssignment(varDecl)) { - declFlags |= 1 /* Exported */; + function checkAccessor(accessor) { + var kind = accessor.kind; + if (languageVersion < 1 /* ES5 */) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + else if (inAmbientContext) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); + } + else if (accessor.body === undefined) { + return grammarErrorAtPos(accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + else if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); + } + else if (kind === 127 /* GetAccessor */ && accessor.parameters.length) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + } + else if (kind === 128 /* SetAccessor */) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + else if (accessor.parameters.length !== 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + else { + var parameter = accessor.parameters[0]; + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + else if (parameter.flags & 243 /* Modifier */) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + else if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + } } - - if (TypeScript.hasModifier(modifiers, 8 /* Ambient */) || isParsingAmbientModule(varDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; + function checkSourceFile(node) { + return inAmbientContext && checkTopLevelElementsForRequiredDeclareModifier(file); } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkTopLevelElementsForRequiredDeclareModifier(file) { + for (var i = 0, n = file.statements.length; i < n; i++) { + var decl = file.statements[i]; + if (ts.isDeclaration(decl) || decl.kind === 164 /* VariableStatement */) { + if (checkTopLevelElementForRequiredDeclareModifier(decl)) { + return true; + } + } + } } - - var decl = new TypeScript.NormalPullDecl(varDecl.propertyName.valueText(), varDecl.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(varDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, varDecl); - - if (parent) { - parent.addVariableDeclToGroup(decl); + function checkTopLevelElementForRequiredDeclareModifier(node) { + if (node.kind === 186 /* InterfaceDeclaration */ || node.kind === 191 /* ImportDeclaration */ || node.kind === 192 /* ExportAssignment */ || (node.flags & 2 /* Ambient */)) { + return false; + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } - } - - function preCollectVarDecls(ast, context) { - if (ast.parent.kind() === 136 /* MemberVariableDeclaration */) { - return; + function checkShorthandPropertyAssignment(node) { + return checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); } - - var varDecl = ast; - createVariableDeclaration(varDecl, context); - } - - function createFunctionTypeDeclaration(functionTypeDeclAST, context) { - var declFlags = 2048 /* Signature */; - var declType = 16777216 /* FunctionType */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkSwitchStatement(node) { + var firstDefaultClause; + for (var i = 0, n = node.clauses.length; i < n; i++) { + var clause = node.clauses[i]; + if (clause.kind === 195 /* DefaultClause */) { + if (firstDefaultClause === undefined) { + firstDefaultClause = clause; + } + else { + var start = ts.skipTrivia(file.text, clause.pos); + var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + } + } + } } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(functionTypeDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, functionTypeDeclAST); - - context.pushParent(decl); - } - - function createConstructorTypeDeclaration(constructorTypeDeclAST, context) { - var declFlags = 0 /* None */; - var declType = 33554432 /* ConstructorType */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkTaggedTemplateExpression(node) { + if (languageVersion < 2 /* ES6 */) { + return grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(constructorTypeDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, constructorTypeDeclAST); - - context.pushParent(decl); - } - - function createFunctionDeclaration(funcDeclAST, context) { - var declFlags = 0 /* None */; - var declType = 16384 /* Function */; - - if ((TypeScript.hasModifier(funcDeclAST.modifiers, 1 /* Exported */) || isParsingAmbientModule(funcDeclAST, context)) && !containingModuleHasExportAssignment(funcDeclAST)) { - declFlags |= 1 /* Exported */; + function checkThrowStatement(node) { + if (node.expression === undefined) { + return grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); + } } - - if (TypeScript.hasModifier(funcDeclAST.modifiers, 8 /* Ambient */) || isParsingAmbientModule(funcDeclAST, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; + function checkTupleType(node) { + return checkForDisallowedTrailingComma(node.elementTypes) || checkForAtLeastOneType(node); } - - if (!funcDeclAST.block) { - declFlags |= 2048 /* Signature */; + function checkForAtLeastOneType(node) { + if (node.elementTypes.length === 0) { + return grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkTypeParameter(node) { + if (node.expression) { + return grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); + } } - - var decl = new TypeScript.NormalPullDecl(funcDeclAST.identifier.valueText(), funcDeclAST.identifier.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(funcDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, funcDeclAST); - - context.pushParent(decl); - } - - function createAnyFunctionExpressionDeclaration(functionExpressionDeclAST, id, context, displayName) { - if (typeof displayName === "undefined") { displayName = null; } - var declFlags = 0 /* None */; - - if (functionExpressionDeclAST.kind() === 219 /* SimpleArrowFunctionExpression */ || functionExpressionDeclAST.kind() === 218 /* ParenthesizedArrowFunctionExpression */) { - declFlags |= 8192 /* ArrowFunction */; + function checkTypeReference(node) { + return checkTypeArguments(node.typeArguments); } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkVariableDeclaration(node) { + if (inAmbientContext && node.initializer) { + var equalsPos = node.type ? ts.skipTrivia(sourceText, node.type.end) : ts.skipTrivia(sourceText, node.name.end); + return grammarErrorAtPos(equalsPos, "=".length, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + if (!inAmbientContext && !node.initializer && ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized); + } + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.name)) { + return reportInvalidUseInStrictMode(node.name); + } } - - var name = id ? id.text() : ""; - var displayNameText = displayName ? displayName.text() : ""; - var decl = new TypeScript.PullFunctionExpressionDecl(name, declFlags, parent, displayNameText); - context.semanticInfoChain.setDeclForAST(functionExpressionDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, functionExpressionDeclAST); - - context.pushParent(decl); - - if (functionExpressionDeclAST.kind() === 219 /* SimpleArrowFunctionExpression */) { - var simpleArrow = functionExpressionDeclAST; - var declFlags = 4 /* Public */; - - var parent = context.getParent(); - - if (TypeScript.hasFlag(parent.flags, 2097152 /* DeclaredInAWithBlock */)) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkVariableDeclarations(declarations) { + if (declarations) { + if (checkForDisallowedTrailingComma(declarations)) { + return true; + } + if (!declarations.length) { + return grammarErrorAtPos(declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); + } + var decl = declarations[0]; + if (languageVersion < 2 /* ES6 */) { + if (ts.isLet(decl)) { + return grammarErrorOnFirstToken(decl, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (ts.isConst(decl)) { + return grammarErrorOnFirstToken(decl, ts.Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + } } - - var decl = new TypeScript.NormalPullDecl(simpleArrow.identifier.valueText(), simpleArrow.identifier.text(), 2048 /* Parameter */, declFlags, parent); - - context.semanticInfoChain.setASTForDecl(decl, simpleArrow.identifier); - context.semanticInfoChain.setDeclForAST(simpleArrow.identifier, decl); - - parent.addVariableDeclToGroup(decl); } - } - - function createMemberFunctionDeclaration(funcDecl, context) { - var declFlags = 0 /* None */; - var declType = 65536 /* Method */; - - if (TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; + function checkVariableStatement(node) { + return checkVariableDeclarations(node.declarations) || checkForDisallowedLetOrConstStatement(node); } - - if (TypeScript.hasModifier(funcDecl.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; + function checkForDisallowedLetOrConstStatement(node) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (ts.isLet(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } + else if (ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } } - - if (!funcDecl.block) { - declFlags |= 2048 /* Signature */; + function allowLetAndConstDeclarations(parent) { + switch (parent.kind) { + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 175 /* WithStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + return false; + case 177 /* LabeledStatement */: + return allowLetAndConstDeclarations(parent.parent); + } + return true; } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(funcDecl.propertyName.valueText(), funcDecl.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(funcDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, funcDecl); - - context.pushParent(decl); - } - - function createIndexSignatureDeclaration(indexSignatureDeclAST, context) { - var declFlags = 2048 /* Signature */; - var declType = 4194304 /* IndexSignature */; - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(indexSignatureDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, indexSignatureDeclAST); - - context.pushParent(decl); - } - - function createCallSignatureDeclaration(callSignature, context) { - var isChildOfObjectType = callSignature.parent && callSignature.parent.parent && callSignature.parent.kind() === 2 /* SeparatedList */ && callSignature.parent.parent.kind() === 122 /* ObjectType */; - - if (!isChildOfObjectType) { - return; + function checkWithStatement(node) { + if (node.parserContextFlags & 1 /* StrictMode */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } } - - var declFlags = 2048 /* Signature */; - var declType = 1048576 /* CallSignature */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function checkYieldExpression(node) { + if (!(node.parserContextFlags & 4 /* Yield */)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expressions_are_not_currently_supported); } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(callSignature, decl); - context.semanticInfoChain.setASTForDecl(decl, callSignature); - - context.pushParent(decl); } - - function createMethodSignatureDeclaration(method, context) { - var declFlags = 0 /* None */; - var declType = 65536 /* Method */; - - declFlags |= 4 /* Public */; - declFlags |= 2048 /* Signature */; - - if (method.questionToken !== null) { - declFlags |= 128 /* Optional */; + function createProgram(rootNames, options, host) { + var program; + var files = []; + var filesByName = {}; + var errors = []; + var seenNoDefaultLib = options.noLib; + var commonSourceDirectory; + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!seenNoDefaultLib) { + processRootFile(host.getDefaultLibFilename(options), true); + } + verifyCompilerOptions(); + errors.sort(ts.compareDiagnostics); + program = { + getSourceFile: getSourceFile, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, + getCompilerHost: function () { return host; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeChecker: function (fullTypeCheckMode) { return ts.createTypeChecker(program, fullTypeCheckMode); }, + getCommonSourceDirectory: function () { return commonSourceDirectory; } + }; + return program; + function getSourceFile(filename) { + filename = host.getCanonicalFileName(filename); + return ts.hasProperty(filesByName, filename) ? filesByName[filename] : undefined; + } + function getDiagnostics(sourceFile) { + return sourceFile ? ts.filter(errors, function (e) { return e.file === sourceFile; }) : errors; + } + function getGlobalDiagnostics() { + return ts.filter(errors, function (e) { return !e.file; }); + } + function hasExtension(filename) { + return ts.getBaseFilename(filename).indexOf(".") >= 0; + } + function processRootFile(filename, isDefaultLib) { + processSourceFile(ts.normalizePath(filename), isDefaultLib); + } + function processSourceFile(filename, isDefaultLib, refFile, refPos, refEnd) { + if (refEnd !== undefined && refPos !== undefined) { + var start = refPos; + var length = refEnd - refPos; + } + var diagnostic; + if (hasExtension(filename)) { + if (!options.allowNonTsExtensions && !ts.fileExtensionIs(filename, ".ts")) { + diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + } + else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (refFile && host.getCanonicalFileName(filename) === host.getCanonicalFileName(refFile.filename)) { + diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + } + } + else { + if (options.allowNonTsExtensions && !findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (!findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + filename += ".ts"; + } + } + if (diagnostic) { + if (refFile) { + errors.push(ts.createFileDiagnostic(refFile, start, length, diagnostic, filename)); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnostic, filename)); + } + } } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(method.propertyName.valueText(), method.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(method, decl); - context.semanticInfoChain.setASTForDecl(decl, method); - - context.pushParent(decl); - } - - function createConstructSignatureDeclaration(constructSignatureDeclAST, context) { - var declFlags = 2048 /* Signature */; - var declType = 2097152 /* ConstructSignature */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function findSourceFile(filename, isDefaultLib, refFile, refStart, refLength) { + var canonicalName = host.getCanonicalFileName(filename); + if (ts.hasProperty(filesByName, canonicalName)) { + return getSourceFileFromCache(filename, canonicalName, false); + } + else { + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(filename, host.getCurrentDirectory()); + var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); + if (ts.hasProperty(filesByName, canonicalAbsolutePath)) { + return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); + } + var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, function (hostErrorMessage) { + errors.push(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + }); + if (file) { + seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib; + filesByName[canonicalAbsolutePath] = file; + if (!options.noResolve) { + var basePath = ts.getDirectoryPath(filename); + processReferencedFiles(file, basePath); + processImportedModules(file, basePath); + } + if (isDefaultLib) { + files.unshift(file); + } + else { + files.push(file); + } + ts.forEach(file.getSyntacticDiagnostics(), function (e) { + errors.push(e); + }); + } + } + return file; + function getSourceFileFromCache(filename, canonicalName, useAbsolutePath) { + var file = filesByName[canonicalName]; + if (file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.filename, host.getCurrentDirectory()) : file.filename; + if (canonicalName !== sourceFileName) { + errors.push(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Filename_0_differs_from_already_included_filename_1_only_in_casing, filename, sourceFileName)); + } + } + return file; + } } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(constructSignatureDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, constructSignatureDeclAST); - - context.pushParent(decl); - } - - function createClassConstructorDeclaration(constructorDeclAST, context) { - var declFlags = 0 /* None */; - var declType = 32768 /* ConstructorMethod */; - - if (!constructorDeclAST.block) { - declFlags |= 2048 /* Signature */; + function processReferencedFiles(file, basePath) { + ts.forEach(file.referencedFiles, function (ref) { + var referencedFilename = ts.isRootedDiskPath(ref.filename) ? ref.filename : ts.combinePaths(basePath, ref.filename); + processSourceFile(ts.normalizePath(referencedFilename), false, file, ref.pos, ref.end); + }); } - - var parent = context.getParent(); - - if (parent) { - var parentFlags = parent.flags; - - if (parentFlags & 1 /* Exported */) { - declFlags |= 1 /* Exported */; + function processImportedModules(file, basePath) { + ts.forEach(file.statements, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 7 /* StringLiteral */) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchPath = basePath; + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + if (findModuleSourceFile(searchName + ".ts", nameLiteral) || findModuleSourceFile(searchName + ".d.ts", nameLiteral)) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + } + } + else if (node.kind === 189 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 7 /* StringLiteral */) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + if (!tsFile) { + findModuleSourceFile(searchName + ".d.ts", nameLiteral); + } + } + } + }); + } + }); + function findModuleSourceFile(filename, nameLiteral) { + return findSourceFile(filename, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + } + } + function verifyCompilerOptions() { + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { + if (options.mapRoot) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + if (options.sourceRoot) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + return; + } + var firstExternalModule = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + if (firstExternalModule && options.module === 0 /* None */) { + var externalModuleErrorSpan = ts.getErrorSpanForNode(firstExternalModule.externalModuleIndicator); + var errorStart = ts.skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); + var errorLength = externalModuleErrorSpan.end - errorStart; + errors.push(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + } + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { + var commonPathComponents; + ts.forEach(files, function (sourceFile) { + if (!(sourceFile.flags & 1024 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + sourcePathComponents.pop(); + if (commonPathComponents) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + } + else { + commonPathComponents = sourcePathComponents; + } + } + }); + commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); + if (commonSourceDirectory) { + commonSourceDirectory += ts.directorySeparator; + } } } - - var decl = new TypeScript.NormalPullDecl(parent.name, parent.getDisplayName(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(constructorDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, constructorDeclAST); - - context.pushParent(decl); } - - function createGetAccessorDeclaration(getAccessorDeclAST, context) { - var declFlags = 4 /* Public */; - var declType = 262144 /* GetAccessor */; - - if (TypeScript.hasModifier(getAccessorDeclAST.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; + ts.createProgram = createProgram; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getModuleInstanceState(node) { + if (node.kind === 186 /* InterfaceDeclaration */) { + return 0 /* NonInstantiated */; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2 /* ConstEnumOnly */; + } + else if (node.kind === 191 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + return 0 /* NonInstantiated */; + } + else if (node.kind === 190 /* ModuleBlock */) { + var state = 0 /* NonInstantiated */; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0 /* NonInstantiated */: + return false; + case 2 /* ConstEnumOnly */: + state = 2 /* ConstEnumOnly */; + return false; + case 1 /* Instantiated */: + state = 1 /* Instantiated */; + return true; + } + }); + return state; } - - if (TypeScript.hasModifier(getAccessorDeclAST.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; + else if (node.kind === 189 /* ModuleDeclaration */) { + return getModuleInstanceState(node.body); } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + else { + return 1 /* Instantiated */; } - - var decl = new TypeScript.NormalPullDecl(getAccessorDeclAST.propertyName.valueText(), getAccessorDeclAST.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(getAccessorDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, getAccessorDeclAST); - - context.pushParent(decl); } - - function createFunctionExpressionDeclaration(expression, context) { - createAnyFunctionExpressionDeclaration(expression, expression.identifier, context); + ts.getModuleInstanceState = getModuleInstanceState; + function hasComputedNameButNotSymbol(declaration) { + return declaration.name && declaration.name.kind === 121 /* ComputedPropertyName */; } - - function createSetAccessorDeclaration(setAccessorDeclAST, context) { - var declFlags = 4 /* Public */; - var declType = 524288 /* SetAccessor */; - - if (TypeScript.hasModifier(setAccessorDeclAST.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; + ts.hasComputedNameButNotSymbol = hasComputedNameButNotSymbol; + function bindSourceFile(file) { + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var symbolCount = 0; + var Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + file.locals = {}; + container = blockScopeContainer = file; + bind(file); + file.symbolCount = symbolCount; + } + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolKind) { + symbol.flags |= symbolKind; + if (!symbol.declarations) + symbol.declarations = []; + symbol.declarations.push(node); + if (symbolKind & 1952 /* HasExports */ && !symbol.exports) + symbol.exports = {}; + if (symbolKind & 6240 /* HasMembers */ && !symbol.members) + symbol.members = {}; + node.symbol = symbol; + if (symbolKind & 107455 /* Value */ && !symbol.valueDeclaration) + symbol.valueDeclaration = node; + } + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 189 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { + return '"' + node.name.text + '"'; + } + ts.Debug.assert(!hasComputedNameButNotSymbol(node)); + return node.name.text; + } + switch (node.kind) { + case 134 /* ConstructorType */: + case 126 /* Constructor */: + return "__constructor"; + case 133 /* FunctionType */: + case 129 /* CallSignature */: + return "__call"; + case 130 /* ConstructSignature */: + return "__new"; + case 131 /* IndexSignature */: + return "__index"; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + function declareSymbol(symbols, parent, node, includes, excludes) { + if (hasComputedNameButNotSymbol(node)) { + return undefined; + } + var name = getDeclarationName(node); + if (name !== undefined) { + var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + var message = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + file.semanticDiagnostics.push(ts.createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); + }); + file.semanticDiagnostics.push(ts.createDiagnosticForNode(node.name, message, getDisplayName(node))); + symbol = createSymbol(0, name); + } + } + else { + symbol = createSymbol(0, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + if (node.kind === 185 /* ClassDeclaration */ && symbol.exports) { + var prototypeSymbol = createSymbol(4 /* Property */ | 536870912 /* Prototype */, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.semanticDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + return symbol; } - - if (TypeScript.hasModifier(setAccessorDeclAST.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; + function isAmbientContext(node) { + while (node) { + if (node.flags & 2 /* Ambient */) + return true; + node = node.parent; + } + return false; } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function declareModuleMember(node, symbolKind, symbolExcludes) { + var exportKind = 0; + if (symbolKind & 107455 /* Value */) { + exportKind |= 4194304 /* ExportValue */; + } + if (symbolKind & 3152352 /* Type */) { + exportKind |= 8388608 /* ExportType */; + } + if (symbolKind & 1536 /* Namespace */) { + exportKind |= 16777216 /* ExportNamespace */; + } + if (node.flags & 1 /* Export */ || (node.kind !== 191 /* ImportDeclaration */ && isAmbientContext(container))) { + if (exportKind) { + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + node.localSymbol = local; + } + else { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + } + } + else { + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + } } - - var decl = new TypeScript.NormalPullDecl(setAccessorDeclAST.propertyName.valueText(), setAccessorDeclAST.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(setAccessorDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, setAccessorDeclAST); - - context.pushParent(decl); - } - - function preCollectCatchDecls(ast, context) { - var declFlags = 0 /* None */; - var declType = 268435456 /* CatchBlock */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function bindChildren(node, symbolKind, isBlockScopeContainer) { + if (symbolKind & 1041936 /* HasLocals */) { + node.locals = {}; + } + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + parent = node; + if (symbolKind & 1048560 /* IsContainer */) { + container = node; + if (lastContainer !== container && !container.nextContainer) { + if (lastContainer) { + lastContainer.nextContainer = container; + } + lastContainer = container; + } + } + if (isBlockScopeContainer) { + blockScopeContainer = node; + } + ts.forEachChild(node, bind); + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - - context.pushParent(decl); - - var declFlags = 0 /* None */; - var declType = 1024 /* CatchVariable */; - - var parent = context.getParent(); - - if (TypeScript.hasFlag(parent.flags, 2097152 /* DeclaredInAWithBlock */)) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; + function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + switch (container.kind) { + case 189 /* ModuleDeclaration */: + declareModuleMember(node, symbolKind, symbolExcludes); + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolKind, symbolExcludes); + break; + } + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + break; + case 185 /* ClassDeclaration */: + if (node.flags & 128 /* Static */) { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + case 136 /* TypeLiteral */: + case 142 /* ObjectLiteralExpression */: + case 186 /* InterfaceDeclaration */: + declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); + break; + case 188 /* EnumDeclaration */: + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + bindChildren(node, symbolKind, isBlockScopeContainer); } - - var decl = new TypeScript.NormalPullDecl(ast.identifier.valueText(), ast.identifier.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast.identifier, decl); - context.semanticInfoChain.setASTForDecl(decl, ast.identifier); - - if (parent) { - parent.addVariableDeclToGroup(decl); + function bindConstructorDeclaration(node) { + bindDeclaration(node, 16384 /* Constructor */, 0, true); + ts.forEach(node.parameters, function (p) { + if (p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { + bindDeclaration(p, 4 /* Property */, 107455 /* PropertyExcludes */, false); + } + }); } - } - - function preCollectWithDecls(ast, context) { - var declFlags = 0 /* None */; - var declType = 134217728 /* WithBlock */; - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - - context.pushParent(decl); - } - - function preCollectObjectLiteralDecls(ast, context) { - var decl = new TypeScript.NormalPullDecl("", "", 256 /* ObjectLiteral */, 0 /* None */, context.getParent()); - - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - - context.pushParent(decl); - } - - function preCollectSimplePropertyAssignmentDecls(propertyAssignment, context) { - var assignmentText = TypeScript.getPropertyAssignmentNameTextFromIdentifier(propertyAssignment.propertyName); - var span = TypeScript.TextSpan.fromBounds(propertyAssignment.start(), propertyAssignment.end()); - - var decl = new TypeScript.NormalPullDecl(assignmentText.memberName, assignmentText.actualText, 4096 /* Property */, 4 /* Public */, context.getParent()); - - context.semanticInfoChain.setDeclForAST(propertyAssignment, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyAssignment); - } - - function preCollectFunctionPropertyAssignmentDecls(propertyAssignment, context) { - var assignmentText = TypeScript.getPropertyAssignmentNameTextFromIdentifier(propertyAssignment.propertyName); - - var decl = new TypeScript.NormalPullDecl(assignmentText.memberName, assignmentText.actualText, 4096 /* Property */, 4 /* Public */, context.getParent()); - - context.semanticInfoChain.setDeclForAST(propertyAssignment, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyAssignment); - - createAnyFunctionExpressionDeclaration(propertyAssignment, propertyAssignment.propertyName, context, propertyAssignment.propertyName); - } - - function preCollectDecls(ast, context) { - switch (ast.kind()) { - case 120 /* SourceUnit */: - preCollectScriptDecls(ast, context); - break; - case 132 /* EnumDeclaration */: - preCollectEnumDecls(ast, context); - break; - case 243 /* EnumElement */: - createEnumElementDecls(ast, context); - break; - case 130 /* ModuleDeclaration */: - preCollectModuleDecls(ast, context); - break; - case 131 /* ClassDeclaration */: - preCollectClassDecls(ast, context); - break; - case 128 /* InterfaceDeclaration */: - preCollectInterfaceDecls(ast, context); - break; - case 122 /* ObjectType */: - preCollectObjectTypeDecls(ast, context); - break; - case 242 /* Parameter */: - preCollectParameterDecl(ast, context); - break; - case 136 /* MemberVariableDeclaration */: - createMemberVariableDeclaration(ast, context); - break; - case 141 /* PropertySignature */: - createPropertySignature(ast, context); - break; - case 225 /* VariableDeclarator */: - preCollectVarDecls(ast, context); - break; - case 137 /* ConstructorDeclaration */: - createClassConstructorDeclaration(ast, context); - break; - case 139 /* GetAccessor */: - createGetAccessorDeclaration(ast, context); - break; - case 140 /* SetAccessor */: - createSetAccessorDeclaration(ast, context); - break; - case 222 /* FunctionExpression */: - createFunctionExpressionDeclaration(ast, context); - break; - case 135 /* MemberFunctionDeclaration */: - createMemberFunctionDeclaration(ast, context); - break; - case 144 /* IndexSignature */: - createIndexSignatureDeclaration(ast, context); - break; - case 123 /* FunctionType */: - createFunctionTypeDeclaration(ast, context); - break; - case 125 /* ConstructorType */: - createConstructorTypeDeclaration(ast, context); - break; - case 142 /* CallSignature */: - createCallSignatureDeclaration(ast, context); - break; - case 143 /* ConstructSignature */: - createConstructSignatureDeclaration(ast, context); - break; - case 145 /* MethodSignature */: - createMethodSignatureDeclaration(ast, context); - break; - case 129 /* FunctionDeclaration */: - createFunctionDeclaration(ast, context); - break; - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - createAnyFunctionExpressionDeclaration(ast, null, context); - break; - case 133 /* ImportDeclaration */: - preCollectImportDecls(ast, context); - break; - case 238 /* TypeParameter */: - preCollectTypeParameterDecl(ast, context); - break; - case 236 /* CatchClause */: - preCollectCatchDecls(ast, context); - break; - case 163 /* WithStatement */: - preCollectWithDecls(ast, context); - break; - case 215 /* ObjectLiteralExpression */: - preCollectObjectLiteralDecls(ast, context); - break; - case 240 /* SimplePropertyAssignment */: - preCollectSimplePropertyAssignmentDecls(ast, context); - break; - case 241 /* FunctionPropertyAssignment */: - preCollectFunctionPropertyAssignmentDecls(ast, context); - break; + function bindModuleDeclaration(node) { + if (node.name.kind === 7 /* StringLiteral */) { + bindDeclaration(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */, true); + } + else { + var state = getModuleInstanceState(node); + if (state === 0 /* NonInstantiated */) { + bindDeclaration(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + } + else { + bindDeclaration(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */, true); + if (state === 2 /* ConstEnumOnly */) { + node.symbol.constEnumOnlyModule = true; + } + else if (node.symbol.constEnumOnlyModule) { + node.symbol.constEnumOnlyModule = false; + } + } + } + } + function bindFunctionOrConstructorType(node) { + var symbolKind = node.kind === 133 /* FunctionType */ ? 131072 /* CallSignature */ : 262144 /* ConstructSignature */; + var symbol = createSymbol(symbolKind, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, false); + var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + typeLiteralSymbol.members = {}; + typeLiteralSymbol.members[node.kind === 133 /* FunctionType */ ? "__call" : "__new"] = symbol; + } + function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { + var symbol = createSymbol(symbolKind, name); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindCatchVariableDeclaration(node) { + var symbol = createSymbol(1 /* FunctionScopedVariable */, node.name.text || "__missing"); + addDeclarationToSymbol(symbol, node, 1 /* FunctionScopedVariable */); + var saveParent = parent; + var savedBlockScopeContainer = blockScopeContainer; + parent = blockScopeContainer = node; + ts.forEachChild(node, bind); + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindBlockScopedVariableDeclaration(node) { + switch (blockScopeContainer.kind) { + case 189 /* ModuleDeclaration */: + declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(container)) { + declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + } + declareSymbol(blockScopeContainer.locals, undefined, node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + } + bindChildren(node, 2 /* BlockScopedVariable */, false); + } + function bind(node) { + node.parent = parent; + switch (node.kind) { + case 122 /* TypeParameter */: + bindDeclaration(node, 1048576 /* TypeParameter */, 2103776 /* TypeParameterExcludes */, false); + break; + case 123 /* Parameter */: + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + break; + case 183 /* VariableDeclaration */: + if (node.flags & 6144 /* BlockScoped */) { + bindBlockScopedVariableDeclaration(node); + } + else { + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); + } + break; + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + bindDeclaration(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); + break; + case 200 /* EnumMember */: + bindDeclaration(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); + break; + case 129 /* CallSignature */: + bindDeclaration(node, 131072 /* CallSignature */, 0, false); + break; + case 130 /* ConstructSignature */: + bindDeclaration(node, 262144 /* ConstructSignature */, 0, true); + break; + case 125 /* Method */: + bindDeclaration(node, 8192 /* Method */, ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); + break; + case 131 /* IndexSignature */: + bindDeclaration(node, 524288 /* IndexSignature */, 0, false); + break; + case 184 /* FunctionDeclaration */: + bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); + break; + case 126 /* Constructor */: + bindConstructorDeclaration(node); + break; + case 127 /* GetAccessor */: + bindDeclaration(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); + break; + case 128 /* SetAccessor */: + bindDeclaration(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); + break; + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + bindFunctionOrConstructorType(node); + break; + case 136 /* TypeLiteral */: + bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); + break; + case 142 /* ObjectLiteralExpression */: + bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); + break; + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); + break; + case 197 /* CatchClause */: + bindCatchVariableDeclaration(node); + break; + case 185 /* ClassDeclaration */: + bindDeclaration(node, 32 /* Class */, 3258879 /* ClassExcludes */, false); + break; + case 186 /* InterfaceDeclaration */: + bindDeclaration(node, 64 /* Interface */, 3152288 /* InterfaceExcludes */, false); + break; + case 187 /* TypeAliasDeclaration */: + bindDeclaration(node, 2097152 /* TypeAlias */, 3152352 /* TypeAliasExcludes */, false); + break; + case 188 /* EnumDeclaration */: + if (ts.isConst(node)) { + bindDeclaration(node, 128 /* ConstEnum */, 3259263 /* ConstEnumExcludes */, false); + } + else { + bindDeclaration(node, 256 /* RegularEnum */, 3258623 /* RegularEnumExcludes */, false); + } + break; + case 189 /* ModuleDeclaration */: + bindModuleDeclaration(node); + break; + case 191 /* ImportDeclaration */: + bindDeclaration(node, 33554432 /* Import */, 33554432 /* ImportExcludes */, false); + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(node)) { + bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); + break; + } + case 163 /* Block */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 176 /* SwitchStatement */: + bindChildren(node, 0, true); + break; + default: + var saveParent = parent; + parent = node; + ts.forEachChild(node, bind); + parent = saveParent; + } } } - - function isContainer(decl) { - return decl.kind === 4 /* Container */ || decl.kind === 32 /* DynamicModule */ || decl.kind === 64 /* Enum */; + ts.bindSourceFile = bindSourceFile; +})(ts || (ts = {})); +var ts; +(function (ts) { + var indentStrings = ["", " "]; + function getIndentString(level) { + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; } - - function getInitializationFlag(decl) { - if (decl.kind & 4 /* Container */) { - return 32768 /* InitializedModule */; - } else if (decl.kind & 32 /* DynamicModule */) { - return 65536 /* InitializedDynamicModule */; - } - - return 0 /* None */; + ts.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; } - - function hasInitializationFlag(decl) { - var kind = decl.kind; - - if (kind & 4 /* Container */) { - return (decl.flags & 32768 /* InitializedModule */) !== 0; - } else if (kind & 32 /* DynamicModule */) { - return (decl.flags & 65536 /* InitializedDynamicModule */) !== 0; + function shouldEmitToOwnFile(sourceFile, compilerOptions) { + if (!ts.isDeclarationFile(sourceFile)) { + if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + return true; + } + return false; } - return false; } - - function postCollectDecls(ast, context) { - var currentDecl = context.getParent(); - - if (ast.kind() === 11 /* IdentifierName */ || ast.kind() === 14 /* StringLiteral */) { - if (currentDecl.kind === 4 /* Container */ || currentDecl.kind === 32 /* DynamicModule */) { - return; - } + ts.shouldEmitToOwnFile = shouldEmitToOwnFile; + function isExternalModuleOrDeclarationFile(sourceFile) { + return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); + } + ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function createTextWriter(newLine) { + var output = ""; + var indent = 0; + var lineStart = true; + var lineCount = 0; + var linePos = 0; + function write(s) { + if (s && s.length) { + if (lineStart) { + output += getIndentString(indent); + lineStart = false; + } + output += s; + } + } + function rawWrite(s) { + if (s !== undefined) { + if (lineStart) { + lineStart = false; + } + output += s; + } + } + function writeLiteral(s) { + if (s && s.length) { + write(s); + var lineStartsOfS = ts.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; + } + } + } + function writeLine() { + if (!lineStart) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; + } + } + function writeTextOfNode(sourceFile, node) { + write(ts.getSourceTextOfNodeFromSourceFile(sourceFile, node)); + } + return { + write: write, + rawWrite: rawWrite, + writeTextOfNode: writeTextOfNode, + writeLiteral: writeLiteral, + writeLine: writeLine, + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } + }; + } + function getLineOfLocalPosition(currentSourceFile, pos) { + return currentSourceFile.getLineAndCharacterFromPosition(pos).line; + } + function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + writer.writeLine(); } - - if (ast.kind() === 130 /* ModuleDeclaration */) { - var moduleDeclaration = ast; - if (moduleDeclaration.stringLiteral) { - TypeScript.Debug.assert(currentDecl.ast() === moduleDeclaration.stringLiteral); - context.popParent(); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(moduleDeclaration.name); - for (var i = moduleNames.length - 1; i >= 0; i--) { - var moduleName = moduleNames[i]; - TypeScript.Debug.assert(currentDecl.ast() === moduleName); - context.popParent(); - currentDecl = context.getParent(); + } + function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + var emitLeadingSpace = !trailingSeparator; + ts.forEach(comments, function (comment) { + if (emitLeadingSpace) { + writer.write(" "); + emitLeadingSpace = false; + } + writeComment(currentSourceFile, writer, comment, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + else if (trailingSeparator) { + writer.write(" "); + } + else { + emitLeadingSpace = true; + } + }); + } + function writeCommentRange(currentSourceFile, writer, comment, newLine) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); + var firstCommentLineIndent; + for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, 1); + if (pos !== comment.pos) { + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, 1), comment.pos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; + } + } + else { + writer.rawWrite(""); + } } + writeTrimmedCurrentLine(pos, nextLineStart); + pos = nextLineStart; } } - - if (ast.kind() === 132 /* EnumDeclaration */) { - computeEnumElementConstantValues(ast, currentDecl, context); + else { + writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); } - - while (currentDecl.getParentDecl() && currentDecl.ast() === ast) { - context.popParent(); - currentDecl = context.getParent(); + function writeTrimmedCurrentLine(pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + if (currentLineText) { + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + writer.writeLiteral(newLine); + } } - } - - function computeEnumElementConstantValues(ast, enumDecl, context) { - TypeScript.Debug.assert(enumDecl.kind === 64 /* Enum */); - - var isAmbientEnum = TypeScript.hasFlag(enumDecl.flags, 8 /* Ambient */); - var inConstantSection = !isAmbientEnum; - var currentConstantValue = 0; - var enumMemberDecls = enumDecl.getChildDecls(); - - for (var i = 0, n = ast.enumElements.nonSeparatorCount(); i < n; i++) { - var enumElement = ast.enumElements.nonSeparatorAt(i); - var enumElementDecl = TypeScript.ArrayUtilities.first(enumMemberDecls, function (d) { - return context.semanticInfoChain.getASTForDecl(d) === enumElement; - }); - - TypeScript.Debug.assert(enumElementDecl.kind === 67108864 /* EnumMember */); - - if (enumElement.equalsValueClause === null) { - if (inConstantSection) { - enumElementDecl.constantValue = currentConstantValue; - currentConstantValue++; + function calculateIndent(pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { + if (currentSourceFile.text.charCodeAt(pos) === 9 /* tab */) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); } - } else { - enumElementDecl.constantValue = computeEnumElementConstantValue(enumElement.equalsValueClause.value, enumMemberDecls, context); - if (enumElementDecl.constantValue !== null && !isAmbientEnum) { - inConstantSection = true; - currentConstantValue = enumElementDecl.constantValue + 1; - } else { - inConstantSection = false; + else { + currentLineIndent++; } } - - TypeScript.Debug.assert(enumElementDecl.constantValue !== undefined); + return currentLineIndent; } } - - function computeEnumElementConstantValue(expression, enumMemberDecls, context) { - TypeScript.Debug.assert(expression); - - if (TypeScript.ASTHelpers.isIntegerLiteralAST(expression)) { - var token; - switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - token = expression.operand; - break; - default: - token = expression; - } - - var value = token.value(); - return value && expression.kind() === 165 /* NegateExpression */ ? -value : value; - } else if (context.propagateEnumConstants) { - switch (expression.kind()) { - case 11 /* IdentifierName */: - var name = expression; - var matchingEnumElement = TypeScript.ArrayUtilities.firstOrDefault(enumMemberDecls, function (d) { - return d.name === name.valueText(); - }); - - return matchingEnumElement ? matchingEnumElement.constantValue : null; - - case 202 /* LeftShiftExpression */: - var binaryExpression = expression; - var left = computeEnumElementConstantValue(binaryExpression.left, enumMemberDecls, context); - var right = computeEnumElementConstantValue(binaryExpression.right, enumMemberDecls, context); - if (left === null || right === null) { - return null; - } - - return left << right; - - case 189 /* BitwiseOrExpression */: - var binaryExpression = expression; - var left = computeEnumElementConstantValue(binaryExpression.left, enumMemberDecls, context); - var right = computeEnumElementConstantValue(binaryExpression.right, enumMemberDecls, context); - if (left === null || right === null) { - return null; - } - - return left | right; + function getFirstConstructorWithBody(node) { + return ts.forEach(node.members, function (member) { + if (member.kind === 126 /* Constructor */ && member.body) { + return member; } - - return null; - } else { - return null; - } + }); } - - (function (DeclarationCreator) { - function create(document, semanticInfoChain, compilationSettings) { - var declCollectionContext = new DeclCollectionContext(document, semanticInfoChain, compilationSettings.propagateEnumConstants()); - - TypeScript.getAstWalkerFactory().simpleWalk(document.sourceUnit(), preCollectDecls, postCollectDecls, declCollectionContext); - - return declCollectionContext.getParent(); - } - DeclarationCreator.create = create; - })(TypeScript.DeclarationCreator || (TypeScript.DeclarationCreator = {})); - var DeclarationCreator = TypeScript.DeclarationCreator; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var PullSymbolBinder = (function () { - function PullSymbolBinder(semanticInfoChain) { - this.semanticInfoChain = semanticInfoChain; - this.declsBeingBound = []; - this.inBindingOtherDeclsWalker = new TypeScript.PullHelpers.OtherPullDeclsWalker(); - } - PullSymbolBinder.prototype.getParent = function (decl, returnInstanceType) { - if (typeof returnInstanceType === "undefined") { returnInstanceType = false; } - var parentDecl = decl.getParentDecl(); - - if (parentDecl.kind === 1 /* Script */) { - return null; - } - - var parent = parentDecl.getSymbol(); - - if (!parent && parentDecl && !parentDecl.hasBeenBound()) { - this.bindDeclToPullSymbol(parentDecl); - } - - parent = parentDecl.getSymbol(); - if (parent) { - var parentDeclKind = parentDecl.kind; - if (parentDeclKind === 262144 /* GetAccessor */) { - parent = parent.getGetter(); - } else if (parentDeclKind === 524288 /* SetAccessor */) { - parent = parent.getSetter(); - } + function getAllAccessorDeclarations(node, accessor) { + var firstAccessor; + var getAccessor; + var setAccessor; + if (accessor.name.kind === 121 /* ComputedPropertyName */) { + firstAccessor = accessor; + if (accessor.kind === 127 /* GetAccessor */) { + getAccessor = accessor; } - - if (parent) { - if (returnInstanceType && parent.isType() && parent.isContainer()) { - var instanceSymbol = parent.getInstanceSymbol(); - - if (instanceSymbol) { - return instanceSymbol.type; - } - } - - return parent.type; + else if (accessor.kind === 128 /* SetAccessor */) { + setAccessor = accessor; } - - return null; - }; - - PullSymbolBinder.prototype.findDeclsInContext = function (startingDecl, declKind, searchGlobally) { - if (!searchGlobally) { - var parentDecl = startingDecl.getParentDecl(); - return parentDecl.searchChildDecls(startingDecl.name, declKind); + else { + ts.Debug.fail("Accessor has wrong kind"); } - - var contextSymbolPath = startingDecl.getParentPath(); - - if (contextSymbolPath.length) { - var copyOfContextSymbolPath = []; - - for (var i = 0; i < contextSymbolPath.length; i++) { - if (contextSymbolPath[i].kind & 1 /* Script */) { - continue; + } + else { + ts.forEach(node.members, function (member) { + if ((member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { + if (!firstAccessor) { + firstAccessor = member; } - copyOfContextSymbolPath[copyOfContextSymbolPath.length] = contextSymbolPath[i].name; - } - - return this.semanticInfoChain.findDecls(copyOfContextSymbolPath, declKind); - } - }; - - PullSymbolBinder.prototype.getExistingSymbol = function (decl, searchKind, parent) { - var lookingForValue = (searchKind & 68147712 /* SomeValue */) !== 0; - var lookingForType = (searchKind & 58728795 /* SomeType */) !== 0; - var lookingForContainer = (searchKind & 164 /* SomeContainer */) !== 0; - var name = decl.name; - if (parent) { - var isExported = (decl.flags & 1 /* Exported */) !== 0; - - var prevSymbol = null; - if (lookingForValue) { - prevSymbol = parent.findContainedNonMember(name); - } else if (lookingForType) { - prevSymbol = parent.findContainedNonMemberType(name, searchKind); - } else if (lookingForContainer) { - prevSymbol = parent.findContainedNonMemberContainer(name, searchKind); - } - var prevIsExported = !prevSymbol; - if (!prevSymbol) { - if (lookingForValue) { - prevSymbol = parent.findMember(name, false); - } else if (lookingForType) { - prevSymbol = parent.findNestedType(name, searchKind); - } else if (lookingForContainer) { - prevSymbol = parent.findNestedContainer(name, searchKind); + if (member.kind === 127 /* GetAccessor */ && !getAccessor) { + getAccessor = member; } - } - - if (isExported && prevIsExported) { - return prevSymbol; - } - if (prevSymbol) { - var prevDecls = prevSymbol.getDeclarations(); - var lastPrevDecl = prevDecls[prevDecls.length - 1]; - var parentDecl = decl.getParentDecl(); - var prevParentDecl = lastPrevDecl && lastPrevDecl.getParentDecl(); - if (parentDecl !== prevParentDecl) { - return null; + if (member.kind === 128 /* SetAccessor */ && !setAccessor) { + setAccessor = member; } - - return prevSymbol; } - } else { - var parentDecl = decl.getParentDecl(); - if (parentDecl && parentDecl.kind === 1 /* Script */) { - return this.semanticInfoChain.findTopLevelSymbol(name, searchKind, decl); - } else { - var prevDecls = parentDecl && parentDecl.searchChildDecls(name, searchKind); - return prevDecls[0] && prevDecls[0].getSymbol(); - } - } - - return null; - }; - - PullSymbolBinder.prototype.checkThatExportsMatch = function (decl, prevSymbol, reportError) { - if (typeof reportError === "undefined") { reportError = true; } - var isExported = (decl.flags & 1 /* Exported */) !== 0; - var prevDecls = prevSymbol.getDeclarations(); - var prevIsExported = (prevDecls[prevDecls.length - 1].flags & 1 /* Exported */) !== 0; - if ((isExported !== prevIsExported) && !prevSymbol.isSignature() && (decl.kind & 7340032 /* SomeSignature */) === 0) { - if (reportError) { - var ast = this.semanticInfoChain.getASTForDecl(decl); - this.semanticInfoChain.addDiagnosticFromAST(ast, TypeScript.DiagnosticCode.All_declarations_of_merged_declaration_0_must_be_exported_or_not_exported, [decl.getDisplayName()]); - } - return false; - } - - return true; - }; - - PullSymbolBinder.prototype.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList = function (signature, currentSignatures) { - var signatureDecl = signature.getDeclarations()[0]; - TypeScript.Debug.assert(signatureDecl); - var enclosingDecl = signatureDecl.getParentDecl(); - var indexToInsert = TypeScript.ArrayUtilities.indexOf(currentSignatures, function (someSignature) { - return someSignature.getDeclarations()[0].getParentDecl() !== enclosingDecl; }); - return indexToInsert < 0 ? currentSignatures.length : indexToInsert; + } + return { + firstAccessor: firstAccessor, + getAccessor: getAccessor, + setAccessor: setAccessor }; - - PullSymbolBinder.prototype.bindEnumDeclarationToPullSymbol = function (enumContainerDecl) { - var enumName = enumContainerDecl.name; - - var enumContainerSymbol = null; - var enumInstanceSymbol = null; - var moduleInstanceTypeSymbol = null; - - var enumInstanceDecl = enumContainerDecl.getValueDecl(); - - var enumDeclKind = enumContainerDecl.kind; - - var parent = this.getParent(enumContainerDecl); - var parentInstanceSymbol = this.getParent(enumContainerDecl, true); - var parentDecl = enumContainerDecl.getParentDecl(); - var enumAST = this.semanticInfoChain.getASTForDecl(enumContainerDecl); - - var isExported = enumContainerDecl.flags & 1 /* Exported */; - - var createdNewSymbol = false; - - enumContainerSymbol = this.getExistingSymbol(enumContainerDecl, 64 /* Enum */, parent); - - if (enumContainerSymbol) { - if (enumContainerSymbol.kind !== enumDeclKind) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(enumAST.identifier, enumContainerDecl.getDisplayName(), enumContainerSymbol.getDeclarations()[0].ast()); - enumContainerSymbol = null; - } else if (!this.checkThatExportsMatch(enumContainerDecl, enumContainerSymbol)) { - enumContainerSymbol = null; + } + function getSourceFilePathInNewDir(sourceFile, program, newDirPath) { + var compilerHost = program.getCompilerHost(); + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, compilerHost.getCurrentDirectory()); + sourceFilePath = sourceFilePath.replace(program.getCommonSourceDirectory(), ""); + return ts.combinePaths(newDirPath, sourceFilePath); + } + function getOwnEmitOutputFilePath(sourceFile, program, extension) { + var compilerOptions = program.getCompilerOptions(); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, program, compilerOptions.outDir)); + } + else { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.filename); + } + return emitOutputFilePathWithoutExtension + extension; + } + function writeFile(compilerHost, diagnostics, filename, data, writeByteOrderMark) { + compilerHost.writeFile(filename, data, writeByteOrderMark, function (hostErrorMessage) { + diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, filename, hostErrorMessage)); + }); + } + function emitDeclarations(program, resolver, diagnostics, jsFilePath, root) { + var newLine = program.getCompilerHost().getNewLine(); + var compilerOptions = program.getCompilerOptions(); + var compilerHost = program.getCompilerHost(); + var write; + var writeLine; + var increaseIndent; + var decreaseIndent; + var writeTextOfNode; + var writer = createAndSetNewTextWriterWithSymbolWriter(); + var enclosingDeclaration; + var currentSourceFile; + var reportedDeclarationError = false; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; + var aliasDeclarationEmitInfo = []; + function createAndSetNewTextWriterWithSymbolWriter() { + var writer = createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + return writer; + } + function setWriter(newWriter) { + writer = newWriter; + write = newWriter.write; + writeTextOfNode = newWriter.writeTextOfNode; + writeLine = newWriter.writeLine; + increaseIndent = newWriter.increaseIndent; + decreaseIndent = newWriter.decreaseIndent; + } + function writeAsychronousImportDeclarations(importDeclarations) { + var oldWriter = writer; + ts.forEach(importDeclarations, function (aliasToWrite) { + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + if (aliasEmitInfo) { + createAndSetNewTextWriterWithSymbolWriter(); + for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { + increaseIndent(); + } + writeImportDeclaration(aliasToWrite); + aliasEmitInfo.asynchronousOutput = writer.getText(); } - } - - if (enumContainerSymbol) { - enumInstanceSymbol = enumContainerSymbol.getInstanceSymbol(); - } else { - enumContainerSymbol = new TypeScript.PullContainerSymbol(enumName, enumDeclKind); - createdNewSymbol = true; - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(enumContainerSymbol, 64 /* Enum */); + }); + setWriter(oldWriter); + } + function handleSymbolAccessibilityError(symbolAccesibilityResult) { + if (symbolAccesibilityResult.accessibility === 0 /* Accessible */) { + if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { + writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); } } - - enumContainerSymbol.addDeclaration(enumContainerDecl); - enumContainerDecl.setSymbol(enumContainerSymbol); - - this.semanticInfoChain.setSymbolForAST(enumAST.identifier, enumContainerSymbol); - this.semanticInfoChain.setSymbolForAST(enumAST, enumContainerSymbol); - - if (!enumInstanceSymbol) { - var variableSymbol = null; - if (parentInstanceSymbol) { - if (isExported) { - variableSymbol = parentInstanceSymbol.findMember(enumName, false); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findContainedNonMember(enumName); - } - } else { - variableSymbol = parentInstanceSymbol.findContainedNonMember(enumName); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findMember(enumName, false); - } + else { + reportedDeclarationError = true; + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + if (errorInfo) { + if (errorInfo.typeName) { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } - - if (variableSymbol) { - var declarations = variableSymbol.getDeclarations(); - - if (declarations.length) { - var variableSymbolParentDecl = declarations[0].getParentDecl(); - - if (parentDecl !== variableSymbolParentDecl) { - variableSymbol = null; - } - } + else { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); } - } else if (!(enumContainerDecl.flags & 1 /* Exported */)) { - var siblingDecls = parentDecl.getChildDecls(); - var augmentedDecl = null; - - for (var i = 0; i < siblingDecls.length; i++) { - if (siblingDecls[i] === enumContainerDecl) { - break; - } - - if ((siblingDecls[i].name === enumName) && (siblingDecls[i].kind & 68147712 /* SomeValue */)) { - augmentedDecl = siblingDecls[i]; - break; - } + } + } + } + function trackSymbol(symbol, enclosingDeclaration, meaning) { + handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + } + function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (type) { + emitType(type); + } + else { + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } + } + function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (signature.type) { + emitType(signature.type); + } + else { + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } + } + function emitLines(nodes) { + for (var i = 0, n = nodes.length; i < n; i++) { + emitNode(nodes[i]); + } + } + function emitSeparatedList(nodes, separator, eachNodeEmitFn) { + var currentWriterPos = writer.getTextPos(); + for (var i = 0, n = nodes.length; i < n; i++) { + if (currentWriterPos !== writer.getTextPos()) { + write(separator); + } + currentWriterPos = writer.getTextPos(); + eachNodeEmitFn(nodes[i]); + } + } + function emitCommaList(nodes, eachNodeEmitFn) { + emitSeparatedList(nodes, ", ", eachNodeEmitFn); + } + function writeJsDocComments(declaration) { + if (declaration) { + var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + emitComments(currentSourceFile, writer, jsDocComments, true, newLine, writeCommentRange); + } + } + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + emitType(type); + } + function emitType(type) { + switch (type.kind) { + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: + case 7 /* StringLiteral */: + return writeTextOfNode(currentSourceFile, type); + case 132 /* TypeReference */: + return emitTypeReference(type); + case 135 /* TypeQuery */: + return emitTypeQuery(type); + case 137 /* ArrayType */: + return emitArrayType(type); + case 138 /* TupleType */: + return emitTupleType(type); + case 139 /* UnionType */: + return emitUnionType(type); + case 140 /* ParenthesizedType */: + return emitParenType(type); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + return emitSignatureDeclarationWithJsDocComments(type); + case 136 /* TypeLiteral */: + return emitTypeLiteral(type); + case 63 /* Identifier */: + return emitEntityName(type); + case 120 /* QualifiedName */: + return emitEntityName(type); + default: + ts.Debug.fail("Unknown type annotation: " + type.kind); + } + function emitEntityName(entityName) { + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 191 /* ImportDeclaration */ ? entityName.parent : enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + writeEntityName(entityName); + function writeEntityName(entityName) { + if (entityName.kind === 63 /* Identifier */) { + writeTextOfNode(currentSourceFile, entityName); } - - if (augmentedDecl) { - variableSymbol = augmentedDecl.getSymbol(); - - if (variableSymbol) { - if (variableSymbol.isContainer()) { - variableSymbol = variableSymbol.getInstanceSymbol(); - } else if (variableSymbol && variableSymbol.isType()) { - variableSymbol = variableSymbol.getConstructorMethod(); - } - } + else { + var qualifiedName = entityName; + writeEntityName(qualifiedName.left); + write("."); + writeTextOfNode(currentSourceFile, qualifiedName.right); } } - - if (variableSymbol) { - enumInstanceSymbol = variableSymbol; - moduleInstanceTypeSymbol = variableSymbol.type; - } else { - enumInstanceSymbol = new TypeScript.PullSymbol(enumName, 512 /* Variable */); - } - - enumContainerSymbol.setInstanceSymbol(enumInstanceSymbol); - - if (!moduleInstanceTypeSymbol) { - moduleInstanceTypeSymbol = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - enumInstanceSymbol.type = moduleInstanceTypeSymbol; - } - - moduleInstanceTypeSymbol.addDeclaration(enumContainerDecl); - - if (!moduleInstanceTypeSymbol.getAssociatedContainerType()) { - moduleInstanceTypeSymbol.setAssociatedContainerType(enumContainerSymbol); - } } - - if (createdNewSymbol && parent) { - if (enumContainerDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberType(enumContainerSymbol); - } else { - parent.addEnclosedNonMemberType(enumContainerSymbol); + function emitTypeReference(type) { + emitEntityName(type.typeName); + if (type.typeArguments) { + write("<"); + emitCommaList(type.typeArguments, emitType); + write(">"); } } - - if (createdNewSymbol) { - this.bindEnumIndexerDeclsToPullSymbols(enumContainerSymbol); + function emitTypeQuery(type) { + write("typeof "); + emitEntityName(type.exprName); } - var valueDecl = enumContainerDecl.getValueDecl(); - - if (valueDecl) { - valueDecl.ensureSymbolIsBound(); + function emitArrayType(type) { + emitType(type.elementType); + write("[]"); } - }; - - PullSymbolBinder.prototype.bindEnumIndexerDeclsToPullSymbols = function (enumContainerSymbol) { - var enumContainerInstanceTypeSymbol = enumContainerSymbol.getInstanceSymbol().type; - - var syntheticIndexerParameterSymbol = new TypeScript.PullSymbol("x", 2048 /* Parameter */); - syntheticIndexerParameterSymbol.type = this.semanticInfoChain.numberTypeSymbol; - syntheticIndexerParameterSymbol.setResolved(); - syntheticIndexerParameterSymbol.setIsSynthesized(); - - var syntheticIndexerSignatureSymbol = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - syntheticIndexerSignatureSymbol.addParameter(syntheticIndexerParameterSymbol); - syntheticIndexerSignatureSymbol.returnType = this.semanticInfoChain.stringTypeSymbol; - syntheticIndexerSignatureSymbol.setResolved(); - syntheticIndexerSignatureSymbol.setIsSynthesized(); - - enumContainerInstanceTypeSymbol.addIndexSignature(syntheticIndexerSignatureSymbol); - }; - - PullSymbolBinder.prototype.findExistingVariableSymbolForModuleValueDecl = function (decl) { - var isExported = TypeScript.hasFlag(decl.flags, 1 /* Exported */); - var modName = decl.name; - var parentInstanceSymbol = this.getParent(decl, true); - var parentDecl = decl.getParentDecl(); - - var variableSymbol = null; - - if (parentInstanceSymbol) { - if (isExported) { - variableSymbol = parentInstanceSymbol.findMember(modName, false); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findContainedNonMember(modName); - } - } else { - variableSymbol = parentInstanceSymbol.findContainedNonMember(modName); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findMember(modName, false); - } + function emitTupleType(type) { + write("["); + emitCommaList(type.elementTypes, emitType); + write("]"); + } + function emitUnionType(type) { + emitSeparatedList(type.types, " | ", emitType); + } + function emitParenType(type) { + write("("); + emitType(type.type); + write(")"); + } + function emitTypeLiteral(type) { + write("{"); + if (type.members.length) { + writeLine(); + increaseIndent(); + emitLines(type.members); + decreaseIndent(); } - - if (variableSymbol) { - var declarations = variableSymbol.getDeclarations(); - - if (declarations.length) { - var variableSymbolParentDecl = declarations[0].getParentDecl(); - var isExportedOrHasTheSameParent = isExported || (parentDecl === variableSymbolParentDecl); - - var canReuseVariableSymbol = isExportedOrHasTheSameParent && this.checkThatExportsMatch(decl, variableSymbol, false); - - if (!canReuseVariableSymbol) { - variableSymbol = null; - } - } + write("}"); + } + } + function emitSourceFile(node) { + currentSourceFile = node; + enclosingDeclaration = node; + emitLines(node.statements); + } + function emitExportAssignment(node) { + write("export = "); + writeTextOfNode(currentSourceFile, node.exportName); + write(";"); + writeLine(); + } + function emitModuleElementDeclarationFlags(node) { + if (node.parent === currentSourceFile) { + if (node.flags & 1 /* Export */) { + write("export "); } - } else if (!isExported) { - var siblingDecls = parentDecl.getChildDecls(); - - for (var i = 0; i < siblingDecls.length; i++) { - var sibling = siblingDecls[i]; - - var siblingIsSomeValue = TypeScript.hasFlag(sibling.kind, 68147712 /* SomeValue */); - var siblingIsFunctionOrHasImplictVarFlag = TypeScript.hasFlag(sibling.kind, 1032192 /* SomeFunction */) || TypeScript.hasFlag(sibling.flags, 118784 /* ImplicitVariable */); - - var isSiblingAnAugmentableVariable = sibling !== decl && sibling !== decl.getValueDecl() && sibling.name === modName && siblingIsSomeValue && siblingIsFunctionOrHasImplictVarFlag; - - if (isSiblingAnAugmentableVariable) { - if (sibling.hasSymbol()) { - variableSymbol = sibling.getSymbol(); - if (variableSymbol.isContainer()) { - variableSymbol = variableSymbol.getInstanceSymbol(); - } else if (variableSymbol && variableSymbol.isType()) { - variableSymbol = variableSymbol.getConstructorMethod(); - } - - break; - } - } + if (node.kind !== 186 /* InterfaceDeclaration */) { + write("declare "); } } - return variableSymbol; - }; - - PullSymbolBinder.prototype.bindModuleDeclarationToPullSymbol = function (moduleContainerDecl) { - var modName = moduleContainerDecl.name; - - var moduleContainerTypeSymbol = null; - var moduleKind = moduleContainerDecl.kind; - - var parent = this.getParent(moduleContainerDecl); - var parentInstanceSymbol = this.getParent(moduleContainerDecl, true); - var parentDecl = moduleContainerDecl.getParentDecl(); - var moduleNameAST = this.semanticInfoChain.getASTForDecl(moduleContainerDecl); - var moduleDeclAST = TypeScript.ASTHelpers.getEnclosingModuleDeclaration(moduleNameAST); - if (!moduleDeclAST) { - TypeScript.Debug.assert(moduleKind === 32 /* DynamicModule */); - TypeScript.Debug.assert(moduleNameAST.kind() === 120 /* SourceUnit */); - - moduleDeclAST = moduleNameAST; + } + function emitClassMemberDeclarationFlags(node) { + if (node.flags & 32 /* Private */) { + write("private "); } - - var isExported = TypeScript.hasFlag(moduleContainerDecl.flags, 1 /* Exported */); - var searchKind = 164 /* SomeContainer */; - var isInitializedModule = (moduleContainerDecl.flags & 102400 /* SomeInitializedModule */) !== 0; - - if (parent && moduleKind === 32 /* DynamicModule */) { - this.semanticInfoChain.addDiagnosticFromAST(moduleNameAST, TypeScript.DiagnosticCode.Ambient_external_module_declaration_must_be_defined_in_global_context, null); + else if (node.flags & 64 /* Protected */) { + write("protected "); } - - var createdNewSymbol = false; - - moduleContainerTypeSymbol = this.getExistingSymbol(moduleContainerDecl, searchKind, parent); - - if (moduleContainerTypeSymbol) { - if (moduleContainerTypeSymbol.kind !== moduleKind) { - if (isInitializedModule) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(moduleNameAST, moduleContainerDecl.getDisplayName(), moduleContainerTypeSymbol.getDeclarations()[0].ast()); - } - - moduleContainerTypeSymbol = null; - } else if (moduleKind === 32 /* DynamicModule */) { - this.semanticInfoChain.addDiagnosticFromAST(moduleNameAST, TypeScript.DiagnosticCode.Ambient_external_module_declaration_cannot_be_reopened); - } else if (!this.checkThatExportsMatch(moduleContainerDecl, moduleContainerTypeSymbol)) { - moduleContainerTypeSymbol = null; - } + if (node.flags & 128 /* Static */) { + write("static "); } - - if (!moduleContainerTypeSymbol) { - moduleContainerTypeSymbol = new TypeScript.PullContainerSymbol(modName, moduleKind); - createdNewSymbol = true; - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(moduleContainerTypeSymbol, searchKind); - } + } + function emitImportDeclaration(node) { + var nodeEmitInfo = { + declaration: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + hasWritten: resolver.isDeclarationVisible(node) + }; + aliasDeclarationEmitInfo.push(nodeEmitInfo); + if (nodeEmitInfo.hasWritten) { + writeImportDeclaration(node); } - - moduleContainerTypeSymbol.addDeclaration(moduleContainerDecl); - moduleContainerDecl.setSymbol(moduleContainerTypeSymbol); - - this.semanticInfoChain.setSymbolForAST(moduleNameAST, moduleContainerTypeSymbol); - this.semanticInfoChain.setSymbolForAST(moduleDeclAST, moduleContainerTypeSymbol); - - var currentModuleValueDecl = moduleContainerDecl.getValueDecl(); - - var moduleDeclarations = moduleContainerTypeSymbol.getDeclarations(); - - if (createdNewSymbol) { - if (parent) { - if (moduleContainerDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberContainer(moduleContainerTypeSymbol); - } else { - parent.addEnclosedNonMemberContainer(moduleContainerTypeSymbol); + } + function writeImportDeclaration(node) { + emitJsDocComments(node); + if (node.flags & 1 /* Export */) { + write("export "); + } + write("import "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); + write(";"); + } + else { + write("require("); + writeTextOfNode(currentSourceFile, ts.getExternalModuleImportDeclarationExpression(node)); + write(");"); + } + writer.writeLine(); + function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; + } + } + function emitModuleDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("module "); + writeTextOfNode(currentSourceFile, node.name); + while (node.body.kind !== 190 /* ModuleBlock */) { + node = node.body; + write("."); + writeTextOfNode(currentSourceFile, node.name); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.body.statements); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitTypeAliasDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("type "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); + write(";"); + writeLine(); + } + function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: node.type, + typeName: node.name + }; + } + } + function emitEnumDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isConst(node)) { + write("const "); + } + write("enum "); + writeTextOfNode(currentSourceFile, node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + } + } + function emitEnumMemberDeclaration(node) { + emitJsDocComments(node); + writeTextOfNode(currentSourceFile, node.name); + var enumMemberValue = resolver.getEnumMemberValue(node); + if (enumMemberValue !== undefined) { + write(" = "); + write(enumMemberValue.toString()); + } + write(","); + writeLine(); + } + function emitTypeParameters(typeParameters) { + function emitTypeParameter(node) { + increaseIndent(); + emitJsDocComments(node); + decreaseIndent(); + writeTextOfNode(currentSourceFile, node.name); + if (node.constraint && (node.parent.kind !== 125 /* Method */ || !(node.parent.flags & 32 /* Private */))) { + write(" extends "); + if (node.parent.kind === 133 /* FunctionType */ || node.parent.kind === 134 /* ConstructorType */ || (node.parent.parent && node.parent.parent.kind === 136 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 125 /* Method */ || node.parent.kind === 133 /* FunctionType */ || node.parent.kind === 134 /* ConstructorType */ || node.parent.kind === 129 /* CallSignature */ || node.parent.kind === 130 /* ConstructSignature */); + emitType(node.constraint); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); + } + } + function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 185 /* ClassDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 186 /* InterfaceDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 130 /* ConstructSignature */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 129 /* CallSignature */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 125 /* Method */: + if (node.parent.flags & 128 /* Static */) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 184 /* FunctionDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; } } - - if (currentModuleValueDecl) { - currentModuleValueDecl.ensureSymbolIsBound(); - - var instanceSymbol = null; - var instanceTypeSymbol = null; - if (currentModuleValueDecl.hasSymbol()) { - instanceSymbol = currentModuleValueDecl.getSymbol(); - } else { - instanceSymbol = new TypeScript.PullSymbol(modName, 512 /* Variable */); - currentModuleValueDecl.setSymbol(instanceSymbol); - if (!instanceSymbol.hasDeclaration(currentModuleValueDecl)) { - instanceSymbol.addDeclaration(currentModuleValueDecl); - } - } - - if (!instanceSymbol.type) { - instanceSymbol.type = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - } - - moduleContainerTypeSymbol.setInstanceSymbol(instanceSymbol); - - if (!instanceSymbol.type.getAssociatedContainerType()) { - instanceSymbol.type.setAssociatedContainerType(moduleContainerTypeSymbol); - } + if (typeParameters) { + write("<"); + emitCommaList(typeParameters, emitTypeParameter); + write(">"); } - }; - - PullSymbolBinder.prototype.bindImportDeclaration = function (importDeclaration) { - var declFlags = importDeclaration.flags; - var declKind = importDeclaration.kind; - var importDeclAST = this.semanticInfoChain.getASTForDecl(importDeclaration); - - var isExported = false; - var importSymbol = null; - var declName = importDeclaration.name; - var parentHadSymbol = false; - var parent = this.getParent(importDeclaration); - - importSymbol = this.getExistingSymbol(importDeclaration, 164 /* SomeContainer */, parent); - - if (importSymbol) { - parentHadSymbol = true; + } + function emitHeritageClause(typeReferences, isImplementsList) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); } - - if (importSymbol) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(importDeclAST, importDeclaration.getDisplayName(), importSymbol.getDeclarations()[0].ast()); - importSymbol = null; + function emitTypeOfTypeReference(node) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.parent.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.parent.parent.name + }; + } } - - if (!importSymbol) { - importSymbol = new TypeScript.PullTypeAliasSymbol(declName); - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(importSymbol, 164 /* SomeContainer */); + } + function emitClassDeclaration(node) { + function emitParameterProperties(constructorDeclaration) { + if (constructorDeclaration) { + ts.forEach(constructorDeclaration.parameters, function (param) { + if (param.flags & 112 /* AccessibilityModifier */) { + emitPropertyDeclaration(param); + } + }); } } - - importSymbol.addDeclaration(importDeclaration); - importDeclaration.setSymbol(importSymbol); - - this.semanticInfoChain.setSymbolForAST(importDeclAST, importSymbol); - - if (parent && !parentHadSymbol) { - if (declFlags & 1 /* Exported */) { - parent.addEnclosedMemberContainer(importSymbol); - } else { - parent.addEnclosedNonMemberContainer(importSymbol); + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("class "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitHeritageClause([baseTypeNode], false); + } + emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + write(" {"); + writeLine(); + increaseIndent(); + emitParameterProperties(getFirstConstructorWithBody(node)); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitInterfaceDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("interface "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitPropertyDeclaration(node) { + emitJsDocComments(node); + emitClassMemberDeclarationFlags(node); + emitVariableDeclaration(node); + write(";"); + writeLine(); + } + function emitVariableDeclaration(node) { + if (node.kind !== 183 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + writeTextOfNode(currentSourceFile, node.name); + if (node.kind === 124 /* Property */ && ts.hasQuestionToken(node)) { + write("?"); + } + if (node.kind === 124 /* Property */ && node.parent.kind === 136 /* TypeLiteral */) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.flags & 32 /* Private */)) { + writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); + } + } + function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.kind === 183 /* VariableDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + } + else if (node.kind === 124 /* Property */) { + if (node.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + } + function emitTypeOfVariableDeclarationFromTypeLiteral(node) { + if (node.type) { + write(": "); + emitType(node.type); + } + } + function emitVariableStatement(node) { + var hasDeclarationWithEmit = ts.forEach(node.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + if (hasDeclarationWithEmit) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isLet(node)) { + write("let "); + } + else if (ts.isConst(node)) { + write("const "); + } + else { + write("var "); + } + emitCommaList(node.declarations, emitVariableDeclaration); + write(";"); + writeLine(); + } + } + function emitAccessorDeclaration(node) { + var accessors = getAllAccessorDeclarations(node.parent, node); + if (node === accessors.firstAccessor) { + emitJsDocComments(accessors.getAccessor); + emitJsDocComments(accessors.setAccessor); + emitClassMemberDeclarationFlags(node); + writeTextOfNode(currentSourceFile, node.name); + if (!(node.flags & 32 /* Private */)) { + var accessorWithTypeAnnotation = node; + var type = getTypeAnnotationFromAccessor(node); + if (!type) { + var anotherAccessor = node.kind === 127 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + type = getTypeAnnotationFromAccessor(anotherAccessor); + if (type) { + accessorWithTypeAnnotation = anotherAccessor; + } + } + writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); } + write(";"); + writeLine(); } - }; - - PullSymbolBinder.prototype.ensurePriorDeclarationsAreBound = function (container, currentDecl) { - if (!container) { - return; + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 127 /* GetAccessor */ ? accessor.type : accessor.parameters[0].type; + } } - - var parentDecls = container.getDeclarations(); - for (var i = 0; i < parentDecls.length; ++i) { - var parentDecl = parentDecls[i]; - var childDecls = parentDecl.getChildDecls(); - for (var j = 0; j < childDecls.length; ++j) { - var childDecl = childDecls[j]; - if (childDecl === currentDecl) { - return; + function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (accessorWithTypeAnnotation.kind === 128 /* SetAccessor */) { + if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } - - if (childDecl.name === currentDecl.name) { - childDecl.ensureSymbolIsBound(); + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.parameters[0], + typeName: accessorWithTypeAnnotation.name + }; } - } - }; - - PullSymbolBinder.prototype.bindClassDeclarationToPullSymbol = function (classDecl) { - var className = classDecl.name; - var classSymbol = null; - - var constructorSymbol = null; - var constructorTypeSymbol = null; - - var classAST = this.semanticInfoChain.getASTForDecl(classDecl); - - var parent = this.getParent(classDecl); - - this.ensurePriorDeclarationsAreBound(parent, classDecl); - - var parentDecl = classDecl.getParentDecl(); - var isExported = classDecl.flags & 1 /* Exported */; - var isGeneric = false; - - classSymbol = this.getExistingSymbol(classDecl, 58728795 /* SomeType */, parent); - - if (classSymbol && classSymbol.kind === 16 /* Interface */) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(classAST.identifier, classDecl.getDisplayName(), classSymbol.getDeclarations()[0].ast()); - classSymbol = null; - } - - classSymbol = new TypeScript.PullTypeSymbol(className, 8 /* Class */); - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(classSymbol, 8 /* Class */); - } - - classSymbol.addDeclaration(classDecl); - - classDecl.setSymbol(classSymbol); - - this.semanticInfoChain.setSymbolForAST(classAST.identifier, classSymbol); - this.semanticInfoChain.setSymbolForAST(classAST, classSymbol); - - if (parent) { - if (classDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberType(classSymbol); - } else { - parent.addEnclosedNonMemberType(classSymbol); + else { + if (accessorWithTypeAnnotation.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.name, + typeName: undefined + }; } } - - var typeParameterDecls = classDecl.getTypeParameters(); - - for (var i = 0; i < typeParameterDecls.length; i++) { - var typeParameterSymbol = classSymbol.findTypeParameter(typeParameterDecls[i].name); - - if (typeParameterSymbol) { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameterSymbol.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameterSymbol.getName()]); + } + function emitFunctionDeclaration(node) { + if ((node.kind !== 184 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + emitJsDocComments(node); + if (node.kind === 184 /* FunctionDeclaration */) { + emitModuleElementDeclarationFlags(node); } - - typeParameterSymbol = new TypeScript.PullTypeParameterSymbol(typeParameterDecls[i].name); - - classSymbol.addTypeParameter(typeParameterSymbol); - typeParameterSymbol.addDeclaration(typeParameterDecls[i]); - typeParameterDecls[i].setSymbol(typeParameterSymbol); - } - - constructorSymbol = classSymbol.getConstructorMethod(); - constructorTypeSymbol = constructorSymbol ? constructorSymbol.type : null; - - if (!constructorSymbol) { - var siblingValueDecls = null; - if (parentDecl) { - siblingValueDecls = parentDecl.searchChildDecls(className, 68147712 /* SomeValue */); - - if (siblingValueDecls && siblingValueDecls[0] && siblingValueDecls[0].hasSymbol()) { - constructorSymbol = siblingValueDecls[0].getSymbol(); - } + else if (node.kind === 125 /* Method */) { + emitClassMemberDeclarationFlags(node); } - - if (constructorSymbol) { - constructorTypeSymbol = constructorSymbol.type; - } else { - constructorSymbol = new TypeScript.PullSymbol(className, 32768 /* ConstructorMethod */); - constructorTypeSymbol = new TypeScript.PullTypeSymbol("", 33554432 /* ConstructorType */); - constructorSymbol.setIsSynthesized(); - constructorSymbol.type = constructorTypeSymbol; + if (node.kind === 184 /* FunctionDeclaration */) { + write("function "); + writeTextOfNode(currentSourceFile, node.name); } - - classSymbol.setConstructorMethod(constructorSymbol); - classSymbol.setHasDefaultConstructor(); + else if (node.kind === 126 /* Constructor */) { + write("constructor"); + } + else { + writeTextOfNode(currentSourceFile, node.name); + if (ts.hasQuestionToken(node)) { + write("?"); + } + } + emitSignatureDeclaration(node); } - - if (constructorSymbol.getIsSynthesized()) { - constructorSymbol.addDeclaration(classDecl.getValueDecl()); - constructorTypeSymbol.addDeclaration(classDecl); - } else { - classSymbol.setHasDefaultConstructor(false); + } + function emitSignatureDeclarationWithJsDocComments(node) { + emitJsDocComments(node); + emitSignatureDeclaration(node); + } + function emitSignatureDeclaration(node) { + if (node.kind === 130 /* ConstructSignature */ || node.kind === 134 /* ConstructorType */) { + write("new "); } - - constructorTypeSymbol.setAssociatedContainerType(classSymbol); - - var valueDecl = classDecl.getValueDecl(); - - if (valueDecl) { - valueDecl.ensureSymbolIsBound(); + emitTypeParameters(node.typeParameters); + if (node.kind === 131 /* IndexSignature */) { + write("["); } - - this.bindStaticPrototypePropertyOfClass(classAST, classSymbol, constructorTypeSymbol); - }; - - PullSymbolBinder.prototype.bindInterfaceDeclarationToPullSymbol = function (interfaceDecl) { - var interfaceName = interfaceDecl.name; - var interfaceSymbol = null; - - var interfaceAST = this.semanticInfoChain.getASTForDecl(interfaceDecl); - var createdNewSymbol = false; - var parent = this.getParent(interfaceDecl); - - var acceptableSharedKind = 16 /* Interface */; - - interfaceSymbol = this.getExistingSymbol(interfaceDecl, 58728795 /* SomeType */, parent); - - if (interfaceSymbol) { - if (!(interfaceSymbol.kind & acceptableSharedKind)) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(interfaceAST.identifier, interfaceDecl.getDisplayName(), interfaceSymbol.getDeclarations()[0].ast()); - interfaceSymbol = null; - } else if (!this.checkThatExportsMatch(interfaceDecl, interfaceSymbol)) { - interfaceSymbol = null; - } + else { + write("("); } - - if (!interfaceSymbol) { - interfaceSymbol = new TypeScript.PullTypeSymbol(interfaceName, 16 /* Interface */); - createdNewSymbol = true; - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(interfaceSymbol, acceptableSharedKind); - } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitCommaList(node.parameters, emitParameterDeclaration); + if (node.kind === 131 /* IndexSignature */) { + write("]"); } - - interfaceSymbol.addDeclaration(interfaceDecl); - interfaceDecl.setSymbol(interfaceSymbol); - - if (createdNewSymbol) { - if (parent) { - if (interfaceDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberType(interfaceSymbol); - } else { - parent.addEnclosedNonMemberType(interfaceSymbol); - } - } + else { + write(")"); } - - var typeParameters = interfaceDecl.getTypeParameters(); - var typeParameter; - var typeParameterDecls = null; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = interfaceSymbol.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - interfaceSymbol.addTypeParameter(typeParameter); - } else { - typeParameterDecls = typeParameter.getDeclarations(); - - for (var j = 0; j < typeParameterDecls.length; j++) { - var typeParameterDeclParent = typeParameterDecls[j].getParentDecl(); - - if (typeParameterDeclParent && typeParameterDeclParent === interfaceDecl) { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameterDecls[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); - - break; - } - } + var isFunctionTypeOrConstructorType = node.kind === 133 /* FunctionType */ || node.kind === 134 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 136 /* TypeLiteral */) { + if (node.type) { + write(isFunctionTypeOrConstructorType ? " => " : ": "); + emitType(node.type); } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); } - }; - - PullSymbolBinder.prototype.bindObjectTypeDeclarationToPullSymbol = function (objectDecl) { - var objectSymbolAST = this.semanticInfoChain.getASTForDecl(objectDecl); - - var objectSymbol = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - - objectSymbol.addDeclaration(objectDecl); - objectDecl.setSymbol(objectSymbol); - - this.semanticInfoChain.setSymbolForAST(objectSymbolAST, objectSymbol); - - var childDecls = objectDecl.getChildDecls(); - - for (var i = 0; i < childDecls.length; i++) { - this.bindDeclToPullSymbol(childDecls[i]); + else if (node.kind !== 126 /* Constructor */ && !(node.flags & 32 /* Private */)) { + writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } - }; - - PullSymbolBinder.prototype.bindConstructorTypeDeclarationToPullSymbol = function (constructorTypeDeclaration) { - var declKind = constructorTypeDeclaration.kind; - var declFlags = constructorTypeDeclaration.flags; - var constructorTypeAST = this.semanticInfoChain.getASTForDecl(constructorTypeDeclaration); - - var constructorTypeSymbol = new TypeScript.PullTypeSymbol("", 33554432 /* ConstructorType */); - - constructorTypeDeclaration.setSymbol(constructorTypeSymbol); - constructorTypeSymbol.addDeclaration(constructorTypeDeclaration); - this.semanticInfoChain.setSymbolForAST(constructorTypeAST, constructorTypeSymbol); - - var signature = new TypeScript.PullSignatureSymbol(2097152 /* ConstructSignature */); - - var funcDecl = this.semanticInfoChain.getASTForDecl(constructorTypeDeclaration); - if (TypeScript.lastParameterIsRest(funcDecl.parameterList)) { - signature.hasVarArgs = true; + enclosingDeclaration = prevEnclosingDeclaration; + if (!isFunctionTypeOrConstructorType) { + write(";"); + writeLine(); } - - signature.addDeclaration(constructorTypeDeclaration); - constructorTypeDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.parameterList), constructorTypeSymbol, signature); - - var typeParameters = constructorTypeDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = constructorTypeSymbol.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.name]); + function getReturnTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 130 /* ConstructSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 129 /* CallSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 131 /* IndexSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 125 /* Method */: + if (node.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + } + break; + case 184 /* FunctionDeclaration */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + break; + default: + ts.Debug.fail("This is unknown kind for signature: " + node.kind); } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); + return { + diagnosticMessage: diagnosticMessage, + errorNode: node.name || node + }; } - - constructorTypeSymbol.appendConstructSignature(signature); - }; - - PullSymbolBinder.prototype.bindVariableDeclarationToPullSymbol = function (variableDeclaration) { - var declFlags = variableDeclaration.flags; - var declKind = variableDeclaration.kind; - var varDeclAST = this.semanticInfoChain.getASTForDecl(variableDeclaration); - var nameAST = varDeclAST.kind() === 131 /* ClassDeclaration */ ? varDeclAST.identifier : varDeclAST.kind() === 225 /* VariableDeclarator */ ? varDeclAST.propertyName : varDeclAST.kind() === 132 /* EnumDeclaration */ ? varDeclAST.identifier : varDeclAST; - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var variableSymbol = null; - - var declName = variableDeclaration.name; - - var parentHadSymbol = false; - - var parent = this.getParent(variableDeclaration, true); - - var parentDecl = variableDeclaration.getParentDecl(); - - var isImplicit = (declFlags & 118784 /* ImplicitVariable */) !== 0; - var isModuleValue = (declFlags & (32768 /* InitializedModule */)) !== 0; - var isEnumValue = (declFlags & 4096 /* Enum */) !== 0; - var isClassConstructorVariable = (declFlags & 16384 /* ClassConstructorVariable */) !== 0; - variableSymbol = this.getExistingSymbol(variableDeclaration, 68147712 /* SomeValue */, parent); - - if (!variableSymbol && isModuleValue) { - variableSymbol = this.findExistingVariableSymbolForModuleValueDecl(variableDeclaration.getContainerDecl()); + } + function emitParameterDeclaration(node) { + increaseIndent(); + emitJsDocComments(node); + if (node.dotDotDotToken) { + write("..."); } - - if (variableSymbol && !variableSymbol.isType()) { - parentHadSymbol = true; + writeTextOfNode(currentSourceFile, node.name); + if (node.initializer || ts.hasQuestionToken(node)) { + write("?"); } - - var decl; - var decls; - var ast; - var members; - - if (variableSymbol) { - var prevKind = variableSymbol.kind; - var prevIsEnum = variableSymbol.anyDeclHasFlag(4096 /* Enum */); - var prevIsClassConstructorVariable = variableSymbol.anyDeclHasFlag(16384 /* ClassConstructorVariable */); - var prevIsModuleValue = variableSymbol.allDeclsHaveFlag(32768 /* InitializedModule */); - var prevIsImplicit = variableSymbol.anyDeclHasFlag(118784 /* ImplicitVariable */); - var prevIsFunction = TypeScript.ArrayUtilities.any(variableSymbol.getDeclarations(), function (decl) { - return decl.kind === 16384 /* Function */; - }); - var prevIsAmbient = variableSymbol.allDeclsHaveFlag(8 /* Ambient */); - var isAmbientOrPrevIsAmbient = prevIsAmbient || (variableDeclaration.flags & 8 /* Ambient */) !== 0; - var prevDecl = variableSymbol.getDeclarations()[0]; - var prevParentDecl = prevDecl.getParentDecl(); - var bothAreGlobal = parentDecl && (parentDecl.kind === 1 /* Script */) && (prevParentDecl.kind === 1 /* Script */); - var shareParent = bothAreGlobal || prevDecl.getParentDecl() === variableDeclaration.getParentDecl(); - var prevIsParam = shareParent && prevKind === 2048 /* Parameter */ && declKind == 512 /* Variable */; - - var acceptableRedeclaration = prevIsParam || (isImplicit && ((!isEnumValue && !isClassConstructorVariable && prevIsFunction) || ((isModuleValue || isEnumValue) && (prevIsModuleValue || prevIsEnum)) || (isClassConstructorVariable && prevIsModuleValue && isAmbientOrPrevIsAmbient) || (isModuleValue && prevIsClassConstructorVariable))); - - if (acceptableRedeclaration && (prevIsClassConstructorVariable || prevIsFunction) && !isAmbientOrPrevIsAmbient) { - if (prevDecl.fileName() !== variableDeclaration.fileName()) { - this.semanticInfoChain.addDiagnostic(TypeScript.PullHelpers.diagnosticFromDecl(variableDeclaration, TypeScript.DiagnosticCode.Module_0_cannot_merge_with_previous_declaration_of_1_in_a_different_file_2, [declName, declName, prevDecl.fileName()])); - variableSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(declName); - } + decreaseIndent(); + if (node.parent.kind === 133 /* FunctionType */ || node.parent.kind === 134 /* ConstructorType */ || node.parent.parent.kind === 136 /* TypeLiteral */) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.parent.flags & 32 /* Private */)) { + writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); + } + function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 126 /* Constructor */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + break; + case 130 /* ConstructSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 129 /* CallSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 125 /* Method */: + if (node.parent.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 184 /* FunctionDeclaration */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); } - - if (!acceptableRedeclaration || prevIsParam) { - if (!prevIsParam && (isImplicit || prevIsImplicit || TypeScript.hasFlag(prevKind, 1032192 /* SomeFunction */)) || !shareParent) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(nameAST, variableDeclaration.getDisplayName(), variableSymbol.getDeclarations()[0].ast()); - variableSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(declName); - } else { - this.checkThatExportsMatch(variableDeclaration, variableSymbol); - variableSymbol = null; - parentHadSymbol = false; + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + function emitNode(node) { + switch (node.kind) { + case 126 /* Constructor */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + return emitFunctionDeclaration(node); + case 130 /* ConstructSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: + return emitSignatureDeclarationWithJsDocComments(node); + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return emitAccessorDeclaration(node); + case 164 /* VariableStatement */: + return emitVariableStatement(node); + case 124 /* Property */: + return emitPropertyDeclaration(node); + case 186 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 185 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 187 /* TypeAliasDeclaration */: + return emitTypeAliasDeclaration(node); + case 200 /* EnumMember */: + return emitEnumMemberDeclaration(node); + case 188 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 189 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 191 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 192 /* ExportAssignment */: + return emitExportAssignment(node); + case 201 /* SourceFile */: + return emitSourceFile(node); + } + } + var referencePathsOutput = ""; + function writeReferencePath(referencedFile) { + var declFileName = referencedFile.flags & 1024 /* DeclarationFile */ ? referencedFile.filename : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, program, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, false); + referencePathsOutput += "/// " + newLine; + } + if (root) { + if (!compilerOptions.noResolve) { + var addedGlobalFileReference = false; + ts.forEach(root.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(program, root, fileReference); + if (referencedFile && ((referencedFile.flags & 1024 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + writeReferencePath(referencedFile); + if (!isExternalModuleOrDeclarationFile(referencedFile)) { + addedGlobalFileReference = true; + } } - } - - if (variableSymbol && !(variableSymbol.type && variableSymbol.type.isError()) && !this.checkThatExportsMatch(variableDeclaration, variableSymbol, !(isModuleValue && prevIsModuleValue))) { - variableSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(declName); - } + }); } - - if ((declFlags & 118784 /* ImplicitVariable */) === 0) { - if (!variableSymbol) { - variableSymbol = new TypeScript.PullSymbol(declName, declKind); - if (!parent && parentDecl.kind === 1 /* Script */) { - this.semanticInfoChain.cacheGlobalSymbol(variableSymbol, declKind); + emitNode(root); + } + else { + var emittedReferencedFiles = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + if (!compilerOptions.noResolve) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(program, sourceFile, fileReference); + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + writeReferencePath(referencedFile); + emittedReferencedFiles.push(referencedFile); + } + }); } + emitNode(sourceFile); } - - variableSymbol.addDeclaration(variableDeclaration); - variableDeclaration.setSymbol(variableSymbol); - - this.semanticInfoChain.setSymbolForAST(nameAST, variableSymbol); - this.semanticInfoChain.setSymbolForAST(varDeclAST, variableSymbol); - } else if (!parentHadSymbol) { - if (isClassConstructorVariable) { - var classTypeSymbol = variableSymbol; - - if (parent) { - members = parent.getMembers(); - - for (var i = 0; i < members.length; i++) { - if ((members[i].name === declName) && (members[i].kind === 8 /* Class */)) { - classTypeSymbol = members[i]; - break; - } + }); + } + return { + reportedDeclarationError: reportedDeclarationError, + aliasDeclarationEmitInfo: aliasDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencePathsOutput: referencePathsOutput + }; + } + function getDeclarationDiagnostics(program, resolver, targetSourceFile) { + var diagnostics = []; + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, program, ".js"); + emitDeclarations(program, resolver, diagnostics, jsFilePath, targetSourceFile); + return diagnostics; + } + ts.getDeclarationDiagnostics = getDeclarationDiagnostics; + function emitFiles(resolver, targetSourceFile) { + var program = resolver.getProgram(); + var compilerHost = program.getCompilerHost(); + var compilerOptions = program.getCompilerOptions(); + var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var diagnostics = []; + var newLine = program.getCompilerHost().getNewLine(); + function emitJavaScript(jsFilePath, root) { + var writer = createTextWriter(newLine); + var write = writer.write; + var writeTextOfNode = writer.writeTextOfNode; + var writeLine = writer.writeLine; + var increaseIndent = writer.increaseIndent; + var decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var extendsEmitted = false; + var writeEmittedFiles = writeJavaScriptFile; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { + } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { + } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { + } : emitLeadingCommentsOfLocalPosition; + var detachedCommentsInfo; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { + } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { + } : emitPinnedOrTripleSlashCommentsOfNode; + var writeComment = writeCommentRange; + var emit = emitNode; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; + var sourceMapData; + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1; + } + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine == lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; } } - - if (!classTypeSymbol) { - var containerDecl = variableDeclaration.getContainerDecl(); - classTypeSymbol = containerDecl.getSymbol(); - if (!classTypeSymbol) { - classTypeSymbol = this.semanticInfoChain.findTopLevelSymbol(declName, 58728795 /* SomeType */, variableDeclaration); + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; } + prevEncodedEmittedColumn = 1; } - - if (classTypeSymbol && (classTypeSymbol.kind !== 8 /* Class */)) { - classTypeSymbol = null; + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; } - - if (classTypeSymbol && classTypeSymbol.isClass()) { - variableSymbol = classTypeSymbol.getConstructorMethod(); - variableDeclaration.setSymbol(variableSymbol); - - decls = classTypeSymbol.getDeclarations(); - - if (decls.length) { - decl = decls[decls.length - 1]; - ast = this.semanticInfoChain.getASTForDecl(decl); + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); } - } else { - if (!variableSymbol) { - variableSymbol = new TypeScript.PullSymbol(declName, declKind); + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; } - - variableSymbol.addDeclaration(variableDeclaration); - variableDeclaration.setSymbol(variableSymbol); - - variableSymbol.type = this.semanticInfoChain.anyTypeSymbol; - } - } else if (declFlags & 102400 /* SomeInitializedModule */) { - var moduleContainerTypeSymbol = null; - var moduleParent = this.getParent(variableDeclaration); - - if (moduleParent) { - members = moduleParent.getMembers(); - - for (var i = 0; i < members.length; i++) { - if ((members[i].name === declName) && (members[i].isContainer())) { - moduleContainerTypeSymbol = members[i]; - break; - } + else { + inValue = inValue << 1; } - } - - if (!moduleContainerTypeSymbol) { - var containerDecl = variableDeclaration.getContainerDecl(); - moduleContainerTypeSymbol = containerDecl.getSymbol(); - if (!moduleContainerTypeSymbol) { - moduleContainerTypeSymbol = this.semanticInfoChain.findTopLevelSymbol(declName, 164 /* SomeContainer */, variableDeclaration); - - if (!moduleContainerTypeSymbol) { - moduleContainerTypeSymbol = this.semanticInfoChain.findTopLevelSymbol(declName, 64 /* Enum */, variableDeclaration); + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = currentSourceFile.getLineAndCharacterFromPosition(pos); + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + var sourcesDirectoryPath = compilerOptions.sourceRoot ? program.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.filename, compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + sourceMapData.inputSourceFileNames.push(node.filename); + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; } } + recordScopeNameIndex(scopeNameIndex); } - - if (moduleContainerTypeSymbol && (!moduleContainerTypeSymbol.isContainer())) { - moduleContainerTypeSymbol = null; + if (scopeName) { + recordScopeNameStart(scopeName); } - - if (moduleContainerTypeSymbol) { - variableSymbol = moduleContainerTypeSymbol.getInstanceSymbol(); - if (!variableSymbol) { - variableSymbol = new TypeScript.PullSymbol(declName, declKind); - variableSymbol.type = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - } - - if (!variableSymbol.hasDeclaration(variableDeclaration)) { - variableSymbol.addDeclaration(variableDeclaration); + else if (node.kind === 184 /* FunctionDeclaration */ || node.kind === 150 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 189 /* ModuleDeclaration */ || node.kind === 185 /* ClassDeclaration */ || node.kind === 188 /* EnumDeclaration */) { + if (node.name) { + scopeName = node.name.text; } - variableDeclaration.setSymbol(variableSymbol); - } else { - TypeScript.Debug.assert(false, "Attempted to bind invalid implicit variable symbol"); + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); } } - } else { - if (!variableSymbol.hasDeclaration(variableDeclaration)) { - variableSymbol.addDeclaration(variableDeclaration); + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); } - variableDeclaration.setSymbol(variableSymbol); - } - - var containerDecl = variableDeclaration.getContainerDecl(); - if (variableSymbol && variableSymbol.type && containerDecl && !variableSymbol.type.hasDeclaration(containerDecl)) { - variableSymbol.type.addDeclaration(containerDecl); - } - - if (parent && !parentHadSymbol) { - if (declFlags & 1 /* Exported */) { - parent.addMember(variableSymbol); - } else { - parent.addEnclosedNonMember(variableSymbol); + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + writeFile(compilerHost, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + sourceMapDataList.push(sourceMapData); + writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFilename(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + sourceMapDir = ts.getDirectoryPath(getSourceFilePathInNewDir(root, program, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(program.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithMap(node) { + if (node) { + if (node.kind != 201 /* SourceFile */) { + recordEmitNodeStartSpan(node); + emitNode(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNode(node); + } + } + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithMap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; } - }; - - PullSymbolBinder.prototype.bindCatchVariableToPullSymbol = function (variableDeclaration) { - var declFlags = variableDeclaration.flags; - var declKind = variableDeclaration.kind; - var identifier = this.semanticInfoChain.getASTForDecl(variableDeclaration); - - var declName = variableDeclaration.name; - - var variableSymbol = new TypeScript.PullSymbol(declName, declKind); - - variableSymbol.addDeclaration(variableDeclaration); - variableDeclaration.setSymbol(variableSymbol); - - variableSymbol.type = this.semanticInfoChain.anyTypeSymbol; - - this.semanticInfoChain.setSymbolForAST(identifier, variableSymbol); - }; - - PullSymbolBinder.prototype.bindEnumMemberDeclarationToPullSymbol = function (propertyDeclaration) { - var declFlags = propertyDeclaration.flags; - var declKind = propertyDeclaration.kind; - var propDeclAST = this.semanticInfoChain.getASTForDecl(propertyDeclaration); - - var declName = propertyDeclaration.name; - - var parentHadSymbol = false; - - var parent = this.getParent(propertyDeclaration, true); - - var propertySymbol = parent.findMember(declName, false); - - if (propertySymbol) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(propDeclAST.propertyName, propertyDeclaration.getDisplayName(), propertySymbol.getDeclarations()[0].ast()); - } - - if (propertySymbol) { - parentHadSymbol = true; + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + writeFile(compilerHost, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } - - if (!parentHadSymbol) { - propertySymbol = new TypeScript.PullSymbol(declName, declKind); + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; } - - propertySymbol.addDeclaration(propertyDeclaration); - propertyDeclaration.setSymbol(propertySymbol); - - this.semanticInfoChain.setSymbolForAST(propDeclAST.propertyName, propertySymbol); - this.semanticInfoChain.setSymbolForAST(propDeclAST, propertySymbol); - - if (parent && !parentHadSymbol) { - parent.addMember(propertySymbol); + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } } - }; - - PullSymbolBinder.prototype.bindPropertyDeclarationToPullSymbol = function (propertyDeclaration) { - var declFlags = propertyDeclaration.flags; - var declKind = propertyDeclaration.kind; - - var ast = this.semanticInfoChain.getASTForDecl(propertyDeclaration); - var astName = ast.kind() === 136 /* MemberVariableDeclaration */ ? ast.variableDeclarator.propertyName : ast.kind() === 141 /* PropertySignature */ ? ast.propertyName : ast.kind() === 242 /* Parameter */ ? ast.identifier : ast.propertyName; - - var isStatic = false; - var isOptional = false; - - var propertySymbol = null; - - if (TypeScript.hasFlag(declFlags, 16 /* Static */)) { - isStatic = true; + function emitTrailingCommaIfPresent(nodeList, isMultiline) { + if (nodeList.hasTrailingComma) { + write(","); + if (isMultiline) { + writeLine(); + } + } } - - if (TypeScript.hasFlag(declFlags, 128 /* Optional */)) { - isOptional = true; + function emitCommaList(nodes, includeTrailingComma, count) { + if (!(count >= 0)) { + count = nodes.length; + } + if (nodes) { + for (var i = 0; i < count; i++) { + if (i) { + write(", "); + } + emit(nodes[i]); + } + if (includeTrailingComma) { + emitTrailingCommaIfPresent(nodes, false); + } + } } - - var declName = propertyDeclaration.name; - - var parentHadSymbol = false; - - var parent = this.getParent(propertyDeclaration, true); - - if (parent.isClass() && isStatic) { - parent = parent.getConstructorMethod().type; + function emitMultiLineList(nodes, includeTrailingComma) { + if (nodes) { + for (var i = 0; i < nodes.length; i++) { + if (i) { + write(","); + } + writeLine(); + emit(nodes[i]); + } + if (includeTrailingComma) { + emitTrailingCommaIfPresent(nodes, true); + } + } } - - propertySymbol = parent.findMember(declName, false); - - if (propertySymbol) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(astName, propertyDeclaration.getDisplayName(), propertySymbol.getDeclarations()[0].ast()); + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); } - - if (propertySymbol) { - parentHadSymbol = true; + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } } - - var classTypeSymbol; - - if (!parentHadSymbol) { - propertySymbol = new TypeScript.PullSymbol(declName, declKind); + function isBinaryOrOctalIntegerLiteral(text) { + if (text.length <= 0) { + return false; + } + if (text.charCodeAt(1) === 66 /* B */ || text.charCodeAt(1) === 98 /* b */ || text.charCodeAt(1) === 79 /* O */ || text.charCodeAt(1) === 111 /* o */) { + return true; + } + return false; } - - propertySymbol.addDeclaration(propertyDeclaration); - propertyDeclaration.setSymbol(propertySymbol); - - this.semanticInfoChain.setSymbolForAST(astName, propertySymbol); - this.semanticInfoChain.setSymbolForAST(ast, propertySymbol); - - if (isOptional) { - propertySymbol.isOptional = true; + function emitLiteral(node) { + var text = getLiteralText(); + if (compilerOptions.sourceMap && (node.kind === 7 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (compilerOptions.target < 2 /* ES6 */ && node.kind === 6 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { + write(node.text); + } + else { + write(text); + } + function getLiteralText() { + if (compilerOptions.target < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind)) { + return getTemplateLiteralAsStringLiteral(node); + } + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } } - - if (parent && !parentHadSymbol) { - parent.addMember(propertySymbol); + function getTemplateLiteralAsStringLiteral(node) { + return '"' + ts.escapeString(node.text) + '"'; } - }; - - PullSymbolBinder.prototype.bindParameterSymbols = function (functionDeclaration, parameterList, funcType, signatureSymbol) { - var parameters = []; - var params = TypeScript.createIntrinsicsObject(); - var funcDecl = this.semanticInfoChain.getDeclForAST(functionDeclaration); - - if (parameterList) { - for (var i = 0, n = parameterList.length; i < n; i++) { - var argDecl = parameterList.astAt(i); - var id = parameterList.identifierAt(i); - var decl = this.semanticInfoChain.getDeclForAST(argDecl); - var isProperty = TypeScript.hasFlag(decl.flags, 8388608 /* PropertyParameter */); - var parameterSymbol = new TypeScript.PullSymbol(id.valueText(), 2048 /* Parameter */); - - if ((i === (n - 1)) && parameterList.lastParameterIsRest()) { - parameterSymbol.isVarArg = true; - } - - if (params[id.valueText()]) { - this.semanticInfoChain.addDiagnosticFromAST(argDecl, TypeScript.DiagnosticCode.Duplicate_identifier_0, [id.text()]); - } else { - params[id.valueText()] = true; + function emitTemplateExpression(node) { + if (compilerOptions.target >= 2 /* ES6 */) { + ts.forEachChild(node, emit); + return; + } + ts.Debug.assert(node.parent.kind !== 147 /* TaggedTemplateExpression */); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + emitLiteral(node.head); + ts.forEach(node.templateSpans, function (templateSpan) { + var needsParens = templateSpan.expression.kind !== 149 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + write(" + "); + if (needsParens) { + write("("); } - - if (decl) { - var isParameterOptional = false; - - if (isProperty) { - decl.ensureSymbolIsBound(); - var valDecl = decl.getValueDecl(); - - if (valDecl) { - isParameterOptional = TypeScript.hasFlag(valDecl.flags, 128 /* Optional */); - - valDecl.setSymbol(parameterSymbol); - parameterSymbol.addDeclaration(valDecl); - } - } else { - isParameterOptional = TypeScript.hasFlag(decl.flags, 128 /* Optional */); - - parameterSymbol.addDeclaration(decl); - decl.setSymbol(parameterSymbol); - } - - parameterSymbol.isOptional = isParameterOptional; + emit(templateSpan.expression); + if (needsParens) { + write(")"); } - - signatureSymbol.addParameter(parameterSymbol, parameterSymbol.isOptional); - - if (signatureSymbol.isDefinition()) { - funcType.addEnclosedNonMember(parameterSymbol); + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); } + }); + if (emitOuterParens) { + write(")"); + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return parent.expression === template; + case 149 /* ParenthesizedExpression */: + return false; + case 147 /* TaggedTemplateExpression */: + ts.Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6."); + default: + return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; + } + } + function comparePrecedenceToBinaryPlus(expression) { + ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); + switch (expression.kind) { + case 157 /* BinaryExpression */: + switch (expression.operator) { + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + return 1 /* GreaterThan */; + case 32 /* PlusToken */: + return 0 /* EqualTo */; + default: + return -1 /* LessThan */; + } + case 158 /* ConditionalExpression */: + return -1 /* LessThan */; + default: + return 1 /* GreaterThan */; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function emitExpressionForPropertyName(node) { + if (node.kind === 7 /* StringLiteral */) { + emitLiteral(node); + } + else if (node.kind === 121 /* ComputedPropertyName */) { + emit(node.expression); + } + else { + write("\""); + if (node.kind === 6 /* NumericLiteral */) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isNotExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + case 200 /* EnumMember */: + case 125 /* Method */: + case 184 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 150 /* FunctionExpression */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + return parent.name === node; + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + case 192 /* ExportAssignment */: + return false; + case 177 /* LabeledStatement */: + return node.parent.label === node; + case 197 /* CatchClause */: + return node.parent.name === node; } } - }; - - PullSymbolBinder.prototype.bindFunctionDeclarationToPullSymbol = function (functionDeclaration) { - var declKind = functionDeclaration.kind; - var declFlags = functionDeclaration.flags; - var funcDeclAST = this.semanticInfoChain.getASTForDecl(functionDeclaration); - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var funcName = functionDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - - var parent = this.getParent(functionDeclaration, true); - - var parentDecl = functionDeclaration.getParentDecl(); - var parentHadSymbol = false; - - var functionSymbol = null; - var functionTypeSymbol = null; - - functionSymbol = this.getExistingSymbol(functionDeclaration, 68147712 /* SomeValue */, parent); - - if (functionSymbol) { - var acceptableRedeclaration; - - if (functionSymbol.kind === 16384 /* Function */) { - acceptableRedeclaration = isSignature || functionSymbol.allDeclsHaveFlag(2048 /* Signature */); - } else { - var isCurrentDeclAmbient = TypeScript.hasFlag(functionDeclaration.flags, 8 /* Ambient */); - acceptableRedeclaration = TypeScript.ArrayUtilities.all(functionSymbol.getDeclarations(), function (decl) { - var isInitializedModuleOrAmbientDecl = TypeScript.hasFlag(decl.flags, 32768 /* InitializedModule */) && (isCurrentDeclAmbient || TypeScript.hasFlag(decl.flags, 8 /* Ambient */)); - var isSignature = TypeScript.hasFlag(decl.flags, 2048 /* Signature */); - return isInitializedModuleOrAmbientDecl || isSignature; - }); + function emitExpressionIdentifier(node) { + var prefix = resolver.getExpressionNamePrefix(node); + if (prefix) { + write(prefix); + write("."); } - - if (!acceptableRedeclaration) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(funcDeclAST.identifier, functionDeclaration.getDisplayName(), functionSymbol.getDeclarations()[0].ast()); - functionSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(funcName); + writeTextOfNode(currentSourceFile, node); + } + function emitIdentifier(node) { + if (!isNotExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else { + writeTextOfNode(currentSourceFile, node); } } - - if (functionSymbol) { - functionTypeSymbol = functionSymbol.type; - parentHadSymbol = true; + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { + write("_this"); + } + else { + write("this"); + } } - - if (!functionSymbol) { - functionSymbol = new TypeScript.PullSymbol(funcName, 16384 /* Function */); + function emitSuper(node) { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 16 /* SuperInstance */) { + write("_super.prototype"); + } + else if (flags & 32 /* SuperStatic */) { + write("_super"); + } + else { + write("super"); + } } - - if (!functionTypeSymbol) { - functionTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - functionSymbol.type = functionTypeSymbol; - functionTypeSymbol.setFunctionSymbol(functionSymbol); + function emitArrayLiteral(node) { + if (node.flags & 256 /* MultiLine */) { + write("["); + increaseIndent(); + emitMultiLineList(node.elements, true); + decreaseIndent(); + writeLine(); + write("]"); + } + else { + write("["); + emitCommaList(node.elements, true); + write("]"); + } } - - functionDeclaration.setSymbol(functionSymbol); - functionSymbol.addDeclaration(functionDeclaration); - functionTypeSymbol.addDeclaration(functionDeclaration); - - this.semanticInfoChain.setSymbolForAST(funcDeclAST.identifier, functionSymbol); - this.semanticInfoChain.setSymbolForAST(funcDeclAST, functionSymbol); - - if (parent && !parentHadSymbol) { - if (isExported) { - parent.addMember(functionSymbol); - } else { - parent.addEnclosedNonMember(functionSymbol); + function emitObjectLiteral(node) { + if (!node.properties.length) { + write("{}"); + } + else if (node.flags & 256 /* MultiLine */) { + write("{"); + increaseIndent(); + emitMultiLineList(node.properties, compilerOptions.target >= 1 /* ES5 */); + decreaseIndent(); + writeLine(); + write("}"); + } + else { + write("{ "); + emitCommaList(node.properties, compilerOptions.target >= 1 /* ES5 */); + write(" }"); } } - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - signature.addDeclaration(functionDeclaration); - functionDeclaration.setSignatureSymbol(signature); - - if (TypeScript.lastParameterIsRest(funcDeclAST.callSignature.parameterList)) { - signature.hasVarArgs = true; + function emitComputedPropertyName(node) { + write("["); + emit(node.expression); + write("]"); } - - var funcDecl = this.semanticInfoChain.getASTForDecl(functionDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), functionTypeSymbol, signature); - - var typeParameters = functionDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = signature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.name]); + function emitDownlevelMethod(node) { + if (!ts.isObjectLiteralMethod(node)) { + return; } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - functionTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindFunctionExpressionToPullSymbol = function (functionExpressionDeclaration) { - var declKind = functionExpressionDeclaration.kind; - var declFlags = functionExpressionDeclaration.flags; - var ast = this.semanticInfoChain.getASTForDecl(functionExpressionDeclaration); - - var parameters = ast.kind() === 219 /* SimpleArrowFunctionExpression */ ? TypeScript.ASTHelpers.parametersFromIdentifier(ast.identifier) : TypeScript.ASTHelpers.parametersFromParameterList(TypeScript.ASTHelpers.getParameterList(ast)); - var funcExpAST = ast; - - var functionName = declKind === 131072 /* FunctionExpression */ ? functionExpressionDeclaration.getFunctionExpressionName() : functionExpressionDeclaration.name; - var functionSymbol = new TypeScript.PullSymbol(functionName, declKind); - var functionTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - functionTypeSymbol.setFunctionSymbol(functionSymbol); - - functionSymbol.type = functionTypeSymbol; - - functionExpressionDeclaration.setSymbol(functionSymbol); - functionSymbol.addDeclaration(functionExpressionDeclaration); - functionTypeSymbol.addDeclaration(functionExpressionDeclaration); - - var name = funcExpAST.kind() === 222 /* FunctionExpression */ ? funcExpAST.identifier : funcExpAST.kind() === 241 /* FunctionPropertyAssignment */ ? funcExpAST.propertyName : null; - if (name) { - this.semanticInfoChain.setSymbolForAST(name, functionSymbol); + emitLeadingComments(node); + emit(node.name); + write(": "); + write("function "); + emitSignatureAndBody(node); + emitTrailingComments(node); } - - this.semanticInfoChain.setSymbolForAST(funcExpAST, functionSymbol); - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, true); - - if (parameters.lastParameterIsRest()) { - signature.hasVarArgs = true; + function emitMethod(node) { + if (!ts.isObjectLiteralMethod(node)) { + return; + } + emitLeadingComments(node); + emit(node.name); + emitSignatureAndBody(node); + emitTrailingComments(node); + } + function emitPropertyAssignment(node) { + emitLeadingComments(node); + emit(node.name); + write(": "); + emit(node.initializer); + emitTrailingComments(node); + } + function emitDownlevelShorthandPropertyAssignment(node) { + emitLeadingComments(node); + emit(node.name); + write(": "); + emitExpressionIdentifier(node.name); + emitTrailingComments(node); + } + function emitShorthandPropertyAssignment(node) { + var prefix = resolver.getExpressionNamePrefix(node.name); + if (prefix) { + emitDownlevelShorthandPropertyAssignment(node); + } + else { + emitLeadingComments(node); + emit(node.name); + emitTrailingComments(node); + } + } + function tryEmitConstantValue(node) { + var constantValue = resolver.getConstantValue(node); + if (constantValue !== undefined) { + var propertyName = node.kind === 143 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(constantValue.toString() + " /* " + propertyName + " */"); + return true; + } + return false; } - - var typeParameters = functionExpressionDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = signature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); + emit(node.expression); + write("."); + emit(node.name); } - - signature.addDeclaration(functionExpressionDeclaration); - functionExpressionDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcExpAST, parameters, functionTypeSymbol, signature); - - functionTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindFunctionTypeDeclarationToPullSymbol = function (functionTypeDeclaration) { - var declKind = functionTypeDeclaration.kind; - var declFlags = functionTypeDeclaration.flags; - var funcTypeAST = this.semanticInfoChain.getASTForDecl(functionTypeDeclaration); - - var functionTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - - functionTypeDeclaration.setSymbol(functionTypeSymbol); - functionTypeSymbol.addDeclaration(functionTypeDeclaration); - this.semanticInfoChain.setSymbolForAST(funcTypeAST, functionTypeSymbol); - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - if (TypeScript.lastParameterIsRest(funcTypeAST.parameterList)) { - signature.hasVarArgs = true; + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); } - - var typeParameters = functionTypeDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = signature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.name]); + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - signature.addDeclaration(functionTypeDeclaration); - functionTypeDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcTypeAST, TypeScript.ASTHelpers.parametersFromParameterList(funcTypeAST.parameterList), functionTypeSymbol, signature); - - functionTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindMethodDeclarationToPullSymbol = function (methodDeclaration) { - var declKind = methodDeclaration.kind; - var declFlags = methodDeclaration.flags; - var methodAST = this.semanticInfoChain.getASTForDecl(methodDeclaration); - - var isPrivate = (declFlags & 2 /* Private */) !== 0; - var isStatic = (declFlags & 16 /* Static */) !== 0; - var isOptional = (declFlags & 128 /* Optional */) !== 0; - - var methodName = methodDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - - var parent = this.getParent(methodDeclaration, true); - var parentHadSymbol = false; - - var methodSymbol = null; - var methodTypeSymbol = null; - - if (parent.isClass() && isStatic) { - parent = parent.getConstructorMethod().type; + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function emitCallExpression(node) { + var superCall = false; + if (node.expression.kind === 89 /* SuperKeyword */) { + write("_super"); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 143 /* PropertyAccessExpression */ && node.expression.expression.kind === 89 /* SuperKeyword */; + } + if (superCall) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments, false); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments, false); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments, false); + write(")"); + } + } + function emitTaggedTemplateExpression(node) { + ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); + emit(node.tag); + write(" "); + emit(node.template); + } + function emitParenExpression(node) { + if (node.expression.kind === 148 /* TypeAssertionExpression */) { + var operand = node.expression.expression; + while (operand.kind == 148 /* TypeAssertionExpression */) { + operand = operand.expression; + } + if (operand.kind !== 155 /* PrefixUnaryExpression */ && operand.kind !== 154 /* VoidExpression */ && operand.kind !== 153 /* TypeOfExpression */ && operand.kind !== 152 /* DeleteExpression */ && operand.kind !== 156 /* PostfixUnaryExpression */ && operand.kind !== 146 /* NewExpression */ && !(operand.kind === 145 /* CallExpression */ && node.parent.kind === 146 /* NewExpression */) && !(operand.kind === 150 /* FunctionExpression */ && node.parent.kind === 145 /* CallExpression */)) { + emit(operand); + return; + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(72 /* DeleteKeyword */)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(97 /* VoidKeyword */)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(95 /* TypeOfKeyword */)); + write(" "); + emit(node.expression); + } + function emitPrefixUnaryExpression(node) { + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 155 /* PrefixUnaryExpression */) { + var operand = node.operand; + if (node.operator === 32 /* PlusToken */ && (operand.operator === 32 /* PlusToken */ || operand.operator === 37 /* PlusPlusToken */)) { + write(" "); + } + else if (node.operator === 33 /* MinusToken */ && (operand.operator === 33 /* MinusToken */ || operand.operator === 38 /* MinusMinusToken */)) { + write(" "); + } + } + emit(node.operand); + } + function emitPostfixUnaryExpression(node) { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + function emitBinaryExpression(node) { + emit(node.left); + if (node.operator !== 22 /* CommaToken */) + write(" "); + write(ts.tokenToString(node.operator)); + write(" "); + emit(node.right); + } + function emitConditionalExpression(node) { + emit(node.condition); + write(" ? "); + emit(node.whenTrue); + write(" : "); + emit(node.whenFalse); + } + function emitBlock(node) { + emitToken(13 /* OpenBraceToken */, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 190 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 189 /* ModuleDeclaration */); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 163 /* Block */) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + var isArrowExpression = node.expression.kind === 151 /* ArrowFunction */; + emitLeadingComments(node); + if (isArrowExpression) + write("("); + emit(node.expression); + if (isArrowExpression) + write(")"); + write(";"); + emitTrailingComments(node); + } + function emitIfStatement(node) { + emitLeadingComments(node); + var endPos = emitToken(82 /* IfKeyword */, node.pos); + write(" "); + endPos = emitToken(15 /* OpenParenToken */, endPos); + emit(node.expression); + emitToken(16 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(74 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 167 /* IfStatement */) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + emitTrailingComments(node); + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 163 /* Block */) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForStatement(node) { + var endPos = emitToken(80 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(15 /* OpenParenToken */, endPos); + if (node.declarations) { + if (node.declarations[0] && ts.isLet(node.declarations[0])) { + emitToken(102 /* LetKeyword */, endPos); + } + else if (node.declarations[0] && ts.isConst(node.declarations[0])) { + emitToken(68 /* ConstKeyword */, endPos); + } + else { + emitToken(96 /* VarKeyword */, endPos); + } + write(" "); + emitCommaList(node.declarations, false); + } + if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.iterator); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInStatement(node) { + var endPos = emitToken(80 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(15 /* OpenParenToken */, endPos); + if (node.declarations) { + if (node.declarations.length >= 1) { + var decl = node.declarations[0]; + if (ts.isLet(decl)) { + emitToken(102 /* LetKeyword */, endPos); + } + else { + emitToken(96 /* VarKeyword */, endPos); + } + write(" "); + emit(decl); + } + } + else { + emit(node.variable); + } + write(" in "); + emit(node.expression); + emitToken(16 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 173 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitLeadingComments(node); + emitToken(88 /* ReturnKeyword */, node.pos); + emitOptional(" ", node.expression); + write(";"); + emitTrailingComments(node); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(90 /* SwitchKeyword */, node.pos); + write(" "); + emitToken(15 /* OpenParenToken */, endPos); + emit(node.expression); + endPos = emitToken(16 /* CloseParenToken */, node.expression.end); + write(" "); + emitToken(13 /* OpenBraceToken */, endPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.clauses.end); + } + function isOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 194 /* CaseClause */) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(66 /* CatchKeyword */, node.pos); + write(" "); + emitToken(15 /* OpenParenToken */, endPos); + emit(node.name); + emitToken(16 /* CloseParenToken */, node.name.end); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(70 /* DebuggerKeyword */, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 189 /* ModuleDeclaration */); + return node; } - - methodSymbol = parent.findMember(methodName, false); - - if (methodSymbol && (methodSymbol.kind !== 65536 /* Method */ || (!isSignature && !methodSymbol.allDeclsHaveFlag(2048 /* Signature */)))) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(methodAST, methodDeclaration.getDisplayName(), methodSymbol.getDeclarations()[0].ast()); - methodSymbol = null; + function emitModuleMemberName(node) { + emitStart(node.name); + if (node.flags & 1 /* Export */) { + var container = getContainingModule(node); + write(container ? resolver.getLocalNameOfContainer(container) : "exports"); + write("."); + } + emitNode(node.name); + emitEnd(node.name); + } + function emitVariableDeclaration(node) { + emitLeadingComments(node); + emitModuleMemberName(node); + emitOptional(" = ", node.initializer); + emitTrailingComments(node); + } + function emitVariableStatement(node) { + emitLeadingComments(node); + if (!(node.flags & 1 /* Export */)) { + if (ts.isLet(node)) { + write("let "); + } + else if (ts.isConst(node)) { + write("const "); + } + else { + write("var "); + } + } + emitCommaList(node.declarations, false); + write(";"); + emitTrailingComments(node); + } + function emitParameter(node) { + emitLeadingComments(node); + emit(node.name); + emitTrailingComments(node); + } + function emitDefaultValueAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.initializer) { + writeLine(); + emitStart(param); + write("if ("); + emitNode(param.name); + write(" === void 0)"); + emitEnd(param); + write(" { "); + emitStart(param); + emitNode(param.name); + write(" = "); + emitNode(param.initializer); + emitEnd(param); + write("; }"); + } + }); } - - if (methodSymbol) { - methodTypeSymbol = methodSymbol.type; - parentHadSymbol = true; + function emitRestParameter(node) { + if (ts.hasRestParameters(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNode(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var _i = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write("_i < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write("_i++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNode(restParam.name); + write("[_i - " + restIndex + "] = arguments[_i];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + emitLeadingComments(node); + write(node.kind === 127 /* GetAccessor */ ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + emitTrailingComments(node); + } + function emitFunctionDeclaration(node) { + if (!node.body) { + return emitPinnedOrTripleSlashComments(node); + } + if (node.kind !== 125 /* Method */) { + emitLeadingComments(node); + } + write("function "); + if (node.kind === 184 /* FunctionDeclaration */ || (node.kind === 150 /* FunctionExpression */ && node.name)) { + emit(node.name); + } + emitSignatureAndBody(node); + if (node.kind !== 125 /* Method */) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + emitCommaList(node.parameters, false, node.parameters.length - (ts.hasRestParameters(node) ? 1 : 0)); + } + write(")"); + decreaseIndent(); + } + function emitSignatureAndBody(node) { + emitSignatureParameters(node); + write(" {"); + scopeEmitStart(node); + increaseIndent(); + emitDetachedComments(node.body.kind === 163 /* Block */ ? node.body.statements : node.body); + var startIndex = 0; + if (node.body.kind === 163 /* Block */) { + startIndex = emitDirectivePrologues(node.body.statements, true); + } + var outPos = writer.getTextPos(); + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + if (node.body.kind !== 163 /* Block */ && outPos === writer.getTextPos()) { + decreaseIndent(); + write(" "); + emitStart(node.body); + write("return "); + emitNode(node.body); + emitEnd(node.body); + write("; "); + emitStart(node.body); + write("}"); + emitEnd(node.body); + } + else { + if (node.body.kind === 163 /* Block */) { + emitLinesStartingAt(node.body.statements, startIndex); + } + else { + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body); + write(";"); + emitTrailingComments(node.body); + } + writeLine(); + if (node.body.kind === 163 /* Block */) { + emitLeadingCommentsOfPosition(node.body.statements.end); + decreaseIndent(); + emitToken(14 /* CloseBraceToken */, node.body.statements.end); + } + else { + decreaseIndent(); + emitStart(node.body); + write("}"); + emitEnd(node.body); + } + } + scopeEmitEnd(); + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 166 /* ExpressionStatement */) { + var expr = statement.expression; + if (expr && expr.kind === 145 /* CallExpression */) { + var func = expr.expression; + if (func && func.kind === 89 /* SuperKeyword */) { + return statement; + } + } + } + } } - - if (!methodSymbol) { - methodSymbol = new TypeScript.PullSymbol(methodName, 65536 /* Method */); + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112 /* AccessibilityModifier */) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNode(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); } - - if (!methodTypeSymbol) { - methodTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - methodSymbol.type = methodTypeSymbol; - methodTypeSymbol.setFunctionSymbol(methodSymbol); + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 7 /* StringLiteral */ || memberName.kind === 6 /* NumericLiteral */) { + write("["); + emitNode(memberName); + write("]"); + } + else if (memberName.kind === 121 /* ComputedPropertyName */) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNode(memberName); + } + } + function emitMemberAssignments(node, staticFlag) { + ts.forEach(node.members, function (member) { + if (member.kind === 124 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + if (staticFlag) { + emitNode(node.name); + } + else { + write("this"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emit(member.initializer); + write(";"); + emitEnd(member); + emitTrailingComments(member); + } + }); } - - methodDeclaration.setSymbol(methodSymbol); - methodSymbol.addDeclaration(methodDeclaration); - methodTypeSymbol.addDeclaration(methodDeclaration); - - var nameAST = methodAST.kind() === 135 /* MemberFunctionDeclaration */ ? methodAST.propertyName : methodAST.propertyName; - - TypeScript.Debug.assert(nameAST); - - this.semanticInfoChain.setSymbolForAST(nameAST, methodSymbol); - this.semanticInfoChain.setSymbolForAST(methodAST, methodSymbol); - - if (isOptional) { - methodSymbol.isOptional = true; + function emitMemberFunctions(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 125 /* Method */) { + if (!member.body) { + return emitPinnedOrTripleSlashComments(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128 /* Static */)) { + write(".prototype"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitStart(member); + emitFunctionDeclaration(member); + emitEnd(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) { + var accessors = getAllAccessorDeclarations(node, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128 /* Static */)) { + write(".prototype"); + } + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); } - - if (!parentHadSymbol) { - parent.addMember(methodSymbol); + function emitClassDeclaration(node) { + emitLeadingComments(node); + write("var "); + emit(node.name); + write(" = (function ("); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emit(node.name); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructorOfClass(); + emitMemberFunctions(node); + emitMemberAssignments(node, 128 /* Static */); + writeLine(); + function emitClassReturnStatement() { + write("return "); + emitNode(node.name); + } + emitToken(14 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + write(";"); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.typeName); + } + write(");"); + emitEnd(node); + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + emitTrailingComments(node); + function emitConstructorOfClass() { + ts.forEach(node.members, function (member) { + if (member.kind === 126 /* Constructor */ && !member.body) { + emitPinnedOrTripleSlashComments(member); + } + }); + var ctor = getFirstConstructorWithBody(node); + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + write("function "); + emit(node.name); + emitSignatureParameters(ctor); + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeNode) { + var superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("_super.apply(this, arguments);"); + emitEnd(baseTypeNode); + } + } + emitMemberAssignments(node, 0); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) + statements = statements.slice(1); + emitLines(statements); + } + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(14 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } } - - var sigKind = 1048576 /* CallSignature */; - - var signature = new TypeScript.PullSignatureSymbol(sigKind, !isSignature); - - var parameterList = TypeScript.ASTHelpers.getParameterList(methodAST); - if (TypeScript.lastParameterIsRest(parameterList)) { - signature.hasVarArgs = true; + function emitInterfaceDeclaration(node) { + emitPinnedOrTripleSlashComments(node); } - - var typeParameters = methodDeclaration.getTypeParameters(); - var typeParameter; - var typeParameterName; - var typeParameterAST; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameterName = typeParameters[i].name; - typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameters[i]); - - typeParameter = signature.findTypeParameter(typeParameterName); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameterName); - signature.addTypeParameter(typeParameter); - } else { - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); + function emitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + if (isConstEnum && !compilerOptions.preserveConstEnums) { + return; + } + emitLeadingComments(node); + if (!(node.flags & 1 /* Export */)) { + emitStart(node); + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitEnumMemberDeclarations(isConstEnum); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + 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); + }); } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); } - - signature.addDeclaration(methodDeclaration); - methodDeclaration.setSignatureSymbol(signature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(methodDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(TypeScript.ASTHelpers.getParameterList(funcDecl)), methodTypeSymbol, signature); - - var signatureIndex = this.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList(signature, methodTypeSymbol.getOwnCallSignatures()); - methodTypeSymbol.insertCallSignatureAtIndex(signature, signatureIndex); - }; - - PullSymbolBinder.prototype.bindStaticPrototypePropertyOfClass = function (classAST, classTypeSymbol, constructorTypeSymbol) { - var prototypeStr = "prototype"; - - var prototypeSymbol = constructorTypeSymbol.findMember(prototypeStr, false); - if (prototypeSymbol && !prototypeSymbol.getIsSynthesized()) { - this.semanticInfoChain.addDiagnostic(TypeScript.PullHelpers.diagnosticFromDecl(prototypeSymbol.getDeclarations()[0], TypeScript.DiagnosticCode.Duplicate_identifier_0, [prototypeSymbol.getDisplayName()])); + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 189 /* ModuleDeclaration */) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function emitModuleDeclaration(node) { + var shouldEmit = ts.getModuleInstanceState(node) === 1 /* Instantiated */ || (ts.getModuleInstanceState(node) === 2 /* ConstEnumOnly */ && compilerOptions.preserveConstEnums); + if (!shouldEmit) { + return emitPinnedOrTripleSlashComments(node); + } + emitLeadingComments(node); + emitStart(node); + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 190 /* ModuleBlock */) { + emit(node.body); + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(14 /* CloseBraceToken */, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if (node.flags & 1 /* Export */) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + emitTrailingComments(node); + } + function emitImportDeclaration(node) { + var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); + if (!emitImportDeclaration) { + emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); + } + if (emitImportDeclaration) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 201 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.flags & 1 /* Export */) { + writeLine(); + emitLeadingComments(node); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + else { + writeLine(); + emitLeadingComments(node); + emitStart(node); + if (!(node.flags & 1 /* Export */)) + write("var "); + emitModuleMemberName(node); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emit(node.moduleReference); + } + else { + var literal = ts.getExternalModuleImportDeclarationExpression(node); + write("require("); + emitStart(literal); + emitLiteral(literal); + emitEnd(literal); + emitToken(16 /* CloseParenToken */, literal.end); + } + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + } + function getExternalImportDeclarations(node) { + var result = []; + ts.forEach(node.statements, function (statement) { + if (ts.isExternalModuleImportDeclaration(statement) && resolver.isReferencedImportDeclaration(statement)) { + result.push(statement); + } + }); + return result; } - - if (!prototypeSymbol || !prototypeSymbol.getIsSynthesized()) { - var prototypeDecl = new TypeScript.PullSynthesizedDecl(prototypeStr, prototypeStr, 4096 /* Property */, 4 /* Public */ | 16 /* Static */, constructorTypeSymbol.getDeclarations()[0], this.semanticInfoChain); - - prototypeSymbol = new TypeScript.PullSymbol(prototypeStr, 4096 /* Property */); - prototypeSymbol.setIsSynthesized(); - prototypeSymbol.addDeclaration(prototypeDecl); - prototypeSymbol.type = classTypeSymbol; - constructorTypeSymbol.addMember(prototypeSymbol); - - if (prototypeSymbol.type && prototypeSymbol.type.isGeneric()) { - var resolver = this.semanticInfoChain.getResolver(); - prototypeSymbol.type = resolver.instantiateTypeToAny(prototypeSymbol.type, new TypeScript.PullTypeResolutionContext(resolver)); + function getFirstExportAssignment(sourceFile) { + return ts.forEach(sourceFile.statements, function (node) { + if (node.kind === 192 /* ExportAssignment */) { + return node; + } + }); + } + function emitAMDModule(node, startIndex) { + var imports = getExternalImportDeclarations(node); + writeLine(); + write("define("); + if (node.amdModuleName) { + write("\"" + node.amdModuleName + "\", "); + } + write("[\"require\", \"exports\""); + ts.forEach(imports, function (imp) { + write(", "); + emitLiteral(ts.getExternalModuleImportDeclarationExpression(imp)); + }); + ts.forEach(node.amdDependencies, function (amdDependency) { + var text = "\"" + amdDependency + "\""; + write(", "); + write(text); + }); + write("], function (require, exports"); + ts.forEach(imports, function (imp) { + write(", "); + emit(imp.name); + }); + write(") {"); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignement = getFirstExportAssignment(node); + emitStart(exportAssignement); + write("return "); + emitStart(exportAssignement.exportName); + write(exportName); + emitEnd(exportAssignement.exportName); + write(";"); + emitEnd(exportAssignement); + } + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node, startIndex) { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignement = getFirstExportAssignment(node); + emitStart(exportAssignement); + write("module.exports = "); + emitStart(exportAssignement.exportName); + write(exportName); + emitEnd(exportAssignement.exportName); + write(";"); + emitEnd(exportAssignement); + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + return i; + } + } + return statements.length; + } + function emitSourceFile(node) { + currentSourceFile = node; + writeLine(); + emitDetachedComments(node); + var startIndex = emitDirectivePrologues(node.statements, false); + if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */) { + writeLine(); + write("var __extends = this.__extends || function (d, b) {"); + increaseIndent(); + writeLine(); + write("for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];"); + writeLine(); + write("function __() { this.constructor = d; }"); + writeLine(); + write("__.prototype = b.prototype;"); + writeLine(); + write("d.prototype = new __();"); + decreaseIndent(); + writeLine(); + write("};"); + extendsEmitted = true; + } + if (ts.isExternalModule(node)) { + if (compilerOptions.module === 2 /* AMD */) { + emitAMDModule(node, startIndex); + } + else { + emitCommonJSModule(node, startIndex); + } + } + else { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNode(node) { + if (!node) { + return; + } + if (node.flags & 2 /* Ambient */) { + return emitPinnedOrTripleSlashComments(node); + } + switch (node.kind) { + case 63 /* Identifier */: + return emitIdentifier(node); + case 123 /* Parameter */: + return emitParameter(node); + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return emitAccessor(node); + case 91 /* ThisKeyword */: + return emitThis(node); + case 89 /* SuperKeyword */: + return emitSuper(node); + case 87 /* NullKeyword */: + return write("null"); + case 93 /* TrueKeyword */: + return write("true"); + case 78 /* FalseKeyword */: + return write("false"); + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 8 /* RegularExpressionLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 11 /* TemplateMiddle */: + case 12 /* TemplateTail */: + return emitLiteral(node); + case 159 /* TemplateExpression */: + return emitTemplateExpression(node); + case 162 /* TemplateSpan */: + return emitTemplateSpan(node); + case 120 /* QualifiedName */: + return emitQualifiedName(node); + case 141 /* ArrayLiteralExpression */: + return emitArrayLiteral(node); + case 142 /* ObjectLiteralExpression */: + return emitObjectLiteral(node); + case 198 /* PropertyAssignment */: + return emitPropertyAssignment(node); + case 121 /* ComputedPropertyName */: + return emitComputedPropertyName(node); + case 143 /* PropertyAccessExpression */: + return emitPropertyAccess(node); + case 144 /* ElementAccessExpression */: + return emitIndexedAccess(node); + case 145 /* CallExpression */: + return emitCallExpression(node); + case 146 /* NewExpression */: + return emitNewExpression(node); + case 147 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 148 /* TypeAssertionExpression */: + return emit(node.expression); + case 149 /* ParenthesizedExpression */: + return emitParenExpression(node); + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return emitFunctionDeclaration(node); + case 152 /* DeleteExpression */: + return emitDeleteExpression(node); + case 153 /* TypeOfExpression */: + return emitTypeOfExpression(node); + case 154 /* VoidExpression */: + return emitVoidExpression(node); + case 155 /* PrefixUnaryExpression */: + return emitPrefixUnaryExpression(node); + case 156 /* PostfixUnaryExpression */: + return emitPostfixUnaryExpression(node); + case 157 /* BinaryExpression */: + return emitBinaryExpression(node); + case 158 /* ConditionalExpression */: + return emitConditionalExpression(node); + case 161 /* OmittedExpression */: + return; + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return emitBlock(node); + case 164 /* VariableStatement */: + return emitVariableStatement(node); + case 165 /* EmptyStatement */: + return write(";"); + case 166 /* ExpressionStatement */: + return emitExpressionStatement(node); + case 167 /* IfStatement */: + return emitIfStatement(node); + case 168 /* DoStatement */: + return emitDoStatement(node); + case 169 /* WhileStatement */: + return emitWhileStatement(node); + case 170 /* ForStatement */: + return emitForStatement(node); + case 171 /* ForInStatement */: + return emitForInStatement(node); + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + return emitBreakOrContinueStatement(node); + case 174 /* ReturnStatement */: + return emitReturnStatement(node); + case 175 /* WithStatement */: + return emitWithStatement(node); + case 176 /* SwitchStatement */: + return emitSwitchStatement(node); + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + return emitCaseOrDefaultClause(node); + case 177 /* LabeledStatement */: + return emitLabelledStatement(node); + case 178 /* ThrowStatement */: + return emitThrowStatement(node); + case 179 /* TryStatement */: + return emitTryStatement(node); + case 197 /* CatchClause */: + return emitCatchClause(node); + case 182 /* DebuggerStatement */: + return emitDebuggerStatement(node); + case 183 /* VariableDeclaration */: + return emitVariableDeclaration(node); + case 185 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 186 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 188 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 189 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 191 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 201 /* SourceFile */: + return emitSourceFile(node); + } + if (compilerOptions.target < 2 /* ES6 */) { + switch (node.kind) { + case 199 /* ShorthandPropertyAssignment */: + return emitDownlevelShorthandPropertyAssignment(node); + case 125 /* Method */: + return emitDownlevelMethod(node); + } + } + else { + ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Invalid ScriptTarget. We should emit as ES6 or above"); + switch (node.kind) { + case 199 /* ShorthandPropertyAssignment */: + return emitShorthandPropertyAssignment(node); + case 125 /* Method */: + return emitMethod(node); + } + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function getLeadingCommentsToEmit(node) { + if (node.parent.kind === 201 /* SourceFile */ || node.pos !== node.parent.pos) { + var leadingComments; + if (hasDetachedComments(node.pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; + } + } + function emitLeadingDeclarationComments(node) { + var leadingComments = getLeadingCommentsToEmit(node); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingDeclarationComments(node) { + if (node.parent.kind === 201 /* SourceFile */ || node.end !== node.parent.end) { + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + } + function emitLeadingCommentsOfLocalPosition(pos) { + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedCommentsAtPosition(node) { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var astLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (astLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } } - prototypeSymbol.setResolved(); } - }; - - PullSymbolBinder.prototype.bindConstructorDeclarationToPullSymbol = function (constructorDeclaration) { - var declKind = constructorDeclaration.kind; - var declFlags = constructorDeclaration.flags; - var constructorAST = this.semanticInfoChain.getASTForDecl(constructorDeclaration); - - var constructorName = constructorDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - - var parent = this.getParent(constructorDeclaration, true); - - var parentHadSymbol = false; - - var constructorSymbol = parent.getConstructorMethod(); - var constructorTypeSymbol = null; - - if (constructorSymbol && (constructorSymbol.kind !== 32768 /* ConstructorMethod */ || (!isSignature && constructorSymbol.type && constructorSymbol.type.hasOwnConstructSignatures()))) { - var hasDefinitionSignature = false; - var constructorSigs = constructorSymbol.type.getOwnDeclaredConstructSignatures(); - - for (var i = 0; i < constructorSigs.length; i++) { - if (!constructorSigs[i].anyDeclHasFlag(2048 /* Signature */)) { - hasDefinitionSignature = true; - break; + function emitPinnedOrTripleSlashCommentsOfNode(node) { + var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); + function isPinnedOrTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */ && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + return true; } } - - if (hasDefinitionSignature) { - this.semanticInfoChain.addDiagnosticFromAST(constructorAST, TypeScript.DiagnosticCode.Multiple_constructor_implementations_are_not_allowed); - - constructorSymbol = null; - } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, pinnedComments); + emitComments(currentSourceFile, writer, pinnedComments, true, newLine, writeComment); } - - if (constructorSymbol) { - constructorTypeSymbol = constructorSymbol.type; - } else { - constructorSymbol = new TypeScript.PullSymbol(constructorName, 32768 /* ConstructorMethod */); - constructorTypeSymbol = new TypeScript.PullTypeSymbol("", 33554432 /* ConstructorType */); + if (compilerOptions.sourceMap) { + initializeEmitterWithSourceMaps(); } - - parent.setConstructorMethod(constructorSymbol); - constructorSymbol.type = constructorTypeSymbol; - - constructorDeclaration.setSymbol(constructorSymbol); - constructorSymbol.addDeclaration(constructorDeclaration); - constructorTypeSymbol.addDeclaration(constructorDeclaration); - constructorSymbol.setIsSynthesized(false); - this.semanticInfoChain.setSymbolForAST(constructorAST, constructorSymbol); - - var constructSignature = new TypeScript.PullSignatureSymbol(2097152 /* ConstructSignature */, !isSignature); - constructSignature.returnType = parent; - constructSignature.addTypeParametersFromReturnType(); - - constructSignature.addDeclaration(constructorDeclaration); - constructorDeclaration.setSignatureSymbol(constructSignature); - - this.bindParameterSymbols(constructorAST, TypeScript.ASTHelpers.parametersFromParameterList(constructorAST.callSignature.parameterList), constructorTypeSymbol, constructSignature); - - if (TypeScript.lastParameterIsRest(constructorAST.callSignature.parameterList)) { - constructSignature.hasVarArgs = true; + if (root) { + emit(root); } - - constructorTypeSymbol.appendConstructSignature(constructSignature); - }; - - PullSymbolBinder.prototype.bindConstructSignatureDeclarationToPullSymbol = function (constructSignatureDeclaration) { - var parent = this.getParent(constructSignatureDeclaration, true); - var constructorAST = this.semanticInfoChain.getASTForDecl(constructSignatureDeclaration); - - var constructSignature = new TypeScript.PullSignatureSymbol(2097152 /* ConstructSignature */); - - if (TypeScript.lastParameterIsRest(constructorAST.callSignature.parameterList)) { - constructSignature.hasVarArgs = true; + else { + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emit(sourceFile); + } + }); } - - var typeParameters = constructSignatureDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = constructSignature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - constructSignature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + } + function writeDeclarationFile(jsFilePath, sourceFile) { + var emitDeclarationResult = emitDeclarations(program, resolver, diagnostics, jsFilePath, sourceFile); + if (!emitDeclarationResult.reportedDeclarationError) { + var declarationOutput = emitDeclarationResult.referencePathsOutput; + var appliedSyncOutputPos = 0; + ts.forEach(emitDeclarationResult.aliasDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.asynchronousOutput) { + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += aliasEmitInfo.asynchronousOutput; + appliedSyncOutputPos = aliasEmitInfo.outputPos; + } + }); + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos); + writeFile(compilerHost, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); + } + } + var hasSemanticErrors = false; + var isEmitBlocked = false; + if (targetSourceFile === undefined) { + hasSemanticErrors = resolver.hasSemanticErrors(); + isEmitBlocked = resolver.isEmitBlocked(); + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, program, ".js"); + emitFile(jsFilePath, sourceFile); } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); + }); + if (compilerOptions.out) { + emitFile(compilerOptions.out); } - - constructSignature.addDeclaration(constructSignatureDeclaration); - constructSignatureDeclaration.setSignatureSymbol(constructSignature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(constructSignatureDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(TypeScript.ASTHelpers.getParameterList(funcDecl)), null, constructSignature); - - this.semanticInfoChain.setSymbolForAST(this.semanticInfoChain.getASTForDecl(constructSignatureDeclaration), constructSignature); - - var signatureIndex = this.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList(constructSignature, parent.getOwnDeclaredConstructSignatures()); - parent.insertConstructSignatureAtIndex(constructSignature, signatureIndex); - }; - - PullSymbolBinder.prototype.bindCallSignatureDeclarationToPullSymbol = function (callSignatureDeclaration) { - var parent = this.getParent(callSignatureDeclaration, true); - var callSignatureAST = this.semanticInfoChain.getASTForDecl(callSignatureDeclaration); - - var callSignature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */); - - if (TypeScript.lastParameterIsRest(callSignatureAST.parameterList)) { - callSignature.hasVarArgs = true; + } + else { + if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + hasSemanticErrors = resolver.hasSemanticErrors(targetSourceFile); + isEmitBlocked = resolver.isEmitBlocked(targetSourceFile); + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, program, ".js"); + emitFile(jsFilePath, targetSourceFile); } - - var typeParameters = callSignatureDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = callSignature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - callSignature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); + else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!shouldEmitToOwnFile(sourceFile, compilerOptions)) { + hasSemanticErrors = hasSemanticErrors || resolver.hasSemanticErrors(sourceFile); + isEmitBlocked = isEmitBlocked || resolver.isEmitBlocked(sourceFile); + } + }); + emitFile(compilerOptions.out); + } + } + function emitFile(jsFilePath, sourceFile) { + if (!isEmitBlocked) { + emitJavaScript(jsFilePath, sourceFile); + if (!hasSemanticErrors && compilerOptions.declaration) { + writeDeclarationFile(jsFilePath, sourceFile); } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); } - - callSignature.addDeclaration(callSignatureDeclaration); - callSignatureDeclaration.setSignatureSymbol(callSignature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(callSignatureDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.parameterList), null, callSignature); - - this.semanticInfoChain.setSymbolForAST(this.semanticInfoChain.getASTForDecl(callSignatureDeclaration), callSignature); - - var signatureIndex = this.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList(callSignature, parent.getOwnCallSignatures()); - parent.insertCallSignatureAtIndex(callSignature, signatureIndex); - }; - - PullSymbolBinder.prototype.bindIndexSignatureDeclarationToPullSymbol = function (indexSignatureDeclaration) { - var indexSignature = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - - indexSignature.addDeclaration(indexSignatureDeclaration); - indexSignatureDeclaration.setSignatureSymbol(indexSignature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(indexSignatureDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameter(funcDecl.parameter), null, indexSignature); - - this.semanticInfoChain.setSymbolForAST(this.semanticInfoChain.getASTForDecl(indexSignatureDeclaration), indexSignature); - - var parent = this.getParent(indexSignatureDeclaration); - parent.addIndexSignature(indexSignature); - indexSignature.setContainer(parent); + } + diagnostics.sort(ts.compareDiagnostics); + diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); + var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); + var emitResultStatus; + if (isEmitBlocked) { + emitResultStatus = 1 /* AllOutputGenerationSkipped */; + } + else if (hasEmitterError) { + emitResultStatus = 4 /* EmitErrorsEncountered */; + } + else if (hasSemanticErrors && compilerOptions.declaration) { + emitResultStatus = 3 /* DeclarationGenerationSkipped */; + } + else if (hasSemanticErrors && !compilerOptions.declaration) { + emitResultStatus = 2 /* JSGeneratedWithSemanticErrors */; + } + else { + emitResultStatus = 0 /* Succeeded */; + } + return { + emitResultStatus: emitResultStatus, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList }; - - PullSymbolBinder.prototype.bindGetAccessorDeclarationToPullSymbol = function (getAccessorDeclaration) { - var declKind = getAccessorDeclaration.kind; - var declFlags = getAccessorDeclaration.flags; - var funcDeclAST = this.semanticInfoChain.getASTForDecl(getAccessorDeclaration); - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var funcName = getAccessorDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - var isStatic = false; - - if (TypeScript.hasFlag(declFlags, 16 /* Static */)) { - isStatic = true; + } + ts.emitFiles = emitFiles; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nextSymbolId = 1; + var nextNodeId = 1; + var nextMergeId = 1; + function createTypeChecker(program, fullTypeCheck) { + var Symbol = ts.objectAllocator.getSymbolConstructor(); + var Type = ts.objectAllocator.getTypeConstructor(); + var Signature = ts.objectAllocator.getSignatureConstructor(); + var typeCount = 0; + var emptyArray = []; + var emptySymbols = {}; + var compilerOptions = program.getCompilerOptions(); + var checker = { + getProgram: function () { return program; }, + getNodeCount: function () { return ts.sum(program.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(program.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(program.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + emitFiles: invokeEmitter, + getDiagnostics: getDiagnostics, + getDeclarationDiagnostics: getDeclarationDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, + getPropertiesOfType: getPropertiesOfType, + getPropertyOfType: getPropertyOfType, + getSignaturesOfType: getSignaturesOfType, + getIndexTypeOfType: getIndexTypeOfType, + getReturnTypeOfSignature: getReturnTypeOfSignature, + getSymbolsInScope: getSymbolsInScope, + getSymbolAtLocation: getSymbolAtLocation, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getTypeAtLocation: getTypeAtLocation, + typeToString: typeToString, + getSymbolDisplayBuilder: getSymbolDisplayBuilder, + symbolToString: symbolToString, + getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, + getRootSymbols: getRootSymbols, + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName, + getResolvedSignature: getResolvedSignature, + getEnumMemberValue: getEnumMemberValue, + isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + isImplementationOfOverload: isImplementationOfOverload, + getAliasedSymbol: resolveImport, + hasEarlyErrors: hasEarlyErrors, + isEmitBlocked: isEmitBlocked + }; + var undefinedSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "undefined"); + var argumentsSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "arguments"); + var unknownSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "unknown"); + var resolvingSymbol = createSymbol(268435456 /* Transient */, "__resolving__"); + var anyType = createIntrinsicType(1 /* Any */, "any"); + var stringType = createIntrinsicType(2 /* String */, "string"); + var numberType = createIntrinsicType(4 /* Number */, "number"); + var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); + var voidType = createIntrinsicType(16 /* Void */, "void"); + var undefinedType = createIntrinsicType(32 /* Undefined */, "undefined"); + var nullType = createIntrinsicType(64 /* Null */, "null"); + var unknownType = createIntrinsicType(1 /* Any */, "unknown"); + var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); + var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); + var globals = {}; + var globalArraySymbol; + var globalObjectType; + var globalFunctionType; + var globalArrayType; + var globalStringType; + var globalNumberType; + var globalBooleanType; + var globalRegExpType; + var globalTemplateStringsArrayType; + var tupleTypes = {}; + var unionTypes = {}; + var stringLiteralTypes = {}; + var emitExtends = false; + var mergedSymbols = []; + var symbolLinks = []; + var nodeLinks = []; + var potentialThisCollisions = []; + var diagnostics = []; + var diagnosticsModified = false; + function addDiagnostic(diagnostic) { + diagnostics.push(diagnostic); + diagnosticsModified = true; + } + function error(location, message, arg0, arg1, arg2) { + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + addDiagnostic(diagnostic); + } + function createSymbol(flags, name) { + return new Symbol(flags, name); + } + function getExcludedSymbolFlags(flags) { + var result = 0; + if (flags & 2 /* BlockScopedVariable */) + result |= 107455 /* BlockScopedVariableExcludes */; + if (flags & 1 /* FunctionScopedVariable */) + result |= 107454 /* FunctionScopedVariableExcludes */; + if (flags & 4 /* Property */) + result |= 107455 /* PropertyExcludes */; + if (flags & 8 /* EnumMember */) + result |= 107455 /* EnumMemberExcludes */; + if (flags & 16 /* Function */) + result |= 106927 /* FunctionExcludes */; + if (flags & 32 /* Class */) + result |= 3258879 /* ClassExcludes */; + if (flags & 64 /* Interface */) + result |= 3152288 /* InterfaceExcludes */; + if (flags & 256 /* RegularEnum */) + result |= 3258623 /* RegularEnumExcludes */; + if (flags & 128 /* ConstEnum */) + result |= 3259263 /* ConstEnumExcludes */; + if (flags & 512 /* ValueModule */) + result |= 106639 /* ValueModuleExcludes */; + if (flags & 8192 /* Method */) + result |= 99263 /* MethodExcludes */; + if (flags & 32768 /* GetAccessor */) + result |= 41919 /* GetAccessorExcludes */; + if (flags & 65536 /* SetAccessor */) + result |= 74687 /* SetAccessorExcludes */; + if (flags & 1048576 /* TypeParameter */) + result |= 2103776 /* TypeParameterExcludes */; + if (flags & 2097152 /* TypeAlias */) + result |= 3152352 /* TypeAliasExcludes */; + if (flags & 33554432 /* Import */) + result |= 33554432 /* ImportExcludes */; + return result; + } + function recordMergedSymbol(target, source) { + if (!source.mergeId) + source.mergeId = nextMergeId++; + mergedSymbols[source.mergeId] = target; + } + function cloneSymbol(symbol) { + var result = createSymbol(symbol.flags | 134217728 /* Merged */, symbol.name); + result.declarations = symbol.declarations.slice(0); + result.parent = symbol.parent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = cloneSymbolTable(symbol.members); + if (symbol.exports) + result.exports = cloneSymbolTable(symbol.exports); + recordMergedSymbol(result, symbol); + return result; + } + function extendSymbol(target, source) { + if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } + target.flags |= source.flags; + if (!target.valueDeclaration && source.valueDeclaration) + target.valueDeclaration = source.valueDeclaration; + ts.forEach(source.declarations, function (node) { + target.declarations.push(node); + }); + if (source.members) { + if (!target.members) + target.members = {}; + extendSymbolTable(target.members, source.members); + } + if (source.exports) { + if (!target.exports) + target.exports = {}; + extendSymbolTable(target.exports, source.exports); + } + recordMergedSymbol(target, source); + } + else { + var message = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(source.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + ts.forEach(target.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); } - - var parent = this.getParent(getAccessorDeclaration, true); - var parentHadSymbol = false; - - var accessorSymbol = null; - var getterSymbol = null; - var getterTypeSymbol = null; - - if (isStatic) { - parent = parent.getConstructorMethod().type; + } + function cloneSymbolTable(symbolTable) { + var result = {}; + for (var id in symbolTable) { + if (ts.hasProperty(symbolTable, id)) { + result[id] = symbolTable[id]; + } } - - accessorSymbol = parent.findMember(funcName, false); - - if (accessorSymbol) { - if (!accessorSymbol.isAccessor()) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(funcDeclAST.propertyName, getAccessorDeclaration.getDisplayName(), accessorSymbol.getDeclarations()[0].ast()); - accessorSymbol = null; - } else { - getterSymbol = accessorSymbol.getGetter(); - - if (getterSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Getter_0_already_declared, [getAccessorDeclaration.getDisplayName()]); - accessorSymbol = null; - getterSymbol = null; + return result; + } + function extendSymbolTable(target, source) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (!ts.hasProperty(target, id)) { + target[id] = source[id]; + } + else { + var symbol = target[id]; + if (!(symbol.flags & 134217728 /* Merged */)) { + target[id] = symbol = cloneSymbol(symbol); + } + extendSymbol(symbol, source[id]); } } } - - if (accessorSymbol) { - parentHadSymbol = true; - } - - if (accessorSymbol && getterSymbol) { - getterTypeSymbol = getterSymbol.type; + } + function getSymbolLinks(symbol) { + if (symbol.flags & 268435456 /* Transient */) + return symbol; + if (!symbol.id) + symbol.id = nextSymbolId++; + return symbolLinks[symbol.id] || (symbolLinks[symbol.id] = {}); + } + function getNodeLinks(node) { + if (!node.id) + node.id = nextNodeId++; + return nodeLinks[node.id] || (nodeLinks[node.id] = {}); + } + function getSourceFile(node) { + return ts.getAncestor(node, 201 /* SourceFile */); + } + function isGlobalSourceFile(node) { + return node.kind === 201 /* SourceFile */ && !ts.isExternalModule(node); + } + function getSymbol(symbols, name, meaning) { + if (meaning && ts.hasProperty(symbols, name)) { + var symbol = symbols[name]; + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + if (symbol.flags & meaning) { + return symbol; + } + if (symbol.flags & 33554432 /* Import */) { + var target = resolveImport(symbol); + if (target === unknownSymbol || target.flags & meaning) { + return symbol; + } + } } - - if (!accessorSymbol) { - accessorSymbol = new TypeScript.PullAccessorSymbol(funcName); + } + function isDefinedBefore(node1, node2) { + var file1 = ts.getSourceFileOfNode(node1); + var file2 = ts.getSourceFileOfNode(node2); + if (file1 === file2) { + return node1.pos <= node2.pos; } - - if (!getterSymbol) { - getterSymbol = new TypeScript.PullSymbol(funcName, 16384 /* Function */); - getterTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - getterTypeSymbol.setFunctionSymbol(getterSymbol); - - getterSymbol.type = getterTypeSymbol; - - accessorSymbol.setGetter(getterSymbol); + if (!compilerOptions.out) { + return true; } - - getAccessorDeclaration.setSymbol(accessorSymbol); - accessorSymbol.addDeclaration(getAccessorDeclaration); - getterSymbol.addDeclaration(getAccessorDeclaration); - - var nameAST = funcDeclAST.propertyName; - this.semanticInfoChain.setSymbolForAST(nameAST, accessorSymbol); - this.semanticInfoChain.setSymbolForAST(funcDeclAST, getterSymbol); - - if (!parentHadSymbol) { - parent.addMember(accessorSymbol); + var sourceFiles = program.getSourceFiles(); + return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); + } + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { + var result; + var lastLocation; + var propertyWithInvalidInitializer; + var errorLocation = location; + loop: while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = getSymbol(location.locals, name, meaning)) { + break loop; + } + } + switch (location.kind) { + case 201 /* SourceFile */: + if (!ts.isExternalModule(location)) + break; + case 189 /* ModuleDeclaration */: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 35653619 /* ModuleMember */)) { + break loop; + } + break; + case 188 /* EnumDeclaration */: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { + break loop; + } + break; + case 124 /* Property */: + if (location.parent.kind === 185 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + var ctor = findConstructorDeclaration(location.parent); + if (ctor && ctor.locals) { + if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { + propertyWithInvalidInitializer = location; + } + } + } + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 3152352 /* Type */)) { + if (lastLocation && lastLocation.flags & 128 /* Static */) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + return undefined; + } + break loop; + } + break; + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + break; + case 150 /* FunctionExpression */: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + var id = location.name; + if (id && name === id.text) { + result = location.symbol; + break loop; + } + break; + case 197 /* CatchClause */: + var id = location.name; + if (name === id.text) { + result = location.symbol; + break loop; + } + break; + } + lastLocation = location; + location = location.parent; } - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - signature.addDeclaration(getAccessorDeclaration); - getAccessorDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcDeclAST, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), getterTypeSymbol, signature); - - getterTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindSetAccessorDeclarationToPullSymbol = function (setAccessorDeclaration) { - var declKind = setAccessorDeclaration.kind; - var declFlags = setAccessorDeclaration.flags; - var funcDeclAST = this.semanticInfoChain.getASTForDecl(setAccessorDeclaration); - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var funcName = setAccessorDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - var isStatic = false; - - if (TypeScript.hasFlag(declFlags, 16 /* Static */)) { - isStatic = true; + if (!result) { + result = getSymbol(globals, name, meaning); } - - var parent = this.getParent(setAccessorDeclaration, true); - var parentHadSymbol = false; - - var accessorSymbol = null; - var setterSymbol = null; - var setterTypeSymbol = null; - - if (isStatic) { - parent = parent.getConstructorMethod().type; + if (!result) { + if (nameNotFoundMessage) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } + return undefined; } - - accessorSymbol = parent.findMember(funcName, false); - - if (accessorSymbol) { - if (!accessorSymbol.isAccessor()) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(funcDeclAST.propertyName, setAccessorDeclaration.getDisplayName(), accessorSymbol.getDeclarations()[0].ast()); - accessorSymbol = null; - } else { - setterSymbol = accessorSymbol.getSetter(); - - if (setterSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Setter_0_already_declared, [setAccessorDeclaration.getDisplayName()]); - accessorSymbol = null; - setterSymbol = null; + if (nameNotFoundMessage) { + if (propertyWithInvalidInitializer) { + var propertyName = propertyWithInvalidInitializer.name; + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return undefined; + } + if (result.flags & 2 /* BlockScopedVariable */) { + var declaration = ts.forEach(result.declarations, function (d) { return d.flags & 6144 /* BlockScoped */ ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isDefinedBefore(declaration, errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } } - - if (accessorSymbol) { - parentHadSymbol = true; - - if (setterSymbol) { - setterTypeSymbol = setterSymbol.type; + return result; + } + function resolveImport(symbol) { + ts.Debug.assert((symbol.flags & 33554432 /* Import */) !== 0, "Should only get Imports here."); + var links = getSymbolLinks(symbol); + if (!links.target) { + links.target = resolvingSymbol; + var node = ts.getDeclarationOfKind(symbol, 191 /* ImportDeclaration */); + var target = node.moduleReference.kind === 193 /* ExternalModuleReference */ ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + if (links.target === resolvingSymbol) { + links.target = target || unknownSymbol; + } + else { + error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); } } - - if (!accessorSymbol) { - accessorSymbol = new TypeScript.PullAccessorSymbol(funcName); + else if (links.target === resolvingSymbol) { + links.target = unknownSymbol; } - - if (!setterSymbol) { - setterSymbol = new TypeScript.PullSymbol(funcName, 16384 /* Function */); - setterTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - setterTypeSymbol.setFunctionSymbol(setterSymbol); - - setterSymbol.type = setterTypeSymbol; - - accessorSymbol.setSetter(setterSymbol); + return links.target; + } + function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { + if (!importDeclaration) { + importDeclaration = ts.getAncestor(entityName, 191 /* ImportDeclaration */); + ts.Debug.assert(importDeclaration !== undefined); } - - setAccessorDeclaration.setSymbol(accessorSymbol); - accessorSymbol.addDeclaration(setAccessorDeclaration); - setterSymbol.addDeclaration(setAccessorDeclaration); - - var nameAST = funcDeclAST.propertyName; - this.semanticInfoChain.setSymbolForAST(nameAST, accessorSymbol); - this.semanticInfoChain.setSymbolForAST(funcDeclAST, setterSymbol); - - if (!parentHadSymbol) { - parent.addMember(accessorSymbol); + if (entityName.kind === 63 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; } - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - signature.addDeclaration(setAccessorDeclaration); - setAccessorDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcDeclAST, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), setterTypeSymbol, signature); - - setterTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.getDeclsToBind = function (decl) { - var decls; - switch (decl.kind) { - case 64 /* Enum */: - case 32 /* DynamicModule */: - case 4 /* Container */: - case 16 /* Interface */: - decls = this.findDeclsInContext(decl, decl.kind, true); - break; - - case 512 /* Variable */: - case 16384 /* Function */: - case 65536 /* Method */: - case 32768 /* ConstructorMethod */: - decls = this.findDeclsInContext(decl, decl.kind, false); - break; - - default: - decls = [decl]; + if (entityName.kind === 63 /* Identifier */ || entityName.parent.kind === 120 /* QualifiedName */) { + return resolveEntityName(importDeclaration, entityName, 1536 /* Namespace */); } - TypeScript.Debug.assert(decls && decls.length > 0); - TypeScript.Debug.assert(TypeScript.ArrayUtilities.contains(decls, decl)); - return decls; - }; - - PullSymbolBinder.prototype.shouldBindDeclaration = function (decl) { - return !decl.hasBeenBound() && this.declsBeingBound.indexOf(decl.declID) < 0; - }; - - PullSymbolBinder.prototype.bindDeclToPullSymbol = function (decl) { - if (this.shouldBindDeclaration(decl)) { - this.bindAllDeclsToPullSymbol(decl); + else { + ts.Debug.assert(entityName.parent.kind === 191 /* ImportDeclaration */); + return resolveEntityName(importDeclaration, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */); } - }; - - PullSymbolBinder.prototype.bindAllDeclsToPullSymbol = function (askedDecl) { - var allDecls = this.getDeclsToBind(askedDecl); - for (var i = 0; i < allDecls.length; i++) { - var decl = allDecls[i]; - - if (this.shouldBindDeclaration(decl)) { - this.bindSingleDeclToPullSymbol(decl); - } + } + function getFullyQualifiedName(symbol) { + return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); + } + function resolveEntityName(location, name, meaning) { + if (ts.getFullWidth(name) === 0) { + return undefined; } - }; - - PullSymbolBinder.prototype.bindSingleDeclToPullSymbol = function (decl) { - this.declsBeingBound.push(decl.declID); - - switch (decl.kind) { - case 1 /* Script */: - var childDecls = decl.getChildDecls(); - for (var i = 0; i < childDecls.length; i++) { - this.bindDeclToPullSymbol(childDecls[i]); - } - break; - - case 64 /* Enum */: - this.bindEnumDeclarationToPullSymbol(decl); - break; - - case 32 /* DynamicModule */: - case 4 /* Container */: - this.bindModuleDeclarationToPullSymbol(decl); - break; - - case 16 /* Interface */: - this.bindInterfaceDeclarationToPullSymbol(decl); - break; - - case 8 /* Class */: - this.bindClassDeclarationToPullSymbol(decl); - break; - - case 16384 /* Function */: - this.bindFunctionDeclarationToPullSymbol(decl); - break; - - case 512 /* Variable */: - this.bindVariableDeclarationToPullSymbol(decl); - break; - - case 1024 /* CatchVariable */: - this.bindCatchVariableToPullSymbol(decl); - break; - - case 67108864 /* EnumMember */: - this.bindEnumMemberDeclarationToPullSymbol(decl); - break; - - case 4096 /* Property */: - this.bindPropertyDeclarationToPullSymbol(decl); - break; - - case 65536 /* Method */: - this.bindMethodDeclarationToPullSymbol(decl); - break; - - case 32768 /* ConstructorMethod */: - this.bindConstructorDeclarationToPullSymbol(decl); - break; - - case 1048576 /* CallSignature */: - this.bindCallSignatureDeclarationToPullSymbol(decl); - break; - - case 2097152 /* ConstructSignature */: - this.bindConstructSignatureDeclarationToPullSymbol(decl); - break; - - case 4194304 /* IndexSignature */: - this.bindIndexSignatureDeclarationToPullSymbol(decl); - break; - - case 262144 /* GetAccessor */: - this.bindGetAccessorDeclarationToPullSymbol(decl); - break; - - case 524288 /* SetAccessor */: - this.bindSetAccessorDeclarationToPullSymbol(decl); - break; - - case 8388608 /* ObjectType */: - this.bindObjectTypeDeclarationToPullSymbol(decl); - break; - - case 16777216 /* FunctionType */: - this.bindFunctionTypeDeclarationToPullSymbol(decl); - break; - - case 33554432 /* ConstructorType */: - this.bindConstructorTypeDeclarationToPullSymbol(decl); - break; - - case 131072 /* FunctionExpression */: - this.bindFunctionExpressionToPullSymbol(decl); - break; - - case 128 /* TypeAlias */: - this.bindImportDeclaration(decl); - break; - - case 2048 /* Parameter */: - case 8192 /* TypeParameter */: - decl.getParentDecl().getSymbol(); + if (name.kind === 63 /* Identifier */) { + var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + if (!symbol) { + return; + } + } + else if (name.kind === 120 /* QualifiedName */) { + var namespace = resolveEntityName(location, name.left, 1536 /* Namespace */); + if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) + return; + var symbol = getSymbol(namespace.exports, name.right.text, meaning); + if (!symbol) { + error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(name.right)); + return; + } + } + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + return symbol.flags & meaning ? symbol : resolveImport(symbol); + } + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + function resolveExternalModuleName(location, moduleReferenceExpression) { + if (moduleReferenceExpression.kind !== 7 /* StringLiteral */) { + return; + } + var moduleReferenceLiteral = moduleReferenceExpression; + var searchPath = ts.getDirectoryPath(getSourceFile(location).filename); + var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); + if (!moduleName) + return; + var isRelative = isExternalModuleNameRelative(moduleName); + if (!isRelative) { + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); + if (symbol) { + return getResolvedExportSymbol(symbol); + } + } + while (true) { + var filename = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + var sourceFile = program.getSourceFile(filename + ".ts") || program.getSourceFile(filename + ".d.ts"); + if (sourceFile || isRelative) break; - - case 268435456 /* CatchBlock */: - case 134217728 /* WithBlock */: + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) break; - - default: - TypeScript.CompilerDiagnostics.assert(false, "Unrecognized type declaration"); + searchPath = parentPath; } - - TypeScript.Debug.assert(TypeScript.ArrayUtilities.last(this.declsBeingBound) === decl.declID); - this.declsBeingBound.pop(); - }; - return PullSymbolBinder; - })(); - TypeScript.PullSymbolBinder = PullSymbolBinder; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (PullHelpers) { - function diagnosticFromDecl(decl, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - var ast = decl.ast(); - return decl.semanticInfoChain.diagnosticFromAST(ast, diagnosticKey, _arguments, additionalLocations); - } - PullHelpers.diagnosticFromDecl = diagnosticFromDecl; - - function resolveDeclaredSymbolToUseType(symbol) { - if (symbol.isSignature()) { - if (!symbol.returnType) { - symbol._resolveDeclaredSymbol(); + if (sourceFile) { + if (sourceFile.symbol) { + return getResolvedExportSymbol(sourceFile.symbol); } - } else if (!symbol.type) { - symbol._resolveDeclaredSymbol(); + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.filename); + return; } + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); } - PullHelpers.resolveDeclaredSymbolToUseType = resolveDeclaredSymbolToUseType; - - function getSignatureForFuncDecl(functionDecl) { - var funcDecl = functionDecl.ast(); - var funcSymbol = functionDecl.getSymbol(); - - if (!funcSymbol) { - funcSymbol = functionDecl.getSignatureSymbol(); + function getResolvedExportSymbol(moduleSymbol) { + var symbol = getExportAssignmentSymbol(moduleSymbol); + if (symbol) { + if (symbol.flags & (107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */)) { + return symbol; + } + if (symbol.flags & 33554432 /* Import */) { + return resolveImport(symbol); + } } - - var functionSignature = null; - var typeSymbolWithAllSignatures = null; - if (funcSymbol.isSignature()) { - functionSignature = funcSymbol; - var parent = functionDecl.getParentDecl(); - typeSymbolWithAllSignatures = parent.getSymbol().type; - } else { - functionSignature = functionDecl.getSignatureSymbol(); - typeSymbolWithAllSignatures = funcSymbol.type; - } - var signatures; - - if (funcDecl.kind() === 137 /* ConstructorDeclaration */ || functionDecl.kind === 2097152 /* ConstructSignature */) { - signatures = typeSymbolWithAllSignatures.getConstructSignatures(); - } else if (functionDecl.kind === 4194304 /* IndexSignature */) { - signatures = typeSymbolWithAllSignatures.getIndexSignatures(); - } else { - signatures = typeSymbolWithAllSignatures.getCallSignatures(); + return moduleSymbol; + } + function getExportAssignmentSymbol(symbol) { + checkTypeOfExportAssignmentSymbol(symbol); + var symbolLinks = getSymbolLinks(symbol); + return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol; + } + function checkTypeOfExportAssignmentSymbol(containerSymbol) { + var symbolLinks = getSymbolLinks(containerSymbol); + if (!symbolLinks.exportAssignSymbol) { + var exportInformation = collectExportInformationForSourceFileOrModule(containerSymbol); + if (exportInformation.exportAssignments.length) { + if (exportInformation.exportAssignments.length > 1) { + ts.forEach(exportInformation.exportAssignments, function (node) { return error(node, ts.Diagnostics.A_module_cannot_have_more_than_one_export_assignment); }); + } + var node = exportInformation.exportAssignments[0]; + if (exportInformation.hasExportedMember) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + if (node.exportName.text) { + var meaning = 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */; + var exportSymbol = resolveName(node, node.exportName.text, meaning, ts.Diagnostics.Cannot_find_name_0, node.exportName); + } + } + symbolLinks.exportAssignSymbol = exportSymbol || unknownSymbol; } - + } + function collectExportInformationForSourceFileOrModule(symbol) { + var seenExportedMember = false; + var result = []; + ts.forEach(symbol.declarations, function (declaration) { + var block = (declaration.kind === 201 /* SourceFile */ ? declaration : declaration.body); + ts.forEach(block.statements, function (node) { + if (node.kind === 192 /* ExportAssignment */) { + result.push(node); + } + else { + seenExportedMember = seenExportedMember || (node.flags & 1 /* Export */) !== 0; + } + }); + }); return { - signature: functionSignature, - allSignatures: signatures + hasExportedMember: seenExportedMember, + exportAssignments: result }; } - PullHelpers.getSignatureForFuncDecl = getSignatureForFuncDecl; - - function getAccessorSymbol(getterOrSetter, semanticInfoChain) { - var functionDecl = semanticInfoChain.getDeclForAST(getterOrSetter); - var getterOrSetterSymbol = functionDecl.getSymbol(); - - return getterOrSetterSymbol; + function getMergedSymbol(symbol) { + var merged; + return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; } - PullHelpers.getAccessorSymbol = getAccessorSymbol; - - function getGetterAndSetterFunction(funcDecl, semanticInfoChain) { - var accessorSymbol = PullHelpers.getAccessorSymbol(funcDecl, semanticInfoChain); - var result = { - getter: null, - setter: null - }; - var getter = accessorSymbol.getGetter(); - if (getter) { - var getterDecl = getter.getDeclarations()[0]; - result.getter = semanticInfoChain.getASTForDecl(getterDecl); + function getSymbolOfNode(node) { + return getMergedSymbol(node.symbol); + } + function getParentOfSymbol(symbol) { + return getMergedSymbol(symbol.parent); + } + function getExportSymbolOfValueSymbolIfExported(symbol) { + return symbol && (symbol.flags & 4194304 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + } + function symbolIsValue(symbol) { + if (symbol.flags & 67108864 /* Instantiated */) { + return symbolIsValue(getSymbolLinks(symbol).target); + } + if (symbol.flags & 107455 /* Value */) { + return true; } - var setter = accessorSymbol.getSetter(); - if (setter) { - var setterDecl = setter.getDeclarations()[0]; - result.setter = semanticInfoChain.getASTForDecl(setterDecl); + if (symbol.flags & 33554432 /* Import */) { + return (resolveImport(symbol).flags & 107455 /* Value */) !== 0; } - + return false; + } + function findConstructorDeclaration(node) { + var members = node.members; + for (var i = 0; i < members.length; i++) { + var member = members[i]; + if (member.kind === 126 /* Constructor */ && member.body) { + return member; + } + } + } + function createType(flags) { + var result = new Type(checker, flags); + result.id = typeCount++; return result; } - PullHelpers.getGetterAndSetterFunction = getGetterAndSetterFunction; - - function symbolIsEnum(source) { - return source && (source.kind & (64 /* Enum */ | 67108864 /* EnumMember */)) !== 0; + function createIntrinsicType(kind, intrinsicName) { + var type = createType(kind); + type.intrinsicName = intrinsicName; + return type; } - PullHelpers.symbolIsEnum = symbolIsEnum; - - function symbolIsModule(symbol) { - return symbol && (symbol.kind === 4 /* Container */ || isOneDeclarationOfKind(symbol, 4 /* Container */)); + function createObjectType(kind, symbol) { + var type = createType(kind); + type.symbol = symbol; + return type; } - PullHelpers.symbolIsModule = symbolIsModule; - - function isOneDeclarationOfKind(symbol, kind) { - var decls = symbol.getDeclarations(); - for (var i = 0; i < decls.length; i++) { - if (decls[i].kind === kind) { - return true; + function isReservedMemberName(name) { + return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */; + } + function getNamedMembers(members) { + var result; + for (var id in members) { + if (ts.hasProperty(members, id)) { + if (!isReservedMemberName(id)) { + if (!result) + result = []; + var symbol = members[id]; + if (symbolIsValue(symbol)) { + result.push(symbol); + } + } } } - - return false; + return result || emptyArray; } - - function isNameNumeric(name) { - return isFinite(+name); + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + type.members = members; + type.properties = getNamedMembers(members); + type.callSignatures = callSignatures; + type.constructSignatures = constructSignatures; + if (stringIndexType) + type.stringIndexType = stringIndexType; + if (numberIndexType) + type.numberIndexType = numberIndexType; + return type; } - PullHelpers.isNameNumeric = isNameNumeric; - - function typeSymbolsAreIdentical(a, b) { - if (a.isTypeReference() && !a.getIsSpecialized()) { - a = a.referencedTypeSymbol; - } - - if (b.isTypeReference() && !b.getIsSpecialized()) { - b = b.referencedTypeSymbol; + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + return setObjectTypeMembers(createObjectType(32768 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function isOptionalProperty(propertySymbol) { + return propertySymbol.valueDeclaration && ts.hasQuestionToken(propertySymbol.valueDeclaration) && propertySymbol.valueDeclaration.kind !== 123 /* Parameter */; + } + function forEachSymbolTableInScope(enclosingDeclaration, callback) { + var result; + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { + return result; + } + } + switch (location.kind) { + case 201 /* SourceFile */: + if (!ts.isExternalModule(location)) { + break; + } + case 189 /* ModuleDeclaration */: + if (result = callback(getSymbolOfNode(location).exports)) { + return result; + } + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + if (result = callback(getSymbolOfNode(location).members)) { + return result; + } + break; + } } - - return a === b; + return callback(globals); } - PullHelpers.typeSymbolsAreIdentical = typeSymbolsAreIdentical; - - function getRootType(type) { - var rootType = type.getRootSymbol(); - - while (true) { - if (type === rootType) { - return type; + function getQualifiedLeftMeaning(rightMeaning) { + return rightMeaning === 107455 /* Value */ ? 107455 /* Value */ : 1536 /* Namespace */; + } + function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { + function getAccessibleSymbolChainFromSymbolTable(symbols) { + function canQualifySymbol(symbolFromSymbolTable, meaning) { + if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { + return true; + } + var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); + return !!accessibleParent; } - - type = rootType; - rootType = type.getRootSymbol(); + function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { + if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { + return !ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return hasExternalModuleSymbol(declaration); }) && canQualifySymbol(symbolFromSymbolTable, meaning); + } + } + if (isAccessible(ts.lookUp(symbols, symbol.name))) { + return [symbol]; + } + return ts.forEachValue(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 33554432 /* Import */) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } + } + } + }); + } + if (symbol) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); } } - PullHelpers.getRootType = getRootType; - - function isSymbolLocal(symbol) { - var container = symbol.getContainer(); - if (container) { - var containerKind = container.kind; - if (containerKind & (1032192 /* SomeFunction */ | 16777216 /* FunctionType */)) { + function needsQualification(symbol, enclosingDeclaration, meaning) { + var qualify = false; + forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { + if (!ts.hasProperty(symbolTable, symbol.name)) { + return false; + } + var symbolFromSymbolTable = symbolTable[symbol.name]; + if (symbolFromSymbolTable === symbol) { return true; } - - if (containerKind === 33554432 /* ConstructorType */ && !symbol.anyDeclHasFlag(16 /* Static */ | 1 /* Exported */)) { + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 33554432 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + if (symbolFromSymbolTable.flags & meaning) { + qualify = true; return true; } + return false; + }); + return qualify; + } + function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { + if (symbol && enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { + var initialSymbol = symbol; + var meaningToLook = meaning; + while (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + if (accessibleSymbolChain) { + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + if (!hasAccessibleDeclarations) { + return { + accessibility: 1 /* NotAccessible */, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536 /* Namespace */) : undefined + }; + } + return hasAccessibleDeclarations; + } + meaningToLook = getQualifiedLeftMeaning(meaning); + symbol = getParentOfSymbol(symbol); + } + var symbolExternalModule = ts.forEach(initialSymbol.declarations, function (declaration) { return getExternalModuleContainer(declaration); }); + if (symbolExternalModule) { + var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + if (symbolExternalModule !== enclosingExternalModule) { + return { + accessibility: 2 /* CannotBeNamed */, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbolToString(symbolExternalModule) + }; + } + } + return { + accessibility: 1 /* NotAccessible */, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) + }; + } + return { accessibility: 0 /* Accessible */ }; + function getExternalModuleContainer(declaration) { + for (; declaration; declaration = declaration.parent) { + if (hasExternalModuleSymbol(declaration)) { + return getSymbolOfNode(declaration); + } + } } - - return false; } - PullHelpers.isSymbolLocal = isSymbolLocal; - - function isExportedSymbolInClodule(symbol) { - var container = symbol.getContainer(); - return container && container.kind === 33554432 /* ConstructorType */ && symbolIsModule(container) && symbol.anyDeclHasFlag(1 /* Exported */); + function hasExternalModuleSymbol(declaration) { + return (declaration.kind === 189 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 201 /* SourceFile */ && ts.isExternalModule(declaration)); } - PullHelpers.isExportedSymbolInClodule = isExportedSymbolInClodule; - - function isSymbolDeclaredInScopeChain(symbol, scopeSymbol) { - TypeScript.Debug.assert(symbol); - var symbolDeclarationScope = symbol.getContainer(); - - while (scopeSymbol) { - if (scopeSymbol === symbolDeclarationScope) { - return true; - } - - scopeSymbol = scopeSymbol.getContainer(); + function hasVisibleDeclarations(symbol) { + var aliasesToMakeVisible; + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + return undefined; } - - if (scopeSymbol === null && symbolDeclarationScope === null) { + return { accessibility: 0 /* Accessible */, aliasesToMakeVisible: aliasesToMakeVisible }; + function getIsDeclarationVisible(declaration) { + if (!isDeclarationVisible(declaration)) { + if (declaration.kind === 191 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + getNodeLinks(declaration).isVisible = true; + if (aliasesToMakeVisible) { + if (!ts.contains(aliasesToMakeVisible, declaration)) { + aliasesToMakeVisible.push(declaration); + } + } + else { + aliasesToMakeVisible = [declaration]; + } + return true; + } + return false; + } return true; } - - return false; } - PullHelpers.isSymbolDeclaredInScopeChain = isSymbolDeclaredInScopeChain; - - - - function walkSignatureSymbol(signatureSymbol, walker) { - var continueWalk = true; - var parameters = signatureSymbol.parameters; - if (parameters) { - for (var i = 0; continueWalk && i < parameters.length; i++) { - continueWalk = walker.signatureParameterWalk(parameters[i]); - } + function isEntityNameVisible(entityName, enclosingDeclaration) { + var meaning; + if (entityName.parent.kind === 135 /* TypeQuery */) { + meaning = 107455 /* Value */ | 4194304 /* ExportValue */; } - - if (continueWalk) { - continueWalk = walker.signatureReturnTypeWalk(signatureSymbol.returnType); + else if (entityName.kind === 120 /* QualifiedName */ || entityName.parent.kind === 191 /* ImportDeclaration */) { + meaning = 1536 /* Namespace */; } - - return continueWalk; + else { + meaning = 3152352 /* Type */; + } + var firstIdentifier = getFirstIdentifier(entityName); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + return (symbol && hasVisibleDeclarations(symbol)) || { + accessibility: 1 /* NotAccessible */, + errorSymbolName: ts.getTextOfNode(firstIdentifier), + errorNode: firstIdentifier + }; } - - function walkPullTypeSymbolStructure(typeSymbol, walker) { - var continueWalk = true; - - var members = typeSymbol.getMembers(); - for (var i = 0; continueWalk && i < members.length; i++) { - continueWalk = walker.memberSymbolWalk(members[i]); + function writeKeyword(writer, kind) { + writer.writeKeyword(ts.tokenToString(kind)); + } + function writePunctuation(writer, kind) { + writer.writePunctuation(ts.tokenToString(kind)); + } + function writeSpace(writer) { + writer.writeSpace(" "); + } + function symbolToString(symbol, enclosingDeclaration, meaning) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function typeToString(type, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + var maxLength = compilerOptions.noErrorTruncation || flags & 4 /* NoTruncation */ ? undefined : 100; + if (maxLength && result.length >= maxLength) { + result = result.substr(0, maxLength - "...".length) + "..."; } - - if (continueWalk) { - var callSigantures = typeSymbol.getCallSignatures(); - for (var i = 0; continueWalk && i < callSigantures.length; i++) { - continueWalk = walker.callSignatureWalk(callSigantures[i]); - if (continueWalk) { - continueWalk = walkSignatureSymbol(callSigantures[i], walker); - } + return result; + } + function getTypeAliasForTypeLiteral(type) { + if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { + var node = type.symbol.declarations[0].parent; + while (node.kind === 140 /* ParenthesizedType */) { + node = node.parent; + } + if (node.kind === 187 /* TypeAliasDeclaration */) { + return getSymbolOfNode(node); } } - - if (continueWalk) { - var constructSignatures = typeSymbol.getConstructSignatures(); - for (var i = 0; continueWalk && i < constructSignatures.length; i++) { - continueWalk = walker.constructSignatureWalk(constructSignatures[i]); - if (continueWalk) { - continueWalk = walkSignatureSymbol(constructSignatures[i], walker); + return undefined; + } + var _displayBuilder; + function getSymbolDisplayBuilder() { + function appendSymbolNameOnly(symbol, writer) { + if (symbol.declarations && symbol.declarations.length > 0) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + writer.writeSymbol(ts.declarationNameToString(declaration.name), symbol); + return; } } + writer.writeSymbol(symbol.name, symbol); } - - if (continueWalk) { - var indexSignatures = typeSymbol.getIndexSignatures(); - for (var i = 0; continueWalk && i < indexSignatures.length; i++) { - continueWalk = walker.indexSignatureWalk(indexSignatures[i]); - if (continueWalk) { - continueWalk = walkSignatureSymbol(indexSignatures[i], walker); + function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags) { + var parentSymbol; + function appendParentTypeArgumentsAndSymbolName(symbol) { + if (parentSymbol) { + if (flags & 1 /* WriteTypeParametersOrArguments */) { + if (symbol.flags & 67108864 /* Instantiated */) { + buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); + } + else { + buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + writePunctuation(writer, 19 /* DotToken */); } + parentSymbol = symbol; + appendSymbolNameOnly(symbol, writer); } - } - } - PullHelpers.walkPullTypeSymbolStructure = walkPullTypeSymbolStructure; - - var OtherPullDeclsWalker = (function () { - function OtherPullDeclsWalker() { - this.currentlyWalkingOtherDecls = []; - } - OtherPullDeclsWalker.prototype.walkOtherPullDecls = function (currentDecl, otherDecls, callBack) { - if (otherDecls) { - var isAlreadyWalkingOtherDecl = TypeScript.ArrayUtilities.any(this.currentlyWalkingOtherDecls, function (inWalkingOtherDecl) { - return TypeScript.ArrayUtilities.contains(otherDecls, inWalkingOtherDecl); - }); - - if (!isAlreadyWalkingOtherDecl) { - this.currentlyWalkingOtherDecls.push(currentDecl); - for (var i = 0; i < otherDecls.length; i++) { - if (otherDecls[i] !== currentDecl) { - callBack(otherDecls[i]); + writer.trackSymbol(symbol, enclosingDeclaration, meaning); + function walkSymbol(symbol, meaning) { + if (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2 /* UseOnlyExternalAliasing */)); + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); + } + if (accessibleSymbolChain) { + for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { + appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + } + } + else { + if (!parentSymbol && ts.forEach(symbol.declarations, function (declaration) { return hasExternalModuleSymbol(declaration); })) { + return; + } + if (symbol.flags & 2048 /* TypeLiteral */ || symbol.flags & 4096 /* ObjectLiteral */) { + return; } + appendParentTypeArgumentsAndSymbolName(symbol); } - var currentlyWalkingOtherDeclsDecl = this.currentlyWalkingOtherDecls.pop(); - TypeScript.Debug.assert(currentlyWalkingOtherDeclsDecl == currentDecl); } } - }; - return OtherPullDeclsWalker; - })(); - PullHelpers.OtherPullDeclsWalker = OtherPullDeclsWalker; - })(TypeScript.PullHelpers || (TypeScript.PullHelpers = {})); - var PullHelpers = TypeScript.PullHelpers; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var WrapsTypeParameterCache = (function () { - function WrapsTypeParameterCache() { - this._wrapsTypeParameterCache = TypeScript.BitVector.getBitVector(true); - } - WrapsTypeParameterCache.prototype.getWrapsTypeParameter = function (typeParameterArgumentMap) { - var mapHasTypeParameterNotCached = false; - for (var typeParameterID in typeParameterArgumentMap) { - if (typeParameterArgumentMap.hasOwnProperty(typeParameterID)) { - var cachedValue = this._wrapsTypeParameterCache.valueAt(typeParameterID); - if (cachedValue) { - return typeParameterID; - } - mapHasTypeParameterNotCached = mapHasTypeParameterNotCached || cachedValue === undefined; + if (enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { + walkSymbol(symbol, meaning); + return; } + return appendParentTypeArgumentsAndSymbolName(symbol); } - - if (!mapHasTypeParameterNotCached) { - return 0; - } - - return undefined; - }; - - WrapsTypeParameterCache.prototype.setWrapsTypeParameter = function (typeParameterArgumentMap, wrappingTypeParameterID) { - if (wrappingTypeParameterID) { - this._wrapsTypeParameterCache.setValueAt(wrappingTypeParameterID, true); - } else { - for (var typeParameterID in typeParameterArgumentMap) { - if (typeParameterArgumentMap.hasOwnProperty(typeParameterID)) { - this._wrapsTypeParameterCache.setValueAt(typeParameterID, false); + function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, typeStack) { + var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */; + return writeType(type, globalFlags); + function writeType(type, flags) { + if (type.flags & 127 /* Intrinsic */) { + writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && (type.flags & 1 /* Any */) ? "any" : type.intrinsicName); + } + else if (type.flags & 4096 /* Reference */) { + writeTypeReference(type, flags); + } + else if (type.flags & (1024 /* Class */ | 2048 /* Interface */ | 128 /* Enum */ | 512 /* TypeParameter */)) { + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 3152352 /* Type */); + } + else if (type.flags & 8192 /* Tuple */) { + writeTupleType(type); + } + else if (type.flags & 16384 /* Union */) { + writeUnionType(type, flags); + } + else if (type.flags & 32768 /* Anonymous */) { + writeAnonymousType(type, flags); + } + else if (type.flags & 256 /* StringLiteral */) { + writer.writeStringLiteral(type.text); + } + else { + writePunctuation(writer, 13 /* OpenBraceToken */); + writeSpace(writer); + writePunctuation(writer, 20 /* DotDotDotToken */); + writeSpace(writer); + writePunctuation(writer, 14 /* CloseBraceToken */); } } - } - }; - return WrapsTypeParameterCache; - })(); - TypeScript.WrapsTypeParameterCache = WrapsTypeParameterCache; - - (function (PullInstantiationHelpers) { - var MutableTypeArgumentMap = (function () { - function MutableTypeArgumentMap(typeParameterArgumentMap) { - this.typeParameterArgumentMap = typeParameterArgumentMap; - this.createdDuplicateTypeArgumentMap = false; - } - MutableTypeArgumentMap.prototype.ensureTypeArgumentCopy = function () { - if (!this.createdDuplicateTypeArgumentMap) { - var passedInTypeArgumentMap = this.typeParameterArgumentMap; - this.typeParameterArgumentMap = []; - for (var typeParameterID in passedInTypeArgumentMap) { - if (passedInTypeArgumentMap.hasOwnProperty(typeParameterID)) { - this.typeParameterArgumentMap[typeParameterID] = passedInTypeArgumentMap[typeParameterID]; + function writeTypeList(types, union) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + if (union) { + writeSpace(writer); + } + writePunctuation(writer, union ? 43 /* BarToken */ : 22 /* CommaToken */); + writeSpace(writer); } + writeType(types[i], union ? 64 /* InElementType */ : 0 /* None */); } - this.createdDuplicateTypeArgumentMap = true; } - }; - return MutableTypeArgumentMap; - })(); - PullInstantiationHelpers.MutableTypeArgumentMap = MutableTypeArgumentMap; - - function instantiateTypeArgument(resolver, symbol, mutableTypeParameterMap) { - if (symbol.getIsSpecialized()) { - var rootTypeArgumentMap = symbol.getTypeParameterArgumentMap(); - var newTypeArgumentMap = []; - var allowedTypeParameters = symbol.getAllowedToReferenceTypeParameters(); - for (var i = 0; i < allowedTypeParameters.length; i++) { - var typeParameterID = allowedTypeParameters[i].pullSymbolID; - var typeArg = rootTypeArgumentMap[typeParameterID]; - if (typeArg) { - newTypeArgumentMap[typeParameterID] = resolver.instantiateType(typeArg, mutableTypeParameterMap.typeParameterArgumentMap); + function writeTypeReference(type, flags) { + if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { + writeType(type.typeArguments[0], 64 /* InElementType */); + writePunctuation(writer, 17 /* OpenBracketToken */); + writePunctuation(writer, 18 /* CloseBracketToken */); + } + else { + buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, 3152352 /* Type */); + writePunctuation(writer, 23 /* LessThanToken */); + writeTypeList(type.typeArguments, false); + writePunctuation(writer, 24 /* GreaterThanToken */); } } - - for (var i = 0; i < allowedTypeParameters.length; i++) { - var typeParameterID = allowedTypeParameters[i].pullSymbolID; - if (newTypeArgumentMap[typeParameterID] && mutableTypeParameterMap.typeParameterArgumentMap[typeParameterID] != newTypeArgumentMap[typeParameterID]) { - mutableTypeParameterMap.ensureTypeArgumentCopy(); - mutableTypeParameterMap.typeParameterArgumentMap[typeParameterID] = newTypeArgumentMap[typeParameterID]; + function writeTupleType(type) { + writePunctuation(writer, 17 /* OpenBracketToken */); + writeTypeList(type.elementTypes, false); + writePunctuation(writer, 18 /* CloseBracketToken */); + } + function writeUnionType(type, flags) { + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 15 /* OpenParenToken */); + } + writeTypeList(type.types, true); + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 16 /* CloseParenToken */); } } - } - } - PullInstantiationHelpers.instantiateTypeArgument = instantiateTypeArgument; - - function cleanUpTypeArgumentMap(symbol, mutableTypeArgumentMap) { - var allowedToReferenceTypeParameters = symbol.getAllowedToReferenceTypeParameters(); - for (var typeParameterID in mutableTypeArgumentMap.typeParameterArgumentMap) { - if (mutableTypeArgumentMap.typeParameterArgumentMap.hasOwnProperty(typeParameterID)) { - if (!TypeScript.ArrayUtilities.any(allowedToReferenceTypeParameters, function (typeParameter) { - return typeParameter.pullSymbolID == typeParameterID; - })) { - mutableTypeArgumentMap.ensureTypeArgumentCopy(); - delete mutableTypeArgumentMap.typeParameterArgumentMap[typeParameterID]; + function writeAnonymousType(type, flags) { + if (type.symbol && type.symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + writeTypeofSymbol(type); + } + else if (shouldWriteTypeOfFunctionSymbol()) { + writeTypeofSymbol(type); + } + else if (typeStack && ts.contains(typeStack, type)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 3152352 /* Type */); + } + else { + writeKeyword(writer, 109 /* AnyKeyword */); + } + } + else { + if (!typeStack) { + typeStack = []; + } + typeStack.push(type); + writeLiteralType(type, flags); + typeStack.pop(); + } + function shouldWriteTypeOfFunctionSymbol() { + if (type.symbol) { + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 201 /* SourceFile */ || declaration.parent.kind === 190 /* ModuleBlock */; })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); + } + } } } - } - } - PullInstantiationHelpers.cleanUpTypeArgumentMap = cleanUpTypeArgumentMap; - - function getAllowedToReferenceTypeParametersFromDecl(decl) { - var allowedToReferenceTypeParameters = []; - - var allowedToUseDeclTypeParameters = false; - var getTypeParametersFromParentDecl = false; - - switch (decl.kind) { - case 65536 /* Method */: - if (TypeScript.hasFlag(decl.flags, 16 /* Static */)) { - allowedToUseDeclTypeParameters = true; - break; + function writeTypeofSymbol(type) { + writeKeyword(writer, 95 /* TypeOfKeyword */); + writeSpace(writer); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */); + } + function getIndexerParameterName(type, indexKind, fallbackName) { + var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); + if (!declaration) { + return fallbackName; } - - case 16777216 /* FunctionType */: - case 33554432 /* ConstructorType */: - case 2097152 /* ConstructSignature */: - case 1048576 /* CallSignature */: - case 131072 /* FunctionExpression */: - case 16384 /* Function */: - allowedToUseDeclTypeParameters = true; - getTypeParametersFromParentDecl = true; - break; - - case 4096 /* Property */: - if (TypeScript.hasFlag(decl.flags, 16 /* Static */)) { - break; + ts.Debug.assert(declaration.parameters.length !== 0); + return ts.declarationNameToString(declaration.parameters[0].name); + } + function writeLiteralType(type, flags) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + writePunctuation(writer, 13 /* OpenBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); + return; + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 15 /* OpenParenToken */); + } + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 16 /* CloseParenToken */); + } + return; + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 15 /* OpenParenToken */); + } + writeKeyword(writer, 86 /* NewKeyword */); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 16 /* CloseParenToken */); + } + return; + } } - - case 2048 /* Parameter */: - case 262144 /* GetAccessor */: - case 524288 /* SetAccessor */: - case 32768 /* ConstructorMethod */: - case 4194304 /* IndexSignature */: - case 8388608 /* ObjectType */: - case 256 /* ObjectLiteral */: - case 8192 /* TypeParameter */: - getTypeParametersFromParentDecl = true; - break; - - case 8 /* Class */: - case 16 /* Interface */: - allowedToUseDeclTypeParameters = true; - break; + writePunctuation(writer, 13 /* OpenBraceToken */); + writer.writeLine(); + writer.increaseIndent(); + for (var i = 0; i < resolved.callSignatures.length; i++) { + buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + for (var i = 0; i < resolved.constructSignatures.length; i++) { + writeKeyword(writer, 86 /* NewKeyword */); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + if (resolved.stringIndexType) { + writePunctuation(writer, 17 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeKeyword(writer, 118 /* StringKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeType(resolved.stringIndexType, 0 /* None */); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + if (resolved.numberIndexType) { + writePunctuation(writer, 17 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeKeyword(writer, 116 /* NumberKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeType(resolved.numberIndexType, 0 /* None */); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + for (var i = 0; i < resolved.properties.length; i++) { + var p = resolved.properties[i]; + var t = getTypeOfSymbol(p); + if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { + var signatures = getSignaturesOfType(t, 0 /* Call */); + for (var j = 0; j < signatures.length; j++) { + buildSymbolDisplay(p, writer); + if (isOptionalProperty(p)) { + writePunctuation(writer, 49 /* QuestionToken */); + } + buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + } + else { + buildSymbolDisplay(p, writer); + if (isOptionalProperty(p)) { + writePunctuation(writer, 49 /* QuestionToken */); + } + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeType(t, 0 /* None */); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + } + writer.decreaseIndent(); + writePunctuation(writer, 14 /* CloseBraceToken */); + } } - - if (getTypeParametersFromParentDecl) { - allowedToReferenceTypeParameters = allowedToReferenceTypeParameters.concat(getAllowedToReferenceTypeParametersFromDecl(decl.getParentDecl())); + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + var targetSymbol = getTargetSymbol(symbol); + if (targetSymbol.flags & 32 /* Class */ || targetSymbol.flags & 64 /* Interface */) { + buildDisplayForTypeParametersAndDelimiters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); + } } - - if (allowedToUseDeclTypeParameters) { - var typeParameterDecls = decl.getTypeParameters(); - for (var i = 0; i < typeParameterDecls.length; i++) { - allowedToReferenceTypeParameters.push(typeParameterDecls[i].getSymbol()); + function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, typeStack) { + appendSymbolNameOnly(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, 77 /* ExtendsKeyword */); + writeSpace(writer); + buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); } } - - return allowedToReferenceTypeParameters; - } - PullInstantiationHelpers.getAllowedToReferenceTypeParametersFromDecl = getAllowedToReferenceTypeParametersFromDecl; - - function createTypeParameterArgumentMap(typeParameters, typeArguments) { - return updateTypeParameterArgumentMap(typeParameters, typeArguments, {}); - } - PullInstantiationHelpers.createTypeParameterArgumentMap = createTypeParameterArgumentMap; - - function updateTypeParameterArgumentMap(typeParameters, typeArguments, typeParameterArgumentMap) { - for (var i = 0; i < typeParameters.length; i++) { - typeParameterArgumentMap[typeParameters[i].getRootSymbol().pullSymbolID] = typeArguments[i]; + function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { + if (ts.hasDotDotDotToken(p.valueDeclaration)) { + writePunctuation(writer, 20 /* DotDotDotToken */); + } + appendSymbolNameOnly(p, writer); + if (ts.hasQuestionToken(p.valueDeclaration) || p.valueDeclaration.initializer) { + writePunctuation(writer, 49 /* QuestionToken */); + } + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); } - return typeParameterArgumentMap; - } - PullInstantiationHelpers.updateTypeParameterArgumentMap = updateTypeParameterArgumentMap; - - function updateMutableTypeParameterArgumentMap(typeParameters, typeArguments, mutableMap) { - for (var i = 0; i < typeParameters.length; i++) { - var typeParameterId = typeParameters[i].getRootSymbol().pullSymbolID; - if (mutableMap.typeParameterArgumentMap[typeParameterId] !== typeArguments[i]) { - mutableMap.ensureTypeArgumentCopy(); - mutableMap.typeParameterArgumentMap[typeParameterId] = typeArguments[i]; + function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 23 /* LessThanToken */); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 22 /* CommaToken */); + writeSpace(writer); + } + buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 24 /* GreaterThanToken */); } } - } - PullInstantiationHelpers.updateMutableTypeParameterArgumentMap = updateMutableTypeParameterArgumentMap; - - function twoTypesAreInstantiationsOfSameNamedGenericType(type1, type2) { - var type1IsGeneric = type1.isGeneric() && type1.getTypeArguments() !== null; - var type2IsGeneric = type2.isGeneric() && type2.getTypeArguments() !== null; - - if (type1IsGeneric && type2IsGeneric) { - var type1Root = TypeScript.PullHelpers.getRootType(type1); - var type2Root = TypeScript.PullHelpers.getRootType(type2); - return type1Root === type2Root; + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 23 /* LessThanToken */); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 22 /* CommaToken */); + writeSpace(writer); + } + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); + } + writePunctuation(writer, 24 /* GreaterThanToken */); + } } - - return false; - } - PullInstantiationHelpers.twoTypesAreInstantiationsOfSameNamedGenericType = twoTypesAreInstantiationsOfSameNamedGenericType; - })(TypeScript.PullInstantiationHelpers || (TypeScript.PullInstantiationHelpers = {})); - var PullInstantiationHelpers = TypeScript.PullInstantiationHelpers; -})(TypeScript || (TypeScript = {})); -if (Error) - Error.stackTraceLimit = 1000; - -var TypeScript; -(function (TypeScript) { - TypeScript.fileResolutionTime = 0; - TypeScript.fileResolutionIOTime = 0; - TypeScript.fileResolutionScanImportsTime = 0; - TypeScript.fileResolutionImportFileSearchTime = 0; - TypeScript.fileResolutionGetDefaultLibraryTime = 0; - TypeScript.sourceCharactersCompiled = 0; - TypeScript.syntaxTreeParseTime = 0; - TypeScript.syntaxDiagnosticsTime = 0; - TypeScript.astTranslationTime = 0; - TypeScript.typeCheckTime = 0; - - TypeScript.compilerResolvePathTime = 0; - TypeScript.compilerDirectoryNameTime = 0; - TypeScript.compilerDirectoryExistsTime = 0; - TypeScript.compilerFileExistsTime = 0; - - TypeScript.emitTime = 0; - TypeScript.emitWriteFileTime = 0; - - TypeScript.declarationEmitTime = 0; - TypeScript.declarationEmitIsExternallyVisibleTime = 0; - TypeScript.declarationEmitTypeSignatureTime = 0; - TypeScript.declarationEmitGetBoundDeclTypeTime = 0; - TypeScript.declarationEmitIsOverloadedCallSignatureTime = 0; - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime = 0; - TypeScript.declarationEmitGetBaseTypeTime = 0; - TypeScript.declarationEmitGetAccessorFunctionTime = 0; - TypeScript.declarationEmitGetTypeParameterSymbolTime = 0; - TypeScript.declarationEmitGetImportDeclarationSymbolTime = 0; - - TypeScript.ioHostResolvePathTime = 0; - TypeScript.ioHostDirectoryNameTime = 0; - TypeScript.ioHostCreateDirectoryStructureTime = 0; - TypeScript.ioHostWriteFileTime = 0; - - (function (EmitOutputResult) { - EmitOutputResult[EmitOutputResult["Succeeded"] = 0] = "Succeeded"; - EmitOutputResult[EmitOutputResult["FailedBecauseOfSyntaxErrors"] = 1] = "FailedBecauseOfSyntaxErrors"; - EmitOutputResult[EmitOutputResult["FailedBecauseOfCompilerOptionsErrors"] = 2] = "FailedBecauseOfCompilerOptionsErrors"; - EmitOutputResult[EmitOutputResult["FailedToGenerateDeclarationsBecauseOfSemanticErrors"] = 3] = "FailedToGenerateDeclarationsBecauseOfSemanticErrors"; - })(TypeScript.EmitOutputResult || (TypeScript.EmitOutputResult = {})); - var EmitOutputResult = TypeScript.EmitOutputResult; - - var EmitOutput = (function () { - function EmitOutput(emitOutputResult) { - if (typeof emitOutputResult === "undefined") { emitOutputResult = 0 /* Succeeded */; } - this.outputFiles = []; - this.emitOutputResult = emitOutputResult; + function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { + writePunctuation(writer, 15 /* OpenParenToken */); + for (var i = 0; i < parameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 22 /* CommaToken */); + writeSpace(writer); + } + buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 16 /* CloseParenToken */); + } + function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (flags & 8 /* WriteArrowStyleSignature */) { + writeSpace(writer); + writePunctuation(writer, 31 /* EqualsGreaterThanToken */); + } + else { + writePunctuation(writer, 50 /* ColonToken */); + } + writeSpace(writer); + buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); + } + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) { + buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, typeStack); + } + buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, typeStack); + buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack); + } + return _displayBuilder || (_displayBuilder = { + symbolToString: symbolToString, + typeToString: typeToString, + buildSymbolDisplay: buildSymbolDisplay, + buildTypeDisplay: buildTypeDisplay, + buildTypeParameterDisplay: buildTypeParameterDisplay, + buildParameterDisplay: buildParameterDisplay, + buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, + buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, + buildDisplayForTypeArgumentsAndDelimiters: buildDisplayForTypeArgumentsAndDelimiters, + buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, + buildSignatureDisplay: buildSignatureDisplay, + buildReturnTypeDisplay: buildReturnTypeDisplay + }); } - return EmitOutput; - })(); - TypeScript.EmitOutput = EmitOutput; - - (function (OutputFileType) { - OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; - OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; - OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; - })(TypeScript.OutputFileType || (TypeScript.OutputFileType = {})); - var OutputFileType = TypeScript.OutputFileType; - - var OutputFile = (function () { - function OutputFile(name, writeByteOrderMark, text, fileType, sourceMapEntries) { - if (typeof sourceMapEntries === "undefined") { sourceMapEntries = []; } - this.name = name; - this.writeByteOrderMark = writeByteOrderMark; - this.text = text; - this.fileType = fileType; - this.sourceMapEntries = sourceMapEntries; - } - return OutputFile; - })(); - TypeScript.OutputFile = OutputFile; - - var CompileResult = (function () { - function CompileResult() { - this.diagnostics = []; - this.outputFiles = []; - } - CompileResult.fromDiagnostics = function (diagnostics) { - var result = new CompileResult(); - result.diagnostics = diagnostics; - return result; - }; - - CompileResult.fromOutputFiles = function (outputFiles) { - var result = new CompileResult(); - result.outputFiles = outputFiles; - return result; - }; - return CompileResult; - })(); - TypeScript.CompileResult = CompileResult; - - var TypeScriptCompiler = (function () { - function TypeScriptCompiler(logger, _settings) { - if (typeof logger === "undefined") { logger = new TypeScript.NullLogger(); } - if (typeof _settings === "undefined") { _settings = TypeScript.ImmutableCompilationSettings.defaultSettings(); } - this.logger = logger; - this._settings = _settings; - this.semanticInfoChain = null; - this.semanticInfoChain = new TypeScript.SemanticInfoChain(this, logger); - } - TypeScriptCompiler.prototype.compilationSettings = function () { - return this._settings; - }; - - TypeScriptCompiler.prototype.setCompilationSettings = function (newSettings) { - var oldSettings = this._settings; - this._settings = newSettings; - - if (!compareDataObjects(oldSettings, newSettings)) { - this.semanticInfoChain.invalidate(oldSettings, newSettings); - } - }; - - TypeScriptCompiler.prototype.getDocument = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - return this.semanticInfoChain.getDocument(fileName); - }; - - TypeScriptCompiler.prototype.cleanupSemanticCache = function () { - this.semanticInfoChain.invalidate(); - }; - - TypeScriptCompiler.prototype.addFile = function (fileName, scriptSnapshot, byteOrderMark, version, isOpen, referencedFiles) { - if (typeof referencedFiles === "undefined") { referencedFiles = []; } - fileName = TypeScript.switchToForwardSlashes(fileName); - - TypeScript.sourceCharactersCompiled += scriptSnapshot.getLength(); - - var document = TypeScript.Document.create(this, this.semanticInfoChain, fileName, scriptSnapshot, byteOrderMark, version, isOpen, referencedFiles); - - this.semanticInfoChain.addDocument(document); - }; - - TypeScriptCompiler.prototype.updateFile = function (fileName, scriptSnapshot, version, isOpen, textChangeRange) { - fileName = TypeScript.switchToForwardSlashes(fileName); - - var document = this.getDocument(fileName); - var updatedDocument = document.update(scriptSnapshot, version, isOpen, textChangeRange); - - this.semanticInfoChain.addDocument(updatedDocument); - }; - - TypeScriptCompiler.prototype.removeFile = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - this.semanticInfoChain.removeDocument(fileName); - }; - - TypeScriptCompiler.prototype.mapOutputFileName = function (document, emitOptions, extensionChanger) { - if (document.emitToOwnOutputFile()) { - var updatedFileName = document.fileName; - if (emitOptions.outputDirectory() !== "") { - updatedFileName = document.fileName.replace(emitOptions.commonDirectoryPath(), ""); - updatedFileName = emitOptions.outputDirectory() + updatedFileName; + function isDeclarationVisible(node) { + function getContainingExternalModule(node) { + for (; node; node = node.parent) { + if (node.kind === 189 /* ModuleDeclaration */) { + if (node.name.kind === 7 /* StringLiteral */) { + return node; + } + } + else if (node.kind === 201 /* SourceFile */) { + return ts.isExternalModule(node) ? node : undefined; + } } - return extensionChanger(updatedFileName, false); - } else { - return extensionChanger(emitOptions.sharedOutputFile(), true); + ts.Debug.fail("getContainingModule cant reach here"); } - }; - - TypeScriptCompiler.prototype.writeByteOrderMarkForDocument = function (document) { - var printReason = false; - - if (document.emitToOwnOutputFile()) { - var result = document.byteOrderMark !== 0 /* None */; - if (printReason) { - TypeScript.Environment.standardOut.WriteLine("Emitting byte order mark because of: " + document.fileName); + function isUsedInExportAssignment(node) { + var externalModule = getContainingExternalModule(node); + if (externalModule) { + var externalModuleSymbol = getSymbolOfNode(externalModule); + var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); + var resolvedExportSymbol; + var symbolOfNode = getSymbolOfNode(node); + if (isSymbolUsedInExportAssignment(symbolOfNode)) { + return true; + } + if (symbolOfNode.flags & 33554432 /* Import */) { + return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); + } } - return result; - } else { - var fileNames = this.fileNames(); - - var result = false; - for (var i = 0, n = fileNames.length; i < n; i++) { - var document = this.getDocument(fileNames[i]); - - if (document.isExternalModule()) { - continue; + function isSymbolUsedInExportAssignment(symbol) { + if (exportAssignmentSymbol === symbol) { + return true; } - - if (document.byteOrderMark !== 0 /* None */) { - if (printReason) { - TypeScript.Environment.standardOut.WriteLine("Emitting byte order mark because of: " + document.fileName); - result = true; - } else { + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 33554432 /* Import */)) { + resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); + if (resolvedExportSymbol === symbol) { return true; } + return ts.forEach(resolvedExportSymbol.declarations, function (current) { + while (current) { + if (current === node) { + return true; + } + current = current.parent; + } + }); } } - - return result; - } - }; - - TypeScriptCompiler.mapToDTSFileName = function (fileName, wholeFileNameReplaced) { - return TypeScript.getDeclareFilePath(fileName); - }; - - TypeScriptCompiler.prototype._shouldEmit = function (document) { - return !document.isDeclareFile(); - }; - - TypeScriptCompiler.prototype._shouldEmitDeclarations = function (document) { - if (!this.compilationSettings().generateDeclarationFiles()) { - return false; - } - - return this._shouldEmit(document); - }; - - TypeScriptCompiler.prototype.emitDocumentDeclarationsWorker = function (document, emitOptions, declarationEmitter) { - var sourceUnit = document.sourceUnit(); - TypeScript.Debug.assert(this._shouldEmitDeclarations(document)); - - if (declarationEmitter) { - declarationEmitter.document = document; - } else { - var declareFileName = this.mapOutputFileName(document, emitOptions, TypeScriptCompiler.mapToDTSFileName); - declarationEmitter = new TypeScript.DeclarationEmitter(declareFileName, document, this, emitOptions, this.semanticInfoChain); } - - declarationEmitter.emitDeclarations(sourceUnit); - return declarationEmitter; - }; - - TypeScriptCompiler.prototype._emitDocumentDeclarations = function (document, emitOptions, onSingleFileEmitComplete, sharedEmitter) { - if (this._shouldEmitDeclarations(document)) { - if (document.emitToOwnOutputFile()) { - var singleEmitter = this.emitDocumentDeclarationsWorker(document, emitOptions); - if (singleEmitter) { - onSingleFileEmitComplete(singleEmitter.getOutputFile()); - } - } else { - sharedEmitter = this.emitDocumentDeclarationsWorker(document, emitOptions, sharedEmitter); + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 183 /* VariableDeclaration */: + case 189 /* ModuleDeclaration */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 184 /* FunctionDeclaration */: + case 188 /* EnumDeclaration */: + case 191 /* ImportDeclaration */: + var parent = node.kind === 183 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 191 /* ImportDeclaration */ && parent.kind !== 201 /* SourceFile */ && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + } + return isDeclarationVisible(parent); + case 124 /* Property */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 125 /* Method */: + if (node.flags & (32 /* Private */ | 64 /* Protected */)) { + return false; + } + case 126 /* Constructor */: + case 130 /* ConstructSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: + case 123 /* Parameter */: + case 190 /* ModuleBlock */: + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 136 /* TypeLiteral */: + case 132 /* TypeReference */: + case 137 /* ArrayType */: + case 138 /* TupleType */: + case 139 /* UnionType */: + case 140 /* ParenthesizedType */: + return isDeclarationVisible(node.parent); + case 122 /* TypeParameter */: + case 201 /* SourceFile */: + return true; + default: + ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } } - - return sharedEmitter; - }; - - TypeScriptCompiler.prototype.emitAllDeclarations = function (resolvePath) { - var start = new Date().getTime(); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var sharedEmitter = null; - var fileNames = this.fileNames(); - - for (var i = 0, n = fileNames.length; i < n; i++) { - var fileName = fileNames[i]; - - var document = this.getDocument(fileNames[i]); - - sharedEmitter = this._emitDocumentDeclarations(document, emitOptions, function (file) { - return emitOutput.outputFiles.push(file); - }, sharedEmitter); - } - - if (sharedEmitter) { - emitOutput.outputFiles.push(sharedEmitter.getOutputFile()); - } - - TypeScript.declarationEmitTime += new Date().getTime() - start; - - return emitOutput; - }; - - TypeScriptCompiler.prototype.emitDeclarations = function (fileName, resolvePath) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; + if (node) { + var links = getNodeLinks(node); + if (links.isVisible === undefined) { + links.isVisible = !!determineIfDeclarationIsVisible(); + } + return links.isVisible; } - - var document = this.getDocument(fileName); - - if (document.emitToOwnOutputFile()) { - this._emitDocumentDeclarations(document, emitOptions, function (file) { - return emitOutput.outputFiles.push(file); - }, null); - return emitOutput; - } else { - return this.emitAllDeclarations(resolvePath); + } + function getTypeOfPrototypeProperty(prototype) { + var classType = getDeclaredTypeOfSymbol(prototype.parent); + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + } + function getTypeOfVariableOrParameterOrPropertyDeclaration(declaration) { + if (declaration.parent.kind === 171 /* ForInStatement */) { + return anyType; } - }; - - TypeScriptCompiler.prototype.canEmitDeclarations = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var document = this.getDocument(fileName); - return this._shouldEmitDeclarations(document); - }; - - TypeScriptCompiler.mapToFileNameExtension = function (extension, fileName, wholeFileNameReplaced) { - if (wholeFileNameReplaced) { - return fileName; - } else { - var splitFname = fileName.split("."); - splitFname.pop(); - return splitFname.join(".") + extension; + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); } - }; - - TypeScriptCompiler.mapToJSFileName = function (fileName, wholeFileNameReplaced) { - return TypeScriptCompiler.mapToFileNameExtension(".js", fileName, wholeFileNameReplaced); - }; - - TypeScriptCompiler.prototype.emitDocumentWorker = function (document, emitOptions, emitter) { - var sourceUnit = document.sourceUnit(); - TypeScript.Debug.assert(this._shouldEmit(document)); - - var typeScriptFileName = document.fileName; - if (!emitter) { - var javaScriptFileName = this.mapOutputFileName(document, emitOptions, TypeScriptCompiler.mapToJSFileName); - var outFile = new TypeScript.TextWriter(javaScriptFileName, this.writeByteOrderMarkForDocument(document), 0 /* JavaScript */); - - emitter = new TypeScript.Emitter(javaScriptFileName, outFile, emitOptions, this.semanticInfoChain); - - if (this.compilationSettings().mapSourceFiles()) { - var sourceMapFile = new TypeScript.TextWriter(javaScriptFileName + TypeScript.SourceMapper.MapFileExtension, false, 1 /* SourceMap */); - emitter.createSourceMapper(document, javaScriptFileName, outFile, sourceMapFile, emitOptions.resolvePath); + if (declaration.kind === 123 /* Parameter */) { + var func = declaration.parent; + if (func.kind === 128 /* SetAccessor */ && !ts.hasComputedNameButNotSymbol(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 127 /* GetAccessor */); + if (getter) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + } + } + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; } - } else if (this.compilationSettings().mapSourceFiles()) { - emitter.setSourceMapperNewSourceFile(document); } - - emitter.setDocument(document); - emitter.emitJavascript(sourceUnit, false); - - return emitter; - }; - - TypeScriptCompiler.prototype._emitDocument = function (document, emitOptions, onSingleFileEmitComplete, sharedEmitter) { - if (this._shouldEmit(document)) { - if (document.emitToOwnOutputFile()) { - var singleEmitter = this.emitDocumentWorker(document, emitOptions); - if (singleEmitter) { - onSingleFileEmitComplete(singleEmitter.getOutputFiles()); + if (declaration.initializer) { + var type = checkAndMarkExpression(declaration.initializer); + if (declaration.kind !== 198 /* PropertyAssignment */) { + var unwidenedType = type; + type = getWidenedType(type); + if (type !== unwidenedType) { + checkImplicitAny(type); } - } else { - sharedEmitter = this.emitDocumentWorker(document, emitOptions, sharedEmitter); } + return type; } - - return sharedEmitter; - }; - - TypeScriptCompiler.prototype.emitAll = function (resolvePath) { - var start = new Date().getTime(); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var fileNames = this.fileNames(); - var sharedEmitter = null; - - for (var i = 0, n = fileNames.length; i < n; i++) { - var fileName = fileNames[i]; - - var document = this.getDocument(fileName); - - sharedEmitter = this._emitDocument(document, emitOptions, function (files) { - return emitOutput.outputFiles.push.apply(emitOutput.outputFiles, files); - }, sharedEmitter); - } - - if (sharedEmitter) { - emitOutput.outputFiles.push.apply(emitOutput.outputFiles, sharedEmitter.getOutputFiles()); - } - - TypeScript.emitTime += new Date().getTime() - start; - return emitOutput; - }; - - TypeScriptCompiler.prototype.emit = function (fileName, resolvePath) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var document = this.getDocument(fileName); - - if (document.emitToOwnOutputFile()) { - this._emitDocument(document, emitOptions, function (files) { - return emitOutput.outputFiles.push.apply(emitOutput.outputFiles, files); - }, null); - return emitOutput; - } else { - return this.emitAll(resolvePath); + if (declaration.kind === 199 /* ShorthandPropertyAssignment */) { + var type = checkIdentifier(declaration.name); + return type; } - }; - - TypeScriptCompiler.prototype.compile = function (resolvePath, continueOnDiagnostics) { - if (typeof continueOnDiagnostics === "undefined") { continueOnDiagnostics = false; } - return new CompilerIterator(this, resolvePath, continueOnDiagnostics); - }; - - TypeScriptCompiler.prototype.getSyntacticDiagnostics = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - return this.getDocument(fileName).diagnostics(); - }; - - TypeScriptCompiler.prototype.getSyntaxTree = function (fileName) { - return this.getDocument(fileName).syntaxTree(); - }; - - TypeScriptCompiler.prototype.getSourceUnit = function (fileName) { - return this.getDocument(fileName).sourceUnit(); - }; - - TypeScriptCompiler.prototype.getSemanticDiagnostics = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - - var document = this.getDocument(fileName); - - var startTime = (new Date()).getTime(); - TypeScript.PullTypeResolver.typeCheck(this.compilationSettings(), this.semanticInfoChain, document); - var endTime = (new Date()).getTime(); - - TypeScript.typeCheckTime += endTime - startTime; - - var errors = this.semanticInfoChain.getDiagnostics(fileName); - - errors = TypeScript.ArrayUtilities.distinct(errors, TypeScript.Diagnostic.equals); - errors.sort(function (d1, d2) { - if (d1.fileName() < d2.fileName()) { - return -1; - } else if (d1.fileName() > d2.fileName()) { - return 1; + var type = ts.hasDotDotDotToken(declaration) ? createArrayType(anyType) : anyType; + checkImplicitAny(type); + return type; + function checkImplicitAny(type) { + if (!fullTypeCheck || !compilerOptions.noImplicitAny) { + return; } - - if (d1.start() < d2.start()) { - return -1; - } else if (d1.start() > d2.start()) { - return 1; + if (getInnermostTypeOfNestedArrayTypes(type) !== anyType) { + return; } - - var code1 = TypeScript.diagnosticInformationMap[d1.diagnosticKey()].code; - var code2 = TypeScript.diagnosticInformationMap[d2.diagnosticKey()].code; - if (code1 < code2) { - return -1; - } else if (code1 > code2) { - return 1; + if (isPrivateWithinAmbient(declaration) || (declaration.kind === 123 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { + return; } - - return 0; - }); - - return errors; - }; - - TypeScriptCompiler.prototype.getCompilerOptionsDiagnostics = function (resolvePath) { - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - var emitDiagnostic = emitOptions.diagnostic(); - if (emitDiagnostic) { - return [emitDiagnostic]; + switch (declaration.kind) { + case 124 /* Property */: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 123 /* Parameter */: + var diagnostic = ts.hasDotDotDotToken(declaration) ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + default: + var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + } + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeToString(type)); } - return TypeScript.sentinelEmptyArray; - }; - - TypeScriptCompiler.prototype.resolveAllFiles = function () { - var fileNames = this.fileNames(); - for (var i = 0, n = fileNames.length; i < n; i++) { - this.getSemanticDiagnostics(fileNames[i]); + } + function getTypeOfVariableOrParameterOrProperty(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + if (symbol.flags & 536870912 /* Prototype */) { + return links.type = getTypeOfPrototypeProperty(symbol); + } + var declaration = symbol.valueDeclaration; + if (declaration.kind === 197 /* CatchClause */) { + return links.type = anyType; + } + links.type = resolvingType; + var type = getTypeOfVariableOrParameterOrPropertyDeclaration(declaration); + if (links.type === resolvingType) { + links.type = type; + } } - }; - - TypeScriptCompiler.prototype.getSymbolOfDeclaration = function (decl) { - if (!decl) { - return null; + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } } - - var resolver = this.semanticInfoChain.getResolver(); - var ast = this.semanticInfoChain.getASTForDecl(decl); - if (!ast) { - return null; + return links.type; + } + function getSetAccessorTypeAnnotationNode(accessor) { + return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + } + function getAnnotatedAccessorType(accessor) { + if (accessor) { + if (accessor.kind === 127 /* GetAccessor */) { + return accessor.type && getTypeFromTypeNode(accessor.type); + } + else { + var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + } } - - var enclosingDecl = resolver.getEnclosingDecl(decl); - if (ast.kind() === 139 /* GetAccessor */ || ast.kind() === 140 /* SetAccessor */) { - return this.getSymbolOfDeclaration(enclosingDecl); + return undefined; + } + function getTypeOfAccessors(symbol) { + var links = getSymbolLinks(symbol); + checkAndStoreTypeOfAccessors(symbol, links); + return links.type; + } + function checkAndStoreTypeOfAccessors(symbol, links) { + links = links || getSymbolLinks(symbol); + if (!links.type) { + links.type = resolvingType; + var getter = ts.getDeclarationOfKind(symbol, 127 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 128 /* SetAccessor */); + var type; + var getterReturnType = getAnnotatedAccessorType(getter); + if (getterReturnType) { + type = getterReturnType; + } + else { + var setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + type = setterParameterType; + } + else { + if (getter && getter.body) { + type = getReturnTypeFromBody(getter); + } + else { + if (compilerOptions.noImplicitAny) { + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); + } + type = anyType; + } + } + } + if (links.type === resolvingType) { + links.type = type; + } } - - return resolver.resolveAST(ast, false, new TypeScript.PullTypeResolutionContext(resolver)); - }; - - TypeScriptCompiler.prototype.extractResolutionContextFromAST = function (resolver, ast, document, propagateContextualTypes) { - var scriptName = document.fileName; - - var enclosingDecl = null; - var enclosingDeclAST = null; - var inContextuallyTypedAssignment = false; - var inWithBlock = false; - - var resolutionContext = new TypeScript.PullTypeResolutionContext(resolver); - - if (!ast) { - return null; + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = ts.getDeclarationOfKind(symbol, 127 /* GetAccessor */); + error(getter, ts.Diagnostics._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, symbolToString(symbol)); + } } - - var path = this.getASTPath(ast); - - for (var i = 0, n = path.length; i < n; i++) { - var current = path[i]; - - switch (current.kind()) { - case 222 /* FunctionExpression */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - if (propagateContextualTypes) { - resolver.resolveAST(current, true, resolutionContext); - } - break; - - case 136 /* MemberVariableDeclaration */: - var memberVariable = current; - inContextuallyTypedAssignment = memberVariable.variableDeclarator.typeAnnotation !== null; - - this.extractResolutionContextForVariable(inContextuallyTypedAssignment, propagateContextualTypes, resolver, resolutionContext, enclosingDecl, memberVariable, memberVariable.variableDeclarator.equalsValueClause); - break; - - case 225 /* VariableDeclarator */: - var variableDeclarator = current; - inContextuallyTypedAssignment = variableDeclarator.typeAnnotation !== null; - - this.extractResolutionContextForVariable(inContextuallyTypedAssignment, propagateContextualTypes, resolver, resolutionContext, enclosingDecl, variableDeclarator, variableDeclarator.equalsValueClause); - break; - - case 213 /* InvocationExpression */: - case 216 /* ObjectCreationExpression */: - if (propagateContextualTypes) { - var isNew = current.kind() === 216 /* ObjectCreationExpression */; - var callExpression = current; - var contextualType = null; - - if ((i + 2 < n) && callExpression.argumentList === path[i + 1] && callExpression.argumentList.arguments === path[i + 2]) { - var callResolutionResults = new TypeScript.PullAdditionalCallResolutionData(); - if (isNew) { - resolver.resolveObjectCreationExpression(callExpression, resolutionContext, callResolutionResults); - } else { - resolver.resolveInvocationExpression(callExpression, resolutionContext, callResolutionResults); - } - - if (callResolutionResults.actualParametersContextTypeSymbols) { - var argExpression = path[i + 3]; - if (argExpression) { - for (var j = 0, m = callExpression.argumentList.arguments.nonSeparatorCount(); j < m; j++) { - if (callExpression.argumentList.arguments.nonSeparatorAt(j) === argExpression) { - var callContextualType = callResolutionResults.actualParametersContextTypeSymbols[j]; - if (callContextualType) { - contextualType = callContextualType; - break; - } - } - } - } - } - } else { - if (isNew) { - resolver.resolveObjectCreationExpression(callExpression, resolutionContext); - } else { - resolver.resolveInvocationExpression(callExpression, resolutionContext); - } + } + function getTypeOfFuncClassEnumModule(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = createObjectType(32768 /* Anonymous */, symbol); + } + return links.type; + } + function getTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + } + return links.type; + } + function getTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getTypeOfSymbol(resolveImport(symbol)); + } + return links.type; + } + function getTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + } + return links.type; + } + function getTypeOfSymbol(symbol) { + if (symbol.flags & 67108864 /* Instantiated */) { + return getTypeOfInstantiatedSymbol(symbol); + } + if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) { + return getTypeOfVariableOrParameterOrProperty(symbol); + } + if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + return getTypeOfFuncClassEnumModule(symbol); + } + if (symbol.flags & 8 /* EnumMember */) { + return getTypeOfEnumMember(symbol); + } + if (symbol.flags & 98304 /* Accessor */) { + return getTypeOfAccessors(symbol); + } + if (symbol.flags & 33554432 /* Import */) { + return getTypeOfImport(symbol); + } + return unknownType; + } + function getTargetType(type) { + return type.flags & 4096 /* Reference */ ? type.target : type; + } + function hasBaseType(type, checkBase) { + return check(type); + function check(type) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(target.baseTypes, check); + } + } + function getTypeParametersOfClassOrInterface(symbol) { + var result; + ts.forEach(symbol.declarations, function (node) { + if (node.kind === 186 /* InterfaceDeclaration */ || node.kind === 185 /* ClassDeclaration */) { + var declaration = node; + if (declaration.typeParameters && declaration.typeParameters.length) { + ts.forEach(declaration.typeParameters, function (node) { + var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!result) { + result = [tp]; } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 214 /* ArrayLiteralExpression */: - if (propagateContextualTypes) { - var contextualType = null; - var currentContextualType = resolutionContext.getContextualType(); - if (currentContextualType && currentContextualType.isArrayNamedTypeReference()) { - contextualType = currentContextualType.getElementType(); + else if (!ts.contains(result, tp)) { + result.push(tp); } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 215 /* ObjectLiteralExpression */: - if (propagateContextualTypes) { - var objectLiteralExpression = current; - var objectLiteralResolutionContext = new TypeScript.PullAdditionalObjectLiteralResolutionData(); - resolver.resolveObjectLiteralExpression(objectLiteralExpression, inContextuallyTypedAssignment, resolutionContext, objectLiteralResolutionContext); - - var memeberAST = (path[i + 1] && path[i + 1].kind() === 2 /* SeparatedList */) ? path[i + 2] : path[i + 1]; - if (memeberAST) { - var contextualType = null; - var memberDecls = objectLiteralExpression.propertyAssignments; - if (memberDecls && objectLiteralResolutionContext.membersContextTypeSymbols) { - for (var j = 0, m = memberDecls.nonSeparatorCount(); j < m; j++) { - if (memberDecls.nonSeparatorAt(j) === memeberAST) { - var memberContextualType = objectLiteralResolutionContext.membersContextTypeSymbols[j]; - if (memberContextualType) { - contextualType = memberContextualType; - break; - } - } - } - } - - resolutionContext.pushNewContextualType(contextualType); + }); + } + } + }); + return result; + } + function getDeclaredTypeOfClass(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(1024 /* Class */, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096 /* Reference */; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + var declaration = ts.getDeclarationOfKind(symbol, 185 /* ClassDeclaration */); + var baseTypeNode = ts.getClassBaseTypeNode(declaration); + if (baseTypeNode) { + var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & 1024 /* Class */) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); } - } - - break; - - case 174 /* AssignmentExpression */: - if (propagateContextualTypes) { - var assignmentExpression = current; - var contextualType = null; - - if (path[i + 1] && path[i + 1] === assignmentExpression.right) { - var leftType = resolver.resolveAST(assignmentExpression.left, inContextuallyTypedAssignment, resolutionContext).type; - if (leftType) { - inContextuallyTypedAssignment = true; - contextualType = leftType; - } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); } - - resolutionContext.pushNewContextualType(contextualType); } - - break; - - case 220 /* CastExpression */: - var castExpression = current; - if (!(i + 1 < n && path[i + 1] === castExpression.type)) { - if (propagateContextualTypes) { - var contextualType = null; - var typeSymbol = resolver.resolveAST(castExpression, inContextuallyTypedAssignment, resolutionContext).type; - - if (typeSymbol) { - inContextuallyTypedAssignment = true; - contextualType = typeSymbol; - } - - resolutionContext.pushNewContextualType(contextualType); - } + else { + error(baseTypeNode, ts.Diagnostics.A_class_may_only_extend_another_class); } - - break; - - case 150 /* ReturnStatement */: - if (propagateContextualTypes) { - var returnStatement = current; - var contextualType = null; - - if (enclosingDecl && (enclosingDecl.kind & 1032192 /* SomeFunction */)) { - var typeAnnotation = TypeScript.ASTHelpers.getType(enclosingDeclAST); - if (typeAnnotation) { - var returnTypeSymbol = resolver.resolveTypeReference(typeAnnotation, resolutionContext); - if (returnTypeSymbol) { - inContextuallyTypedAssignment = true; - contextualType = returnTypeSymbol; + } + } + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = emptyArray; + type.declaredConstructSignatures = emptyArray; + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + } + return links.declaredType; + } + function getDeclaredTypeOfInterface(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(2048 /* Interface */, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096 /* Reference */; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 186 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { + var baseType = getTypeFromTypeReferenceNode(node); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & (1024 /* Class */ | 2048 /* Interface */)) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); } - } else { - var currentContextualType = resolutionContext.getContextualType(); - if (currentContextualType && currentContextualType.isFunction()) { - var contextualSignatures = currentContextualType.kind == 33554432 /* ConstructorType */ ? currentContextualType.getConstructSignatures() : currentContextualType.getCallSignatures(); - var currentContextualTypeSignatureSymbol = contextualSignatures[0]; - var currentContextualTypeReturnTypeSymbol = currentContextualTypeSignatureSymbol.returnType; - if (currentContextualTypeReturnTypeSymbol) { - inContextuallyTypedAssignment = true; - contextualType = currentContextualTypeReturnTypeSymbol; - } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); } } + else { + error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + } } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 122 /* ObjectType */: - if (propagateContextualTypes && TypeScript.isTypesOnlyLocation(current)) { - resolver.resolveAST(current, false, resolutionContext); - } - - break; - - case 163 /* WithStatement */: - inWithBlock = true; - break; - - case 146 /* Block */: - inContextuallyTypedAssignment = false; - break; - } - - var decl = this.semanticInfoChain.getDeclForAST(current); - if (decl) { - enclosingDecl = decl; - enclosingDeclAST = current; - } - } - - if (ast && ast.parent && ast.kind() === 11 /* IdentifierName */) { - if (ast.parent.kind() === 212 /* MemberAccessExpression */) { - if (ast.parent.name === ast) { - ast = ast.parent; - } - } else if (ast.parent.kind() === 121 /* QualifiedName */) { - if (ast.parent.right === ast) { - ast = ast.parent; + }); } + }); + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + } + return links.declaredType; + } + function getDeclaredTypeOfTypeAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = resolvingType; + var declaration = ts.getDeclarationOfKind(symbol, 187 /* TypeAliasDeclaration */); + var type = getTypeFromTypeNode(declaration.type); + if (links.declaredType === resolvingType) { + links.declaredType = type; } } - - return { - ast: ast, - enclosingDecl: enclosingDecl, - resolutionContext: resolutionContext, - inContextuallyTypedAssignment: inContextuallyTypedAssignment, - inWithBlock: inWithBlock - }; - }; - - TypeScriptCompiler.prototype.extractResolutionContextForVariable = function (inContextuallyTypedAssignment, propagateContextualTypes, resolver, resolutionContext, enclosingDecl, assigningAST, init) { - if (inContextuallyTypedAssignment) { - if (propagateContextualTypes) { - resolver.resolveAST(assigningAST, false, resolutionContext); - var varSymbol = this.semanticInfoChain.getSymbolForAST(assigningAST); - - var contextualType = null; - if (varSymbol && inContextuallyTypedAssignment) { - contextualType = varSymbol.type; - } - - resolutionContext.pushNewContextualType(contextualType); - - if (init) { - resolver.resolveAST(init, inContextuallyTypedAssignment, resolutionContext); - } + else if (links.declaredType === resolvingType) { + links.declaredType = unknownType; + var declaration = ts.getDeclarationOfKind(symbol, 187 /* TypeAliasDeclaration */); + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfEnum(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(128 /* Enum */); + type.symbol = symbol; + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfTypeParameter(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(512 /* TypeParameter */); + type.symbol = symbol; + if (!ts.getDeclarationOfKind(symbol, 122 /* TypeParameter */).constraint) { + type.constraint = noConstraintType; } + links.declaredType = type; } - }; - - TypeScriptCompiler.prototype.getASTPath = function (ast) { - var result = []; - - while (ast) { - result.unshift(ast); - ast = ast.parent; + return links.declaredType; + } + function getDeclaredTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = getDeclaredTypeOfSymbol(resolveImport(symbol)); } - - return result; - }; - - TypeScriptCompiler.prototype.pullGetSymbolInformationFromAST = function (ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; + return links.declaredType; + } + function getDeclaredTypeOfSymbol(symbol) { + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0); + if (symbol.flags & 32 /* Class */) { + return getDeclaredTypeOfClass(symbol); } - - ast = context.ast; - var symbol = resolver.resolveAST(ast, context.inContextuallyTypedAssignment, context.resolutionContext); - - if (!symbol) { - TypeScript.Debug.assert(ast.kind() === 120 /* SourceUnit */, "No symbol was found for ast and ast was not source unit. Ast Kind: " + TypeScript.SyntaxKind[ast.kind()]); - return null; + if (symbol.flags & 64 /* Interface */) { + return getDeclaredTypeOfInterface(symbol); } - - if (symbol.isTypeReference()) { - symbol = symbol.getReferencedTypeSymbol(); + if (symbol.flags & 2097152 /* TypeAlias */) { + return getDeclaredTypeOfTypeAlias(symbol); } - - var aliasSymbol = this.semanticInfoChain.getAliasSymbolForAST(ast); - - return { - symbol: symbol, - aliasSymbol: aliasSymbol, - ast: ast, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.pullGetCallInformationFromAST = function (ast, document) { - if (ast.kind() !== 213 /* InvocationExpression */ && ast.kind() !== 216 /* ObjectCreationExpression */) { - return null; + if (symbol.flags & 384 /* Enum */) { + return getDeclaredTypeOfEnum(symbol); } - - var isNew = ast.kind() === 216 /* ObjectCreationExpression */; - - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; + if (symbol.flags & 1048576 /* TypeParameter */) { + return getDeclaredTypeOfTypeParameter(symbol); } - - var callResolutionResults = new TypeScript.PullAdditionalCallResolutionData(); - - if (isNew) { - resolver.resolveObjectCreationExpression(ast, context.resolutionContext, callResolutionResults); - } else { - resolver.resolveInvocationExpression(ast, context.resolutionContext, callResolutionResults); + if (symbol.flags & 33554432 /* Import */) { + return getDeclaredTypeOfImport(symbol); } - - return { - targetSymbol: callResolutionResults.targetSymbol, - resolvedSignatures: callResolutionResults.resolvedSignatures, - candidateSignature: callResolutionResults.candidateSignature, - ast: ast, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl), - isConstructorCall: isNew - }; - }; - - TypeScriptCompiler.prototype.pullGetVisibleMemberSymbolsFromAST = function (ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; + return unknownType; + } + function createSymbolTable(symbols) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = symbol; } - - var symbols = resolver.getVisibleMembersFromExpression(ast, context.enclosingDecl, context.resolutionContext); - if (!symbols) { - return null; + return result; + } + function createInstantiatedSymbolTable(symbols, mapper) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = instantiateSymbol(symbol, mapper); } - - return { - symbols: symbols, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.pullGetVisibleDeclsFromAST = function (ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, false); - if (!context || context.inWithBlock) { - return null; + return result; + } + function addInheritedMembers(symbols, baseSymbols) { + for (var i = 0; i < baseSymbols.length; i++) { + var s = baseSymbols[i]; + if (!ts.hasProperty(symbols, s.name)) { + symbols[s.name] = s; + } } - - return resolver.getVisibleDecls(context.enclosingDecl); - }; - - TypeScriptCompiler.prototype.pullGetContextualMembersFromAST = function (ast, document) { - if (ast.kind() !== 215 /* ObjectLiteralExpression */) { - return null; + } + function addInheritedSignatures(signatures, baseSignatures) { + if (baseSignatures) { + for (var i = 0; i < baseSignatures.length; i++) { + signatures.push(baseSignatures[i]); + } } - - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; + } + function resolveClassOrInterfaceMembers(type) { + var members = type.symbol.members; + var callSignatures = type.declaredCallSignatures; + var constructSignatures = type.declaredConstructSignatures; + var stringIndexType = type.declaredStringIndexType; + var numberIndexType = type.declaredNumberIndexType; + if (type.baseTypes.length) { + members = createSymbolTable(type.declaredProperties); + ts.forEach(type.baseTypes, function (baseType) { + addInheritedMembers(members, getPropertiesOfObjectType(baseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0 /* Call */)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1 /* Construct */)); + stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0 /* String */); + numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1 /* Number */); + }); } - - var members = resolver.getVisibleContextSymbols(context.enclosingDecl, context.resolutionContext); - - return { - symbols: members, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.pullGetDeclInformation = function (decl, ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveTypeReferenceMembers(type) { + var target = type.target; + var mapper = createTypeMapper(target.typeParameters, type.typeArguments); + var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); + var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); + var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); + var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; + var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; + ts.forEach(target.baseTypes, function (baseType) { + var instantiatedBaseType = instantiateType(baseType, mapper); + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); + }); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function createSignature(declaration, typeParameters, parameters, resolvedReturnType, minArgumentCount, hasRestParameter, hasStringLiterals) { + var sig = new Signature(checker); + sig.declaration = declaration; + sig.typeParameters = typeParameters; + sig.parameters = parameters; + sig.resolvedReturnType = resolvedReturnType; + sig.minArgumentCount = minArgumentCount; + sig.hasRestParameter = hasRestParameter; + sig.hasStringLiterals = hasStringLiterals; + return sig; + } + function cloneSignature(sig) { + return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + } + function getDefaultConstructSignatures(classType) { + if (classType.baseTypes.length) { + var baseType = classType.baseTypes[0]; + var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1 /* Construct */); + return ts.map(baseSignatures, function (baseSignature) { + var signature = baseType.flags & 4096 /* Reference */ ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + signature.typeParameters = classType.typeParameters; + signature.resolvedReturnType = classType; + return signature; + }); } - - var astForDecl = decl.ast(); - if (!astForDecl) { - return null; + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; } - - var astForDeclContext = this.extractResolutionContextFromAST(resolver, astForDecl, this.getDocument(astForDecl.fileName()), true); - if (!astForDeclContext) { - return null; + return members; + } + function resolveTupleTypeMembers(type) { + var arrayType = resolveObjectOrUnionTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } + function signatureListsIdentical(s, t) { + if (s.length !== t.length) { + return false; } - - var symbol = decl.getSymbol(); - resolver.resolveDeclaredSymbol(symbol, context.resolutionContext); - symbol.setUnresolved(); - - return { - symbol: symbol, - aliasSymbol: null, - ast: ast, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.topLevelDeclaration = function (fileName) { - return this.semanticInfoChain.topLevelDecl(fileName); - }; - - TypeScriptCompiler.prototype.getDeclForAST = function (ast) { - return this.semanticInfoChain.getDeclForAST(ast); - }; - - TypeScriptCompiler.prototype.fileNames = function () { - return this.semanticInfoChain.fileNames(); - }; - - TypeScriptCompiler.prototype.topLevelDecl = function (fileName) { - return this.semanticInfoChain.topLevelDecl(fileName); - }; - - TypeScriptCompiler.getLocationText = function (location, resolvePath) { - return resolvePath(location.fileName()) + "(" + (location.line() + 1) + "," + (location.character() + 1) + ")"; - }; - - TypeScriptCompiler.getFullDiagnosticText = function (diagnostic, resolvePath) { - var result = ""; - if (diagnostic.fileName()) { - result += this.getLocationText(diagnostic, resolvePath) + ": "; + for (var i = 0; i < s.length; i++) { + if (!compareSignatures(s[i], t[i], false, compareTypes)) { + return false; + } } - - result += diagnostic.message(); - - var additionalLocations = diagnostic.additionalLocations(); - if (additionalLocations.length > 0) { - result += " " + TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Additional_locations, null) + TypeScript.Environment.newLine; - - for (var i = 0, n = additionalLocations.length; i < n; i++) { - result += "\t" + this.getLocationText(additionalLocations[i], resolvePath) + TypeScript.Environment.newLine; + return true; + } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatures = signatureLists[0]; + for (var i = 0; i < signatures.length; i++) { + if (signatures[i].typeParameters) { + return emptyArray; } - } else { - result += TypeScript.Environment.newLine; } - - return result; - }; - return TypeScriptCompiler; - })(); - TypeScript.TypeScriptCompiler = TypeScriptCompiler; - - var CompilerPhase; - (function (CompilerPhase) { - CompilerPhase[CompilerPhase["Syntax"] = 0] = "Syntax"; - CompilerPhase[CompilerPhase["Semantics"] = 1] = "Semantics"; - CompilerPhase[CompilerPhase["EmitOptionsValidation"] = 2] = "EmitOptionsValidation"; - CompilerPhase[CompilerPhase["Emit"] = 3] = "Emit"; - CompilerPhase[CompilerPhase["DeclarationEmit"] = 4] = "DeclarationEmit"; - })(CompilerPhase || (CompilerPhase = {})); - - var CompilerIterator = (function () { - function CompilerIterator(compiler, resolvePath, continueOnDiagnostics, startingPhase) { - if (typeof startingPhase === "undefined") { startingPhase = 0 /* Syntax */; } - this.compiler = compiler; - this.resolvePath = resolvePath; - this.continueOnDiagnostics = continueOnDiagnostics; - this.index = -1; - this.fileNames = null; - this._current = null; - this._emitOptions = null; - this._sharedEmitter = null; - this._sharedDeclarationEmitter = null; - this.hadSyntacticDiagnostics = false; - this.hadSemanticDiagnostics = false; - this.hadEmitDiagnostics = false; - this.fileNames = compiler.fileNames(); - this.compilerPhase = startingPhase; - } - CompilerIterator.prototype.current = function () { - return this._current; - }; - - CompilerIterator.prototype.moveNext = function () { - this._current = null; - - while (this.moveNextInternal()) { - if (this._current) { - return true; + for (var i = 1; i < signatureLists.length; i++) { + if (!signatureListsIdentical(signatures, signatureLists[i])) { + return emptyArray; } } - - return false; - }; - - CompilerIterator.prototype.moveNextInternal = function () { - this.index++; - - while (this.shouldMoveToNextPhase()) { - this.index = 0; - this.compilerPhase++; + var result = ts.map(signatures, cloneSignature); + for (var i = 0; i < result.length; i++) { + var s = result[i]; + s.resolvedReturnType = undefined; + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); } - - if (this.compilerPhase > 4 /* DeclarationEmit */) { - return false; + return result; + } + function getUnionIndexType(types, kind) { + var indexTypes = []; + for (var i = 0; i < types.length; i++) { + var indexType = getIndexTypeOfType(types[i], kind); + if (!indexType) { + return undefined; + } + indexTypes.push(indexType); + } + return getUnionType(indexTypes); + } + function resolveUnionTypeMembers(type) { + var callSignatures = getUnionSignatures(type.types, 0 /* Call */); + var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */); + var stringIndexType = getUnionIndexType(type.types, 0 /* String */); + var numberIndexType = getUnionIndexType(type.types, 1 /* Number */); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveAnonymousTypeMembers(type) { + var symbol = type.symbol; + if (symbol.flags & 2048 /* TypeLiteral */) { + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); + var numberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + } + else { + var members = emptySymbols; + var callSignatures = emptyArray; + var constructSignatures = emptyArray; + if (symbol.flags & 1952 /* HasExports */) { + members = symbol.exports; + } + if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { + callSignatures = getSignaturesOfSymbol(symbol); + } + if (symbol.flags & 32 /* Class */) { + var classType = getDeclaredTypeOfClass(symbol); + constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + if (!constructSignatures.length) { + constructSignatures = getDefaultConstructSignatures(classType); + } + if (classType.baseTypes.length) { + members = createSymbolTable(getNamedMembers(members)); + addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); + } + } + var stringIndexType = undefined; + var numberIndexType = (symbol.flags & 384 /* Enum */) ? stringType : undefined; } - - switch (this.compilerPhase) { - case 0 /* Syntax */: - return this.moveNextSyntaxPhase(); - case 1 /* Semantics */: - return this.moveNextSemanticsPhase(); - case 2 /* EmitOptionsValidation */: - return this.moveNextEmitOptionsValidationPhase(); - case 3 /* Emit */: - return this.moveNextEmitPhase(); - case 4 /* DeclarationEmit */: - return this.moveNextDeclarationEmitPhase(); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveObjectOrUnionTypeMembers(type) { + if (!type.members) { + if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { + resolveClassOrInterfaceMembers(type); + } + else if (type.flags & 32768 /* Anonymous */) { + resolveAnonymousTypeMembers(type); + } + else if (type.flags & 8192 /* Tuple */) { + resolveTupleTypeMembers(type); + } + else if (type.flags & 16384 /* Union */) { + resolveUnionTypeMembers(type); + } + else { + resolveTypeReferenceMembers(type); + } } - }; - - CompilerIterator.prototype.shouldMoveToNextPhase = function () { - switch (this.compilerPhase) { - case 2 /* EmitOptionsValidation */: - return this.index === 1; - - case 0 /* Syntax */: - case 1 /* Semantics */: - return this.index === this.fileNames.length; - - case 3 /* Emit */: - case 4 /* DeclarationEmit */: - return this.index === (this.fileNames.length + 1); + return type; + } + function getPropertiesOfObjectType(type) { + if (type.flags & 48128 /* ObjectType */) { + return resolveObjectOrUnionTypeMembers(type).properties; } - - return false; - }; - - CompilerIterator.prototype.moveNextSyntaxPhase = function () { - TypeScript.Debug.assert(this.index >= 0 && this.index < this.fileNames.length); - var fileName = this.fileNames[this.index]; - - var diagnostics = this.compiler.getSyntacticDiagnostics(fileName); - if (diagnostics.length) { - if (!this.continueOnDiagnostics) { - this.hadSyntacticDiagnostics = true; + return emptyArray; + } + function getPropertyOfObjectType(type, name) { + if (type.flags & 48128 /* ObjectType */) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } } - - this._current = CompileResult.fromDiagnostics(diagnostics); } - - return true; - }; - - CompilerIterator.prototype.moveNextSemanticsPhase = function () { - if (this.hadSyntacticDiagnostics) { - return false; + } + function getPropertiesOfUnionType(type) { + var result = []; + ts.forEach(getPropertiesOfType(type.types[0]), function (prop) { + var unionProp = getPropertyOfUnionType(type, prop.name); + if (unionProp) { + result.push(unionProp); + } + }); + return result; + } + function getPropertiesOfType(type) { + if (type.flags & 16384 /* Union */) { + return getPropertiesOfUnionType(type); } - - TypeScript.Debug.assert(this.index >= 0 && this.index < this.fileNames.length); - var fileName = this.fileNames[this.index]; - var diagnostics = this.compiler.getSemanticDiagnostics(fileName); - if (diagnostics.length) { - if (!this.continueOnDiagnostics) { - this.hadSemanticDiagnostics = true; + return getPropertiesOfObjectType(getApparentType(type)); + } + function getApparentType(type) { + if (type.flags & 512 /* TypeParameter */) { + do { + type = getConstraintOfTypeParameter(type); + } while (type && type.flags & 512 /* TypeParameter */); + if (!type) { + type = emptyObjectType; } - - this._current = CompileResult.fromDiagnostics(diagnostics); } - - return true; - }; - - CompilerIterator.prototype.moveNextEmitOptionsValidationPhase = function () { - TypeScript.Debug.assert(!this.hadSyntacticDiagnostics); - - if (!this._emitOptions) { - this._emitOptions = new TypeScript.EmitOptions(this.compiler, this.resolvePath); + if (type.flags & 258 /* StringLike */) { + type = globalStringType; + } + else if (type.flags & 132 /* NumberLike */) { + type = globalNumberType; } - - if (this._emitOptions.diagnostic()) { - if (!this.continueOnDiagnostics) { - this.hadEmitDiagnostics = true; + else if (type.flags & 8 /* Boolean */) { + type = globalBooleanType; + } + return type; + } + function createUnionProperty(unionType, name) { + var types = unionType.types; + var props; + for (var i = 0; i < types.length; i++) { + var type = getApparentType(types[i]); + if (type !== unknownType) { + var prop = getPropertyOfType(type, name); + if (!prop) { + return undefined; + } + if (!props) { + props = [prop]; + } + else { + props.push(prop); + } } - - this._current = CompileResult.fromDiagnostics([this._emitOptions.diagnostic()]); } - - return true; - }; - - CompilerIterator.prototype.moveNextEmitPhase = function () { - var _this = this; - TypeScript.Debug.assert(!this.hadSyntacticDiagnostics); - TypeScript.Debug.assert(this._emitOptions); - - if (this.hadEmitDiagnostics) { - return false; + var propTypes = []; + var declarations = []; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (prop.declarations) { + declarations.push.apply(declarations, prop.declarations); + } + propTypes.push(getTypeOfSymbol(prop)); } - - TypeScript.Debug.assert(this.index >= 0 && this.index <= this.fileNames.length); - if (this.index < this.fileNames.length) { - var fileName = this.fileNames[this.index]; - var document = this.compiler.getDocument(fileName); - - this._sharedEmitter = this.compiler._emitDocument(document, this._emitOptions, function (outputFiles) { - _this._current = CompileResult.fromOutputFiles(outputFiles); - }, this._sharedEmitter); - return true; + var result = createSymbol(4 /* Property */ | 268435456 /* Transient */ | 1073741824 /* UnionProperty */, name); + result.unionType = unionType; + result.declarations = declarations; + result.type = getUnionType(propTypes); + return result; + } + function getPropertyOfUnionType(type, name) { + var properties = type.resolvedProperties || (type.resolvedProperties = {}); + if (ts.hasProperty(properties, name)) { + return properties[name]; } - - if (this.index === this.fileNames.length && this._sharedEmitter) { - this._current = CompileResult.fromOutputFiles(this._sharedEmitter.getOutputFiles()); + var property = createUnionProperty(type, name); + if (property) { + properties[name] = property; } - - return true; - }; - - CompilerIterator.prototype.moveNextDeclarationEmitPhase = function () { - var _this = this; - TypeScript.Debug.assert(!this.hadSyntacticDiagnostics); - TypeScript.Debug.assert(!this.hadEmitDiagnostics); - if (this.hadSemanticDiagnostics) { - return false; + return property; + } + function getPropertyOfType(type, name) { + if (type.flags & 16384 /* Union */) { + return getPropertyOfUnionType(type, name); } - - if (!this.compiler.compilationSettings().generateDeclarationFiles()) { - return false; + if (!(type.flags & 48128 /* ObjectType */)) { + type = getApparentType(type); + if (!(type.flags & 48128 /* ObjectType */)) { + return undefined; + } } - - TypeScript.Debug.assert(this.index >= 0 && this.index <= this.fileNames.length); - if (this.index < this.fileNames.length) { - var fileName = this.fileNames[this.index]; - var document = this.compiler.getDocument(fileName); - - this._sharedDeclarationEmitter = this.compiler._emitDocumentDeclarations(document, this._emitOptions, function (file) { - _this._current = CompileResult.fromOutputFiles([file]); - }, this._sharedDeclarationEmitter); - return true; + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } } - - if (this.index === this.fileNames.length && this._sharedDeclarationEmitter) { - this._current = CompileResult.fromOutputFiles([this._sharedDeclarationEmitter.getOutputFile()]); + if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) + return symbol; } - - return true; - }; - return CompilerIterator; - })(); - - function compareDataObjects(dst, src) { - for (var e in dst) { - if (typeof dst[e] === "object") { - if (!compareDataObjects(dst[e], src[e])) - return false; - } else if (typeof dst[e] !== "function") { - if (dst[e] !== src[e]) - return false; + return getPropertyOfObjectType(globalObjectType, name); + } + function getSignaturesOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 /* ObjectType */ | 16384 /* Union */)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 /* Call */ ? resolved.callSignatures : resolved.constructSignatures; } + return emptyArray; } - return true; - } - TypeScript.compareDataObjects = compareDataObjects; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (GenerativeTypeClassification) { - GenerativeTypeClassification[GenerativeTypeClassification["Unknown"] = 0] = "Unknown"; - GenerativeTypeClassification[GenerativeTypeClassification["Open"] = 1] = "Open"; - GenerativeTypeClassification[GenerativeTypeClassification["Closed"] = 2] = "Closed"; - GenerativeTypeClassification[GenerativeTypeClassification["InfinitelyExpanding"] = 3] = "InfinitelyExpanding"; - })(TypeScript.GenerativeTypeClassification || (TypeScript.GenerativeTypeClassification = {})); - var GenerativeTypeClassification = TypeScript.GenerativeTypeClassification; - - var PullTypeReferenceSymbol = (function (_super) { - __extends(PullTypeReferenceSymbol, _super); - function PullTypeReferenceSymbol(referencedTypeSymbol) { - _super.call(this, referencedTypeSymbol.name, referencedTypeSymbol.kind); - this.referencedTypeSymbol = referencedTypeSymbol; - this.isResolved = true; - - TypeScript.Debug.assert(referencedTypeSymbol !== null, "Type root symbol may not be null"); - - this.setRootSymbol(referencedTypeSymbol); - - this.typeReference = this; + function getSignaturesOfType(type, kind) { + return getSignaturesOfObjectOrUnionType(getApparentType(type), kind); } - PullTypeReferenceSymbol.createTypeReference = function (type) { - if (type.isTypeReference()) { - return type; - } - - var typeReference = type.typeReference; - - if (!typeReference) { - typeReference = new PullTypeReferenceSymbol(type); - type.typeReference = typeReference; + function getIndexTypeOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 /* ObjectType */ | 16384 /* Union */)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 /* String */ ? resolved.stringIndexType : resolved.numberIndexType; } - - return typeReference; - }; - - PullTypeReferenceSymbol.prototype.isTypeReference = function () { - return true; - }; - - PullTypeReferenceSymbol.prototype.setResolved = function () { - }; - - PullTypeReferenceSymbol.prototype.setUnresolved = function () { - }; - PullTypeReferenceSymbol.prototype.invalidate = function () { - }; - - PullTypeReferenceSymbol.prototype.ensureReferencedTypeIsResolved = function () { - this._getResolver().resolveDeclaredSymbol(this.referencedTypeSymbol); - }; - - PullTypeReferenceSymbol.prototype.getReferencedTypeSymbol = function () { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol; - }; - - PullTypeReferenceSymbol.prototype._getResolver = function () { - return this.referencedTypeSymbol._getResolver(); - }; - - PullTypeReferenceSymbol.prototype.hasMembers = function () { - return this.referencedTypeSymbol.hasMembers(); - }; - - PullTypeReferenceSymbol.prototype.setAssociatedContainerType = function (type) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": setAssociatedContainerType"); - }; - - PullTypeReferenceSymbol.prototype.getAssociatedContainerType = function () { - return this.referencedTypeSymbol.getAssociatedContainerType(); - }; - - PullTypeReferenceSymbol.prototype.getFunctionSymbol = function () { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.getFunctionSymbol(); - }; - PullTypeReferenceSymbol.prototype.setFunctionSymbol = function (symbol) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": setFunctionSymbol"); - }; - - PullTypeReferenceSymbol.prototype.addContainedNonMember = function (nonMember) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addContainedNonMember"); - }; - PullTypeReferenceSymbol.prototype.findContainedNonMemberContainer = function (containerName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.findContainedNonMemberContainer(containerName, kind); - }; - - PullTypeReferenceSymbol.prototype.addMember = function (memberSymbol) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addMember"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedMemberType = function (enclosedType) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedMemberType"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedMemberContainer = function (enclosedContainer) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedMemberContainer"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedNonMember = function (enclosedNonMember) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedNonMember"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedNonMemberType = function (enclosedNonMemberType) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedNonMemberType"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedNonMemberContainer = function (enclosedNonMemberContainer) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedNonMemberContainer"); - }; - PullTypeReferenceSymbol.prototype.addTypeParameter = function (typeParameter) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addTypeParameter"); - }; - PullTypeReferenceSymbol.prototype.addConstructorTypeParameter = function (typeParameter) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addConstructorTypeParameter"); - }; - - PullTypeReferenceSymbol.prototype.findContainedNonMember = function (name) { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findContainedNonMember(name); - }; - - PullTypeReferenceSymbol.prototype.findContainedNonMemberType = function (typeName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findContainedNonMemberType(typeName, kind); - }; - - PullTypeReferenceSymbol.prototype.getMembers = function () { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.getMembers(); - }; - - PullTypeReferenceSymbol.prototype.setHasDefaultConstructor = function (hasOne) { - if (typeof hasOne === "undefined") { hasOne = true; } - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ":setHasDefaultConstructor"); - }; - PullTypeReferenceSymbol.prototype.getHasDefaultConstructor = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getHasDefaultConstructor(); - }; - PullTypeReferenceSymbol.prototype.getConstructorMethod = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getConstructorMethod(); - }; - PullTypeReferenceSymbol.prototype.setConstructorMethod = function (constructorMethod) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": setConstructorMethod"); - }; - PullTypeReferenceSymbol.prototype.getTypeParameters = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypeParameters(); - }; - - PullTypeReferenceSymbol.prototype.isGeneric = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.isGeneric(); - }; - - PullTypeReferenceSymbol.prototype.addSpecialization = function (specializedVersionOfThisType, substitutingTypes) { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.addSpecialization(specializedVersionOfThisType, substitutingTypes); - }; - PullTypeReferenceSymbol.prototype.getSpecialization = function (substitutingTypes) { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getSpecialization(substitutingTypes); - }; - PullTypeReferenceSymbol.prototype.getKnownSpecializations = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getKnownSpecializations(); - }; - PullTypeReferenceSymbol.prototype.getTypeArguments = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypeArguments(); - }; - PullTypeReferenceSymbol.prototype.getTypeArgumentsOrTypeParameters = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypeArgumentsOrTypeParameters(); - }; - - PullTypeReferenceSymbol.prototype.appendCallSignature = function (callSignature) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": appendCallSignature"); - }; - PullTypeReferenceSymbol.prototype.insertCallSignatureAtIndex = function (callSignature, index) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": insertCallSignatureAtIndex"); - }; - PullTypeReferenceSymbol.prototype.appendConstructSignature = function (callSignature) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": appendConstructSignature"); - }; - PullTypeReferenceSymbol.prototype.insertConstructSignatureAtIndex = function (callSignature, index) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": insertConstructSignatureAtIndex"); - }; - PullTypeReferenceSymbol.prototype.addIndexSignature = function (indexSignature) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addIndexSignature"); - }; - - PullTypeReferenceSymbol.prototype.hasOwnCallSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.hasOwnCallSignatures(); - }; - PullTypeReferenceSymbol.prototype.getCallSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getCallSignatures(); - }; - PullTypeReferenceSymbol.prototype.hasOwnConstructSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.hasOwnConstructSignatures(); - }; - PullTypeReferenceSymbol.prototype.getConstructSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getConstructSignatures(); - }; - PullTypeReferenceSymbol.prototype.hasOwnIndexSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.hasOwnIndexSignatures(); - }; - PullTypeReferenceSymbol.prototype.getIndexSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getIndexSignatures(); - }; - - PullTypeReferenceSymbol.prototype.addImplementedType = function (implementedType) { - this.referencedTypeSymbol.addImplementedType(implementedType); - }; - PullTypeReferenceSymbol.prototype.getImplementedTypes = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getImplementedTypes(); - }; - PullTypeReferenceSymbol.prototype.addExtendedType = function (extendedType) { - this.referencedTypeSymbol.addExtendedType(extendedType); - }; - PullTypeReferenceSymbol.prototype.getExtendedTypes = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getExtendedTypes(); - }; - PullTypeReferenceSymbol.prototype.addTypeThatExtendsThisType = function (type) { - this.referencedTypeSymbol.addTypeThatExtendsThisType(type); - }; - PullTypeReferenceSymbol.prototype.getTypesThatExtendThisType = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypesThatExtendThisType(); - }; - PullTypeReferenceSymbol.prototype.addTypeThatExplicitlyImplementsThisType = function (type) { - this.referencedTypeSymbol.addTypeThatExplicitlyImplementsThisType(type); - }; - PullTypeReferenceSymbol.prototype.getTypesThatExplicitlyImplementThisType = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypesThatExplicitlyImplementThisType(); - }; - - PullTypeReferenceSymbol.prototype.isValidBaseKind = function (baseType, isExtendedType) { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.isValidBaseKind(baseType, isExtendedType); - }; - - PullTypeReferenceSymbol.prototype.findMember = function (name, lookInParent) { - if (typeof lookInParent === "undefined") { lookInParent = true; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findMember(name, lookInParent); - }; - PullTypeReferenceSymbol.prototype.findNestedType = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findNestedType(name, kind); - }; - PullTypeReferenceSymbol.prototype.findNestedContainer = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findNestedContainer(name, kind); - }; - PullTypeReferenceSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisiblity) { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.getAllMembers(searchDeclKind, memberVisiblity); - }; - - PullTypeReferenceSymbol.prototype.findTypeParameter = function (name) { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findTypeParameter(name); - }; - - PullTypeReferenceSymbol.prototype.hasOnlyOverloadCallSignatures = function () { - return this.referencedTypeSymbol.hasOnlyOverloadCallSignatures(); - }; - return PullTypeReferenceSymbol; - })(TypeScript.PullTypeSymbol); - TypeScript.PullTypeReferenceSymbol = PullTypeReferenceSymbol; - - TypeScript.nSpecializationsCreated = 0; - TypeScript.nSpecializedSignaturesCreated = 0; - TypeScript.nSpecializedTypeParameterCreated = 0; - - var PullInstantiatedTypeReferenceSymbol = (function (_super) { - __extends(PullInstantiatedTypeReferenceSymbol, _super); - function PullInstantiatedTypeReferenceSymbol(referencedTypeSymbol, _typeParameterArgumentMap, isInstanceReferenceType) { - _super.call(this, referencedTypeSymbol); - this.referencedTypeSymbol = referencedTypeSymbol; - this._typeParameterArgumentMap = _typeParameterArgumentMap; - this.isInstanceReferenceType = isInstanceReferenceType; - this._instantiatedMembers = null; - this._allInstantiatedMemberNameCache = null; - this._instantiatedMemberNameCache = TypeScript.createIntrinsicsObject(); - this._instantiatedCallSignatures = null; - this._instantiatedConstructSignatures = null; - this._instantiatedIndexSignatures = null; - this._typeArgumentReferences = undefined; - this._instantiatedConstructorMethod = null; - this._instantiatedAssociatedContainerType = null; - this._isArray = undefined; - this._generativeTypeClassification = []; - - TypeScript.nSpecializationsCreated++; } - PullInstantiatedTypeReferenceSymbol.prototype.getIsSpecialized = function () { - return !this.isInstanceReferenceType; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getGenerativeTypeClassification = function (enclosingType) { - if (!this.isNamedTypeSymbol()) { - return 0 /* Unknown */; - } - - var generativeTypeClassification = this._generativeTypeClassification[enclosingType.pullSymbolID] || 0 /* Unknown */; - if (generativeTypeClassification === 0 /* Unknown */) { - var typeParameters = enclosingType.getTypeParameters(); - var enclosingTypeParameterMap = []; - for (var i = 0; i < typeParameters.length; i++) { - enclosingTypeParameterMap[typeParameters[i].pullSymbolID] = typeParameters[i]; + function getIndexTypeOfType(type, kind) { + return getIndexTypeOfObjectOrUnionType(getApparentType(type), kind); + } + function getTypeParametersFromDeclaration(typeParameterDeclarations) { + var result = []; + ts.forEach(typeParameterDeclarations, function (node) { + var tp = getDeclaredTypeOfTypeParameter(node.symbol); + if (!ts.contains(result, tp)) { + result.push(tp); } - - var typeArguments = this.getTypeArguments(); - for (var i = 0; i < typeArguments.length; i++) { - if (typeArguments[i].wrapsSomeTypeParameter(enclosingTypeParameterMap, true)) { - generativeTypeClassification = 1 /* Open */; - break; + }); + return result; + } + function getSignatureFromDeclaration(declaration) { + var links = getNodeLinks(declaration); + if (!links.resolvedSignature) { + var classType = declaration.kind === 126 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var parameters = []; + var hasStringLiterals = false; + var minArgumentCount = -1; + for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var param = declaration.parameters[i]; + parameters.push(param.symbol); + if (param.type && param.type.kind === 7 /* StringLiteral */) { + hasStringLiterals = true; + } + if (minArgumentCount < 0) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + minArgumentCount = i; + } } } - - if (generativeTypeClassification === 1 /* Open */) { - if (this.wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType)) { - generativeTypeClassification = 3 /* InfinitelyExpanding */; + if (minArgumentCount < 0) { + minArgumentCount = declaration.parameters.length; + } + var returnType; + if (classType) { + returnType = classType; + } + else if (declaration.type) { + returnType = getTypeFromTypeNode(declaration.type); + } + else { + if (declaration.kind === 127 /* GetAccessor */ && !ts.hasComputedNameButNotSymbol(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 128 /* SetAccessor */); + returnType = getAnnotatedAccessorType(setter); + } + if (!returnType && !declaration.body) { + returnType = anyType; } - } else { - generativeTypeClassification = 2 /* Closed */; } - - this._generativeTypeClassification[enclosingType.pullSymbolID] = generativeTypeClassification; - } - - return generativeTypeClassification; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.isArrayNamedTypeReference = function () { - if (this._isArray === undefined) { - this._isArray = this.getRootSymbol().isArrayNamedTypeReference() || (this.getRootSymbol() === this._getResolver().getArrayNamedType()); - } - return this._isArray; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getElementType = function () { - if (!this.isArrayNamedTypeReference()) { - return null; - } - - var typeArguments = this.getTypeArguments(); - return typeArguments ? typeArguments[0] : null; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getReferencedTypeSymbol = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.getIsSpecialized()) { - return this; + links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, minArgumentCount, ts.hasRestParameters(declaration), hasStringLiterals); } - - return this.referencedTypeSymbol; - }; - - PullInstantiatedTypeReferenceSymbol.create = function (resolver, type, typeParameterArgumentMap) { - TypeScript.Debug.assert(resolver); - - var mutableTypeParameterMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(typeParameterArgumentMap); - - TypeScript.PullInstantiationHelpers.instantiateTypeArgument(resolver, type, mutableTypeParameterMap); - - var rootType = type.getRootSymbol(); - var instantiation = rootType.getSpecialization(mutableTypeParameterMap.typeParameterArgumentMap); - if (instantiation) { - return instantiation; + return links.resolvedSignature; + } + function getSignaturesOfSymbol(symbol) { + if (!symbol) + return emptyArray; + var result = []; + for (var i = 0, len = symbol.declarations.length; i < len; i++) { + var node = symbol.declarations[i]; + switch (node.kind) { + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + if (i > 0 && node.body) { + var previous = symbol.declarations[i - 1]; + if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { + break; + } + } + result.push(getSignatureFromDeclaration(node)); + } } - - TypeScript.PullInstantiationHelpers.cleanUpTypeArgumentMap(type, mutableTypeParameterMap); - typeParameterArgumentMap = mutableTypeParameterMap.typeParameterArgumentMap; - - var isInstanceReferenceType = (type.kind & 8216 /* SomeInstantiatableType */) != 0; - var resolvedTypeParameterArgumentMap = typeParameterArgumentMap; - if (isInstanceReferenceType) { - var typeParameters = rootType.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - if (!TypeScript.PullHelpers.typeSymbolsAreIdentical(typeParameters[i], typeParameterArgumentMap[typeParameters[i].pullSymbolID])) { - isInstanceReferenceType = false; - break; - } + return result; + } + function getReturnTypeOfSignature(signature) { + if (!signature.resolvedReturnType) { + signature.resolvedReturnType = resolvingType; + if (signature.target) { + var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } - - if (isInstanceReferenceType) { - typeParameterArgumentMap = []; + else if (signature.unionSignatures) { + var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + } + else { + var type = getReturnTypeFromBody(signature.declaration); + } + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = type; } } - - instantiation = new PullInstantiatedTypeReferenceSymbol(rootType, typeParameterArgumentMap, isInstanceReferenceType); - - rootType.addSpecialization(instantiation, resolvedTypeParameterArgumentMap); - - return instantiation; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.isGeneric = function () { - return this.getRootSymbol().isGeneric(); - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getTypeParameterArgumentMap = function () { - return this._typeParameterArgumentMap; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getTypeArguments = function () { - if (this.isInstanceReferenceType) { - return this.getTypeParameters(); - } - - if (this._typeArgumentReferences === undefined) { - var typeParameters = this.referencedTypeSymbol.getTypeParameters(); - - if (typeParameters.length) { - var typeArgument = null; - var typeArguments = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeArgument = this._typeParameterArgumentMap[typeParameters[i].pullSymbolID]; - - if (!typeArgument) { - TypeScript.Debug.fail("type argument count mismatch"); - } - - if (typeArgument) { - typeArguments[typeArguments.length] = typeArgument; - } + else if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._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, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.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); } - - this._typeArgumentReferences = typeArguments; - } else { - this._typeArgumentReferences = null; } } - - return this._typeArgumentReferences; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getTypeArgumentsOrTypeParameters = function () { - return this.getTypeArguments(); - }; - - PullInstantiatedTypeReferenceSymbol.prototype.populateInstantiatedMemberFromReferencedMember = function (referencedMember) { - var instantiatedMember; - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(referencedMember); - - if (!referencedMember.type.wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - instantiatedMember = referencedMember; - } else { - instantiatedMember = new TypeScript.PullSymbol(referencedMember.name, referencedMember.kind); - instantiatedMember.setRootSymbol(referencedMember); - instantiatedMember.type = this._getResolver().instantiateType(referencedMember.type, this._typeParameterArgumentMap); - instantiatedMember.isOptional = referencedMember.isOptional; - } - this._instantiatedMemberNameCache[instantiatedMember.name] = instantiatedMember; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getMembers = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getMembers(); + return signature.resolvedReturnType; + } + function getRestTypeOfSignature(signature) { + if (signature.hasRestParameter) { + var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + if (type.flags & 4096 /* Reference */ && type.target === globalArrayType) { + return type.typeArguments[0]; + } } - - if (!this._instantiatedMembers) { - var referencedMembers = this.referencedTypeSymbol.getMembers(); - var referencedMember = null; - var instantiatedMember = null; - - this._instantiatedMembers = []; - - for (var i = 0; i < referencedMembers.length; i++) { - referencedMember = referencedMembers[i]; - - this._getResolver().resolveDeclaredSymbol(referencedMember); - - if (!this._instantiatedMemberNameCache[referencedMember.name]) { - this.populateInstantiatedMemberFromReferencedMember(referencedMember); - } - - this._instantiatedMembers[this._instantiatedMembers.length] = this._instantiatedMemberNameCache[referencedMember.name]; + return anyType; + } + function getSignatureInstantiation(signature, typeArguments) { + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + } + function getErasedSignature(signature) { + if (!signature.typeParameters) + return signature; + if (!signature.erasedSignatureCache) { + if (signature.target) { + signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); + } + else { + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); } } - - return this._instantiatedMembers; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.findMember = function (name, lookInParent) { - if (typeof lookInParent === "undefined") { lookInParent = true; } - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.findMember(name, lookInParent); + return signature.erasedSignatureCache; + } + function getOrCreateTypeFromSignature(signature) { + if (!signature.isolatedSignatureType) { + var isConstructor = signature.declaration.kind === 126 /* Constructor */ || signature.declaration.kind === 130 /* ConstructSignature */; + var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); + type.members = emptySymbols; + type.properties = emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; + signature.isolatedSignatureType = type; } - - var memberSymbol = this._instantiatedMemberNameCache[name]; - - if (!memberSymbol) { - var referencedMemberSymbol = this.referencedTypeSymbol.findMember(name, lookInParent); - - if (referencedMemberSymbol) { - this.populateInstantiatedMemberFromReferencedMember(referencedMemberSymbol); - memberSymbol = this._instantiatedMemberNameCache[name]; - } else { - memberSymbol = null; + return signature.isolatedSignatureType; + } + function getIndexSymbol(symbol) { + return symbol.members["__index"]; + } + function getIndexDeclarationOfSymbol(symbol, kind) { + var syntaxKind = kind === 1 /* Number */ ? 116 /* NumberKeyword */ : 118 /* StringKeyword */; + var indexSymbol = getIndexSymbol(symbol); + if (indexSymbol) { + var len = indexSymbol.declarations.length; + for (var i = 0; i < len; i++) { + var node = indexSymbol.declarations[i]; + if (node.parameters.length === 1) { + var parameter = node.parameters[0]; + if (parameter && parameter.type && parameter.type.kind === syntaxKind) { + return node; + } + } } } - - return memberSymbol; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisiblity) { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getAllMembers(searchDeclKind, memberVisiblity); - } - - var requestedMembers = []; - var allReferencedMembers = this.referencedTypeSymbol.getAllMembers(searchDeclKind, memberVisiblity); - - if (!this._allInstantiatedMemberNameCache) { - this._allInstantiatedMemberNameCache = TypeScript.createIntrinsicsObject(); - - var members = this.getMembers(); - - for (var i = 0; i < members.length; i++) { - this._allInstantiatedMemberNameCache[members[i].name] = members[i]; + return undefined; + } + function getIndexTypeOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + } + function getConstraintOfTypeParameter(type) { + if (!type.constraint) { + if (type.target) { + var targetConstraint = getConstraintOfTypeParameter(type.target); + type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + } + else { + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 122 /* TypeParameter */).constraint); } } - - var referencedMember = null; - var requestedMember = null; - - for (var i = 0; i < allReferencedMembers.length; i++) { - referencedMember = allReferencedMembers[i]; - - this._getResolver().resolveDeclaredSymbol(referencedMember); - - if (this._allInstantiatedMemberNameCache[referencedMember.name]) { - requestedMembers[requestedMembers.length] = this._allInstantiatedMemberNameCache[referencedMember.name]; - } else { - if (!referencedMember.type.wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._allInstantiatedMemberNameCache[referencedMember.name] = referencedMember; - requestedMembers[requestedMembers.length] = referencedMember; - } else { - requestedMember = new TypeScript.PullSymbol(referencedMember.name, referencedMember.kind); - requestedMember.setRootSymbol(referencedMember); - - requestedMember.type = this._getResolver().instantiateType(referencedMember.type, this._typeParameterArgumentMap); - requestedMember.isOptional = referencedMember.isOptional; - - this._allInstantiatedMemberNameCache[requestedMember.name] = requestedMember; - requestedMembers[requestedMembers.length] = requestedMember; + return type.constraint === noConstraintType ? undefined : type.constraint; + } + function getTypeListId(types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) + result += ","; + result += types[i].id; } - } + return result; } - - return requestedMembers; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getConstructorMethod = function () { - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getConstructorMethod(); + } + function createTypeReference(target, typeArguments) { + var id = getTypeListId(typeArguments); + var type = target.instantiations[id]; + if (!type) { + type = target.instantiations[id] = createObjectType(4096 /* Reference */, target.symbol); + type.target = target; + type.typeArguments = typeArguments; } - - if (!this._instantiatedConstructorMethod) { - var referencedConstructorMethod = this.referencedTypeSymbol.getConstructorMethod(); - this._instantiatedConstructorMethod = new TypeScript.PullSymbol(referencedConstructorMethod.name, referencedConstructorMethod.kind); - this._instantiatedConstructorMethod.setRootSymbol(referencedConstructorMethod); - this._instantiatedConstructorMethod.setResolved(); - - this._instantiatedConstructorMethod.type = PullInstantiatedTypeReferenceSymbol.create(this._getResolver(), referencedConstructorMethod.type, this._typeParameterArgumentMap); + return type; + } + function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { + var links = getNodeLinks(typeReferenceNode); + if (links.isIllegalTypeReferenceInConstraint !== undefined) { + return links.isIllegalTypeReferenceInConstraint; } - - return this._instantiatedConstructorMethod; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getAssociatedContainerType = function () { - if (!this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getAssociatedContainerType(); + var currentNode = typeReferenceNode; + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + currentNode = currentNode.parent; } - - if (!this._instantiatedAssociatedContainerType) { - var referencedAssociatedContainerType = this.referencedTypeSymbol.getAssociatedContainerType(); - - if (referencedAssociatedContainerType) { - this._instantiatedAssociatedContainerType = PullInstantiatedTypeReferenceSymbol.create(this._getResolver(), referencedAssociatedContainerType, this._typeParameterArgumentMap); + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 122 /* TypeParameter */; + return links.isIllegalTypeReferenceInConstraint; + } + function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { + var typeParameterSymbol; + function check(n) { + if (n.kind === 132 /* TypeReference */ && n.typeName.kind === 63 /* Identifier */) { + var links = getNodeLinks(n); + if (links.isIllegalTypeReferenceInConstraint === undefined) { + var symbol = resolveName(typeParameter, n.typeName.text, 3152352 /* Type */, undefined, undefined); + if (symbol && (symbol.flags & 1048576 /* TypeParameter */)) { + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + } + } + if (links.isIllegalTypeReferenceInConstraint) { + error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); + } } + ts.forEachChild(n, check); } - - return this._instantiatedAssociatedContainerType; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getCallSignatures = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getCallSignatures(); + if (typeParameter.constraint) { + typeParameterSymbol = getSymbolOfNode(typeParameter); + check(typeParameter.constraint); } - - if (this._instantiatedCallSignatures) { - return this._instantiatedCallSignatures; + } + function getTypeFromTypeReferenceNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var symbol = resolveEntityName(node, node.typeName, 3152352 /* Type */); + if (symbol) { + var type; + if ((symbol.flags & 1048576 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; + } + else { + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 /* Class */ | 2048 /* Interface */) && type.flags & 4096 /* Reference */) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } + } + } + } + links.resolvedType = type || unknownType; } - - var referencedCallSignatures = this.referencedTypeSymbol.getCallSignatures(); - this._instantiatedCallSignatures = []; - - for (var i = 0; i < referencedCallSignatures.length; i++) { - this._getResolver().resolveDeclaredSymbol(referencedCallSignatures[i]); - - if (!referencedCallSignatures[i].wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._instantiatedCallSignatures[this._instantiatedCallSignatures.length] = referencedCallSignatures[i]; - } else { - this._instantiatedCallSignatures[this._instantiatedCallSignatures.length] = this._getResolver().instantiateSignature(referencedCallSignatures[i], this._typeParameterArgumentMap); - this._instantiatedCallSignatures[this._instantiatedCallSignatures.length - 1].functionType = this; + return links.resolvedType; + } + function getTypeFromTypeQueryNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName)); + } + return links.resolvedType; + } + function getTypeOfGlobalSymbol(symbol, arity) { + function getTypeDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + switch (declaration.kind) { + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + return declaration; + } } } - - return this._instantiatedCallSignatures; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getConstructSignatures = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getConstructSignatures(); + if (!symbol) { + return emptyObjectType; } - - if (this._instantiatedConstructSignatures) { - return this._instantiatedConstructSignatures; + var type = getDeclaredTypeOfSymbol(symbol); + if (!(type.flags & 48128 /* ObjectType */)) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); + return emptyObjectType; } - - var referencedConstructSignatures = this.referencedTypeSymbol.getConstructSignatures(); - this._instantiatedConstructSignatures = []; - - for (var i = 0; i < referencedConstructSignatures.length; i++) { - this._getResolver().resolveDeclaredSymbol(referencedConstructSignatures[i]); - - if (!referencedConstructSignatures[i].wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._instantiatedConstructSignatures[this._instantiatedConstructSignatures.length] = referencedConstructSignatures[i]; - } else { - this._instantiatedConstructSignatures[this._instantiatedConstructSignatures.length] = this._getResolver().instantiateSignature(referencedConstructSignatures[i], this._typeParameterArgumentMap); - this._instantiatedConstructSignatures[this._instantiatedConstructSignatures.length - 1].functionType = this; - } + if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); + return emptyObjectType; } - - return this._instantiatedConstructSignatures; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getIndexSignatures = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getIndexSignatures(); + return type; + } + function getGlobalSymbol(name) { + return resolveName(undefined, name, 3152352 /* Type */, ts.Diagnostics.Cannot_find_global_type_0, name); + } + function getGlobalType(name) { + return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + } + function createArrayType(elementType) { + var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + } + function getTypeFromArrayTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); } - - if (this._instantiatedIndexSignatures) { - return this._instantiatedIndexSignatures; + return links.resolvedType; + } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(8192 /* Tuple */); + type.elementTypes = elementTypes; } - - var referencedIndexSignatures = this.referencedTypeSymbol.getIndexSignatures(); - this._instantiatedIndexSignatures = []; - - for (var i = 0; i < referencedIndexSignatures.length; i++) { - this._getResolver().resolveDeclaredSymbol(referencedIndexSignatures[i]); - - if (!referencedIndexSignatures[i].wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._instantiatedIndexSignatures[this._instantiatedIndexSignatures.length] = referencedIndexSignatures[i]; - } else { - this._instantiatedIndexSignatures[this._instantiatedIndexSignatures.length] = this._getResolver().instantiateSignature(referencedIndexSignatures[i], this._typeParameterArgumentMap); - this._instantiatedIndexSignatures[this._instantiatedIndexSignatures.length - 1].functionType = this; - } + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); } - - return this._instantiatedIndexSignatures; - }; - return PullInstantiatedTypeReferenceSymbol; - })(PullTypeReferenceSymbol); - TypeScript.PullInstantiatedTypeReferenceSymbol = PullInstantiatedTypeReferenceSymbol; - - var PullInstantiatedSignatureSymbol = (function (_super) { - __extends(PullInstantiatedSignatureSymbol, _super); - function PullInstantiatedSignatureSymbol(rootSignature, _typeParameterArgumentMap) { - _super.call(this, rootSignature.kind, rootSignature.isDefinition()); - this._typeParameterArgumentMap = _typeParameterArgumentMap; - this.setRootSymbol(rootSignature); - TypeScript.nSpecializedSignaturesCreated++; - - rootSignature.addSpecialization(this, _typeParameterArgumentMap); + return links.resolvedType; } - PullInstantiatedSignatureSymbol.prototype.getTypeParameterArgumentMap = function () { - return this._typeParameterArgumentMap; - }; - - PullInstantiatedSignatureSymbol.prototype.getIsSpecialized = function () { - return true; - }; - - PullInstantiatedSignatureSymbol.prototype._getResolver = function () { - return this.getRootSymbol()._getResolver(); - }; - - PullInstantiatedSignatureSymbol.prototype.getTypeParameters = function () { - var _this = this; - if (!this._typeParameters) { - var rootSymbol = this.getRootSymbol(); - var typeParameters = rootSymbol.getTypeParameters(); - var hasInstantiatedTypeParametersOfThisSignature = TypeScript.ArrayUtilities.all(typeParameters, function (typeParameter) { - return _this._typeParameterArgumentMap[typeParameter.pullSymbolID] !== undefined; - }); - - if (!hasInstantiatedTypeParametersOfThisSignature && typeParameters.length) { - this._typeParameters = []; - for (var i = 0; i < typeParameters.length; i++) { - this._typeParameters[this._typeParameters.length] = this._getResolver().instantiateTypeParameter(typeParameters[i], this._typeParameterArgumentMap); - } - } else { - this._typeParameters = TypeScript.sentinelEmptyArray; + function addTypeToSortedSet(sortedSet, type) { + if (type.flags & 16384 /* Union */) { + addTypesToSortedSet(sortedSet, type.types); + } + else { + var i = 0; + var id = type.id; + while (i < sortedSet.length && sortedSet[i].id < id) { + i++; + } + if (i === sortedSet.length || sortedSet[i].id !== id) { + sortedSet.splice(i, 0, type); } } - - return this._typeParameters; - }; - - PullInstantiatedSignatureSymbol.prototype.getAllowedToReferenceTypeParameters = function () { - var rootSymbol = this.getRootSymbol(); - return rootSymbol.getAllowedToReferenceTypeParameters(); - }; - return PullInstantiatedSignatureSymbol; - })(TypeScript.PullSignatureSymbol); - TypeScript.PullInstantiatedSignatureSymbol = PullInstantiatedSignatureSymbol; - - var PullInstantiatedTypeParameterSymbol = (function (_super) { - __extends(PullInstantiatedTypeParameterSymbol, _super); - function PullInstantiatedTypeParameterSymbol(rootTypeParameter, constraintType) { - _super.call(this, rootTypeParameter.name); - TypeScript.nSpecializedTypeParameterCreated++; - - this.setRootSymbol(rootTypeParameter); - this.setConstraint(constraintType); - - rootTypeParameter.addSpecialization(this, [constraintType]); } - PullInstantiatedTypeParameterSymbol.prototype._getResolver = function () { - return this.getRootSymbol()._getResolver(); - }; - return PullInstantiatedTypeParameterSymbol; - })(TypeScript.PullTypeParameterSymbol); - TypeScript.PullInstantiatedTypeParameterSymbol = PullInstantiatedTypeParameterSymbol; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxTreeToAstVisitor = (function () { - function SyntaxTreeToAstVisitor(fileName, lineMap, compilationSettings) { - this.fileName = fileName; - this.lineMap = lineMap; - this.compilationSettings = compilationSettings; - this.position = 0; - this.previousTokenTrailingComments = null; - } - SyntaxTreeToAstVisitor.visit = function (syntaxTree, fileName, compilationSettings, incrementalAST) { - var visitor = incrementalAST ? new SyntaxTreeToIncrementalAstVisitor(fileName, syntaxTree.lineMap(), compilationSettings) : new SyntaxTreeToAstVisitor(fileName, syntaxTree.lineMap(), compilationSettings); - return syntaxTree.sourceUnit().accept(visitor); - }; - - SyntaxTreeToAstVisitor.prototype.movePast = function (element) { - if (element !== null) { - this.position += element.fullWidth(); + function addTypesToSortedSet(sortedTypes, types) { + for (var i = 0, len = types.length; i < len; i++) { + addTypeToSortedSet(sortedTypes, types[i]); } - }; - - SyntaxTreeToAstVisitor.prototype.moveTo = function (element1, element2) { - if (element2 !== null) { - this.position += TypeScript.Syntax.childOffset(element1, element2); - } - }; - - SyntaxTreeToAstVisitor.prototype.setCommentsAndSpan = function (ast, fullStart, node) { - var firstToken = node.firstToken(); - var lastToken = node.lastToken(); - - this.setSpan(ast, fullStart, node, firstToken, lastToken); - ast.setPreComments(this.convertTokenLeadingComments(firstToken, fullStart)); - ast.setPostComments(this.convertNodeTrailingComments(node, lastToken, fullStart)); - }; - - SyntaxTreeToAstVisitor.prototype.createTokenSpan = function (fullStart, element) { - if (element === null) { - return null; + } + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + return true; + } } - - if (element.fullWidth() === 0) { - return new TypeScript.ASTSpan(-1, -1); + return false; + } + function removeSubtypes(types) { + var i = types.length; + while (i > 0) { + i--; + if (isSubtypeOfAny(types[i], types)) { + types.splice(i, 1); + } } - - var leadingTriviaWidth = element.leadingTriviaWidth(); - var trailingTriviaWidth = element.trailingTriviaWidth(); - - var start = fullStart + leadingTriviaWidth; - var end = fullStart + element.fullWidth() - trailingTriviaWidth; - - return new TypeScript.ASTSpan(start, end); - }; - - SyntaxTreeToAstVisitor.prototype.setSpan = function (span, fullStart, element, firstToken, lastToken) { - if (typeof firstToken === "undefined") { firstToken = element.firstToken(); } - if (typeof lastToken === "undefined") { lastToken = element.lastToken(); } - var leadingTriviaWidth = firstToken ? firstToken.leadingTriviaWidth() : 0; - var trailingTriviaWidth = lastToken ? lastToken.trailingTriviaWidth() : 0; - - var desiredMinChar = fullStart + leadingTriviaWidth; - var desiredLimChar = fullStart + element.fullWidth() - trailingTriviaWidth; - - this.setSpanExplicit(span, desiredMinChar, desiredLimChar); - - span._trailingTriviaWidth = trailingTriviaWidth; - }; - - SyntaxTreeToAstVisitor.prototype.setSpanExplicit = function (span, start, end) { - span._start = start; - span._end = end; - }; - - SyntaxTreeToAstVisitor.prototype.visitSyntaxList = function (node) { - var start = this.position; - var array = new Array(node.childCount()); - - for (var i = 0, n = node.childCount(); i < n; i++) { - array[i] = node.childAt(i).accept(this); + } + function containsAnyType(types) { + for (var i = 0; i < types.length; i++) { + if (types[i].flags & 1 /* Any */) { + return true; + } } - - var result = new TypeScript.ISyntaxList2(this.fileName, array); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSeparatedSyntaxList = function (list) { - var start = this.position; - var array = new Array(list.nonSeparatorCount()); - - for (var i = 0, n = list.childCount(); i < n; i++) { - if (i % 2 === 0) { - array[i / 2] = list.childAt(i).accept(this); - this.previousTokenTrailingComments = null; - } else { - var separatorToken = list.childAt(i); - this.previousTokenTrailingComments = this.convertTokenTrailingComments(separatorToken, this.position + separatorToken.leadingTriviaWidth() + separatorToken.width()); - this.movePast(separatorToken); + return false; + } + function removeAllButLast(types, typeToRemove) { + var i = types.length; + while (i > 0 && types.length > 1) { + i--; + if (types[i] === typeToRemove) { + types.splice(i, 1); } } - - var result = new TypeScript.ISeparatedSyntaxList2(this.fileName, array, list.separatorCount()); - this.setSpan(result, start, list); - - result.setPostComments(this.previousTokenTrailingComments); - this.previousTokenTrailingComments = null; - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.convertComment = function (trivia, commentStartPosition, hasTrailingNewLine) { - var comment = new TypeScript.Comment(trivia, hasTrailingNewLine, commentStartPosition, commentStartPosition + trivia.fullWidth()); - - return comment; - }; - - SyntaxTreeToAstVisitor.prototype.convertComments = function (triviaList, commentStartPosition) { - var result = []; - - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - - if (trivia.isComment()) { - var hasTrailingNewLine = ((i + 1) < n) && triviaList.syntaxTriviaAt(i + 1).isNewLine(); - result.push(this.convertComment(trivia, commentStartPosition, hasTrailingNewLine)); + } + function getUnionType(types, noSubtypeReduction) { + if (types.length === 0) { + return emptyObjectType; + } + var sortedTypes = []; + addTypesToSortedSet(sortedTypes, types); + if (noSubtypeReduction) { + if (containsAnyType(sortedTypes)) { + return anyType; } - - commentStartPosition += trivia.fullWidth(); + removeAllButLast(sortedTypes, undefinedType); + removeAllButLast(sortedTypes, nullType); } - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.mergeComments = function (comments1, comments2) { - if (comments1 === null) { - return comments2; + else { + removeSubtypes(sortedTypes); } - - if (comments2 === null) { - return comments1; + if (sortedTypes.length === 1) { + return sortedTypes[0]; } - - return comments1.concat(comments2); - }; - - SyntaxTreeToAstVisitor.prototype.convertTokenLeadingComments = function (token, commentStartPosition) { - if (token === null) { - return null; + var id = getTypeListId(sortedTypes); + var type = unionTypes[id]; + if (!type) { + type = unionTypes[id] = createObjectType(16384 /* Union */); + type.types = sortedTypes; } - - var preComments = token.hasLeadingComment() ? this.convertComments(token.leadingTrivia(), commentStartPosition) : null; - - var previousTokenTrailingComments = this.previousTokenTrailingComments; - this.previousTokenTrailingComments = null; - - return this.mergeComments(previousTokenTrailingComments, preComments); - }; - - SyntaxTreeToAstVisitor.prototype.convertTokenTrailingComments = function (token, commentStartPosition) { - if (token === null || !token.hasTrailingComment() || token.hasTrailingNewLine()) { - return null; + return type; + } + function getTypeFromUnionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); } - - return this.convertComments(token.trailingTrivia(), commentStartPosition); - }; - - SyntaxTreeToAstVisitor.prototype.convertNodeTrailingComments = function (node, lastToken, nodeStart) { - if (lastToken === null || !lastToken.hasTrailingComment() || lastToken.hasTrailingNewLine()) { - return null; + return links.resolvedType; + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createObjectType(32768 /* Anonymous */, node.symbol); } - - return this.convertComments(lastToken.trailingTrivia(), nodeStart + node.fullWidth() - lastToken.trailingTriviaWidth()); - }; - - SyntaxTreeToAstVisitor.prototype.visitIdentifier = function (token) { - return this.visitToken(token); - }; - - SyntaxTreeToAstVisitor.prototype.visitToken = function (token) { - var fullStart = this.position; - - var result = this.visitTokenWorker(token); - - this.movePast(token); - - var start = fullStart + token.leadingTriviaWidth(); - this.setSpanExplicit(result, start, start + token.width()); - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTokenWorker = function (token) { - switch (token.tokenKind) { - case 60 /* AnyKeyword */: - return new TypeScript.BuiltInType(60 /* AnyKeyword */, token.text(), token.valueText()); - case 61 /* BooleanKeyword */: - return new TypeScript.BuiltInType(61 /* BooleanKeyword */, token.text(), token.valueText()); - case 67 /* NumberKeyword */: - return new TypeScript.BuiltInType(67 /* NumberKeyword */, token.text(), token.valueText()); - case 69 /* StringKeyword */: - return new TypeScript.BuiltInType(69 /* StringKeyword */, token.text(), token.valueText()); - case 41 /* VoidKeyword */: - return new TypeScript.BuiltInType(41 /* VoidKeyword */, token.text(), token.valueText()); - case 35 /* ThisKeyword */: - return new TypeScript.ThisExpression(token.text(), token.valueText()); - case 50 /* SuperKeyword */: - return new TypeScript.SuperExpression(token.text(), token.valueText()); - case 37 /* TrueKeyword */: - return new TypeScript.LiteralExpression(37 /* TrueKeyword */, token.text(), token.valueText()); - case 24 /* FalseKeyword */: - return new TypeScript.LiteralExpression(24 /* FalseKeyword */, token.text(), token.valueText()); - case 32 /* NullKeyword */: - return new TypeScript.LiteralExpression(32 /* NullKeyword */, token.text(), token.valueText()); - case 14 /* StringLiteral */: - return new TypeScript.StringLiteral(token.text(), token.valueText()); - case 12 /* RegularExpressionLiteral */: - return new TypeScript.RegularExpressionLiteral(token.text(), token.valueText()); - case 13 /* NumericLiteral */: - var fullStart = this.position; - var preComments = this.convertTokenLeadingComments(token, fullStart); - - var result = new TypeScript.NumericLiteral(token.value(), token.text(), token.valueText()); - - result.setPreComments(preComments); - return result; - case 11 /* IdentifierName */: - return new TypeScript.Identifier(token.text()); + return links.resolvedType; + } + function getStringLiteralType(node) { + if (ts.hasProperty(stringLiteralTypes, node.text)) { + return stringLiteralTypes[node.text]; + } + var type = stringLiteralTypes[node.text] = createType(256 /* StringLiteral */); + type.text = ts.getTextOfNode(node); + return type; + } + function getTypeFromStringLiteral(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getStringLiteralType(node); + } + return links.resolvedType; + } + function getTypeFromTypeNode(node) { + switch (node.kind) { + case 109 /* AnyKeyword */: + return anyType; + case 118 /* StringKeyword */: + return stringType; + case 116 /* NumberKeyword */: + return numberType; + case 110 /* BooleanKeyword */: + return booleanType; + case 97 /* VoidKeyword */: + return voidType; + case 7 /* StringLiteral */: + return getTypeFromStringLiteral(node); + case 132 /* TypeReference */: + return getTypeFromTypeReferenceNode(node); + case 135 /* TypeQuery */: + return getTypeFromTypeQueryNode(node); + case 137 /* ArrayType */: + return getTypeFromArrayTypeNode(node); + case 138 /* TupleType */: + return getTypeFromTupleTypeNode(node); + case 139 /* UnionType */: + return getTypeFromUnionTypeNode(node); + case 140 /* ParenthesizedType */: + return getTypeFromTypeNode(node.type); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 136 /* TypeLiteral */: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 63 /* Identifier */: + case 120 /* QualifiedName */: + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); default: - throw TypeScript.Errors.invalidOperation(); + return unknownType; } - }; - - SyntaxTreeToAstVisitor.prototype.visitSourceUnit = function (node) { - var start = this.position; - TypeScript.Debug.assert(start === 0); - - var bod = this.visitSyntaxList(node.moduleElements); - var comments = this.convertTokenLeadingComments(node.endOfFileToken, TypeScript.Syntax.childOffset(node, node.endOfFileToken)); - var result = new TypeScript.SourceUnit(bod, comments, this.fileName); - this.setSpanExplicit(result, start, start + node.fullWidth()); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitExternalModuleReference = function (node) { - var start = this.position; - - this.moveTo(node, node.stringLiteral); - var stringLiteral = node.stringLiteral.accept(this); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ExternalModuleReference(stringLiteral); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitModuleNameModuleReference = function (node) { - var start = this.position; - var moduleName = node.moduleName.accept(this); - - var result = new TypeScript.ModuleNameModuleReference(moduleName); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitClassDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var heritageClauses = node.heritageClauses ? this.visitSyntaxList(node.heritageClauses) : null; - - this.movePast(node.openBraceToken); - var members = this.visitSyntaxList(node.classElements); - - var closeBraceToken = this.createTokenSpan(this.position, node.closeBraceToken); - this.movePast(node.closeBraceToken); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.ClassDeclaration(modifiers, name, typeParameters, heritageClauses, members, closeBraceToken); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitModifiers = function (modifiers) { - var result = null; - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 47 /* ExportKeyword */)) { - result = result || []; - result.push(1 /* Exported */); + } + function instantiateList(items, mapper, instantiator) { + if (items && items.length) { + var result = []; + for (var i = 0; i < items.length; i++) { + result.push(instantiator(items[i], mapper)); + } + return result; } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 63 /* DeclareKeyword */)) { - result = result || []; - result.push(8 /* Ambient */); + return items; + } + function createUnaryTypeMapper(source, target) { + return function (t) { return t === source ? target : t; }; + } + function createBinaryTypeMapper(source1, target1, source2, target2) { + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + } + function createTypeMapper(sources, targets) { + switch (sources.length) { + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 58 /* StaticKeyword */)) { - result = result || []; - result.push(16 /* Static */); + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return targets[i]; + } + return t; + }; + } + function createUnaryTypeEraser(source) { + return function (t) { return t === source ? anyType : t; }; + } + function createBinaryTypeEraser(source1, source2) { + return function (t) { return t === source1 || t === source2 ? anyType : t; }; + } + function createTypeEraser(sources) { + switch (sources.length) { + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 57 /* PublicKeyword */)) { - result = result || []; - result.push(4 /* Public */); + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return anyType; + } + return t; + }; + } + function createInferenceMapper(context) { + return function (t) { + for (var i = 0; i < context.typeParameters.length; i++) { + if (t === context.typeParameters[i]) { + return getInferredType(context, i); + } + } + return t; + }; + } + function identityMapper(type) { + return type; + } + function combineTypeMappers(mapper1, mapper2) { + return function (t) { return mapper2(mapper1(t)); }; + } + function instantiateTypeParameter(typeParameter, mapper) { + var result = createType(512 /* TypeParameter */); + result.symbol = typeParameter.symbol; + if (typeParameter.constraint) { + result.constraint = instantiateType(typeParameter.constraint, mapper); } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 55 /* PrivateKeyword */)) { - result = result || []; - result.push(2 /* Private */); + else { + result.target = typeParameter; + result.mapper = mapper; } - - return result || TypeScript.sentinelEmptyArray; - }; - - SyntaxTreeToAstVisitor.prototype.visitInterfaceDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var heritageClauses = node.heritageClauses ? this.visitSyntaxList(node.heritageClauses) : null; - - var body = this.visitObjectType(node.body); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.InterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, body); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitHeritageClause = function (node) { - var start = this.position; - - this.movePast(node.extendsOrImplementsKeyword); - var typeNames = this.visitSeparatedSyntaxList(node.typeNames); - - var result = new TypeScript.HeritageClause(node.extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */ ? 230 /* ExtendsHeritageClause */ : 231 /* ImplementsHeritageClause */, typeNames); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitModuleDeclaration = function (node) { - var start = this.position; - - var modifiers = this.visitModifiers(node.modifiers); - - this.moveTo(node, node.moduleKeyword); - this.movePast(node.moduleKeyword); - - var moduleName = node.name ? node.name.accept(this) : null; - var stringLiteral = node.stringLiteral ? node.stringLiteral.accept(this) : null; - - this.movePast(node.openBraceToken); - - var moduleElements = this.visitSyntaxList(node.moduleElements); - - var closeBraceToken = this.createTokenSpan(this.position, node.closeBraceToken); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.ModuleDeclaration(modifiers, moduleName, stringLiteral, moduleElements, closeBraceToken); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - - var callSignature = this.visitCallSignature(node.callSignature); - var block = node.block ? this.visitBlock(node.block) : null; - - this.movePast(node.semicolonToken); - - var result = new TypeScript.FunctionDeclaration(this.visitModifiers(node.modifiers), name, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEnumDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var identifier = this.visitIdentifier(node.identifier); - - this.movePast(node.openBraceToken); - - var enumElements = this.visitSeparatedSyntaxList(node.enumElements); - - this.movePast(node.closeBraceToken); - - var result = new TypeScript.EnumDeclaration(this.visitModifiers(node.modifiers), identifier, enumElements); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEnumElement = function (node) { - var start = this.position; - - var memberName = this.visitToken(node.propertyName); - - var value = node.equalsValueClause !== null ? this.visitEqualsValueClause(node.equalsValueClause) : null; - - var result = new TypeScript.EnumElement(memberName, value); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitImportDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - this.movePast(node.equalsToken); - var alias = node.moduleReference.accept(this); - this.movePast(node.semicolonToken); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.ImportDeclaration(modifiers, name, alias); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitExportAssignment = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - this.movePast(node.semicolonToken); - - var result = new TypeScript.ExportAssignment(name); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVariableStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.variableDeclaration); - - var declaration = node.variableDeclaration.accept(this); - this.movePast(node.semicolonToken); - - var modifiers = this.visitModifiers(node.modifiers); - - var result = new TypeScript.VariableStatement(modifiers, declaration); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVariableDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.variableDeclarators); - var variableDecls = this.visitSeparatedSyntaxList(node.variableDeclarators); - - var result = new TypeScript.VariableDeclaration(variableDecls); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVariableDeclarator = function (node) { - var start = this.position; - var propertyName = this.visitToken(node.propertyName); - var typeExpr = this.visitTypeAnnotation(node.typeAnnotation); - var init = node.equalsValueClause ? this.visitEqualsValueClause(node.equalsValueClause) : null; - - var result = new TypeScript.VariableDeclarator(propertyName, typeExpr, init); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEqualsValueClause = function (node) { - var start = this.position; - var afterEqualsComments = this.convertTokenTrailingComments(node.equalsToken, this.position + node.equalsToken.leadingTriviaWidth() + node.equalsToken.width()); - - this.movePast(node.equalsToken); - var value = node.value.accept(this); - value.setPreComments(this.mergeComments(afterEqualsComments, value.preComments())); - - var result = new TypeScript.EqualsValueClause(value); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitPrefixUnaryExpression = function (node) { - var start = this.position; - - this.movePast(node.operatorToken); - var operand = node.operand.accept(this); - - var result = new TypeScript.PrefixUnaryExpression(node.kind(), operand); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitArrayLiteralExpression = function (node) { - var start = this.position; - var openStart = this.position + node.openBracketToken.leadingTriviaWidth(); - this.movePast(node.openBracketToken); - - var expressions = this.visitSeparatedSyntaxList(node.expressions); - - var closeStart = this.position + node.closeBracketToken.leadingTriviaWidth(); - this.movePast(node.closeBracketToken); - - var result = new TypeScript.ArrayLiteralExpression(expressions); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitOmittedExpression = function (node) { - var start = this.position; - - var result = new TypeScript.OmittedExpression(); - this.setSpan(result, start, node); - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParenthesizedExpression = function (node) { - var start = this.position; - - var openParenToken = node.openParenToken; - var openParenTrailingComments = this.convertTokenTrailingComments(openParenToken, start + openParenToken.leadingTriviaWidth() + openParenToken.width()); - - this.movePast(openParenToken); - - var expr = node.expression.accept(this); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ParenthesizedExpression(openParenTrailingComments, expr); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSimpleArrowFunctionExpression = function (node) { - var start = this.position; - - var identifier = node.identifier.accept(this); - this.movePast(node.equalsGreaterThanToken); - - var block = node.block ? this.visitBlock(node.block) : null; - var expression = node.expression ? node.expression.accept(this) : null; - - var result = new TypeScript.SimpleArrowFunctionExpression(identifier, block, expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - var start = this.position; - - var callSignature = this.visitCallSignature(node.callSignature); - this.movePast(node.equalsGreaterThanToken); - - var block = node.block ? this.visitBlock(node.block) : null; - var expression = node.expression ? node.expression.accept(this) : null; - - var result = new TypeScript.ParenthesizedArrowFunctionExpression(callSignature, block, expression); - this.setCommentsAndSpan(result, start, node); - + } + function instantiateSignature(signature, mapper, eraseTypeParameters) { + if (signature.typeParameters && !eraseTypeParameters) { + var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + } + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + result.target = signature; + result.mapper = mapper; return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitType = function (type) { - return type ? type.accept(this) : null; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeQuery = function (node) { - var start = this.position; - this.movePast(node.typeOfKeyword); - var name = node.name.accept(this); - - var result = new TypeScript.TypeQuery(name); - this.setSpan(result, start, node); - + } + function instantiateSymbol(symbol, mapper) { + if (symbol.flags & 67108864 /* Instantiated */) { + var links = getSymbolLinks(symbol); + symbol = links.target; + mapper = combineTypeMappers(links.mapper, mapper); + } + var result = createSymbol(67108864 /* Instantiated */ | 268435456 /* Transient */ | symbol.flags, symbol.name); + result.declarations = symbol.declarations; + result.parent = symbol.parent; + result.target = symbol; + result.mapper = mapper; + if (symbol.valueDeclaration) { + result.valueDeclaration = symbol.valueDeclaration; + } return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitQualifiedName = function (node) { - var start = this.position; - var left = this.visitType(node.left); - this.movePast(node.dotToken); - var right = this.visitIdentifier(node.right); - - var result = new TypeScript.QualifiedName(left, right); - this.setSpan(result, start, node); - + } + function instantiateAnonymousType(type, mapper) { + var result = createObjectType(32768 /* Anonymous */, type.symbol); + result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); + result.members = createSymbolTable(result.properties); + result.callSignatures = instantiateList(getSignaturesOfType(type, 0 /* Call */), mapper, instantiateSignature); + result.constructSignatures = instantiateList(getSignaturesOfType(type, 1 /* Construct */), mapper, instantiateSignature); + var stringIndexType = getIndexTypeOfType(type, 0 /* String */); + var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + if (stringIndexType) + result.stringIndexType = instantiateType(stringIndexType, mapper); + if (numberIndexType) + result.numberIndexType = instantiateType(numberIndexType, mapper); return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeArgumentList = function (node) { - if (node === null) { - return null; + } + function instantiateType(type, mapper) { + if (mapper !== identityMapper) { + if (type.flags & 512 /* TypeParameter */) { + return mapper(type); + } + if (type.flags & 32768 /* Anonymous */) { + return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; + } + if (type.flags & 4096 /* Reference */) { + return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); + } + if (type.flags & 8192 /* Tuple */) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } + if (type.flags & 16384 /* Union */) { + return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + } + } + return type; + } + function isContextSensitive(node) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + switch (node.kind) { + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return isContextSensitiveFunctionLikeDeclaration(node); + case 142 /* ObjectLiteralExpression */: + return ts.forEach(node.properties, isContextSensitive); + case 141 /* ArrayLiteralExpression */: + return ts.forEach(node.elements, isContextSensitive); + case 158 /* ConditionalExpression */: + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + case 157 /* BinaryExpression */: + return node.operator === 48 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 198 /* PropertyAssignment */: + return isContextSensitive(node.initializer); + case 125 /* Method */: + return isContextSensitiveFunctionLikeDeclaration(node); + } + return false; + } + function isContextSensitiveFunctionLikeDeclaration(node) { + return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); + } + function getTypeWithoutConstructors(type) { + if (type.flags & 48128 /* ObjectType */) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.constructSignatures.length) { + var result = createObjectType(32768 /* Anonymous */, type.symbol); + result.members = resolved.members; + result.properties = resolved.properties; + result.callSignatures = resolved.callSignatures; + result.constructSignatures = emptyArray; + type = result; + } + } + return type; + } + var subtypeRelation = {}; + var assignableRelation = {}; + var identityRelation = {}; + function isTypeIdenticalTo(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined); + } + function compareTypes(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + } + function isTypeSubtypeOf(source, target) { + return checkTypeSubtypeOf(source, target, undefined); + } + function isTypeAssignableTo(source, target) { + return checkTypeAssignableTo(source, target, undefined); + } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } + function checkTypeAssignableTo(source, target, errorNode, headMessage) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage); + } + function isSignatureAssignableTo(source, target) { + var sourceType = getOrCreateTypeFromSignature(source); + var targetType = getOrCreateTypeFromSignature(target); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + } + function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { + var errorInfo; + var sourceStack; + var targetStack; + var maybeStack; + var expandingFlags; + var depth = 0; + var overflow = false; + ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); + var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + if (overflow) { + error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + } + else if (errorInfo) { + if (containingMessageChain) { + errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); + } + addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); + } + return result !== 0 /* False */; + function reportError(message, arg0, arg1, arg2) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + } + function isRelatedTo(source, target, reportErrors, headMessage) { + var result; + if (relation === identityRelation) { + if (source === target) + return -1 /* True */; + } + else { + if (source === target) + return -1 /* True */; + if (target.flags & 1 /* Any */) + return -1 /* True */; + if (source === undefinedType) + return -1 /* True */; + if (source === nullType && target !== undefinedType) + return -1 /* True */; + if (source.flags & 128 /* Enum */ && target === numberType) + return -1 /* True */; + if (source.flags & 256 /* StringLiteral */ && target === stringType) + return -1 /* True */; + if (relation === assignableRelation) { + if (source.flags & 1 /* Any */) + return -1 /* True */; + if (source === numberType && target.flags & 128 /* Enum */) + return -1 /* True */; + } + } + if (source.flags & 16384 /* Union */) { + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; + } + } + else if (target.flags & 16384 /* Union */) { + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; + } + } + else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; + } + } + else { + var saveErrorInfo = errorInfo; + if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + 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))) { + errorInfo = saveErrorInfo; + return result; + } + } + if (reportErrors) { + headMessage = headMessage || ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + reportError(headMessage, typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + function typeRelatedToUnionType(source, target, reportErrors) { + var targetTypes = target.types; + for (var i = 0, len = targetTypes.length; i < len; i++) { + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; + } + } + return 0 /* False */; + } + function unionTypeRelatedToType(source, target, reportErrors) { + var result = -1 /* True */; + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + var related = isRelatedTo(sourceTypes[i], target, reportErrors); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function typesRelatedTo(sources, targets, reportErrors) { + var result = -1 /* True */; + for (var i = 0, len = sources.length; i < len; i++) { + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function typeParameterRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + if (source.symbol.name !== target.symbol.name) { + return 0 /* False */; + } + if (source.constraint === target.constraint) { + return -1 /* True */; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { + return 0 /* False */; + } + return isRelatedTo(source.constraint, target.constraint, reportErrors); + } + else { + while (true) { + var constraint = getConstraintOfTypeParameter(source); + if (constraint === target) + return -1 /* True */; + if (!(constraint && constraint.flags & 512 /* TypeParameter */)) + break; + source = constraint; + } + return 0 /* False */; + } + } + function objectTypeRelatedTo(source, target, reportErrors) { + if (overflow) { + return 0 /* False */; + } + var id = source.id + "," + target.id; + var related = relation[id]; + if (related !== undefined) { + return related ? -1 /* True */ : 0 /* False */; + } + if (depth > 0) { + for (var i = 0; i < depth; i++) { + if (maybeStack[i][id]) { + return 1 /* Maybe */; + } + } + if (depth === 100) { + overflow = true; + return 0 /* False */; + } + } + else { + sourceStack = []; + targetStack = []; + maybeStack = []; + expandingFlags = 0; + } + sourceStack[depth] = source; + targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = true; + depth++; + var saveExpandingFlags = expandingFlags; + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) + expandingFlags |= 1; + if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) + expandingFlags |= 2; + if (expandingFlags === 3) { + var result = 1 /* Maybe */; + } + else { + var result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); + } + } + } + } + } + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = result === -1 /* True */ || depth === 0 ? relation : maybeStack[depth - 1]; + for (var p in maybeCache) { + destinationCache[p] = maybeCache[p]; + } + } + else { + relation[id] = false; + } + return result; + } + function isDeeplyNestedGeneric(type, stack) { + if (type.flags & 4096 /* Reference */ && depth >= 10) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 /* Reference */ && t.target === target) { + count++; + if (count >= 10) + return true; + } + } + } + return false; + } + function propertiesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return propertiesIdenticalTo(source, target); + } + var result = -1 /* True */; + var properties = getPropertiesOfObjectType(target); + 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 || !isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return 0 /* False */; + } + } + else if (!(targetProp.flags & 536870912 /* Prototype */)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & 32 /* Private */ && targetFlags & 32 /* Private */) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); + } + } + return 0 /* False */; + } + } + else if (targetFlags & 64 /* Protected */) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return 0 /* False */; + } + } + else if (sourceFlags & 64 /* Protected */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0 /* False */; + } + result &= related; + if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + } + } + } + return result; } - - var start = this.position; - this.movePast(node.lessThanToken); - var typeArguments = this.visitSeparatedSyntaxList(node.typeArguments); - this.movePast(node.greaterThanToken); - - var result = new TypeScript.TypeArgumentList(typeArguments); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstructorType = function (node) { - var start = this.position; - - this.movePast(node.newKeyword); - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var parameters = this.visitParameterList(node.parameterList); - this.movePast(node.equalsGreaterThanToken); - var returnType = this.visitType(node.type); - - var result = new TypeScript.ConstructorType(typeParameters, parameters, returnType); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionType = function (node) { - var start = this.position; - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var parameters = this.visitParameterList(node.parameterList); - this.movePast(node.equalsGreaterThanToken); - var returnType = this.visitType(node.type); - - var result = new TypeScript.FunctionType(typeParameters, parameters, returnType); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitObjectType = function (node) { - var start = this.position; - - this.movePast(node.openBraceToken); - var typeMembers = this.visitSeparatedSyntaxList(node.typeMembers); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.ObjectType(typeMembers); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitArrayType = function (node) { - var start = this.position; - - var underlying = this.visitType(node.type); - this.movePast(node.openBracketToken); - this.movePast(node.closeBracketToken); - - var result = new TypeScript.ArrayType(underlying); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitGenericType = function (node) { - var start = this.position; - - var underlying = this.visitType(node.name); - var typeArguments = this.visitTypeArgumentList(node.typeArgumentList); - - var result = new TypeScript.GenericType(underlying, typeArguments); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeAnnotation = function (node) { - if (!node) { - return null; + function propertiesIdenticalTo(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return 0 /* False */; + } + var result = -1 /* True */; + for (var i = 0, len = sourceProperties.length; i < len; ++i) { + var sourceProp = sourceProperties[i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp) { + return 0 /* False */; + } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; } - - var start = this.position; - this.movePast(node.colonToken); - var type = this.visitType(node.type); - - var result = new TypeScript.TypeAnnotation(type); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitBlock = function (node) { - if (!node) { - return null; + function signaturesRelatedTo(source, target, kind, reportErrors) { + if (relation === identityRelation) { + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1 /* True */; + } + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var result = -1 /* True */; + var saveErrorInfo = errorInfo; + outer: for (var i = 0; i < targetSignatures.length; i++) { + var t = targetSignatures[i]; + if (!t.hasStringLiterals || target.flags & 65536 /* FromSignature */) { + var localErrors = reportErrors; + for (var j = 0; j < sourceSignatures.length; j++) { + var s = sourceSignatures[j]; + if (!s.hasStringLiterals || source.flags & 65536 /* FromSignature */) { + var related = signatureRelatedTo(s, t, localErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; + } + localErrors = false; + } + } + return 0 /* False */; + } + } + return result; } - - var start = this.position; - - this.movePast(node.openBraceToken); - var statements = this.visitSyntaxList(node.statements); - var closeBracePosition = this.position; - - var closeBraceLeadingComments = this.convertTokenLeadingComments(node.closeBraceToken, this.position); - var closeBraceToken = this.createTokenSpan(this.position, node.closeBraceToken); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.Block(statements, closeBraceLeadingComments, closeBraceToken); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParameter = function (node) { - var start = this.position; - - var dotDotDotToken = this.createTokenSpan(this.position, node.dotDotDotToken); - - this.moveTo(node, node.identifier); - var identifier = this.visitIdentifier(node.identifier); - - var questionToken = this.createTokenSpan(this.position, node.questionToken); - this.movePast(node.questionToken); - var typeExpr = this.visitTypeAnnotation(node.typeAnnotation); - var init = node.equalsValueClause ? node.equalsValueClause.accept(this) : null; - - var modifiers = this.visitModifiers(node.modifiers); - - var result = new TypeScript.Parameter(dotDotDotToken, modifiers, identifier, questionToken, typeExpr, init); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMemberAccessExpression = function (node) { - var start = this.position; - - var expression = node.expression.accept(this); - this.movePast(node.dotToken); - var name = this.visitIdentifier(node.name); - - var result = new TypeScript.MemberAccessExpression(expression, name); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitPostfixUnaryExpression = function (node) { - var start = this.position; - - var operand = node.operand.accept(this); - this.movePast(node.operatorToken); - - var result = new TypeScript.PostfixUnaryExpression(node.kind() === 210 /* PostIncrementExpression */ ? 210 /* PostIncrementExpression */ : 211 /* PostDecrementExpression */, operand); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitElementAccessExpression = function (node) { - var start = this.position; - - var expression = node.expression.accept(this); - this.movePast(node.openBracketToken); - var argumentExpression = node.argumentExpression.accept(this); - this.movePast(node.closeBracketToken); - - var result = new TypeScript.ElementAccessExpression(expression, argumentExpression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitInvocationExpression = function (node) { - var start = this.position; - - var expression = node.expression.accept(this); - var argumentList = this.visitArgumentList(node.argumentList); - - var result = new TypeScript.InvocationExpression(expression, argumentList); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitArgumentList = function (node) { - if (node === null) { - return null; + function signatureRelatedTo(source, target, reportErrors) { + if (source === target) { + return -1 /* True */; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0 /* False */; + } + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var checkCount; + if (source.hasRestParameter && target.hasRestParameter) { + checkCount = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + checkCount = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + checkCount = sourceMax; + } + else { + checkCount = sourceMax < targetMax ? sourceMax : targetMax; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1 /* True */; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var saveErrorInfo = errorInfo; + var related = isRelatedTo(s, t, reportErrors); + if (!related) { + related = isRelatedTo(t, s, false); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); + } + return 0 /* False */; + } + errorInfo = saveErrorInfo; + } + result &= related; + } + var t = getReturnTypeOfSignature(target); + if (t === voidType) + return result; + var s = getReturnTypeOfSignature(source); + return result & isRelatedTo(s, t, reportErrors); } - - var start = this.position; - - var typeArguments = this.visitTypeArgumentList(node.typeArgumentList); - - this.movePast(node.openParenToken); - - var _arguments = this.visitSeparatedSyntaxList(node.arguments); - - if (node.arguments.fullWidth() === 0 && node.closeParenToken.fullWidth() === 0) { - var openParenTokenEnd = start + node.openParenToken.leadingTriviaWidth() + node.openParenToken.width(); - this.setSpanExplicit(_arguments, openParenTokenEnd, openParenTokenEnd + node.openParenToken.trailingTriviaWidth()); + function signaturesIdenticalTo(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return 0 /* False */; + } + var result = -1 /* True */; + for (var i = 0, len = sourceSignatures.length; i < len; ++i) { + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function stringIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(0 /* String */, source, target); + } + var targetType = getIndexTypeOfType(target, 0 /* String */); + if (targetType) { + var sourceType = getIndexTypeOfType(source, 0 /* String */); + if (!sourceType) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0 /* False */; + } + var related = isRelatedTo(sourceType, targetType, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0 /* False */; + } + return related; + } + return -1 /* True */; + } + function numberIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(1 /* Number */, source, target); + } + var targetType = getIndexTypeOfType(target, 1 /* Number */); + if (targetType) { + var sourceStringType = getIndexTypeOfType(source, 0 /* String */); + var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); + if (!(sourceStringType || sourceNumberType)) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0 /* False */; + } + if (sourceStringType && sourceNumberType) { + var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + } + else { + var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + } + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0 /* False */; + } + return related; + } + return -1 /* True */; + } + function indexTypesIdenticalTo(indexKind, source, target) { + var targetType = getIndexTypeOfType(target, indexKind); + var sourceType = getIndexTypeOfType(source, indexKind); + if (!sourceType && !targetType) { + return -1 /* True */; + } + if (sourceType && targetType) { + return isRelatedTo(sourceType, targetType); + } + return 0 /* False */; + } + } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1 /* True */; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0 /* False */; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0 /* False */; + } + } + else { + if (isOptionalProperty(sourceProp) !== isOptionalProperty(targetProp)) { + return 0 /* False */; + } + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + function compareSignatures(source, target, compareReturnTypes, compareTypes) { + if (source === target) { + return -1 /* True */; + } + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + return 0 /* False */; + } + var result = -1 /* True */; + if (source.typeParameters && target.typeParameters) { + if (source.typeParameters.length !== target.typeParameters.length) { + return 0 /* False */; + } + for (var i = 0, len = source.typeParameters.length; i < len; ++i) { + var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + if (!related) { + return 0 /* False */; + } + result &= related; + } + } + else if (source.typeParameters || source.typeParameters) { + return 0 /* False */; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { + return 0 /* False */; + } + result &= related; + } + if (compareReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } - - var closeParenToken = this.createTokenSpan(this.position, node.closeParenToken); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ArgumentList(typeArguments, _arguments, closeParenToken); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitBinaryExpression = function (node) { - var start = this.position; - - var left = node.left.accept(this); - this.movePast(node.operatorToken); - var right = node.right.accept(this); - - var result = new TypeScript.BinaryExpression(node.kind(), left, right); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConditionalExpression = function (node) { - var start = this.position; - - var condition = node.condition.accept(this); - this.movePast(node.questionToken); - var whenTrue = node.whenTrue.accept(this); - this.movePast(node.colonToken); - var whenFalse = node.whenFalse.accept(this); - - var result = new TypeScript.ConditionalExpression(condition, whenTrue, whenFalse); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstructSignature = function (node) { - var start = this.position; - - this.movePast(node.newKeyword); - var callSignature = this.visitCallSignature(node.callSignature); - - var result = new TypeScript.ConstructSignature(callSignature); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMethodSignature = function (node) { - var start = this.position; - - var name = this.visitToken(node.propertyName); - - var questionToken = this.createTokenSpan(this.position, node.questionToken); - this.movePast(node.questionToken); - - var callSignature = this.visitCallSignature(node.callSignature); - - var result = new TypeScript.MethodSignature(name, questionToken, callSignature); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitIndexSignature = function (node) { - var start = this.position; - - this.movePast(node.openBracketToken); - - var parameter = node.parameter.accept(this); - - this.movePast(node.closeBracketToken); - var returnType = this.visitTypeAnnotation(node.typeAnnotation); - - var result = new TypeScript.IndexSignature(parameter, returnType); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitPropertySignature = function (node) { - var start = this.position; - - var name = this.visitToken(node.propertyName); - - var questionToken = this.createTokenSpan(this.position, node.questionToken); - this.movePast(node.questionToken); - var typeExpr = this.visitTypeAnnotation(node.typeAnnotation); - - var result = new TypeScript.PropertySignature(name, questionToken, typeExpr); - this.setCommentsAndSpan(result, start, node); - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParameterList = function (node) { - if (!node) { - return null; + } + function isSupertypeOfEach(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + return false; + } + return true; + } + function getCommonSupertype(types) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { + var bestSupertype; + var bestSupertypeDownfallType; + var bestSupertypeScore = 0; + for (var i = 0; i < types.length; i++) { + var score = 0; + var downfallType = undefined; + for (var j = 0; j < types.length; j++) { + if (isTypeSubtypeOf(types[j], types[i])) { + score++; + } + else if (!downfallType) { + downfallType = types[j]; + } + } + if (score > bestSupertypeScore) { + bestSupertype = types[i]; + bestSupertypeDownfallType = downfallType; + bestSupertypeScore = score; + } + if (bestSupertypeScore === types.length - 1) { + break; + } + } + 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; + } + function getInnermostTypeOfNestedArrayTypes(type) { + while (isArrayType(type)) { + type = type.typeArguments[0]; + } + return type; + } + function getWidenedType(type, suppressNoImplicitAnyErrors) { + if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + return anyType; + } + if (type.flags & 16384 /* Union */) { + return getWidenedTypeOfUnion(type); + } + if (isTypeOfObjectLiteral(type)) { + return getWidenedTypeOfObjectLiteral(type); + } + if (isArrayType(type)) { + return getWidenedTypeOfArrayLiteral(type); + } + return type; + function getWidenedTypeOfUnion(type) { + return getUnionType(ts.map(type.types, function (t) { return getWidenedType(t, suppressNoImplicitAnyErrors); })); + } + function getWidenedTypeOfObjectLiteral(type) { + var properties = getPropertiesOfObjectType(type); + if (properties.length) { + var widenedTypes = []; + var propTypeWasWidened = false; + ts.forEach(properties, function (p) { + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + propTypeWasWidened = true; + if (!suppressNoImplicitAnyErrors && compilerOptions.noImplicitAny && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(widenedType)); + } + } + widenedTypes.push(widenedType); + }); + if (propTypeWasWidened) { + var members = {}; + var index = 0; + ts.forEach(properties, function (p) { + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */ | p.flags, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedTypes[index++]; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + members[symbol.name] = symbol; + }); + var stringIndexType = getIndexTypeOfType(type, 0 /* String */); + var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + if (stringIndexType) + stringIndexType = getWidenedType(stringIndexType); + if (numberIndexType) + numberIndexType = getWidenedType(numberIndexType); + type = createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + } + } + return type; + } + function getWidenedTypeOfArrayLiteral(type) { + var elementType = type.typeArguments[0]; + var widenedType = getWidenedType(elementType, suppressNoImplicitAnyErrors); + type = elementType !== widenedType ? createArrayType(widenedType) : type; + return type; + } + } + function forEachMatchingParameterType(source, target, callback) { + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var count; + if (source.hasRestParameter && target.hasRestParameter) { + count = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + count = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + count = sourceMax; + } + else { + count = sourceMax < targetMax ? sourceMax : targetMax; + } + for (var i = 0; i < count; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + callback(s, t); + } + } + function createInferenceContext(typeParameters, inferUnionTypes) { + var inferences = []; + for (var i = 0; i < typeParameters.length; i++) { + inferences.push({ primary: undefined, secondary: undefined }); + } + return { + typeParameters: typeParameters, + inferUnionTypes: inferUnionTypes, + inferenceCount: 0, + inferences: inferences, + inferredTypes: new Array(typeParameters.length) + }; + } + function inferTypes(context, source, target) { + var sourceStack; + var targetStack; + var depth = 0; + var inferiority = 0; + inferFromTypes(source, target); + function isInProcess(source, target) { + for (var i = 0; i < depth; i++) { + if (source === sourceStack[i] && target === targetStack[i]) + return true; + } + return false; + } + function isWithinDepthLimit(type, stack) { + if (depth >= 5) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 /* Reference */ && t.target === target) + count++; + } + return count < 5; + } + return true; + } + function inferFromTypes(source, target) { + if (target.flags & 512 /* TypeParameter */) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (target === typeParameters[i]) { + var inferences = context.inferences[i]; + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) + candidates.push(source); + break; + } + } + } + else if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + var sourceTypes = source.typeArguments; + var targetTypes = target.typeArguments; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + else if (target.flags & 16384 /* Union */) { + var targetTypes = target.types; + var typeParameterCount = 0; + var typeParameter; + for (var i = 0; i < targetTypes.length; i++) { + var t = targetTypes[i]; + if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { + typeParameter = t; + typeParameterCount++; + } + else { + inferFromTypes(source, t); + } + } + if (typeParameterCount === 1) { + inferiority++; + inferFromTypes(source, typeParameter); + inferiority--; + } + } + else if (source.flags & 16384 /* Union */) { + var sourceTypes = source.types; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], target); + } + } + else if (source.flags & 48128 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */))) { + if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { + if (depth === 0) { + sourceStack = []; + targetStack = []; + } + sourceStack[depth] = source; + targetStack[depth] = target; + depth++; + inferFromProperties(source, target); + inferFromSignatures(source, target, 0 /* Call */); + inferFromSignatures(source, target, 1 /* Construct */); + inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */); + inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */); + inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */); + depth--; + } + } } - - var start = this.position; - - var openParenToken = node.openParenToken; - - this.previousTokenTrailingComments = this.convertTokenTrailingComments(openParenToken, start + openParenToken.leadingTriviaWidth() + openParenToken.width()); - var openParenTrailingComments = null; - if (node.parameters.childCount() === 0) { - openParenTrailingComments = this.previousTokenTrailingComments; - this.previousTokenTrailingComments = null; + function inferFromProperties(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfObjectType(source, targetProp.name); + if (sourceProp) { + inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + } } - - this.movePast(node.openParenToken); - var parameters = this.visitSeparatedSyntaxList(node.parameters); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ParameterList(openParenTrailingComments, parameters); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCallSignature = function (node) { - var start = this.position; - - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var parameters = this.visitParameterList(node.parameterList); - var returnType = this.visitTypeAnnotation(node.typeAnnotation); - - var result = new TypeScript.CallSignature(typeParameters, parameters, returnType); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeParameterList = function (node) { - if (!node) { - return null; + function inferFromSignatures(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var sourceLen = sourceSignatures.length; + var targetLen = targetSignatures.length; + var len = sourceLen < targetLen ? sourceLen : targetLen; + for (var i = 0; i < len; i++) { + inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); + } } - - var start = this.position; - this.movePast(node.lessThanToken); - var typeParameters = this.visitSeparatedSyntaxList(node.typeParameters); - this.movePast(node.greaterThanToken); - - var result = new TypeScript.TypeParameterList(typeParameters); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeParameter = function (node) { - var start = this.position; - - var identifier = this.visitIdentifier(node.identifier); - var constraint = node.constraint ? node.constraint.accept(this) : null; - - var result = new TypeScript.TypeParameter(identifier, constraint); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstraint = function (node) { - var start = this.position; - this.movePast(node.extendsKeyword); - var type = this.visitType(node.type); - - var result = new TypeScript.Constraint(type); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitIfStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.condition); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - var thenBod = node.statement.accept(this); - var elseBod = node.elseClause ? node.elseClause.accept(this) : null; - - var result = new TypeScript.IfStatement(condition, thenBod, elseBod); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitElseClause = function (node) { - var start = this.position; - - this.movePast(node.elseKeyword); - var statement = node.statement.accept(this); - - var result = new TypeScript.ElseClause(statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitExpressionStatement = function (node) { - var start = this.position; - - var preComments = this.convertTokenLeadingComments(node.firstToken(), start); - var expression = node.expression.accept(this); - - var semicolonPosition = this.position; - - var postComments = this.convertComments(node.semicolonToken.trailingTrivia(), this.position + node.semicolonToken.leadingTriviaWidth() + node.semicolonToken.width()); - this.movePast(node.semicolonToken); - - var result = new TypeScript.ExpressionStatement(expression); - this.setSpan(result, start, node); - - result.setPreComments(preComments); - result.setPostComments(postComments); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstructorDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.callSignature); - var callSignature = this.visitCallSignature(node.callSignature); - - var block = node.block ? node.block.accept(this) : null; - - this.movePast(node.semicolonToken); - - var result = new TypeScript.ConstructorDeclaration(callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitIndexMemberDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.indexSignature); - var indexSignature = node.indexSignature.accept(this); - - this.movePast(node.semicolonToken); - - var result = new TypeScript.IndexMemberDeclaration(indexSignature); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMemberFunctionDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.propertyName); - var name = this.visitToken(node.propertyName); - - var callSignature = this.visitCallSignature(node.callSignature); - var block = node.block ? this.visitBlock(node.block) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.MemberFunctionDeclaration(this.visitModifiers(node.modifiers), name, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitGetAccessor = function (node) { - var start = this.position; - - this.moveTo(node, node.propertyName); - var name = this.visitToken(node.propertyName); - var parameters = this.visitParameterList(node.parameterList); - var returnType = this.visitTypeAnnotation(node.typeAnnotation); - - var block = node.block ? node.block.accept(this) : null; - var result = new TypeScript.GetAccessor(this.visitModifiers(node.modifiers), name, parameters, returnType, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSetAccessor = function (node) { - var start = this.position; - - this.moveTo(node, node.propertyName); - var name = this.visitToken(node.propertyName); - var parameters = this.visitParameterList(node.parameterList); - var block = node.block ? node.block.accept(this) : null; - var result = new TypeScript.SetAccessor(this.visitModifiers(node.modifiers), name, parameters, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMemberVariableDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.variableDeclarator); - var variableDeclarator = node.variableDeclarator.accept(this); - this.movePast(node.semicolonToken); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.MemberVariableDeclaration(modifiers, variableDeclarator); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitThrowStatement = function (node) { - var start = this.position; - - this.movePast(node.throwKeyword); - var expression = node.expression.accept(this); - this.movePast(node.semicolonToken); - - var result = new TypeScript.ThrowStatement(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitReturnStatement = function (node) { - var start = this.position; - - this.movePast(node.returnKeyword); - var expression = node.expression ? node.expression.accept(this) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.ReturnStatement(expression); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitObjectCreationExpression = function (node) { - var start = this.position; - - this.movePast(node.newKeyword); - var expression = node.expression.accept(this); - var argumentList = this.visitArgumentList(node.argumentList); - - var result = new TypeScript.ObjectCreationExpression(expression, argumentList); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSwitchStatement = function (node) { - var start = this.position; - - this.movePast(node.switchKeyword); - this.movePast(node.openParenToken); - var expression = node.expression.accept(this); - - var closeParenToken = this.createTokenSpan(this.position, node.closeParenToken); - this.movePast(node.closeParenToken); - this.movePast(node.openBraceToken); - var switchClauses = this.visitSyntaxList(node.switchClauses); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.SwitchStatement(expression, closeParenToken, switchClauses); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCaseSwitchClause = function (node) { - var start = this.position; - - this.movePast(node.caseKeyword); - var expression = node.expression.accept(this); - this.movePast(node.colonToken); - var statements = this.visitSyntaxList(node.statements); - - var result = new TypeScript.CaseSwitchClause(expression, statements); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDefaultSwitchClause = function (node) { - var start = this.position; - - this.movePast(node.defaultKeyword); - this.movePast(node.colonToken); - var statements = this.visitSyntaxList(node.statements); - - var result = new TypeScript.DefaultSwitchClause(statements); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitBreakStatement = function (node) { - var start = this.position; - - this.movePast(node.breakKeyword); - var identifier = node.identifier ? node.identifier.accept(this) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.BreakStatement(identifier); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitContinueStatement = function (node) { - var start = this.position; - - this.movePast(node.continueKeyword); - var identifier = node.identifier ? node.identifier.accept(this) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.ContinueStatement(identifier); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitForStatement = function (node) { - var start = this.position; - - this.movePast(node.forKeyword); - this.movePast(node.openParenToken); - var variableDeclaration = node.variableDeclaration ? node.variableDeclaration.accept(this) : null; - var initializer = node.initializer ? node.initializer.accept(this) : null; - - this.movePast(node.firstSemicolonToken); - var cond = node.condition ? node.condition.accept(this) : null; - this.movePast(node.secondSemicolonToken); - var incr = node.incrementor ? node.incrementor.accept(this) : null; - this.movePast(node.closeParenToken); - var body = node.statement.accept(this); - - var result = new TypeScript.ForStatement(variableDeclaration, initializer, cond, incr, body); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitForInStatement = function (node) { - var start = this.position; - - this.movePast(node.forKeyword); - this.movePast(node.openParenToken); - var variableDeclaration = node.variableDeclaration ? node.variableDeclaration.accept(this) : null; - var left = node.left ? node.left.accept(this) : null; - - this.movePast(node.inKeyword); - var expression = node.expression.accept(this); - this.movePast(node.closeParenToken); - var body = node.statement.accept(this); - - var result = new TypeScript.ForInStatement(variableDeclaration, left, expression, body); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitWhileStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.condition); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - var statement = node.statement.accept(this); - - var result = new TypeScript.WhileStatement(condition, statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitWithStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.condition); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - var statement = node.statement.accept(this); - - var result = new TypeScript.WithStatement(condition, statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCastExpression = function (node) { - var start = this.position; - - this.movePast(node.lessThanToken); - var castTerm = this.visitType(node.type); - this.movePast(node.greaterThanToken); - var expression = node.expression.accept(this); - - var result = new TypeScript.CastExpression(castTerm, expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitObjectLiteralExpression = function (node) { - var start = this.position; - - var openStart = this.position + node.openBraceToken.leadingTriviaWidth(); - this.movePast(node.openBraceToken); - - var propertyAssignments = this.visitSeparatedSyntaxList(node.propertyAssignments); - - var closeStart = this.position + node.closeBraceToken.leadingTriviaWidth(); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.ObjectLiteralExpression(propertyAssignments); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSimplePropertyAssignment = function (node) { - var start = this.position; - - var preComments = this.convertTokenLeadingComments(node.firstToken(), start); - var postComments = this.convertNodeTrailingComments(node, node.lastToken(), start); - - var propertyName = node.propertyName.accept(this); - - var afterColonComments = this.convertTokenTrailingComments(node.colonToken, this.position + node.colonToken.leadingTriviaWidth() + node.colonToken.width()); - - this.movePast(node.colonToken); - var expression = node.expression.accept(this); - expression.setPreComments(this.mergeComments(afterColonComments, expression.preComments())); - - var result = new TypeScript.SimplePropertyAssignment(propertyName, expression); - this.setSpan(result, start, node); - - result.setPreComments(preComments); - result.setPostComments(postComments); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionPropertyAssignment = function (node) { - var start = this.position; - - var propertyName = node.propertyName.accept(this); - var callSignature = this.visitCallSignature(node.callSignature); - var block = this.visitBlock(node.block); - - var result = new TypeScript.FunctionPropertyAssignment(propertyName, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionExpression = function (node) { - var start = this.position; - - this.movePast(node.functionKeyword); - var name = node.identifier === null ? null : this.visitIdentifier(node.identifier); - - var callSignature = this.visitCallSignature(node.callSignature); - var block = node.block ? node.block.accept(this) : null; - - var result = new TypeScript.FunctionExpression(name, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEmptyStatement = function (node) { - var start = this.position; - - this.movePast(node.semicolonToken); - - var result = new TypeScript.EmptyStatement(); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTryStatement = function (node) { - var start = this.position; - - this.movePast(node.tryKeyword); - var tryBody = node.block.accept(this); - - var catchClause = null; - if (node.catchClause !== null) { - catchClause = node.catchClause.accept(this); + function inferFromSignature(source, target) { + forEachMatchingParameterType(source, target, inferFromTypes); + inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + function inferFromIndexTypes(source, target, sourceKind, targetKind) { + var targetIndexType = getIndexTypeOfType(target, targetKind); + if (targetIndexType) { + var sourceIndexType = getIndexTypeOfType(source, sourceKind); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetIndexType); + } + } + } + } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } + function getInferredType(context, index) { + var inferredType = context.inferredTypes[index]; + if (!inferredType) { + var inferences = getInferenceCandidates(context, index); + if (inferences.length) { + var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; + } + else { + inferredType = emptyObjectType; + } + if (inferredType !== inferenceFailureType) { + var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + } + context.inferredTypes[index] = inferredType; + } + return inferredType; + } + function getInferredTypes(context) { + for (var i = 0; i < context.inferredTypes.length; i++) { + getInferredType(context, i); + } + return context.inferredTypes; + } + function hasAncestor(node, kind) { + return ts.getAncestor(node, kind) !== undefined; + } + function getResolvedSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 /* Value */ | 4194304 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + } + return links.resolvedSymbol; + } + function isInTypeQuery(node) { + while (node) { + switch (node.kind) { + case 135 /* TypeQuery */: + return true; + case 63 /* Identifier */: + case 120 /* QualifiedName */: + node = node.parent; + continue; + default: + return false; + } + } + ts.Debug.fail("should not get here"); + } + function subtractPrimitiveTypes(type, subtractMask) { + 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); })); + } + } + return type; + } + function isVariableAssignedWithin(symbol, node) { + var links = getNodeLinks(node); + if (links.assignmentChecks) { + var cachedResult = links.assignmentChecks[symbol.id]; + if (cachedResult !== undefined) { + return cachedResult; + } } - - var finallyBody = null; - if (node.finallyClause !== null) { - finallyBody = node.finallyClause.accept(this); + else { + links.assignmentChecks = {}; + } + return links.assignmentChecks[symbol.id] = isAssignedIn(node); + function isAssignedInBinaryExpression(node) { + if (node.operator >= 51 /* FirstAssignment */ && node.operator <= 62 /* LastAssignment */) { + var n = node.left; + while (n.kind === 149 /* ParenthesizedExpression */) { + n = n.expression; + } + if (n.kind === 63 /* Identifier */ && getResolvedSymbol(n) === symbol) { + return true; + } + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedInVariableDeclaration(node) { + if (getSymbolOfNode(node) === symbol && node.initializer) { + return true; + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedIn(node) { + switch (node.kind) { + case 157 /* BinaryExpression */: + return isAssignedInBinaryExpression(node); + case 183 /* VariableDeclaration */: + return isAssignedInVariableDeclaration(node); + case 141 /* ArrayLiteralExpression */: + case 142 /* ObjectLiteralExpression */: + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 148 /* TypeAssertionExpression */: + case 149 /* ParenthesizedExpression */: + case 155 /* PrefixUnaryExpression */: + case 152 /* DeleteExpression */: + case 153 /* TypeOfExpression */: + case 154 /* VoidExpression */: + case 156 /* PostfixUnaryExpression */: + case 158 /* ConditionalExpression */: + case 163 /* Block */: + case 164 /* VariableStatement */: + case 166 /* ExpressionStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 174 /* ReturnStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + return ts.forEachChild(node, isAssignedIn); + } + return false; + } + } + function resolveLocation(node) { + var containerNodes = []; + for (var parent = node.parent; parent; parent = parent.parent) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { + containerNodes.unshift(parent); + } + } + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); + } + function getSymbolAtLocation(node) { + resolveLocation(node); + return getSymbolInfo(node); + } + function getTypeAtLocation(node) { + resolveLocation(node); + return getTypeOfNode(node); + } + function getTypeOfSymbolAtLocation(symbol, node) { + resolveLocation(node); + return getNarrowedTypeOfSymbol(symbol, node); + } + function getNarrowedTypeOfSymbol(symbol, node) { + var type = getTypeOfSymbol(symbol); + if (node && symbol.flags & 3 /* Variable */ && type.flags & (48128 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { + loop: while (node.parent) { + var child = node; + node = node.parent; + var narrowedType = type; + switch (node.kind) { + case 167 /* IfStatement */: + if (child !== node.expression) { + narrowedType = narrowType(type, node.expression, child === node.thenStatement); + } + break; + case 158 /* ConditionalExpression */: + if (child !== node.condition) { + narrowedType = narrowType(type, node.condition, child === node.whenTrue); + } + break; + case 157 /* BinaryExpression */: + if (child === node.right) { + if (node.operator === 47 /* AmpersandAmpersandToken */) { + narrowedType = narrowType(type, node.left, true); + } + else if (node.operator === 48 /* BarBarToken */) { + narrowedType = narrowType(type, node.left, false); + } + } + break; + case 201 /* SourceFile */: + case 189 /* ModuleDeclaration */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + break loop; + } + if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { + if (isVariableAssignedWithin(symbol, node)) { + break; + } + type = narrowedType; + } + } + } + return type; + function narrowTypeByEquality(type, expr, assumeTrue) { + if (expr.left.kind !== 153 /* TypeOfExpression */ || expr.right.kind !== 7 /* StringLiteral */) { + return type; + } + var left = expr.left; + var right = expr.right; + if (left.expression.kind !== 63 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + return type; + } + var t = right.text; + var checkType = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; + if (expr.operator === 30 /* ExclamationEqualsEqualsToken */) { + assumeTrue = !assumeTrue; + } + if (assumeTrue) { + return checkType === emptyObjectType ? subtractPrimitiveTypes(type, 2 /* String */ | 4 /* Number */ | 8 /* Boolean */) : checkType; + } + else { + return checkType === emptyObjectType ? type : subtractPrimitiveTypes(type, checkType.flags); + } + } + function narrowTypeByAnd(type, expr, assumeTrue) { + if (assumeTrue) { + return narrowType(narrowType(type, expr.left, true), expr.right, true); + } + else { + return getUnionType([ + narrowType(type, expr.left, false), + narrowType(narrowType(type, expr.left, true), expr.right, false) + ]); + } + } + function narrowTypeByOr(type, expr, assumeTrue) { + if (assumeTrue) { + return getUnionType([ + narrowType(type, expr.left, true), + narrowType(narrowType(type, expr.left, false), expr.right, true) + ]); + } + else { + return narrowType(narrowType(type, expr.left, false), expr.right, false); + } + } + function narrowTypeByInstanceof(type, expr, assumeTrue) { + if (!assumeTrue || expr.left.kind !== 63 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + return type; + } + var rightType = checkExpression(expr.right); + if (!isTypeSubtypeOf(rightType, globalFunctionType)) { + return type; + } + var prototypeProperty = getPropertyOfType(rightType, "prototype"); + if (!prototypeProperty) { + return type; + } + var prototypeType = getTypeOfSymbol(prototypeProperty); + return isTypeSubtypeOf(prototypeType, type) ? prototypeType : type; + } + function narrowType(type, expr, assumeTrue) { + switch (expr.kind) { + case 149 /* ParenthesizedExpression */: + return narrowType(type, expr.expression, assumeTrue); + case 157 /* BinaryExpression */: + var operator = expr.operator; + if (operator === 29 /* EqualsEqualsEqualsToken */ || operator === 30 /* ExclamationEqualsEqualsToken */) { + return narrowTypeByEquality(type, expr, assumeTrue); + } + else if (operator === 47 /* AmpersandAmpersandToken */) { + return narrowTypeByAnd(type, expr, assumeTrue); + } + else if (operator === 48 /* BarBarToken */) { + return narrowTypeByOr(type, expr, assumeTrue); + } + else if (operator === 85 /* InstanceOfKeyword */) { + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + break; + case 155 /* PrefixUnaryExpression */: + if (expr.operator === 45 /* ExclamationToken */) { + return narrowType(type, expr.operand, !assumeTrue); + } + break; + } + return type; + } + } + function checkIdentifier(node) { + var symbol = getResolvedSymbol(node); + if (symbol.flags & 33554432 /* Import */) { + getSymbolLinks(symbol).referenced = getSymbolLinks(symbol).referenced || (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol))); + } + checkCollisionWithCapturedSuperVariable(node, node); + checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithIndexVariableInGeneratedCode(node, node); + return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + } + function captureLexicalThis(node, container) { + var classNode = container.parent && container.parent.kind === 185 /* ClassDeclaration */ ? container.parent : undefined; + getNodeLinks(node).flags |= 2 /* LexicalThis */; + if (container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */) { + getNodeLinks(classNode).flags |= 4 /* CaptureThis */; + } + else { + getNodeLinks(container).flags |= 4 /* CaptureThis */; + } + } + function checkThisExpression(node) { + var container = ts.getThisContainer(node, true); + var needToCaptureLexicalThis = false; + if (container.kind === 151 /* ArrowFunction */) { + container = ts.getThisContainer(container, false); + needToCaptureLexicalThis = true; + } + switch (container.kind) { + case 189 /* ModuleDeclaration */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + break; + case 188 /* EnumDeclaration */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + break; + case 126 /* Constructor */: + if (isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + } + break; + case 124 /* Property */: + if (container.flags & 128 /* Static */) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + } + break; + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node, container); + } + var classNode = container.parent && container.parent.kind === 185 /* ClassDeclaration */ ? container.parent : undefined; + if (classNode) { + var symbol = getSymbolOfNode(classNode); + return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + } + return anyType; + } + function getSuperContainer(node) { + while (true) { + node = node.parent; + if (!node) + return node; + switch (node.kind) { + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return node; + } + } + } + function isInConstructorArgumentInitializer(node, constructorDecl) { + for (var n = node; n && n !== constructorDecl; n = n.parent) { + if (n.kind === 123 /* Parameter */) { + return true; + } + } + return false; + } + function checkSuperExpression(node) { + var isCallExpression = node.parent.kind === 145 /* CallExpression */ && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 185 /* ClassDeclaration */); + var baseClass; + if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); + baseClass = classType.baseTypes.length && classType.baseTypes[0]; + } + if (!baseClass) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + return unknownType; + } + var container = getSuperContainer(node); + if (container) { + var canUseSuperExpression = false; + if (isCallExpression) { + canUseSuperExpression = container.kind === 126 /* Constructor */; + } + else { + var needToCaptureLexicalThis = false; + while (container && container.kind === 151 /* ArrowFunction */) { + container = getSuperContainer(container); + needToCaptureLexicalThis = true; + } + if (container && container.parent && container.parent.kind === 185 /* ClassDeclaration */) { + if (container.flags & 128 /* Static */) { + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */; + } + else { + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */ || container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */; + } + } + } + if (canUseSuperExpression) { + var returnType; + if ((container.flags & 128 /* Static */) || isCallExpression) { + getNodeLinks(node).flags |= 32 /* SuperStatic */; + returnType = getTypeOfSymbol(baseClass.symbol); + } + else { + getNodeLinks(node).flags |= 16 /* SuperInstance */; + returnType = baseClass; + } + if (container.kind === 126 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + returnType = unknownType; + } + if (!isCallExpression && needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + return returnType; + } + } + if (isCallExpression) { + error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } + else { + error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + } + return unknownType; + } + function getContextuallyTypedParameterType(parameter) { + if (isFunctionExpressionOrArrowFunction(parameter.parent)) { + var func = parameter.parent; + if (isContextSensitive(func)) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameters(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + } + } + } + } + return undefined; + } + function getContextualTypeForInitializerExpression(node) { + var declaration = node.parent; + if (node === declaration.initializer) { + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 123 /* Parameter */) { + return getContextuallyTypedParameterType(declaration); + } + } + return undefined; + } + function getContextualTypeForReturnExpression(node) { + var func = ts.getContainingFunction(node); + if (func) { + if (func.type || func.kind === 126 /* Constructor */ || func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + } + var signature = getContextualSignatureForFunctionLikeDeclaration(func); + if (signature) { + return getReturnTypeOfSignature(signature); + } + } + return undefined; + } + function getContextualTypeForArgument(callTarget, arg) { + var args = getEffectiveCallArguments(callTarget); + var argIndex = ts.indexOf(args, arg); + if (argIndex >= 0) { + var signature = getResolvedSignature(callTarget); + return getTypeAtPosition(signature, argIndex); + } + return undefined; + } + function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { + if (template.parent.kind === 147 /* TaggedTemplateExpression */) { + return getContextualTypeForArgument(template.parent, substitutionExpression); + } + return undefined; + } + function getContextualTypeForBinaryOperand(node) { + var binaryExpression = node.parent; + var operator = binaryExpression.operator; + if (operator >= 51 /* FirstAssignment */ && operator <= 62 /* LastAssignment */) { + if (node === binaryExpression.right) { + return checkExpression(binaryExpression.left); + } + } + else if (operator === 48 /* BarBarToken */) { + var type = getContextualType(binaryExpression); + if (!type && node === binaryExpression.right) { + type = checkExpression(binaryExpression.left); + } + return type; + } + return undefined; + } + function applyToContextualType(type, mapper) { + if (!(type.flags & 16384 /* Union */)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var i = 0; i < types.length; i++) { + var t = mapper(types[i]); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; + } + function getTypeOfPropertyOfContextualType(type, name) { + return applyToContextualType(type, function (t) { + var prop = getPropertyOfObjectType(t, name); + return prop ? getTypeOfSymbol(prop) : undefined; + }); + } + function getIndexTypeOfContextualType(type, kind) { + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + } + function contextualTypeIsTupleType(type) { + return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getPropertyOfObjectType(t, "0"); }) : getPropertyOfObjectType(type, "0")); + } + function contextualTypeHasIndexSignature(type, kind) { + return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + } + function getContextualTypeForObjectLiteralMethod(node) { + ts.Debug.assert(ts.isObjectLiteralMethod(node)); + if (isInsideWithStatementBody(node)) { + return undefined; + } + return getContextualTypeForObjectLiteralElement(node); + } + 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 */); + } + return undefined; + } + function getContextualTypeForElementExpression(node) { + var arrayLiteral = node.parent; + var type = getContextualType(arrayLiteral); + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */); + } + return undefined; + } + function getContextualTypeForConditionalOperand(node) { + var conditional = node.parent; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + } + function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (node.contextualType) { + return node.contextualType; + } + var parent = node.parent; + switch (parent.kind) { + case 183 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: + return getContextualTypeForInitializerExpression(node); + case 151 /* ArrowFunction */: + case 174 /* ReturnStatement */: + return getContextualTypeForReturnExpression(node); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return getContextualTypeForArgument(parent, node); + case 148 /* TypeAssertionExpression */: + return getTypeFromTypeNode(parent.type); + case 157 /* BinaryExpression */: + return getContextualTypeForBinaryOperand(node); + case 198 /* PropertyAssignment */: + return getContextualTypeForObjectLiteralElement(parent); + case 141 /* ArrayLiteralExpression */: + return getContextualTypeForElementExpression(node); + case 158 /* ConditionalExpression */: + return getContextualTypeForConditionalOperand(node); + case 162 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 159 /* TemplateExpression */); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + } + return undefined; + } + function getNonGenericSignature(type) { + var signatures = getSignaturesOfObjectOrUnionType(type, 0 /* Call */); + if (signatures.length === 1) { + var signature = signatures[0]; + if (!signature.typeParameters) { + return signature; + } + } + } + function isFunctionExpressionOrArrowFunction(node) { + return node.kind === 150 /* FunctionExpression */ || node.kind === 151 /* ArrowFunction */; + } + function getContextualSignatureForFunctionLikeDeclaration(node) { + return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; + } + function getContextualSignature(node) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + if (!type) { + return undefined; + } + if (!(type.flags & 16384 /* Union */)) { + return getNonGenericSignature(type); + } + var signatureList; + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0 /* Call */).length > 1) { + return undefined; + } + var signature = getNonGenericSignature(types[i]); + if (signature) { + if (!signatureList) { + signatureList = [signature]; + } + else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + return undefined; + } + else { + signatureList.push(signature); + } + } + } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; } - - var result = new TypeScript.TryStatement(tryBody, catchClause, finallyBody); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCatchClause = function (node) { - var start = this.position; - - this.movePast(node.catchKeyword); - this.movePast(node.openParenToken); - var identifier = this.visitIdentifier(node.identifier); - var typeAnnotation = this.visitTypeAnnotation(node.typeAnnotation); - this.movePast(node.closeParenToken); - var block = node.block.accept(this); - - var result = new TypeScript.CatchClause(identifier, typeAnnotation, block); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFinallyClause = function (node) { - var start = this.position; - this.movePast(node.finallyKeyword); - var block = node.block.accept(this); - - var result = new TypeScript.FinallyClause(block); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitLabeledStatement = function (node) { - var start = this.position; - - var identifier = this.visitIdentifier(node.identifier); - this.movePast(node.colonToken); - var statement = node.statement.accept(this); - - var result = new TypeScript.LabeledStatement(identifier, statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDoStatement = function (node) { - var start = this.position; - - this.movePast(node.doKeyword); - var statement = node.statement.accept(this); - var whileKeyword = this.createTokenSpan(this.position, node.whileKeyword); - - this.movePast(node.whileKeyword); - this.movePast(node.openParenToken); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - this.movePast(node.semicolonToken); - - var result = new TypeScript.DoStatement(statement, whileKeyword, condition); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeOfExpression = function (node) { - var start = this.position; - - this.movePast(node.typeOfKeyword); - var expression = node.expression.accept(this); - - var result = new TypeScript.TypeOfExpression(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDeleteExpression = function (node) { - var start = this.position; - - this.movePast(node.deleteKeyword); - var expression = node.expression.accept(this); - - var result = new TypeScript.DeleteExpression(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVoidExpression = function (node) { - var start = this.position; - - this.movePast(node.voidKeyword); - var expression = node.expression.accept(this); - - var result = new TypeScript.VoidExpression(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDebuggerStatement = function (node) { - var start = this.position; - - this.movePast(node.debuggerKeyword); - this.movePast(node.semicolonToken); - - var result = new TypeScript.DebuggerStatement(); - this.setSpan(result, start, node); - return result; - }; - return SyntaxTreeToAstVisitor; - })(); - TypeScript.SyntaxTreeToAstVisitor = SyntaxTreeToAstVisitor; - - function applyDelta(ast, delta) { - if (ast) { - if (ast._start !== -1) { - ast._start += delta; + } + function isInferentialContext(mapper) { + return mapper && mapper !== identityMapper; + } + function checkArrayLiteral(node, contextualMapper) { + var elements = node.elements; + if (!elements.length) { + return createArrayType(undefinedType); + } + var elementTypes = ts.map(elements, function (e) { return checkExpression(e, contextualMapper); }); + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsTupleType(contextualType)) { + return createTupleType(elementTypes); + } + return createArrayType(getUnionType(elementTypes)); + } + function isNumericName(name) { + return (+name).toString() === name; + } + function checkObjectLiteral(node, contextualMapper) { + var members = node.symbol.members; + var properties = {}; + var contextualType = getContextualType(node); + 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]; + var type; + if (memberDecl.kind === 198 /* PropertyAssignment */) { + type = checkExpression(memberDecl.initializer, contextualMapper); + } + else if (memberDecl.kind === 125 /* Method */) { + type = checkObjectLiteralMethod(memberDecl, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 199 /* ShorthandPropertyAssignment */); + type = memberDecl.name.kind === 121 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); + } + var prop = createSymbol(4 /* Property */ | 268435456 /* 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 { + var getAccessor = ts.getDeclarationOfKind(member, 127 /* GetAccessor */); + if (getAccessor) { + checkAccessorDeclaration(getAccessor); + } + var setAccessor = ts.getDeclarationOfKind(member, 128 /* SetAccessor */); + if (setAccessor) { + checkAccessorDeclaration(setAccessor); + } + } + properties[member.name] = member; + } + } + var stringIndexType = getIndexType(0 /* String */); + var numberIndexType = getIndexType(1 /* Number */); + return createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); + 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); + } + } + } + } + return propTypes.length ? getUnionType(propTypes) : undefinedType; + } + return undefined; + } + } + function getDeclarationKindFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.kind : 124 /* Property */; + } + function getDeclarationFlagsFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 536870912 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + } + function checkClassPropertyAccess(node, left, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + return; + } + var enclosingClassDeclaration = ts.getAncestor(node, 185 /* ClassDeclaration */); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + if (flags & 32 /* Private */) { + if (declaringClass !== enclosingClass) { + error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + if (left.kind === 89 /* SuperKeyword */) { + return; + } + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + if (flags & 128 /* Static */) { + return; + } + if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } + } + function checkPropertyAccessExpression(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); + } + function checkQualifiedName(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); + } + function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { + var type = checkExpressionOrQualifiedName(left); + if (type === unknownType) + return type; + if (type !== anyType) { + var apparentType = getApparentType(getWidenedType(type)); + if (apparentType === unknownType) { + return unknownType; + } + var prop = getPropertyOfType(apparentType, right.text); + if (!prop) { + if (right.text) { + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + } + return unknownType; + } + getNodeLinks(node).resolvedSymbol = prop; + if (prop.parent && prop.parent.flags & 32 /* Class */) { + if (left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { + error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + } + else { + checkClassPropertyAccess(node, left, type, prop); + } + } + return getTypeOfSymbol(prop); } - - if (ast._end !== -1) { - ast._end += delta; + return anyType; + } + function isValidPropertyAccess(node, propertyName) { + var left = node.kind === 143 /* PropertyAccessExpression */ ? node.expression : node.left; + var type = checkExpressionOrQualifiedName(left); + if (type !== unknownType && type !== anyType) { + var prop = getPropertyOfType(getWidenedType(type), propertyName); + if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { + if (left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { + return false; + } + else { + var diagnosticsCount = diagnostics.length; + checkClassPropertyAccess(node, left, type, prop); + return diagnostics.length === diagnosticsCount; + } + } } + return true; } - } - - function applyDeltaToComments(comments, delta) { - if (comments && comments.length > 0) { - for (var i = 0; i < comments.length; i++) { - var comment = comments[i]; - applyDelta(comment, delta); + function checkIndexedAccess(node) { + var objectType = getApparentType(checkExpression(node.expression)); + var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; + if (objectType === unknownType) { + return unknownType; + } + if (isConstEnumObjectType(objectType) && node.argumentExpression && node.argumentExpression.kind !== 7 /* StringLiteral */) { + error(node.argumentExpression, ts.Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string); + } + if (node.argumentExpression) { + if (node.argumentExpression.kind === 7 /* StringLiteral */ || node.argumentExpression.kind === 6 /* NumericLiteral */) { + var name = node.argumentExpression.text; + var prop = getPropertyOfType(objectType, name); + if (prop) { + getNodeLinks(node).resolvedSymbol = prop; + return getTypeOfSymbol(prop); + } + } } + if (indexType.flags & (1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { + if (indexType.flags & (1 /* Any */ | 132 /* NumberLike */)) { + var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); + if (numberIndexType) { + return numberIndexType; + } + } + var stringIndexType = getIndexTypeOfType(objectType, 0 /* String */); + if (stringIndexType) { + return stringIndexType; + } + if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && objectType !== anyType) { + error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + } + return anyType; + } + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + return unknownType; } - } - - var SyntaxTreeToIncrementalAstVisitor = (function (_super) { - __extends(SyntaxTreeToIncrementalAstVisitor, _super); - function SyntaxTreeToIncrementalAstVisitor() { - _super.apply(this, arguments); + function resolveUntypedCall(node) { + if (node.kind === 147 /* TaggedTemplateExpression */) { + checkExpression(node.template); + } + else { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } + return anySignature; + } + function resolveErrorCall(node) { + resolveUntypedCall(node); + return unknownSignature; + } + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + if (node.kind === 147 /* TaggedTemplateExpression */) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 159 /* TemplateExpression */) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 9 /* NoSubstitutionTemplateLiteral */); + callIsIncomplete = !!templateLiteral.isUnterminated; + } + } + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 146 /* NewExpression */); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + } + ts.Debug.assert(adjustedArgCount !== undefined, "'adjustedArgCount' undefined"); + ts.Debug.assert(callIsIncomplete !== undefined, "'callIsIncomplete' undefined"); + return checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature); + function checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature) { + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; + } } - SyntaxTreeToIncrementalAstVisitor.prototype.applyDelta = function (ast, delta) { - if (delta === 0) { - return; + function getSingleCallSignature(type) { + if (type.flags & 48128 /* ObjectType */) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + return resolved.callSignatures[0]; + } } - - var pre = function (cur) { - applyDelta(cur, delta); - applyDeltaToComments(cur.preComments(), delta); - applyDeltaToComments(cur.postComments(), delta); - - switch (cur.kind()) { - case 146 /* Block */: - applyDelta(cur.closeBraceToken, delta); - break; - - case 226 /* ArgumentList */: - applyDelta(cur.closeParenToken, delta); - break; - - case 130 /* ModuleDeclaration */: - applyDelta(cur.endingToken, delta); - break; - - case 131 /* ClassDeclaration */: - applyDelta(cur.closeBraceToken, delta); - break; - - case 161 /* DoStatement */: - applyDelta(cur.whileKeyword, delta); - break; - - case 151 /* SwitchStatement */: - applyDelta(cur.closeParenToken, delta); - break; + return undefined; + } + function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { + var context = createInferenceContext(signature.typeParameters, true); + forEachMatchingParameterType(contextualSignature, signature, function (source, target) { + inferTypes(context, instantiateType(source, contextualMapper), target); + }); + return getSignatureInstantiation(signature, getInferredTypes(context)); + } + function inferTypeArguments(signature, args, excludeArgument) { + var typeParameters = signature.typeParameters; + var context = createInferenceContext(typeParameters, false); + var mapper = createInferenceMapper(context); + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 161 /* OmittedExpression */) { + continue; + } + if (!excludeArgument || excludeArgument[i] === undefined) { + var parameterType = getTypeAtPosition(signature, i); + if (i === 0 && args[i].parent.kind === 147 /* TaggedTemplateExpression */) { + inferTypes(context, globalTemplateStringsArrayType, parameterType); + continue; + } + inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } - }; - - TypeScript.getAstWalkerFactory().simpleWalk(ast, pre); - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.setSpanExplicit = function (span, start, end) { - if (span._start !== -1) { - var delta = start - span._start; - this.applyDelta(span, delta); - - span._end = end; - } else { - _super.prototype.setSpanExplicit.call(this, span, start, end); } - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.getAndMovePastAST = function (element) { - if (this.previousTokenTrailingComments !== null) { - return null; + if (excludeArgument) { + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 161 /* OmittedExpression */) { + continue; + } + if (excludeArgument[i] === false) { + var parameterType = getTypeAtPosition(signature, i); + inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); + } + } } - - var result = element._ast; - if (!result) { - return null; + var inferredTypes = getInferredTypes(context); + context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); + for (var i = 0; i < inferredTypes.length; i++) { + if (inferredTypes[i] === inferenceFailureType) { + inferredTypes[i] = unknownType; + } } - - var start = this.position; - this.movePast(element); - this.setSpan(result, start, element); - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.setAST = function (element, ast) { - element._ast = ast; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSyntaxList = function (list) { - var result = this.getAndMovePastAST(list); - if (!result) { - result = _super.prototype.visitSyntaxList.call(this, list); - - if (list.childCount() > 0) { - this.setAST(list, result); + return context; + } + function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors) { + var typeParameters = signature.typeParameters; + var typeArgumentsAreAssignable = true; + for (var i = 0; i < typeParameters.length; i++) { + var typeArgNode = typeArguments[i]; + var typeArgument = getTypeFromTypeNode(typeArgNode); + typeArgumentResultTypes[i] = typeArgument; + if (typeArgumentsAreAssignable) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSeparatedSyntaxList = function (list) { - var result = this.getAndMovePastAST(list); - if (!result) { - result = _super.prototype.visitSeparatedSyntaxList.call(this, list); - - if (list.childCount() > 0) { - this.setAST(list, result); + return typeArgumentsAreAssignable; + } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var argType; + if (arg.kind === 161 /* OmittedExpression */) { + continue; + } + var paramType = getTypeAtPosition(signature, i); + if (i === 0 && node.kind === 147 /* TaggedTemplateExpression */) { + argType = globalTemplateStringsArrayType; + } + else { + argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + } + var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); + if (!isValidArgument) { + return false; } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitToken = function (token) { - var result = this.getAndMovePastAST(token); - - if (!result) { - result = _super.prototype.visitToken.call(this, token); - this.setAST(token, result); + return true; + } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 147 /* TaggedTemplateExpression */) { + var template = node.template; + args = [template]; + if (template.kind === 159 /* TemplateExpression */) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitClassDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitClassDeclaration.call(this, node); - this.setAST(node, result); + else { + args = node.arguments || emptyArray; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitInterfaceDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitInterfaceDeclaration.call(this, node); - this.setAST(node, result); + return args; + } + function resolveCall(node, signatures, candidatesOutArray) { + var isTaggedTemplate = node.kind === 147 /* TaggedTemplateExpression */; + var typeArguments = isTaggedTemplate ? undefined : node.typeArguments; + ts.forEach(typeArguments, checkSourceElement); + var candidates = candidatesOutArray || []; + collectCandidates(); + if (!candidates.length) { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + return resolveErrorCall(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitHeritageClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitHeritageClause.call(this, node); - this.setAST(node, result); + var args = getEffectiveCallArguments(node); + var excludeArgument; + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { + if (isContextSensitive(args[i])) { + if (!excludeArgument) { + excludeArgument = new Array(args.length); + } + excludeArgument[i] = true; + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitModuleDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitModuleDeclaration.call(this, node); - this.setAST(node, result); + var candidateForArgumentError; + var candidateForTypeArgumentError; + var resultOfFailedInference; + var result; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionDeclaration = function (node) { - var result = this.getAndMovePastAST(node); if (!result) { - result = _super.prototype.visitFunctionDeclaration.call(this, node); - this.setAST(node, result); + candidateForArgumentError = undefined; + candidateForTypeArgumentError = undefined; + resultOfFailedInference = undefined; + result = chooseOverload(candidates, assignableRelation); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitImportDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitImportDeclaration.call(this, node); - this.setAST(node, result); + if (result) { + return result; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitExportAssignment = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitExportAssignment.call(this, node); - this.setAST(node, result); + if (candidateForArgumentError) { + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitPrefixUnaryExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitPrefixUnaryExpression.call(this, node); - this.setAST(node, result); + else if (candidateForTypeArgumentError) { + if (!isTaggedTemplate && node.typeArguments) { + checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true); + } + else { + ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); + var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); + reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitArrayLiteralExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitArrayLiteralExpression.call(this, node); - this.setAST(node, result); + else { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitOmittedExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitOmittedExpression.call(this, node); - this.setAST(node, result); + if (!fullTypeCheck) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (hasCorrectArity(node, args, candidates[i])) { + return candidates[i]; + } + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitParenthesizedExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitParenthesizedExpression.call(this, node); - this.setAST(node, result); + return resolveErrorCall(node); + function chooseOverload(candidates, relation) { + for (var i = 0; i < candidates.length; i++) { + if (!hasCorrectArity(node, args, candidates[i])) { + continue; + } + var originalCandidate = candidates[i]; + var inferenceResult; + while (true) { + var candidate = originalCandidate; + if (candidate.typeParameters) { + var typeArgumentTypes; + var typeArgumentsAreValid; + if (typeArguments) { + typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + } + else { + inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; + typeArgumentTypes = inferenceResult.inferredTypes; + } + if (!typeArgumentsAreValid) { + break; + } + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + } + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + break; + } + var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + if (index < 0) { + return candidate; + } + excludeArgument[index] = false; + } + if (originalCandidate.typeParameters) { + var instantiatedCandidate = candidate; + if (typeArgumentsAreValid) { + candidateForArgumentError = instantiatedCandidate; + } + else { + candidateForTypeArgumentError = originalCandidate; + if (!typeArguments) { + resultOfFailedInference = inferenceResult; + } + } + } + else { + ts.Debug.assert(originalCandidate === candidate); + candidateForArgumentError = originalCandidate; + } + } + return undefined; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSimpleArrowFunctionExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSimpleArrowFunctionExpression.call(this, node); - this.setAST(node, result); + function collectCandidates() { + var result = candidates; + var lastParent; + var lastSymbol; + var cutoffPos = 0; + var pos; + ts.Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + pos++; + } + else { + lastParent = parent; + pos = cutoffPos; + } + } + else { + pos = cutoffPos = result.length; + lastParent = parent; + } + lastSymbol = symbol; + for (var j = result.length; j > pos; j--) { + result[j] = result[j - 1]; + } + result[pos] = signature; + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitParenthesizedArrowFunctionExpression.call(this, node); - this.setAST(node, result); + } + function resolveCallExpression(node, candidatesOutArray) { + if (node.expression.kind === 89 /* SuperKeyword */) { + var superType = checkSuperExpression(node.expression); + if (superType !== unknownType) { + return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */), candidatesOutArray); + } + return resolveUntypedCall(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitQualifiedName = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - var result = _super.prototype.visitQualifiedName.call(this, node); - this.setAST(node, result); + var funcType = checkExpression(node.expression); + var apparentType = getApparentType(funcType); + if (apparentType === unknownType) { + return resolveErrorCall(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConstructorType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConstructorType.call(this, node); - this.setAST(node, result); + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */); + if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionType.call(this, node); - this.setAST(node, result); + if (!callSignatures.length) { + if (constructSignatures.length) { + error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + } + else { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + } + return resolveErrorCall(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitObjectType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitObjectType.call(this, node); - this.setAST(node, result); + return resolveCall(node, callSignatures, candidatesOutArray); + } + function resolveNewExpression(node, candidatesOutArray) { + var expressionType = checkExpression(node.expression); + if (expressionType === anyType) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitArrayType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitArrayType.call(this, node); - this.setAST(node, result); + expressionType = getApparentType(expressionType); + if (expressionType === unknownType) { + return resolveErrorCall(node); + } + var constructSignatures = getSignaturesOfType(expressionType, 1 /* Construct */); + if (constructSignatures.length) { + return resolveCall(node, constructSignatures, candidatesOutArray); + } + var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); + if (callSignatures.length) { + var signature = resolveCall(node, callSignatures, candidatesOutArray); + if (getReturnTypeOfSignature(signature) !== voidType) { + error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + } + return signature; + } + error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); + return resolveErrorCall(node); + } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function getResolvedSignature(node, candidatesOutArray) { + var links = getNodeLinks(node); + if (!links.resolvedSignature || candidatesOutArray) { + links.resolvedSignature = anySignature; + if (node.kind === 145 /* CallExpression */) { + links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); + } + else if (node.kind === 146 /* NewExpression */) { + links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); + } + else if (node.kind === 147 /* TaggedTemplateExpression */) { + links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); + } + else { + ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); + } + } + return links.resolvedSignature; + } + function checkCallExpression(node) { + var signature = getResolvedSignature(node); + if (node.expression.kind === 89 /* SuperKeyword */) { + return voidType; + } + if (node.kind === 146 /* NewExpression */) { + var declaration = signature.declaration; + if (declaration && declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */ && declaration.kind !== 134 /* ConstructorType */) { + if (compilerOptions.noImplicitAny) { + error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + } + return anyType; + } + } + return getReturnTypeOfSignature(signature); + } + function checkTaggedTemplateExpression(node) { + return getReturnTypeOfSignature(getResolvedSignature(node)); + } + function checkTypeAssertion(node) { + var exprType = checkExpression(node.expression); + var targetType = getTypeFromTypeNode(node.type); + if (fullTypeCheck && targetType !== unknownType) { + var widenedType = getWidenedType(exprType, true); + if (!(isTypeAssignableTo(targetType, widenedType))) { + checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + } + } + return targetType; + } + function getTypeAtPosition(signature, pos) { + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + } + function assignContextualParameterTypes(signature, context, mapper) { + var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); + for (var i = 0; i < len; i++) { + var parameter = signature.parameters[i]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeAtPosition(context, i), mapper); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitGenericType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitGenericType.call(this, node); - this.setAST(node, result); + if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { + var parameter = signature.parameters[signature.parameters.length - 1]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitBlock = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitBlock.call(this, node); - this.setAST(node, result); + } + function getReturnTypeFromBody(func, contextualMapper) { + var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (func.body.kind !== 163 /* Block */) { + var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); + var widenedType = getWidenedType(unwidenedType); + if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + error(func, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeToString(widenedType)); + } + return widenedType; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitParameter = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitParameter.call(this, node); - this.setAST(node, result); + var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); + if (types.length > 0) { + var commonType = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + if (!commonType) { + error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); + return unknownType; + } + var widenedType = getWidenedType(commonType); + if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + var typeName = typeToString(widenedType); + if (func.name) { + error(func, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(func.name), typeName); + } + else { + error(func, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); + } + } + return widenedType; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMemberAccessExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMemberAccessExpression.call(this, node); - this.setAST(node, result); + return voidType; + } + function checkAndAggregateReturnExpressionTypes(body, contextualMapper) { + var aggregatedTypes = []; + ts.forEachReturnStatement(body, function (returnStatement) { + var expr = returnStatement.expression; + if (expr) { + var type = checkAndMarkExpression(expr, contextualMapper); + if (!ts.contains(aggregatedTypes, type)) { + aggregatedTypes.push(type); + } + } + }); + return aggregatedTypes; + } + function bodyContainsAReturnStatement(funcBody) { + return ts.forEachReturnStatement(funcBody, function (returnStatement) { + return true; + }); + } + function bodyContainsSingleThrowStatement(body) { + return (body.statements.length === 1) && (body.statements[0].kind === 178 /* ThrowStatement */); + } + function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + if (!fullTypeCheck) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitPostfixUnaryExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitPostfixUnaryExpression.call(this, node); - this.setAST(node, result); + if (returnType === voidType || returnType === anyType) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitElementAccessExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitElementAccessExpression.call(this, node); - this.setAST(node, result); + if (!func.body || func.body.kind !== 163 /* Block */) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitInvocationExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitInvocationExpression.call(this, node); - this.setAST(node, result); + var bodyBlock = func.body; + if (bodyContainsAReturnStatement(bodyBlock)) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitBinaryExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitBinaryExpression.call(this, node); - this.setAST(node, result); + if (bodyContainsSingleThrowStatement(bodyBlock)) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConditionalExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConditionalExpression.call(this, node); - this.setAST(node, result); + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); + } + function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + if (contextualMapper === identityMapper) { + return anyFunctionType; + } + var links = getNodeLinks(node); + var type = getTypeOfSymbol(node.symbol); + if (!(links.flags & 64 /* ContextChecked */)) { + var contextualSignature = getContextualSignature(node); + if (!(links.flags & 64 /* ContextChecked */)) { + links.flags |= 64 /* ContextChecked */; + if (contextualSignature) { + var signature = getSignaturesOfType(type, 0 /* Call */)[0]; + if (isContextSensitive(node)) { + assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + } + if (!node.type) { + signature.resolvedReturnType = resolvingType; + var returnType = getReturnTypeFromBody(node, contextualMapper); + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = returnType; + } + } + } + checkSignatureDeclaration(node); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConstructSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConstructSignature.call(this, node); - this.setAST(node, result); + if (fullTypeCheck && node.kind !== 125 /* Method */) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMethodSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMethodSignature.call(this, node); - this.setAST(node, result); + return type; + } + function checkFunctionExpressionOrObjectLiteralMethodBody(node) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + if (node.type) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitIndexSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitIndexSignature.call(this, node); - this.setAST(node, result); + if (node.body) { + if (node.body.kind === 163 /* Block */) { + checkSourceElement(node.body); + } + else { + var exprType = checkExpression(node.body); + if (node.type) { + checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + } + checkFunctionExpressionBodies(node.body); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitPropertySignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitPropertySignature.call(this, node); - this.setAST(node, result); + } + function checkArithmeticOperandType(operand, type, diagnostic) { + if (!(type.flags & (1 /* Any */ | 132 /* NumberLike */))) { + error(operand, diagnostic); + return false; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCallSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCallSignature.call(this, node); - this.setAST(node, result); + return true; + } + function checkReferenceExpression(n, invalidReferenceMessage, constantVarianleMessage) { + function findSymbol(n) { + var symbol = getNodeLinks(n).resolvedSymbol; + return symbol && getExportSymbolOfValueSymbolIfExported(symbol); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitTypeParameter = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitTypeParameter.call(this, node); - this.setAST(node, result); + function isReferenceOrErrorExpression(n) { + switch (n.kind) { + case 63 /* Identifier */: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; + case 143 /* PropertyAccessExpression */: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; + case 144 /* ElementAccessExpression */: + return true; + case 149 /* ParenthesizedExpression */: + return isReferenceOrErrorExpression(n.expression); + default: + return false; + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitIfStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitIfStatement.call(this, node); - this.setAST(node, result); + function isConstVariableReference(n) { + switch (n.kind) { + case 63 /* Identifier */: + case 143 /* PropertyAccessExpression */: + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; + case 144 /* ElementAccessExpression */: + var index = n.argumentExpression; + var symbol = findSymbol(n.expression); + if (symbol && index && index.kind === 7 /* StringLiteral */) { + var name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); + return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; + } + return false; + case 149 /* ParenthesizedExpression */: + return isConstVariableReference(n.expression); + default: + return false; + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitExpressionStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitExpressionStatement.call(this, node); - this.setAST(node, result); + if (!isReferenceOrErrorExpression(n)) { + error(n, invalidReferenceMessage); + return false; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConstructorDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConstructorDeclaration.call(this, node); - this.setAST(node, result); + if (isConstVariableReference(n)) { + error(n, constantVarianleMessage); + return false; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMemberFunctionDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMemberFunctionDeclaration.call(this, node); - this.setAST(node, result); + return true; + } + function checkDeleteExpression(node) { + var operandType = checkExpression(node.expression); + return booleanType; + } + function checkTypeOfExpression(node) { + var operandType = checkExpression(node.expression); + return stringType; + } + function checkVoidExpression(node) { + var operandType = checkExpression(node.expression); + return undefinedType; + } + function checkPrefixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + switch (node.operator) { + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + return numberType; + case 45 /* ExclamationToken */: + return booleanType; + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + } + return numberType; + } + return unknownType; + } + function checkPostfixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + } + return numberType; + } + function isStructuredType(type) { + if (type.flags & 16384 /* Union */) { + return !ts.forEach(type.types, function (t) { return !isStructuredType(t); }); + } + return (type.flags & (48128 /* ObjectType */ | 512 /* TypeParameter */)) !== 0; + } + function isConstEnumObjectType(type) { + return type.flags & (48128 /* ObjectType */ | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128 /* ConstEnum */) !== 0; + } + function checkInstanceOfExpression(node, leftType, rightType) { + if (!(leftType.flags & 1 /* Any */ || isStructuredType(leftType))) { + 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))) { + error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + } + return booleanType; + } + function checkInExpression(node, leftType, rightType) { + if (leftType !== anyType && leftType !== stringType && leftType !== numberType) { + 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))) { + 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; + } + function checkBinaryExpression(node, contextualMapper) { + var operator = node.operator; + var leftType = checkExpression(node.left, contextualMapper); + var rightType = checkExpression(node.right, contextualMapper); + switch (operator) { + case 34 /* AsteriskToken */: + case 54 /* AsteriskEqualsToken */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 36 /* PercentToken */: + case 56 /* PercentEqualsToken */: + case 33 /* MinusToken */: + case 53 /* MinusEqualsToken */: + case 39 /* LessThanLessThanToken */: + case 57 /* LessThanLessThanEqualsToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: + if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + leftType = rightType; + if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + rightType = leftType; + var suggestedOperator; + if ((leftType.flags & 8 /* Boolean */) && (rightType.flags & 8 /* Boolean */) && (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { + error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operator), ts.tokenToString(suggestedOperator)); + } + else { + var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + if (leftOk && rightOk) { + checkAssignmentOperator(numberType); + } + } + return numberType; + case 32 /* PlusToken */: + case 52 /* PlusEqualsToken */: + if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + leftType = rightType; + if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + rightType = leftType; + var resultType; + if (leftType.flags & 132 /* NumberLike */ && rightType.flags & 132 /* NumberLike */) { + resultType = numberType; + } + else if (leftType.flags & 258 /* StringLike */ || rightType.flags & 258 /* StringLike */) { + resultType = stringType; + } + else if (leftType.flags & 1 /* Any */ || leftType === unknownType || rightType.flags & 1 /* Any */ || rightType === unknownType) { + resultType = anyType; + } + if (!resultType) { + reportOperatorError(); + return anyType; + } + if (operator === 52 /* PlusEqualsToken */) { + checkAssignmentOperator(resultType); + } + return resultType; + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + reportOperatorError(); + } + return booleanType; + case 85 /* InstanceOfKeyword */: + return checkInstanceOfExpression(node, leftType, rightType); + case 84 /* InKeyword */: + return checkInExpression(node, leftType, rightType); + case 47 /* AmpersandAmpersandToken */: + return rightType; + case 48 /* BarBarToken */: + return getUnionType([leftType, rightType]); + case 51 /* EqualsToken */: + checkAssignmentOperator(rightType); + return rightType; + case 22 /* CommaToken */: + return rightType; + } + function getSuggestedBooleanOperator(operator) { + switch (operator) { + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + return 48 /* BarBarToken */; + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + return 30 /* ExclamationEqualsEqualsToken */; + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: + return 47 /* AmpersandAmpersandToken */; + default: + return undefined; + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitGetAccessor = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitGetAccessor.call(this, node); - this.setAST(node, result); + function checkAssignmentOperator(valueType) { + if (fullTypeCheck && operator >= 51 /* FirstAssignment */ && operator <= 62 /* LastAssignment */) { + var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + if (ok) { + checkTypeAssignableTo(valueType, leftType, node.left, undefined); + } + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSetAccessor = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSetAccessor.call(this, node); - this.setAST(node, result); + function reportOperatorError() { + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); } - + } + function checkConditionalExpression(node, contextualMapper) { + checkExpression(node.condition); + var type1 = checkExpression(node.whenTrue, contextualMapper); + var type2 = checkExpression(node.whenFalse, contextualMapper); + return getUnionType([type1, type2]); + } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } + function checkExpressionWithContextualType(node, contextualType, contextualMapper) { + var saveContextualType = node.contextualType; + node.contextualType = contextualType; + var result = checkExpression(node, contextualMapper); + node.contextualType = saveContextualType; return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMemberVariableDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMemberVariableDeclaration.call(this, node); - this.setAST(node, result); - } - + } + function checkAndMarkExpression(node, contextualMapper) { + var result = checkExpression(node, contextualMapper); + getNodeLinks(node).flags |= 1 /* TypeChecked */; return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitThrowStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitThrowStatement.call(this, node); - this.setAST(node, result); + } + function checkObjectLiteralMethod(node, contextualMapper) { + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { + if (contextualMapper && contextualMapper !== identityMapper) { + var signature = getSingleCallSignature(type); + if (signature && signature.typeParameters) { + var contextualType = getContextualType(node); + if (contextualType) { + var contextualSignature = getSingleCallSignature(contextualType); + if (contextualSignature && !contextualSignature.typeParameters) { + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + } + } + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitReturnStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitReturnStatement.call(this, node); - this.setAST(node, result); + return type; + } + function checkExpression(node, contextualMapper) { + return checkExpressionOrQualifiedName(node, contextualMapper); + } + function checkExpressionOrQualifiedName(node, contextualMapper) { + var type; + if (node.kind == 120 /* QualifiedName */) { + type = checkQualifiedName(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitObjectCreationExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitObjectCreationExpression.call(this, node); - this.setAST(node, result); + else { + var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSwitchStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSwitchStatement.call(this, node); - this.setAST(node, result); + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 143 /* PropertyAccessExpression */ && node.parent.expression === node) || (node.parent.kind === 144 /* ElementAccessExpression */ && node.parent.expression === node) || ((node.kind === 63 /* Identifier */ || node.kind === 120 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + if (!ok) { + error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCaseSwitchClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCaseSwitchClause.call(this, node); - this.setAST(node, result); + return type; + } + function checkExpressionWorker(node, contextualMapper) { + switch (node.kind) { + case 63 /* Identifier */: + return checkIdentifier(node); + case 91 /* ThisKeyword */: + return checkThisExpression(node); + case 89 /* SuperKeyword */: + return checkSuperExpression(node); + case 87 /* NullKeyword */: + return nullType; + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + return booleanType; + case 6 /* NumericLiteral */: + return numberType; + case 159 /* TemplateExpression */: + return checkTemplateExpression(node); + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + return stringType; + case 8 /* RegularExpressionLiteral */: + return globalRegExpType; + case 141 /* ArrayLiteralExpression */: + return checkArrayLiteral(node, contextualMapper); + case 142 /* ObjectLiteralExpression */: + return checkObjectLiteral(node, contextualMapper); + case 143 /* PropertyAccessExpression */: + return checkPropertyAccessExpression(node); + case 144 /* ElementAccessExpression */: + return checkIndexedAccess(node); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return checkCallExpression(node); + case 147 /* TaggedTemplateExpression */: + return checkTaggedTemplateExpression(node); + case 148 /* TypeAssertionExpression */: + return checkTypeAssertion(node); + case 149 /* ParenthesizedExpression */: + return checkExpression(node.expression); + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 153 /* TypeOfExpression */: + return checkTypeOfExpression(node); + case 152 /* DeleteExpression */: + return checkDeleteExpression(node); + case 154 /* VoidExpression */: + return checkVoidExpression(node); + case 155 /* PrefixUnaryExpression */: + return checkPrefixUnaryExpression(node); + case 156 /* PostfixUnaryExpression */: + return checkPostfixUnaryExpression(node); + case 157 /* BinaryExpression */: + return checkBinaryExpression(node, contextualMapper); + case 158 /* ConditionalExpression */: + return checkConditionalExpression(node, contextualMapper); + case 161 /* OmittedExpression */: + return undefinedType; + } + return unknownType; + } + function checkTypeParameter(node) { + checkSourceElement(node.constraint); + if (fullTypeCheck) { + checkTypeParameterHasIllegalReferencesInConstraint(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); + } + } + function checkParameter(parameterDeclaration) { + checkVariableOrParameterDeclaration(parameterDeclaration); + if (fullTypeCheck) { + checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); + if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 126 /* Constructor */ && parameterDeclaration.parent.body)) { + error(parameterDeclaration, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + if (parameterDeclaration.dotDotDotToken) { + if (!isArrayType(getTypeOfSymbol(parameterDeclaration.symbol))) { + error(parameterDeclaration, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); + } + } + else { + if (parameterDeclaration.initializer && !parameterDeclaration.parent.body) { + error(parameterDeclaration, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + } + } + } + function checkReferencesInInitializer(n) { + if (n.kind === 63 /* Identifier */) { + var referencedSymbol = getNodeLinks(n).resolvedSymbol; + if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { + if (referencedSymbol.valueDeclaration.kind === 123 /* Parameter */) { + if (referencedSymbol.valueDeclaration === parameterDeclaration) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(parameterDeclaration.name)); + return; + } + var enclosingOrReferencedParameter = ts.forEach(parameterDeclaration.parent.parameters, function (p) { return p === parameterDeclaration || p === referencedSymbol.valueDeclaration ? p : undefined; }); + if (enclosingOrReferencedParameter === referencedSymbol.valueDeclaration) { + return; + } + } + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(parameterDeclaration.name), ts.declarationNameToString(n)); + } + } + else { + ts.forEachChild(n, checkReferencesInInitializer); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDefaultSwitchClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDefaultSwitchClause.call(this, node); - this.setAST(node, result); + if (parameterDeclaration.initializer) { + checkReferencesInInitializer(parameterDeclaration.initializer); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitBreakStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitBreakStatement.call(this, node); - this.setAST(node, result); + } + function checkSignatureDeclaration(node) { + checkTypeParameters(node.typeParameters); + ts.forEach(node.parameters, checkParameter); + if (node.type) { + checkSourceElement(node.type); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitContinueStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitContinueStatement.call(this, node); - this.setAST(node, result); + if (fullTypeCheck) { + checkCollisionWithArgumentsInGeneratedCode(node); + if (compilerOptions.noImplicitAny && !node.type) { + switch (node.kind) { + case 130 /* ConstructSignature */: + error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + case 129 /* CallSignature */: + error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + } + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitForStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitForStatement.call(this, node); - this.setAST(node, result); + checkSpecializedSignatureDeclaration(node); + } + function checkTypeForDuplicateIndexSignatures(node) { + if (node.kind === 186 /* InterfaceDeclaration */) { + var nodeSymbol = getSymbolOfNode(node); + if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { + return; + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitForInStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitForInStatement.call(this, node); - this.setAST(node, result); + var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + if (indexSymbol) { + var seenNumericIndexer = false; + var seenStringIndexer = false; + for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { + var declaration = indexSymbol.declarations[i]; + if (declaration.parameters.length == 1 && declaration.parameters[0].type) { + switch (declaration.parameters[0].type.kind) { + case 118 /* StringKeyword */: + if (!seenStringIndexer) { + seenStringIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_string_index_signature); + } + break; + case 116 /* NumberKeyword */: + if (!seenNumericIndexer) { + seenNumericIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_number_index_signature); + } + break; + } + } + } + } + } + function checkPropertyDeclaration(node) { + if (fullTypeCheck) { + checkVariableOrParameterOrPropertyInFullTypeCheck(node); + } + } + function checkMethodDeclaration(node) { + checkFunctionLikeDeclaration(node); + } + function checkConstructorDeclaration(node) { + checkSignatureDeclaration(node); + checkSourceElement(node.body); + var symbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(symbol); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitWhileStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitWhileStatement.call(this, node); - this.setAST(node, result); + if (!node.body) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitWithStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitWithStatement.call(this, node); - this.setAST(node, result); + if (!fullTypeCheck) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCastExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCastExpression.call(this, node); - this.setAST(node, result); + function isSuperCallExpression(n) { + return n.kind === 145 /* CallExpression */ && n.expression.kind === 89 /* SuperKeyword */; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitObjectLiteralExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitObjectLiteralExpression.call(this, node); - this.setAST(node, result); + function containsSuperCall(n) { + if (isSuperCallExpression(n)) { + return true; + } + switch (n.kind) { + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + case 142 /* ObjectLiteralExpression */: return false; + default: return ts.forEachChild(n, containsSuperCall); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSimplePropertyAssignment = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSimplePropertyAssignment.call(this, node); - this.setAST(node, result); + function markThisReferencesAsErrors(n) { + if (n.kind === 91 /* ThisKeyword */) { + error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + } + else if (n.kind !== 150 /* FunctionExpression */ && n.kind !== 184 /* FunctionDeclaration */) { + ts.forEachChild(n, markThisReferencesAsErrors); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionPropertyAssignment = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionPropertyAssignment.call(this, node); - this.setAST(node, result); + function isInstancePropertyWithInitializer(n) { + return n.kind === 124 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionExpression.call(this, node); - this.setAST(node, result); + if (ts.getClassBaseTypeNode(node.parent)) { + if (containsSuperCall(node.body)) { + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + if (superCallShouldBeFirst) { + var statements = node.body.statements; + if (!statements.length || statements[0].kind !== 166 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); + } + else { + markThisReferencesAsErrors(statements[0].expression); + } + } + } + else { + error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitEmptyStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitEmptyStatement.call(this, node); - this.setAST(node, result); + } + function checkAccessorDeclaration(node) { + if (fullTypeCheck) { + if (node.kind === 127 /* GetAccessor */) { + if (!ts.isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); + } + } + if (!ts.hasComputedNameButNotSymbol(node)) { + var otherKind = node.kind === 127 /* GetAccessor */ ? 128 /* SetAccessor */ : 127 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); + if (otherAccessor) { + if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { + error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); + } + var currentAccessorType = getAnnotatedAccessorType(node); + var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + if (currentAccessorType && otherAccessorType) { + if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { + error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + } + } + } + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitTryStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitTryStatement.call(this, node); - this.setAST(node, result); + checkFunctionLikeDeclaration(node); + } + function checkTypeReference(node) { + var type = getTypeFromTypeReferenceNode(node); + if (type !== unknownType && node.typeArguments) { + var len = node.typeArguments.length; + for (var i = 0; i < len; i++) { + checkSourceElement(node.typeArguments[i]); + var constraint = getConstraintOfTypeParameter(type.target.typeParameters[i]); + if (fullTypeCheck && constraint) { + var typeArgument = type.typeArguments[i]; + checkTypeAssignableTo(typeArgument, constraint, node, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCatchClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCatchClause.call(this, node); - this.setAST(node, result); + } + function checkTypeQuery(node) { + getTypeFromTypeQueryNode(node); + } + function checkTypeLiteral(node) { + ts.forEach(node.members, checkSourceElement); + if (fullTypeCheck) { + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitLabeledStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitLabeledStatement.call(this, node); - this.setAST(node, result); + } + function checkArrayType(node) { + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + ts.forEach(node.elementTypes, checkSourceElement); + } + function checkUnionType(node) { + ts.forEach(node.types, checkSourceElement); + } + function isPrivateWithinAmbient(node) { + return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); + } + function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { + if (!fullTypeCheck) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDoStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDoStatement.call(this, node); - this.setAST(node, result); + var signature = getSignatureFromDeclaration(signatureDeclarationNode); + if (!signature.hasStringLiterals) { + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitTypeOfExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitTypeOfExpression.call(this, node); - this.setAST(node, result); + if (signatureDeclarationNode.body) { + error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); + return; } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDeleteExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDeleteExpression.call(this, node); - this.setAST(node, result); + var signaturesToCheck; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 186 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 129 /* CallSignature */ || signatureDeclarationNode.kind === 130 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 129 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); + var containingType = getDeclaredTypeOfSymbol(containingSymbol); + signaturesToCheck = getSignaturesOfType(containingType, signatureKind); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitVoidExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitVoidExpression.call(this, node); - this.setAST(node, result); + else { + signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDebuggerStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDebuggerStatement.call(this, node); - this.setAST(node, result); + for (var i = 0; i < signaturesToCheck.length; i++) { + var otherSignature = signaturesToCheck[i]; + if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { + return; + } } - - return result; - }; - return SyntaxTreeToIncrementalAstVisitor; - })(SyntaxTreeToAstVisitor); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ASTSpan = (function () { - function ASTSpan(_start, _end) { - this._start = _start; - this._end = _end; - } - ASTSpan.prototype.start = function () { - return this._start; - }; - - ASTSpan.prototype.end = function () { - return this._end; - }; - return ASTSpan; - })(); - TypeScript.ASTSpan = ASTSpan; - - var astID = 0; - - function structuralEqualsNotIncludingPosition(ast1, ast2) { - return structuralEquals(ast1, ast2, false); - } - TypeScript.structuralEqualsNotIncludingPosition = structuralEqualsNotIncludingPosition; - - function structuralEqualsIncludingPosition(ast1, ast2) { - return structuralEquals(ast1, ast2, true); - } - TypeScript.structuralEqualsIncludingPosition = structuralEqualsIncludingPosition; - - function commentStructuralEqualsNotIncludingPosition(ast1, ast2) { - return commentStructuralEquals(ast1, ast2, false); - } - - function commentStructuralEqualsIncludingPosition(ast1, ast2) { - return commentStructuralEquals(ast1, ast2, true); - } - - function structuralEquals(ast1, ast2, includingPosition) { - if (ast1 === ast2) { - return true; + error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); } - - return ast1 !== null && ast2 !== null && ast1.kind() === ast2.kind() && ast1.structuralEquals(ast2, includingPosition); - } - - function commentStructuralEquals(ast1, ast2, includingPosition) { - if (ast1 === ast2) { - return true; + function getEffectiveDeclarationFlags(n, flagsToCheck) { + var flags = n.flags; + if (n.parent.kind !== 186 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (!(flags & 2 /* Ambient */)) { + flags |= 1 /* Export */; + } + flags |= 2 /* Ambient */; + } + return flags & flagsToCheck; } - - return ast1 !== null && ast2 !== null && ast1.structuralEquals(ast2, includingPosition); - } - - function astArrayStructuralEquals(array1, array2, includingPosition) { - return TypeScript.ArrayUtilities.sequenceEquals(array1, array2, includingPosition ? structuralEqualsIncludingPosition : structuralEqualsNotIncludingPosition); - } - - function commentArrayStructuralEquals(array1, array2, includingPosition) { - return TypeScript.ArrayUtilities.sequenceEquals(array1, array2, includingPosition ? commentStructuralEqualsIncludingPosition : commentStructuralEqualsNotIncludingPosition); - } - - var AST = (function () { - function AST() { - this.parent = null; - this._start = -1; - this._end = -1; - this._trailingTriviaWidth = 0; - this._astID = astID++; - this._preComments = null; - this._postComments = null; - } - AST.prototype.syntaxID = function () { - return this._astID; - }; - - AST.prototype.start = function () { - return this._start; - }; - - AST.prototype.end = function () { - return this._end; - }; - - AST.prototype.trailingTriviaWidth = function () { - return this._trailingTriviaWidth; - }; - - AST.prototype.fileName = function () { - return this.parent.fileName(); - }; - - AST.prototype.kind = function () { - throw TypeScript.Errors.abstract(); - }; - - AST.prototype.preComments = function () { - return this._preComments; - }; - - AST.prototype.postComments = function () { - return this._postComments; - }; - - AST.prototype.setPreComments = function (comments) { - if (comments && comments.length) { - this._preComments = comments; - } else if (this._preComments) { - this._preComments = null; + function checkFunctionOrConstructorSymbol(symbol) { + if (!fullTypeCheck) { + return; } - }; - - AST.prototype.setPostComments = function (comments) { - if (comments && comments.length) { - this._postComments = comments; - } else if (this._postComments) { - this._postComments = null; + function getCanonicalOverload(overloads, implementation) { + var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; + return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; } - }; - - AST.prototype.width = function () { - return this.end() - this.start(); - }; - - AST.prototype.structuralEquals = function (ast, includingPosition) { - if (includingPosition) { - if (this.start() !== ast.start() || this.end() !== ast.end()) { - return false; + function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { + var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + if (someButNotAllOverloadFlags !== 0) { + var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + ts.forEach(overloads, function (o) { + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; + if (deviation & 1 /* Export */) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + } + else if (deviation & 2 /* Ambient */) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + } + else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + } + }); } } - - return commentArrayStructuralEquals(this.preComments(), ast.preComments(), includingPosition) && commentArrayStructuralEquals(this.postComments(), ast.postComments(), includingPosition); - }; - - AST.prototype.isExpression = function () { - return false; - }; - return AST; - })(); - TypeScript.AST = AST; - - var ISyntaxList2 = (function (_super) { - __extends(ISyntaxList2, _super); - function ISyntaxList2(_fileName, members) { - _super.call(this); - this._fileName = _fileName; - this.members = members; - - for (var i = 0, n = members.length; i < n; i++) { - members[i].parent = this; + function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { + if (someHaveQuestionToken !== allHaveQuestionToken) { + var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + ts.forEach(overloads, function (o) { + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + if (deviation) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); + } + }); + } } - } - ISyntaxList2.prototype.childCount = function () { - return this.members.length; - }; - - ISyntaxList2.prototype.childAt = function (index) { - return this.members[index]; - }; - - ISyntaxList2.prototype.fileName = function () { - return this._fileName; - }; - - ISyntaxList2.prototype.kind = function () { - return 1 /* List */; - }; - - ISyntaxList2.prototype.firstOrDefault = function (func) { - return TypeScript.ArrayUtilities.firstOrDefault(this.members, func); - }; - - ISyntaxList2.prototype.lastOrDefault = function (func) { - return TypeScript.ArrayUtilities.lastOrDefault(this.members, func); - }; - - ISyntaxList2.prototype.any = function (func) { - return TypeScript.ArrayUtilities.any(this.members, func); - }; - - ISyntaxList2.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && astArrayStructuralEquals(this.members, ast.members, includingPosition); - }; - return ISyntaxList2; - })(AST); - TypeScript.ISyntaxList2 = ISyntaxList2; - - var ISeparatedSyntaxList2 = (function (_super) { - __extends(ISeparatedSyntaxList2, _super); - function ISeparatedSyntaxList2(_fileName, members, _separatorCount) { - _super.call(this); - this._fileName = _fileName; - this.members = members; - this._separatorCount = _separatorCount; - - for (var i = 0, n = members.length; i < n; i++) { - members[i].parent = this; + var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */; + var someNodeFlags = 0; + var allNodeFlags = flagsToCheck; + var someHaveQuestionToken = false; + var allHaveQuestionToken = true; + var hasOverloads = false; + var bodyDeclaration; + var lastSeenNonAmbientDeclaration; + var previousDeclaration; + var declarations = symbol.declarations; + var isConstructor = (symbol.flags & 16384 /* Constructor */) !== 0; + function reportImplementationExpectedError(node) { + if (node.name && ts.getFullWidth(node.name) === 0) { + return; + } + var seen = false; + var subsequentNode = ts.forEachChild(node.parent, function (c) { + if (seen) { + return c; + } + else { + seen = c === node; + } + }); + if (subsequentNode) { + if (subsequentNode.kind === node.kind) { + var errorNode = subsequentNode.name || subsequentNode; + if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { + ts.Debug.assert(node.kind === 125 /* Method */); + ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); + var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode, diagnostic); + return; + } + else if (subsequentNode.body) { + error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + return; + } + } + } + var errorNode = node.name || node; + if (isConstructor) { + error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); + } + else { + error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + } + } + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536 /* Module */; + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; + for (var i = 0; i < declarations.length; i++) { + var node = declarations[i]; + var inAmbientContext = ts.isInAmbientContext(node); + var inAmbientContextOrInterface = node.parent.kind === 186 /* InterfaceDeclaration */ || node.parent.kind === 136 /* TypeLiteral */ || inAmbientContext; + if (inAmbientContextOrInterface) { + previousDeclaration = undefined; + } + if (node.kind === 184 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { + var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + someNodeFlags |= currentNodeFlags; + allNodeFlags &= currentNodeFlags; + someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node); + allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node); + if (node.body && bodyDeclaration) { + if (isConstructor) { + multipleConstructorImplementation = true; + } + else { + duplicateFunctionDeclaration = true; + } + } + else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); + } + if (node.body) { + if (!bodyDeclaration) { + bodyDeclaration = node; + } + } + else { + hasOverloads = true; + } + previousDeclaration = node; + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } + } + } + if (multipleConstructorImplementation) { + ts.forEach(declarations, function (declaration) { + error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + if (duplicateFunctionDeclaration) { + ts.forEach(declarations, function (declaration) { + error(declaration.name, ts.Diagnostics.Duplicate_function_implementation); + }); + } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); + } + if (hasOverloads) { + checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags); + checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); + if (bodyDeclaration) { + var signatures = getSignaturesOfSymbol(symbol); + var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + if (!bodySignature.hasStringLiterals) { + for (var i = 0, len = signatures.length; i < len; ++i) { + if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { + error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; + } + } + } + } } } - ISeparatedSyntaxList2.prototype.nonSeparatorCount = function () { - return this.members.length; - }; - - ISeparatedSyntaxList2.prototype.separatorCount = function () { - return this._separatorCount; - }; - - ISeparatedSyntaxList2.prototype.nonSeparatorAt = function (index) { - return this.members[index]; - }; - - ISeparatedSyntaxList2.prototype.nonSeparatorIndexOf = function (ast) { - for (var i = 0, n = this.nonSeparatorCount(); i < n; i++) { - if (this.nonSeparatorAt(i) === ast) { - return i; + function checkExportsOnMergedDeclarations(node) { + if (!fullTypeCheck) { + return; + } + var symbol; + var symbol = node.localSymbol; + if (!symbol) { + symbol = getSymbolOfNode(node); + if (!(symbol.flags & 29360128 /* Export */)) { + return; + } + } + if (ts.getDeclarationOfKind(symbol, node.kind) !== node) { + return; + } + var exportedDeclarationSpaces = 0; + var nonExportedDeclarationSpaces = 0; + ts.forEach(symbol.declarations, function (d) { + var declarationSpaces = getDeclarationSpaces(d); + if (getEffectiveDeclarationFlags(d, 1 /* Export */)) { + exportedDeclarationSpaces |= declarationSpaces; + } + else { + nonExportedDeclarationSpaces |= declarationSpaces; } + }); + var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + if (commonDeclarationSpace) { + ts.forEach(symbol.declarations, function (d) { + if (getDeclarationSpaces(d) & commonDeclarationSpace) { + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); + } + }); } - - return -1; - }; - - ISeparatedSyntaxList2.prototype.fileName = function () { - return this._fileName; - }; - - ISeparatedSyntaxList2.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - ISeparatedSyntaxList2.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && astArrayStructuralEquals(this.members, ast.members, includingPosition); - }; - return ISeparatedSyntaxList2; - })(AST); - TypeScript.ISeparatedSyntaxList2 = ISeparatedSyntaxList2; - - var SourceUnit = (function (_super) { - __extends(SourceUnit, _super); - function SourceUnit(moduleElements, endOfFileTokenLeadingComments, _fileName) { - _super.call(this); - this.moduleElements = moduleElements; - this.endOfFileTokenLeadingComments = endOfFileTokenLeadingComments; - this._fileName = _fileName; - moduleElements && (moduleElements.parent = this); - } - SourceUnit.prototype.fileName = function () { - return this._fileName; - }; - - SourceUnit.prototype.kind = function () { - return 120 /* SourceUnit */; - }; - - SourceUnit.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.moduleElements, ast.moduleElements, includingPosition); - }; - return SourceUnit; - })(AST); - TypeScript.SourceUnit = SourceUnit; - - var Identifier = (function (_super) { - __extends(Identifier, _super); - function Identifier(_text) { - _super.call(this); - this._text = _text; - this._valueText = null; - } - Identifier.prototype.text = function () { - return this._text; - }; - Identifier.prototype.valueText = function () { - if (!this._valueText) { - var text = this._text; - if (text === "__proto__") { - this._valueText = "#__proto__"; - } else { - this._valueText = TypeScript.Syntax.massageEscapes(text); + function getDeclarationSpaces(d) { + switch (d.kind) { + case 186 /* InterfaceDeclaration */: + return 8388608 /* ExportType */; + case 189 /* ModuleDeclaration */: + return d.name.kind === 7 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 16777216 /* ExportNamespace */ | 4194304 /* ExportValue */ : 16777216 /* ExportNamespace */; + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + return 8388608 /* ExportType */ | 4194304 /* ExportValue */; + case 191 /* ImportDeclaration */: + var result = 0; + var target = resolveImport(getSymbolOfNode(d)); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); + return result; + default: + return 4194304 /* ExportValue */; } } - - return this._valueText; - }; - - Identifier.prototype.kind = function () { - return 11 /* IdentifierName */; - }; - - Identifier.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && this._text === ast._text; - }; - - Identifier.prototype.isExpression = function () { - return true; - }; - return Identifier; - })(AST); - TypeScript.Identifier = Identifier; - - var LiteralExpression = (function (_super) { - __extends(LiteralExpression, _super); - function LiteralExpression(_nodeType, _text, _valueText) { - _super.call(this); - this._nodeType = _nodeType; - this._text = _text; - this._valueText = _valueText; - } - LiteralExpression.prototype.text = function () { - return this._text; - }; - - LiteralExpression.prototype.valueText = function () { - return this._valueText; - }; - - LiteralExpression.prototype.kind = function () { - return this._nodeType; - }; - - LiteralExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - LiteralExpression.prototype.isExpression = function () { - return true; - }; - return LiteralExpression; - })(AST); - TypeScript.LiteralExpression = LiteralExpression; - - var ThisExpression = (function (_super) { - __extends(ThisExpression, _super); - function ThisExpression(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - } - ThisExpression.prototype.text = function () { - return this._text; - }; - - ThisExpression.prototype.valueText = function () { - return this._valueText; - }; - - ThisExpression.prototype.kind = function () { - return 35 /* ThisKeyword */; - }; - - ThisExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - ThisExpression.prototype.isExpression = function () { - return true; - }; - return ThisExpression; - })(AST); - TypeScript.ThisExpression = ThisExpression; - - var SuperExpression = (function (_super) { - __extends(SuperExpression, _super); - function SuperExpression(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - } - SuperExpression.prototype.text = function () { - return this._text; - }; - - SuperExpression.prototype.valueText = function () { - return this._valueText; - }; - - SuperExpression.prototype.kind = function () { - return 50 /* SuperKeyword */; - }; - - SuperExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - SuperExpression.prototype.isExpression = function () { - return true; - }; - return SuperExpression; - })(AST); - TypeScript.SuperExpression = SuperExpression; - - var NumericLiteral = (function (_super) { - __extends(NumericLiteral, _super); - function NumericLiteral(_value, _text, _valueText) { - _super.call(this); - this._value = _value; - this._text = _text; - this._valueText = _valueText; - } - NumericLiteral.prototype.text = function () { - return this._text; - }; - NumericLiteral.prototype.valueText = function () { - return this._valueText; - }; - NumericLiteral.prototype.value = function () { - return this._value; - }; - - NumericLiteral.prototype.kind = function () { - return 13 /* NumericLiteral */; - }; - - NumericLiteral.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && (this._value === ast._value || (isNaN(this._value) && isNaN(ast._value))) && this._text === ast._text; - }; - - NumericLiteral.prototype.isExpression = function () { - return true; - }; - return NumericLiteral; - })(AST); - TypeScript.NumericLiteral = NumericLiteral; - - var RegularExpressionLiteral = (function (_super) { - __extends(RegularExpressionLiteral, _super); - function RegularExpressionLiteral(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - } - RegularExpressionLiteral.prototype.text = function () { - return this._text; - }; - - RegularExpressionLiteral.prototype.valueText = function () { - return this._valueText; - }; - - RegularExpressionLiteral.prototype.kind = function () { - return 12 /* RegularExpressionLiteral */; - }; - - RegularExpressionLiteral.prototype.isExpression = function () { - return true; - }; - return RegularExpressionLiteral; - })(AST); - TypeScript.RegularExpressionLiteral = RegularExpressionLiteral; - - var StringLiteral = (function (_super) { - __extends(StringLiteral, _super); - function StringLiteral(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - this._valueText = _valueText === "__proto__" ? "#__proto__" : _valueText; - } - StringLiteral.prototype.text = function () { - return this._text; - }; - StringLiteral.prototype.valueText = function () { - return this._valueText; - }; - - StringLiteral.prototype.kind = function () { - return 14 /* StringLiteral */; - }; - - StringLiteral.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && this._text === ast._text; - }; - - StringLiteral.prototype.isExpression = function () { - return true; - }; - return StringLiteral; - })(AST); - TypeScript.StringLiteral = StringLiteral; - - var TypeAnnotation = (function (_super) { - __extends(TypeAnnotation, _super); - function TypeAnnotation(type) { - _super.call(this); - this.type = type; - type && (type.parent = this); - } - TypeAnnotation.prototype.kind = function () { - return 244 /* TypeAnnotation */; - }; - return TypeAnnotation; - })(AST); - TypeScript.TypeAnnotation = TypeAnnotation; - - var BuiltInType = (function (_super) { - __extends(BuiltInType, _super); - function BuiltInType(_nodeType, _text, _valueText) { - _super.call(this); - this._nodeType = _nodeType; - this._text = _text; - this._valueText = _valueText; - } - BuiltInType.prototype.text = function () { - return this._text; - }; - - BuiltInType.prototype.valueText = function () { - return this._valueText; - }; - - BuiltInType.prototype.kind = function () { - return this._nodeType; - }; - return BuiltInType; - })(AST); - TypeScript.BuiltInType = BuiltInType; - - var ExternalModuleReference = (function (_super) { - __extends(ExternalModuleReference, _super); - function ExternalModuleReference(stringLiteral) { - _super.call(this); - this.stringLiteral = stringLiteral; - stringLiteral && (stringLiteral.parent = this); - } - ExternalModuleReference.prototype.kind = function () { - return 245 /* ExternalModuleReference */; - }; - return ExternalModuleReference; - })(AST); - TypeScript.ExternalModuleReference = ExternalModuleReference; - - var ModuleNameModuleReference = (function (_super) { - __extends(ModuleNameModuleReference, _super); - function ModuleNameModuleReference(moduleName) { - _super.call(this); - this.moduleName = moduleName; - moduleName && (moduleName.parent = this); - } - ModuleNameModuleReference.prototype.kind = function () { - return 246 /* ModuleNameModuleReference */; - }; - return ModuleNameModuleReference; - })(AST); - TypeScript.ModuleNameModuleReference = ModuleNameModuleReference; - - var ImportDeclaration = (function (_super) { - __extends(ImportDeclaration, _super); - function ImportDeclaration(modifiers, identifier, moduleReference) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.moduleReference = moduleReference; - identifier && (identifier.parent = this); - moduleReference && (moduleReference.parent = this); - } - ImportDeclaration.prototype.kind = function () { - return 133 /* ImportDeclaration */; - }; - - ImportDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.moduleReference, ast.moduleReference, includingPosition); - }; - return ImportDeclaration; - })(AST); - TypeScript.ImportDeclaration = ImportDeclaration; - - var ExportAssignment = (function (_super) { - __extends(ExportAssignment, _super); - function ExportAssignment(identifier) { - _super.call(this); - this.identifier = identifier; - identifier && (identifier.parent = this); - } - ExportAssignment.prototype.kind = function () { - return 134 /* ExportAssignment */; - }; - - ExportAssignment.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition); - }; - return ExportAssignment; - })(AST); - TypeScript.ExportAssignment = ExportAssignment; - - var TypeParameterList = (function (_super) { - __extends(TypeParameterList, _super); - function TypeParameterList(typeParameters) { - _super.call(this); - this.typeParameters = typeParameters; - typeParameters && (typeParameters.parent = this); - } - TypeParameterList.prototype.kind = function () { - return 229 /* TypeParameterList */; - }; - return TypeParameterList; - })(AST); - TypeScript.TypeParameterList = TypeParameterList; - - var ClassDeclaration = (function (_super) { - __extends(ClassDeclaration, _super); - function ClassDeclaration(modifiers, identifier, typeParameterList, heritageClauses, classElements, closeBraceToken) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.classElements = classElements; - this.closeBraceToken = closeBraceToken; - identifier && (identifier.parent = this); - typeParameterList && (typeParameterList.parent = this); - heritageClauses && (heritageClauses.parent = this); - classElements && (classElements.parent = this); - } - ClassDeclaration.prototype.kind = function () { - return 131 /* ClassDeclaration */; - }; - - ClassDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.classElements, ast.classElements, includingPosition) && structuralEquals(this.typeParameterList, ast.typeParameterList, includingPosition) && structuralEquals(this.heritageClauses, ast.heritageClauses, includingPosition); - }; - return ClassDeclaration; - })(AST); - TypeScript.ClassDeclaration = ClassDeclaration; - - var InterfaceDeclaration = (function (_super) { - __extends(InterfaceDeclaration, _super); - function InterfaceDeclaration(modifiers, identifier, typeParameterList, heritageClauses, body) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.body = body; - identifier && (identifier.parent = this); - typeParameterList && (typeParameterList.parent = this); - body && (body.parent = this); - heritageClauses && (heritageClauses.parent = this); - } - InterfaceDeclaration.prototype.kind = function () { - return 128 /* InterfaceDeclaration */; - }; - - InterfaceDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.body, ast.body, includingPosition) && structuralEquals(this.typeParameterList, ast.typeParameterList, includingPosition) && structuralEquals(this.heritageClauses, ast.heritageClauses, includingPosition); - }; - return InterfaceDeclaration; - })(AST); - TypeScript.InterfaceDeclaration = InterfaceDeclaration; - - var HeritageClause = (function (_super) { - __extends(HeritageClause, _super); - function HeritageClause(_nodeType, typeNames) { - _super.call(this); - this._nodeType = _nodeType; - this.typeNames = typeNames; - typeNames && (typeNames.parent = this); - } - HeritageClause.prototype.kind = function () { - return this._nodeType; - }; - - HeritageClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.typeNames, ast.typeNames, includingPosition); - }; - return HeritageClause; - })(AST); - TypeScript.HeritageClause = HeritageClause; - - var ModuleDeclaration = (function (_super) { - __extends(ModuleDeclaration, _super); - function ModuleDeclaration(modifiers, name, stringLiteral, moduleElements, endingToken) { - _super.call(this); - this.modifiers = modifiers; - this.name = name; - this.stringLiteral = stringLiteral; - this.moduleElements = moduleElements; - this.endingToken = endingToken; - name && (name.parent = this); - stringLiteral && (stringLiteral.parent = this); - moduleElements && (moduleElements.parent = this); - } - ModuleDeclaration.prototype.kind = function () { - return 130 /* ModuleDeclaration */; - }; - - ModuleDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.name, ast.name, includingPosition) && structuralEquals(this.moduleElements, ast.moduleElements, includingPosition); - }; - return ModuleDeclaration; - })(AST); - TypeScript.ModuleDeclaration = ModuleDeclaration; - - var FunctionDeclaration = (function (_super) { - __extends(FunctionDeclaration, _super); - function FunctionDeclaration(modifiers, identifier, callSignature, block) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - identifier && (identifier.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - FunctionDeclaration.prototype.kind = function () { - return 129 /* FunctionDeclaration */; - }; - - FunctionDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.block, ast.block, includingPosition) && structuralEquals(this.callSignature, ast.callSignature, includingPosition); - }; - return FunctionDeclaration; - })(AST); - TypeScript.FunctionDeclaration = FunctionDeclaration; - - var VariableStatement = (function (_super) { - __extends(VariableStatement, _super); - function VariableStatement(modifiers, declaration) { - _super.call(this); - this.modifiers = modifiers; - this.declaration = declaration; - declaration && (declaration.parent = this); - } - VariableStatement.prototype.kind = function () { - return 148 /* VariableStatement */; - }; - - VariableStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.declaration, ast.declaration, includingPosition); - }; - return VariableStatement; - })(AST); - TypeScript.VariableStatement = VariableStatement; - - var VariableDeclaration = (function (_super) { - __extends(VariableDeclaration, _super); - function VariableDeclaration(declarators) { - _super.call(this); - this.declarators = declarators; - declarators && (declarators.parent = this); - } - VariableDeclaration.prototype.kind = function () { - return 224 /* VariableDeclaration */; - }; - - VariableDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.declarators, ast.declarators, includingPosition); - }; - return VariableDeclaration; - })(AST); - TypeScript.VariableDeclaration = VariableDeclaration; - - var VariableDeclarator = (function (_super) { - __extends(VariableDeclarator, _super); - function VariableDeclarator(propertyName, typeAnnotation, equalsValueClause) { - _super.call(this); - this.propertyName = propertyName; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - propertyName && (propertyName.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - equalsValueClause && (equalsValueClause.parent = this); - } - VariableDeclarator.prototype.kind = function () { - return 225 /* VariableDeclarator */; - }; - return VariableDeclarator; - })(AST); - TypeScript.VariableDeclarator = VariableDeclarator; - - var EqualsValueClause = (function (_super) { - __extends(EqualsValueClause, _super); - function EqualsValueClause(value) { - _super.call(this); - this.value = value; - value && (value.parent = this); - } - EqualsValueClause.prototype.kind = function () { - return 232 /* EqualsValueClause */; - }; - return EqualsValueClause; - })(AST); - TypeScript.EqualsValueClause = EqualsValueClause; - - var PrefixUnaryExpression = (function (_super) { - __extends(PrefixUnaryExpression, _super); - function PrefixUnaryExpression(_nodeType, operand) { - _super.call(this); - this._nodeType = _nodeType; - this.operand = operand; - operand && (operand.parent = this); - } - PrefixUnaryExpression.prototype.kind = function () { - return this._nodeType; - }; - - PrefixUnaryExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.operand, ast.operand, includingPosition); - }; - - PrefixUnaryExpression.prototype.isExpression = function () { - return true; - }; - return PrefixUnaryExpression; - })(AST); - TypeScript.PrefixUnaryExpression = PrefixUnaryExpression; - - var ArrayLiteralExpression = (function (_super) { - __extends(ArrayLiteralExpression, _super); - function ArrayLiteralExpression(expressions) { - _super.call(this); - this.expressions = expressions; - expressions && (expressions.parent = this); - } - ArrayLiteralExpression.prototype.kind = function () { - return 214 /* ArrayLiteralExpression */; - }; - - ArrayLiteralExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expressions, ast.expressions, includingPosition); - }; - - ArrayLiteralExpression.prototype.isExpression = function () { - return true; - }; - return ArrayLiteralExpression; - })(AST); - TypeScript.ArrayLiteralExpression = ArrayLiteralExpression; - - var OmittedExpression = (function (_super) { - __extends(OmittedExpression, _super); - function OmittedExpression() { - _super.apply(this, arguments); } - OmittedExpression.prototype.kind = function () { - return 223 /* OmittedExpression */; - }; - - OmittedExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - OmittedExpression.prototype.isExpression = function () { - return true; - }; - return OmittedExpression; - })(AST); - TypeScript.OmittedExpression = OmittedExpression; - - var ParenthesizedExpression = (function (_super) { - __extends(ParenthesizedExpression, _super); - function ParenthesizedExpression(openParenTrailingComments, expression) { - _super.call(this); - this.openParenTrailingComments = openParenTrailingComments; - this.expression = expression; - expression && (expression.parent = this); - } - ParenthesizedExpression.prototype.kind = function () { - return 217 /* ParenthesizedExpression */; - }; - - ParenthesizedExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - ParenthesizedExpression.prototype.isExpression = function () { - return true; - }; - return ParenthesizedExpression; - })(AST); - TypeScript.ParenthesizedExpression = ParenthesizedExpression; - - var SimpleArrowFunctionExpression = (function (_super) { - __extends(SimpleArrowFunctionExpression, _super); - function SimpleArrowFunctionExpression(identifier, block, expression) { - _super.call(this); - this.identifier = identifier; - this.block = block; - this.expression = expression; - identifier && (identifier.parent = this); - block && (block.parent = this); - expression && (expression.parent = this); - } - SimpleArrowFunctionExpression.prototype.kind = function () { - return 219 /* SimpleArrowFunctionExpression */; - }; - - SimpleArrowFunctionExpression.prototype.isExpression = function () { - return true; - }; - return SimpleArrowFunctionExpression; - })(AST); - TypeScript.SimpleArrowFunctionExpression = SimpleArrowFunctionExpression; - - var ParenthesizedArrowFunctionExpression = (function (_super) { - __extends(ParenthesizedArrowFunctionExpression, _super); - function ParenthesizedArrowFunctionExpression(callSignature, block, expression) { - _super.call(this); - this.callSignature = callSignature; - this.block = block; - this.expression = expression; - callSignature && (callSignature.parent = this); - block && (block.parent = this); - expression && (expression.parent = this); - } - ParenthesizedArrowFunctionExpression.prototype.kind = function () { - return 218 /* ParenthesizedArrowFunctionExpression */; - }; - - ParenthesizedArrowFunctionExpression.prototype.isExpression = function () { - return true; - }; - return ParenthesizedArrowFunctionExpression; - })(AST); - TypeScript.ParenthesizedArrowFunctionExpression = ParenthesizedArrowFunctionExpression; - - var QualifiedName = (function (_super) { - __extends(QualifiedName, _super); - function QualifiedName(left, right) { - _super.call(this); - this.left = left; - this.right = right; - left && (left.parent = this); - right && (right.parent = this); - } - QualifiedName.prototype.kind = function () { - return 121 /* QualifiedName */; - }; - - QualifiedName.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.left, ast.left, includingPosition) && structuralEquals(this.right, ast.right, includingPosition); - }; - return QualifiedName; - })(AST); - TypeScript.QualifiedName = QualifiedName; - - var ParameterList = (function (_super) { - __extends(ParameterList, _super); - function ParameterList(openParenTrailingComments, parameters) { - _super.call(this); - this.openParenTrailingComments = openParenTrailingComments; - this.parameters = parameters; - parameters && (parameters.parent = this); - } - ParameterList.prototype.kind = function () { - return 227 /* ParameterList */; - }; - return ParameterList; - })(AST); - TypeScript.ParameterList = ParameterList; - - var ConstructorType = (function (_super) { - __extends(ConstructorType, _super); - function ConstructorType(typeParameterList, parameterList, type) { - _super.call(this); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.type = type; - typeParameterList && (typeParameterList.parent = this); - parameterList && (parameterList.parent = this); - type && (type.parent = this); - } - ConstructorType.prototype.kind = function () { - return 125 /* ConstructorType */; - }; - return ConstructorType; - })(AST); - TypeScript.ConstructorType = ConstructorType; - - var FunctionType = (function (_super) { - __extends(FunctionType, _super); - function FunctionType(typeParameterList, parameterList, type) { - _super.call(this); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.type = type; - typeParameterList && (typeParameterList.parent = this); - parameterList && (parameterList.parent = this); - type && (type.parent = this); - } - FunctionType.prototype.kind = function () { - return 123 /* FunctionType */; - }; - return FunctionType; - })(AST); - TypeScript.FunctionType = FunctionType; - - var ObjectType = (function (_super) { - __extends(ObjectType, _super); - function ObjectType(typeMembers) { - _super.call(this); - this.typeMembers = typeMembers; - typeMembers && (typeMembers.parent = this); - } - ObjectType.prototype.kind = function () { - return 122 /* ObjectType */; - }; - - ObjectType.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.typeMembers, ast.typeMembers, includingPosition); - }; - return ObjectType; - })(AST); - TypeScript.ObjectType = ObjectType; - - var ArrayType = (function (_super) { - __extends(ArrayType, _super); - function ArrayType(type) { - _super.call(this); - this.type = type; - type && (type.parent = this); - } - ArrayType.prototype.kind = function () { - return 124 /* ArrayType */; - }; - - ArrayType.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.type, ast.type, includingPosition); - }; - return ArrayType; - })(AST); - TypeScript.ArrayType = ArrayType; - - var TypeArgumentList = (function (_super) { - __extends(TypeArgumentList, _super); - function TypeArgumentList(typeArguments) { - _super.call(this); - this.typeArguments = typeArguments; - typeArguments && (typeArguments.parent = this); - } - TypeArgumentList.prototype.kind = function () { - return 228 /* TypeArgumentList */; - }; - return TypeArgumentList; - })(AST); - TypeScript.TypeArgumentList = TypeArgumentList; - - var GenericType = (function (_super) { - __extends(GenericType, _super); - function GenericType(name, typeArgumentList) { - _super.call(this); - this.name = name; - this.typeArgumentList = typeArgumentList; - name && (name.parent = this); - typeArgumentList && (typeArgumentList.parent = this); - } - GenericType.prototype.kind = function () { - return 126 /* GenericType */; - }; - - GenericType.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.name, ast.name, includingPosition) && structuralEquals(this.typeArgumentList, ast.typeArgumentList, includingPosition); - }; - return GenericType; - })(AST); - TypeScript.GenericType = GenericType; - - var TypeQuery = (function (_super) { - __extends(TypeQuery, _super); - function TypeQuery(name) { - _super.call(this); - this.name = name; - name && (name.parent = this); - } - TypeQuery.prototype.kind = function () { - return 127 /* TypeQuery */; - }; - - TypeQuery.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.name, ast.name, includingPosition); - }; - return TypeQuery; - })(AST); - TypeScript.TypeQuery = TypeQuery; - - var Block = (function (_super) { - __extends(Block, _super); - function Block(statements, closeBraceLeadingComments, closeBraceToken) { - _super.call(this); - this.statements = statements; - this.closeBraceLeadingComments = closeBraceLeadingComments; - this.closeBraceToken = closeBraceToken; - statements && (statements.parent = this); - } - Block.prototype.kind = function () { - return 146 /* Block */; - }; - - Block.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statements, ast.statements, includingPosition); - }; - return Block; - })(AST); - TypeScript.Block = Block; - - var Parameter = (function (_super) { - __extends(Parameter, _super); - function Parameter(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - _super.call(this); - this.dotDotDotToken = dotDotDotToken; - this.modifiers = modifiers; - this.identifier = identifier; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - identifier && (identifier.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - equalsValueClause && (equalsValueClause.parent = this); - } - Parameter.prototype.kind = function () { - return 242 /* Parameter */; - }; - return Parameter; - })(AST); - TypeScript.Parameter = Parameter; - - var MemberAccessExpression = (function (_super) { - __extends(MemberAccessExpression, _super); - function MemberAccessExpression(expression, name) { - _super.call(this); - this.expression = expression; - this.name = name; - expression && (expression.parent = this); - name && (name.parent = this); - } - MemberAccessExpression.prototype.kind = function () { - return 212 /* MemberAccessExpression */; - }; - - MemberAccessExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.name, ast.name, includingPosition); - }; - - MemberAccessExpression.prototype.isExpression = function () { - return true; - }; - return MemberAccessExpression; - })(AST); - TypeScript.MemberAccessExpression = MemberAccessExpression; - - var PostfixUnaryExpression = (function (_super) { - __extends(PostfixUnaryExpression, _super); - function PostfixUnaryExpression(_nodeType, operand) { - _super.call(this); - this._nodeType = _nodeType; - this.operand = operand; - operand && (operand.parent = this); - } - PostfixUnaryExpression.prototype.kind = function () { - return this._nodeType; - }; - - PostfixUnaryExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.operand, ast.operand, includingPosition); - }; - - PostfixUnaryExpression.prototype.isExpression = function () { - return true; - }; - return PostfixUnaryExpression; - })(AST); - TypeScript.PostfixUnaryExpression = PostfixUnaryExpression; - - var ElementAccessExpression = (function (_super) { - __extends(ElementAccessExpression, _super); - function ElementAccessExpression(expression, argumentExpression) { - _super.call(this); - this.expression = expression; - this.argumentExpression = argumentExpression; - expression && (expression.parent = this); - argumentExpression && (argumentExpression.parent = this); - } - ElementAccessExpression.prototype.kind = function () { - return 221 /* ElementAccessExpression */; - }; - - ElementAccessExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.argumentExpression, ast.argumentExpression, includingPosition); - }; - - ElementAccessExpression.prototype.isExpression = function () { - return true; - }; - return ElementAccessExpression; - })(AST); - TypeScript.ElementAccessExpression = ElementAccessExpression; - - var InvocationExpression = (function (_super) { - __extends(InvocationExpression, _super); - function InvocationExpression(expression, argumentList) { - _super.call(this); - this.expression = expression; - this.argumentList = argumentList; - expression && (expression.parent = this); - argumentList && (argumentList.parent = this); - } - InvocationExpression.prototype.kind = function () { - return 213 /* InvocationExpression */; - }; - - InvocationExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.argumentList, ast.argumentList, includingPosition); - }; - - InvocationExpression.prototype.isExpression = function () { - return true; - }; - return InvocationExpression; - })(AST); - TypeScript.InvocationExpression = InvocationExpression; - - var ArgumentList = (function (_super) { - __extends(ArgumentList, _super); - function ArgumentList(typeArgumentList, _arguments, closeParenToken) { - _super.call(this); - this.typeArgumentList = typeArgumentList; - this.closeParenToken = closeParenToken; - this.arguments = _arguments; - - typeArgumentList && (typeArgumentList.parent = this); - _arguments && (_arguments.parent = this); + function checkFunctionDeclaration(node) { + checkFunctionLikeDeclaration(node); + if (fullTypeCheck) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + } + } + function checkFunctionLikeDeclaration(node) { + checkSignatureDeclaration(node); + if (!ts.hasComputedNameButNotSymbol(node)) { + var symbol = getSymbolOfNode(node); + var localSymbol = node.localSymbol || symbol; + var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(localSymbol); + } + if (symbol.parent) { + if (ts.getDeclarationOfKind(symbol, node.kind) === node) { + checkFunctionOrConstructorSymbol(symbol); + } + } + } + checkSourceElement(node.body); + if (node.type && !isAccessor(node.kind)) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (fullTypeCheck && compilerOptions.noImplicitAny && !node.body && !node.type) { + if (!isPrivateWithinAmbient(node)) { + var typeName = typeToString(anyType); + if (node.name) { + error(node, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(node.name), typeName); + } + else { + error(node, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); + } + } + } } - ArgumentList.prototype.kind = function () { - return 226 /* ArgumentList */; - }; - return ArgumentList; - })(AST); - TypeScript.ArgumentList = ArgumentList; - - var BinaryExpression = (function (_super) { - __extends(BinaryExpression, _super); - function BinaryExpression(_nodeType, left, right) { - _super.call(this); - this._nodeType = _nodeType; - this.left = left; - this.right = right; - left && (left.parent = this); - right && (right.parent = this); - } - BinaryExpression.prototype.kind = function () { - return this._nodeType; - }; - - BinaryExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.left, ast.left, includingPosition) && structuralEquals(this.right, ast.right, includingPosition); - }; - - BinaryExpression.prototype.isExpression = function () { - return true; - }; - return BinaryExpression; - })(AST); - TypeScript.BinaryExpression = BinaryExpression; - - var ConditionalExpression = (function (_super) { - __extends(ConditionalExpression, _super); - function ConditionalExpression(condition, whenTrue, whenFalse) { - _super.call(this); - this.condition = condition; - this.whenTrue = whenTrue; - this.whenFalse = whenFalse; - condition && (condition.parent = this); - whenTrue && (whenTrue.parent = this); - whenFalse && (whenFalse.parent = this); - } - ConditionalExpression.prototype.kind = function () { - return 186 /* ConditionalExpression */; - }; - - ConditionalExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.whenTrue, ast.whenTrue, includingPosition) && structuralEquals(this.whenFalse, ast.whenFalse, includingPosition); - }; - - ConditionalExpression.prototype.isExpression = function () { - return true; - }; - return ConditionalExpression; - })(AST); - TypeScript.ConditionalExpression = ConditionalExpression; - - var ConstructSignature = (function (_super) { - __extends(ConstructSignature, _super); - function ConstructSignature(callSignature) { - _super.call(this); - this.callSignature = callSignature; - callSignature && (callSignature.parent = this); - } - ConstructSignature.prototype.kind = function () { - return 143 /* ConstructSignature */; - }; - return ConstructSignature; - })(AST); - TypeScript.ConstructSignature = ConstructSignature; - - var MethodSignature = (function (_super) { - __extends(MethodSignature, _super); - function MethodSignature(propertyName, questionToken, callSignature) { - _super.call(this); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.callSignature = callSignature; - propertyName && (propertyName.parent = this); - callSignature && (callSignature.parent = this); - } - MethodSignature.prototype.kind = function () { - return 145 /* MethodSignature */; - }; - return MethodSignature; - })(AST); - TypeScript.MethodSignature = MethodSignature; - - var IndexSignature = (function (_super) { - __extends(IndexSignature, _super); - function IndexSignature(parameter, typeAnnotation) { - _super.call(this); - this.parameter = parameter; - this.typeAnnotation = typeAnnotation; - parameter && (parameter.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - } - IndexSignature.prototype.kind = function () { - return 144 /* IndexSignature */; - }; - return IndexSignature; - })(AST); - TypeScript.IndexSignature = IndexSignature; - - var PropertySignature = (function (_super) { - __extends(PropertySignature, _super); - function PropertySignature(propertyName, questionToken, typeAnnotation) { - _super.call(this); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - propertyName && (propertyName.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - } - PropertySignature.prototype.kind = function () { - return 141 /* PropertySignature */; - }; - return PropertySignature; - })(AST); - TypeScript.PropertySignature = PropertySignature; - - var CallSignature = (function (_super) { - __extends(CallSignature, _super); - function CallSignature(typeParameterList, parameterList, typeAnnotation) { - _super.call(this); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - typeParameterList && (typeParameterList.parent = this); - parameterList && (parameterList.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - } - CallSignature.prototype.kind = function () { - return 142 /* CallSignature */; - }; - return CallSignature; - })(AST); - TypeScript.CallSignature = CallSignature; - - var TypeParameter = (function (_super) { - __extends(TypeParameter, _super); - function TypeParameter(identifier, constraint) { - _super.call(this); - this.identifier = identifier; - this.constraint = constraint; - identifier && (identifier.parent = this); - constraint && (constraint.parent = this); - } - TypeParameter.prototype.kind = function () { - return 238 /* TypeParameter */; - }; - - TypeParameter.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.constraint, ast.constraint, includingPosition); - }; - return TypeParameter; - })(AST); - TypeScript.TypeParameter = TypeParameter; - - var Constraint = (function (_super) { - __extends(Constraint, _super); - function Constraint(type) { - _super.call(this); - this.type = type; - type && (type.parent = this); - } - Constraint.prototype.kind = function () { - return 239 /* Constraint */; - }; - return Constraint; - })(AST); - TypeScript.Constraint = Constraint; - - var ElseClause = (function (_super) { - __extends(ElseClause, _super); - function ElseClause(statement) { - _super.call(this); - this.statement = statement; - statement && (statement.parent = this); - } - ElseClause.prototype.kind = function () { - return 235 /* ElseClause */; - }; - - ElseClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return ElseClause; - })(AST); - TypeScript.ElseClause = ElseClause; - - var IfStatement = (function (_super) { - __extends(IfStatement, _super); - function IfStatement(condition, statement, elseClause) { - _super.call(this); - this.condition = condition; - this.statement = statement; - this.elseClause = elseClause; - condition && (condition.parent = this); - statement && (statement.parent = this); - elseClause && (elseClause.parent = this); - } - IfStatement.prototype.kind = function () { - return 147 /* IfStatement */; - }; - - IfStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition) && structuralEquals(this.elseClause, ast.elseClause, includingPosition); - }; - return IfStatement; - })(AST); - TypeScript.IfStatement = IfStatement; - - var ExpressionStatement = (function (_super) { - __extends(ExpressionStatement, _super); - function ExpressionStatement(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - ExpressionStatement.prototype.kind = function () { - return 149 /* ExpressionStatement */; - }; - - ExpressionStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return ExpressionStatement; - })(AST); - TypeScript.ExpressionStatement = ExpressionStatement; - - var ConstructorDeclaration = (function (_super) { - __extends(ConstructorDeclaration, _super); - function ConstructorDeclaration(callSignature, block) { - _super.call(this); - this.callSignature = callSignature; - this.block = block; - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - ConstructorDeclaration.prototype.kind = function () { - return 137 /* ConstructorDeclaration */; - }; - return ConstructorDeclaration; - })(AST); - TypeScript.ConstructorDeclaration = ConstructorDeclaration; - - var MemberFunctionDeclaration = (function (_super) { - __extends(MemberFunctionDeclaration, _super); - function MemberFunctionDeclaration(modifiers, propertyName, callSignature, block) { - _super.call(this); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - propertyName && (propertyName.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - MemberFunctionDeclaration.prototype.kind = function () { - return 135 /* MemberFunctionDeclaration */; - }; - return MemberFunctionDeclaration; - })(AST); - TypeScript.MemberFunctionDeclaration = MemberFunctionDeclaration; - - var GetAccessor = (function (_super) { - __extends(GetAccessor, _super); - function GetAccessor(modifiers, propertyName, parameterList, typeAnnotation, block) { - _super.call(this); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - this.block = block; - propertyName && (propertyName.parent = this); - parameterList && (parameterList.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - block && (block.parent = this); - } - GetAccessor.prototype.kind = function () { - return 139 /* GetAccessor */; - }; - return GetAccessor; - })(AST); - TypeScript.GetAccessor = GetAccessor; - - var SetAccessor = (function (_super) { - __extends(SetAccessor, _super); - function SetAccessor(modifiers, propertyName, parameterList, block) { - _super.call(this); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.block = block; - propertyName && (propertyName.parent = this); - parameterList && (parameterList.parent = this); - block && (block.parent = this); - } - SetAccessor.prototype.kind = function () { - return 140 /* SetAccessor */; - }; - return SetAccessor; - })(AST); - TypeScript.SetAccessor = SetAccessor; - - var MemberVariableDeclaration = (function (_super) { - __extends(MemberVariableDeclaration, _super); - function MemberVariableDeclaration(modifiers, variableDeclarator) { - _super.call(this); - this.modifiers = modifiers; - this.variableDeclarator = variableDeclarator; - variableDeclarator && (variableDeclarator.parent = this); - } - MemberVariableDeclaration.prototype.kind = function () { - return 136 /* MemberVariableDeclaration */; - }; - return MemberVariableDeclaration; - })(AST); - TypeScript.MemberVariableDeclaration = MemberVariableDeclaration; - - var IndexMemberDeclaration = (function (_super) { - __extends(IndexMemberDeclaration, _super); - function IndexMemberDeclaration(indexSignature) { - _super.call(this); - this.indexSignature = indexSignature; - indexSignature && (indexSignature.parent = this); - } - IndexMemberDeclaration.prototype.kind = function () { - return 138 /* IndexMemberDeclaration */; - }; - return IndexMemberDeclaration; - })(AST); - TypeScript.IndexMemberDeclaration = IndexMemberDeclaration; - - var ThrowStatement = (function (_super) { - __extends(ThrowStatement, _super); - function ThrowStatement(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - ThrowStatement.prototype.kind = function () { - return 157 /* ThrowStatement */; - }; - - ThrowStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return ThrowStatement; - })(AST); - TypeScript.ThrowStatement = ThrowStatement; - - var ReturnStatement = (function (_super) { - __extends(ReturnStatement, _super); - function ReturnStatement(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - ReturnStatement.prototype.kind = function () { - return 150 /* ReturnStatement */; - }; - - ReturnStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return ReturnStatement; - })(AST); - TypeScript.ReturnStatement = ReturnStatement; - - var ObjectCreationExpression = (function (_super) { - __extends(ObjectCreationExpression, _super); - function ObjectCreationExpression(expression, argumentList) { - _super.call(this); - this.expression = expression; - this.argumentList = argumentList; - expression && (expression.parent = this); - argumentList && (argumentList.parent = this); - } - ObjectCreationExpression.prototype.kind = function () { - return 216 /* ObjectCreationExpression */; - }; - - ObjectCreationExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.argumentList, ast.argumentList, includingPosition); - }; - - ObjectCreationExpression.prototype.isExpression = function () { - return true; - }; - return ObjectCreationExpression; - })(AST); - TypeScript.ObjectCreationExpression = ObjectCreationExpression; - - var SwitchStatement = (function (_super) { - __extends(SwitchStatement, _super); - function SwitchStatement(expression, closeParenToken, switchClauses) { - _super.call(this); - this.expression = expression; - this.closeParenToken = closeParenToken; - this.switchClauses = switchClauses; - expression && (expression.parent = this); - switchClauses && (switchClauses.parent = this); - } - SwitchStatement.prototype.kind = function () { - return 151 /* SwitchStatement */; - }; - - SwitchStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.switchClauses, ast.switchClauses, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return SwitchStatement; - })(AST); - TypeScript.SwitchStatement = SwitchStatement; - - var CaseSwitchClause = (function (_super) { - __extends(CaseSwitchClause, _super); - function CaseSwitchClause(expression, statements) { - _super.call(this); - this.expression = expression; - this.statements = statements; - expression && (expression.parent = this); - statements && (statements.parent = this); - } - CaseSwitchClause.prototype.kind = function () { - return 233 /* CaseSwitchClause */; - }; - - CaseSwitchClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.statements, ast.statements, includingPosition); - }; - return CaseSwitchClause; - })(AST); - TypeScript.CaseSwitchClause = CaseSwitchClause; - - var DefaultSwitchClause = (function (_super) { - __extends(DefaultSwitchClause, _super); - function DefaultSwitchClause(statements) { - _super.call(this); - this.statements = statements; - statements && (statements.parent = this); - } - DefaultSwitchClause.prototype.kind = function () { - return 234 /* DefaultSwitchClause */; - }; - - DefaultSwitchClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statements, ast.statements, includingPosition); - }; - return DefaultSwitchClause; - })(AST); - TypeScript.DefaultSwitchClause = DefaultSwitchClause; - - var BreakStatement = (function (_super) { - __extends(BreakStatement, _super); - function BreakStatement(identifier) { - _super.call(this); - this.identifier = identifier; - } - BreakStatement.prototype.kind = function () { - return 152 /* BreakStatement */; - }; - - BreakStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - return BreakStatement; - })(AST); - TypeScript.BreakStatement = BreakStatement; - - var ContinueStatement = (function (_super) { - __extends(ContinueStatement, _super); - function ContinueStatement(identifier) { - _super.call(this); - this.identifier = identifier; - } - ContinueStatement.prototype.kind = function () { - return 153 /* ContinueStatement */; - }; - - ContinueStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - return ContinueStatement; - })(AST); - TypeScript.ContinueStatement = ContinueStatement; - - var ForStatement = (function (_super) { - __extends(ForStatement, _super); - function ForStatement(variableDeclaration, initializer, condition, incrementor, statement) { - _super.call(this); - this.variableDeclaration = variableDeclaration; - this.initializer = initializer; - this.condition = condition; - this.incrementor = incrementor; - this.statement = statement; - variableDeclaration && (variableDeclaration.parent = this); - initializer && (initializer.parent = this); - condition && (condition.parent = this); - incrementor && (incrementor.parent = this); - statement && (statement.parent = this); - } - ForStatement.prototype.kind = function () { - return 154 /* ForStatement */; - }; - - ForStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.initializer, ast.initializer, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.incrementor, ast.incrementor, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return ForStatement; - })(AST); - TypeScript.ForStatement = ForStatement; - - var ForInStatement = (function (_super) { - __extends(ForInStatement, _super); - function ForInStatement(variableDeclaration, left, expression, statement) { - _super.call(this); - this.variableDeclaration = variableDeclaration; - this.left = left; - this.expression = expression; - this.statement = statement; - variableDeclaration && (variableDeclaration.parent = this); - left && (left.parent = this); - expression && (expression.parent = this); - statement && (statement.parent = this); - } - ForInStatement.prototype.kind = function () { - return 155 /* ForInStatement */; - }; - - ForInStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.variableDeclaration, ast.variableDeclaration, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return ForInStatement; - })(AST); - TypeScript.ForInStatement = ForInStatement; - - var WhileStatement = (function (_super) { - __extends(WhileStatement, _super); - function WhileStatement(condition, statement) { - _super.call(this); - this.condition = condition; - this.statement = statement; - condition && (condition.parent = this); - statement && (statement.parent = this); - } - WhileStatement.prototype.kind = function () { - return 158 /* WhileStatement */; - }; - - WhileStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return WhileStatement; - })(AST); - TypeScript.WhileStatement = WhileStatement; - - var WithStatement = (function (_super) { - __extends(WithStatement, _super); - function WithStatement(condition, statement) { - _super.call(this); - this.condition = condition; - this.statement = statement; - condition && (condition.parent = this); - statement && (statement.parent = this); - } - WithStatement.prototype.kind = function () { - return 163 /* WithStatement */; - }; - - WithStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return WithStatement; - })(AST); - TypeScript.WithStatement = WithStatement; - - var EnumDeclaration = (function (_super) { - __extends(EnumDeclaration, _super); - function EnumDeclaration(modifiers, identifier, enumElements) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.enumElements = enumElements; - identifier && (identifier.parent = this); - enumElements && (enumElements.parent = this); - } - EnumDeclaration.prototype.kind = function () { - return 132 /* EnumDeclaration */; - }; - return EnumDeclaration; - })(AST); - TypeScript.EnumDeclaration = EnumDeclaration; - - var EnumElement = (function (_super) { - __extends(EnumElement, _super); - function EnumElement(propertyName, equalsValueClause) { - _super.call(this); - this.propertyName = propertyName; - this.equalsValueClause = equalsValueClause; - propertyName && (propertyName.parent = this); - equalsValueClause && (equalsValueClause.parent = this); - } - EnumElement.prototype.kind = function () { - return 243 /* EnumElement */; - }; - return EnumElement; - })(AST); - TypeScript.EnumElement = EnumElement; - - var CastExpression = (function (_super) { - __extends(CastExpression, _super); - function CastExpression(type, expression) { - _super.call(this); - this.type = type; - this.expression = expression; - type && (type.parent = this); - expression && (expression.parent = this); - } - CastExpression.prototype.kind = function () { - return 220 /* CastExpression */; - }; - - CastExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.type, ast.type, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - CastExpression.prototype.isExpression = function () { - return true; - }; - return CastExpression; - })(AST); - TypeScript.CastExpression = CastExpression; - - var ObjectLiteralExpression = (function (_super) { - __extends(ObjectLiteralExpression, _super); - function ObjectLiteralExpression(propertyAssignments) { - _super.call(this); - this.propertyAssignments = propertyAssignments; - propertyAssignments && (propertyAssignments.parent = this); - } - ObjectLiteralExpression.prototype.kind = function () { - return 215 /* ObjectLiteralExpression */; - }; - - ObjectLiteralExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.propertyAssignments, ast.propertyAssignments, includingPosition); - }; - - ObjectLiteralExpression.prototype.isExpression = function () { - return true; - }; - return ObjectLiteralExpression; - })(AST); - TypeScript.ObjectLiteralExpression = ObjectLiteralExpression; - - var SimplePropertyAssignment = (function (_super) { - __extends(SimplePropertyAssignment, _super); - function SimplePropertyAssignment(propertyName, expression) { - _super.call(this); - this.propertyName = propertyName; - this.expression = expression; - propertyName && (propertyName.parent = this); - expression && (expression.parent = this); - } - SimplePropertyAssignment.prototype.kind = function () { - return 240 /* SimplePropertyAssignment */; - }; - return SimplePropertyAssignment; - })(AST); - TypeScript.SimplePropertyAssignment = SimplePropertyAssignment; - - var FunctionPropertyAssignment = (function (_super) { - __extends(FunctionPropertyAssignment, _super); - function FunctionPropertyAssignment(propertyName, callSignature, block) { - _super.call(this); - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - propertyName && (propertyName.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - FunctionPropertyAssignment.prototype.kind = function () { - return 241 /* FunctionPropertyAssignment */; - }; - return FunctionPropertyAssignment; - })(AST); - TypeScript.FunctionPropertyAssignment = FunctionPropertyAssignment; - - var FunctionExpression = (function (_super) { - __extends(FunctionExpression, _super); - function FunctionExpression(identifier, callSignature, block) { - _super.call(this); - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - identifier && (identifier.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - FunctionExpression.prototype.kind = function () { - return 222 /* FunctionExpression */; - }; - - FunctionExpression.prototype.isExpression = function () { - return true; - }; - return FunctionExpression; - })(AST); - TypeScript.FunctionExpression = FunctionExpression; - - var EmptyStatement = (function (_super) { - __extends(EmptyStatement, _super); - function EmptyStatement() { - _super.apply(this, arguments); + function checkBlock(node) { + ts.forEach(node.statements, checkSourceElement); + if (ts.isFunctionBlock(node) || node.kind === 190 /* ModuleBlock */) { + checkFunctionExpressionBodies(node); + } } - EmptyStatement.prototype.kind = function () { - return 156 /* EmptyStatement */; - }; - - EmptyStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - return EmptyStatement; - })(AST); - TypeScript.EmptyStatement = EmptyStatement; - - var TryStatement = (function (_super) { - __extends(TryStatement, _super); - function TryStatement(block, catchClause, finallyClause) { - _super.call(this); - this.block = block; - this.catchClause = catchClause; - this.finallyClause = finallyClause; - block && (block.parent = this); - catchClause && (catchClause.parent = this); - finallyClause && (finallyClause.parent = this); - } - TryStatement.prototype.kind = function () { - return 159 /* TryStatement */; - }; - - TryStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.block, ast.block, includingPosition) && structuralEquals(this.catchClause, ast.catchClause, includingPosition) && structuralEquals(this.finallyClause, ast.finallyClause, includingPosition); - }; - return TryStatement; - })(AST); - TypeScript.TryStatement = TryStatement; - - var CatchClause = (function (_super) { - __extends(CatchClause, _super); - function CatchClause(identifier, typeAnnotation, block) { - _super.call(this); - this.identifier = identifier; - this.typeAnnotation = typeAnnotation; - this.block = block; - identifier && (identifier.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - block && (block.parent = this); - } - CatchClause.prototype.kind = function () { - return 236 /* CatchClause */; - }; - - CatchClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.typeAnnotation, ast.typeAnnotation, includingPosition) && structuralEquals(this.block, ast.block, includingPosition); - }; - return CatchClause; - })(AST); - TypeScript.CatchClause = CatchClause; - - var FinallyClause = (function (_super) { - __extends(FinallyClause, _super); - function FinallyClause(block) { - _super.call(this); - this.block = block; - block && (block.parent = this); - } - FinallyClause.prototype.kind = function () { - return 237 /* FinallyClause */; - }; - - FinallyClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.block, ast.block, includingPosition); - }; - return FinallyClause; - })(AST); - TypeScript.FinallyClause = FinallyClause; - - var LabeledStatement = (function (_super) { - __extends(LabeledStatement, _super); - function LabeledStatement(identifier, statement) { - _super.call(this); - this.identifier = identifier; - this.statement = statement; - identifier && (identifier.parent = this); - statement && (statement.parent = this); - } - LabeledStatement.prototype.kind = function () { - return 160 /* LabeledStatement */; - }; - - LabeledStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return LabeledStatement; - })(AST); - TypeScript.LabeledStatement = LabeledStatement; - - var DoStatement = (function (_super) { - __extends(DoStatement, _super); - function DoStatement(statement, whileKeyword, condition) { - _super.call(this); - this.statement = statement; - this.whileKeyword = whileKeyword; - this.condition = condition; - statement && (statement.parent = this); - condition && (condition.parent = this); - } - DoStatement.prototype.kind = function () { - return 161 /* DoStatement */; - }; - - DoStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition); - }; - return DoStatement; - })(AST); - TypeScript.DoStatement = DoStatement; - - var TypeOfExpression = (function (_super) { - __extends(TypeOfExpression, _super); - function TypeOfExpression(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - TypeOfExpression.prototype.kind = function () { - return 171 /* TypeOfExpression */; - }; - - TypeOfExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - TypeOfExpression.prototype.isExpression = function () { - return true; - }; - return TypeOfExpression; - })(AST); - TypeScript.TypeOfExpression = TypeOfExpression; - - var DeleteExpression = (function (_super) { - __extends(DeleteExpression, _super); - function DeleteExpression(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - DeleteExpression.prototype.kind = function () { - return 170 /* DeleteExpression */; - }; - - DeleteExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - DeleteExpression.prototype.isExpression = function () { - return true; - }; - return DeleteExpression; - })(AST); - TypeScript.DeleteExpression = DeleteExpression; - - var VoidExpression = (function (_super) { - __extends(VoidExpression, _super); - function VoidExpression(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - VoidExpression.prototype.kind = function () { - return 172 /* VoidExpression */; - }; - - VoidExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - VoidExpression.prototype.isExpression = function () { + function checkCollisionWithArgumentsInGeneratedCode(node) { + if (!ts.hasRestParameters(node) || ts.isInAmbientContext(node) || !node.body) { + return; + } + ts.forEach(node.parameters, function (p) { + if (p.name && p.name.text === argumentsSymbol.name) { + error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + } + }); + } + function checkCollisionWithIndexVariableInGeneratedCode(node, name) { + if (!(name && name.text === "_i")) { + return; + } + if (node.kind === 123 /* Parameter */) { + if (node.parent.body && ts.hasRestParameters(node.parent) && !ts.isInAmbientContext(node)) { + error(node, ts.Diagnostics.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter); + } + return; + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol === unknownSymbol) { + return; + } + var current = node; + while (current) { + var definedOnCurrentLevel = ts.forEach(symbol.declarations, function (d) { return d.parent === current ? d : undefined; }); + if (definedOnCurrentLevel) { + return; + } + switch (current.kind) { + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 125 /* Method */: + case 151 /* ArrowFunction */: + case 126 /* Constructor */: + if (ts.hasRestParameters(current)) { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); + return; + } + break; + } + current = current.parent; + } + } + function needCollisionCheckForIdentifier(node, identifier, name) { + if (!identifier || identifier.text !== name) { + return false; + } + if (node.kind === 124 /* Property */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */) { + return false; + } + if (ts.isInAmbientContext(node)) { + return false; + } + if (node.kind === 123 /* Parameter */ && !node.parent.body) { + return false; + } return true; - }; - return VoidExpression; - })(AST); - TypeScript.VoidExpression = VoidExpression; - - var DebuggerStatement = (function (_super) { - __extends(DebuggerStatement, _super); - function DebuggerStatement() { - _super.apply(this, arguments); } - DebuggerStatement.prototype.kind = function () { - return 162 /* DebuggerStatement */; - }; - return DebuggerStatement; - })(AST); - TypeScript.DebuggerStatement = DebuggerStatement; - - var Comment = (function () { - function Comment(_trivia, endsLine, _start, _end) { - this._trivia = _trivia; - this.endsLine = endsLine; - this._start = _start; - this._end = _end; - } - Comment.prototype.start = function () { - return this._start; - }; - - Comment.prototype.end = function () { - return this._end; - }; - - Comment.prototype.fullText = function () { - return this._trivia.fullText(); - }; - - Comment.prototype.kind = function () { - return this._trivia.kind(); - }; - - Comment.prototype.structuralEquals = function (ast, includingPosition) { - if (includingPosition) { - if (this.start() !== ast.start() || this.end() !== ast.end()) { - return false; + function checkCollisionWithCapturedThisVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_this")) { + potentialThisCollisions.push(node); + } + } + function checkIfThisIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { + var isDeclaration = node.kind !== 63 /* Identifier */; + if (isDeclaration) { + error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + } + return; } + current = current.parent; } - - return this._trivia.fullText() === ast._trivia.fullText() && this.endsLine === ast.endsLine; - }; - return Comment; - })(); - TypeScript.Comment = Comment; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (IOUtils) { - function createDirectoryStructure(ioHost, dirName) { - if (ioHost.directoryExists(dirName)) { + } + function checkCollisionWithCapturedSuperVariable(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "_super")) { + return; + } + var enclosingClass = ts.getAncestor(node, 185 /* ClassDeclaration */); + if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { + return; + } + if (ts.getClassBaseTypeNode(enclosingClass)) { + var isDeclaration = node.kind !== 63 /* Identifier */; + if (isDeclaration) { + error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); + } + } + } + function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { + return; + } + if (node.kind === 189 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } - - var parentDirectory = ioHost.dirName(dirName); - if (parentDirectory != "") { - createDirectoryStructure(ioHost, parentDirectory); + var parent = node.kind === 183 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 201 /* SourceFile */ && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkCollisionWithConstDeclarations(node) { + if (node.initializer && (node.flags & 6144 /* BlockScoped */) === 0) { + var symbol = getSymbolOfNode(node); + if (symbol.flags & 1 /* FunctionScopedVariable */) { + var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, undefined, undefined); + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 4096 /* Const */) { + error(node, ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + } + } + } + } + } + function checkVariableOrParameterOrPropertyInFullTypeCheck(node) { + ts.Debug.assert(fullTypeCheck); + checkSourceElement(node.type); + if (ts.hasComputedNameButNotSymbol(node)) { + return node.initializer ? checkAndMarkExpression(node.initializer) : anyType; + } + var symbol = getSymbolOfNode(node); + var type; + if (symbol.valueDeclaration !== node) { + type = getTypeOfVariableOrParameterOrPropertyDeclaration(node); + } + else { + type = getTypeOfVariableOrParameterOrProperty(symbol); } - ioHost.createDirectory(dirName); - } - - function writeFileAndFolderStructure(ioHost, fileName, contents, writeByteOrderMark) { - var start = new Date().getTime(); - var path = ioHost.resolvePath(fileName); - TypeScript.ioHostResolvePathTime += new Date().getTime() - start; - - var start = new Date().getTime(); - var dirName = ioHost.dirName(path); - TypeScript.ioHostDirectoryNameTime += new Date().getTime() - start; - - var start = new Date().getTime(); - createDirectoryStructure(ioHost, dirName); - TypeScript.ioHostCreateDirectoryStructureTime += new Date().getTime() - start; - - var start = new Date().getTime(); - ioHost.writeFile(path, contents, writeByteOrderMark); - TypeScript.ioHostWriteFileTime += new Date().getTime() - start; + if (node.initializer && !(getNodeLinks(node.initializer).flags & 1 /* TypeChecked */)) { + checkTypeAssignableTo(checkAndMarkExpression(node.initializer), type, node, undefined); + } + return type; } - IOUtils.writeFileAndFolderStructure = writeFileAndFolderStructure; - - function throwIOError(message, error) { - var errorMessage = message; - if (error && error.message) { - errorMessage += (" " + error.message); + function checkVariableOrParameterDeclaration(node) { + if (fullTypeCheck) { + var type = checkVariableOrParameterOrPropertyInFullTypeCheck(node); + checkExportsOnMergedDeclarations(node); + if (node.initializer) { + checkCollisionWithConstDeclarations(node); + } + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + var symbol = getSymbolOfNode(node); + if (node !== symbol.valueDeclaration) { + var typeOfValueDeclaration = getTypeOfVariableOrParameterOrProperty(symbol); + if (typeOfValueDeclaration !== unknownType && type !== unknownType && !isTypeIdenticalTo(typeOfValueDeclaration, type)) { + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type)); + } + } } - throw new Error(errorMessage); } - IOUtils.throwIOError = throwIOError; - - function combine(prefix, suffix) { - return prefix + "/" + suffix; + function checkVariableStatement(node) { + ts.forEach(node.declarations, checkVariableOrParameterDeclaration); } - IOUtils.combine = combine; - - var BufferedTextWriter = (function () { - function BufferedTextWriter(writer, capacity) { - if (typeof capacity === "undefined") { capacity = 1024; } - this.writer = writer; - this.capacity = capacity; - this.buffer = ""; - } - BufferedTextWriter.prototype.Write = function (str) { - this.buffer += str; - if (this.buffer.length >= this.capacity) { - this.writer.Write(this.buffer); - this.buffer = ""; - } - }; - BufferedTextWriter.prototype.WriteLine = function (str) { - this.Write(str + '\r\n'); - }; - BufferedTextWriter.prototype.Close = function () { - this.writer.Write(this.buffer); - this.writer.Close(); - this.buffer = null; - }; - return BufferedTextWriter; - })(); - IOUtils.BufferedTextWriter = BufferedTextWriter; - })(TypeScript.IOUtils || (TypeScript.IOUtils = {})); - var IOUtils = TypeScript.IOUtils; - - TypeScript.IO = (function () { - function getWindowsScriptHostIO() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var streamObjectPool = []; - - function getStreamObject() { - if (streamObjectPool.length > 0) { - return streamObjectPool.pop(); - } else { - return new ActiveXObject("ADODB.Stream"); + function checkExpressionStatement(node) { + checkExpression(node.expression); + } + function checkIfStatement(node) { + checkExpression(node.expression); + checkSourceElement(node.thenStatement); + checkSourceElement(node.elseStatement); + } + function checkDoStatement(node) { + checkSourceElement(node.statement); + checkExpression(node.expression); + } + function checkWhileStatement(node) { + checkExpression(node.expression); + checkSourceElement(node.statement); + } + function checkForStatement(node) { + if (node.declarations) + ts.forEach(node.declarations, checkVariableOrParameterDeclaration); + if (node.initializer) + checkExpression(node.initializer); + if (node.condition) + checkExpression(node.condition); + if (node.iterator) + checkExpression(node.iterator); + checkSourceElement(node.statement); + } + function checkForInStatement(node) { + if (node.declarations) { + if (node.declarations.length >= 1) { + var decl = node.declarations[0]; + checkVariableOrParameterDeclaration(decl); + if (decl.type) { + error(decl, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); + } } } - - function releaseStreamObject(obj) { - streamObjectPool.push(obj); + if (node.variable) { + var exprType = checkExpression(node.variable); + if (exprType !== anyType && exprType !== stringType) { + error(node.variable, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + } + else { + checkReferenceExpression(node.variable, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + } } - - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); + var exprType = checkExpression(node.expression); + if (!(exprType.flags & 1 /* Any */ || isStructuredType(exprType))) { + 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); } - - return { - appendFile: function (path, content) { - var txtFile = fso.OpenTextFile(path, 8, true); - txtFile.Write(content); - txtFile.Close(); - }, - readFile: function (path, codepage) { - return TypeScript.Environment.readFile(path, codepage); - }, - writeFile: function (path, contents, writeByteOrderMark) { - TypeScript.Environment.writeFile(path, contents, writeByteOrderMark); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - dirName: function (path) { - return fso.GetParentFolderName(path); - }, - findFile: function (rootPath, partialFilePath) { - var path = fso.GetAbsolutePathName(rootPath) + "/" + partialFilePath; - - while (true) { - if (fso.FileExists(path)) { - return { fileInformation: this.readFile(path), path: path }; - } else { - rootPath = fso.GetParentFolderName(fso.GetAbsolutePathName(rootPath)); - - if (rootPath == "") { - return null; - } else { - path = fso.BuildPath(rootPath, partialFilePath); - } - } - } - }, - deleteFile: function (path) { - try { - if (fso.FileExists(path)) { - fso.DeleteFile(path, true); - } - } catch (e) { - IOUtils.throwIOError(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Could_not_delete_file_0, [path]), e); - } - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (path) { - try { - if (!this.directoryExists(path)) { - fso.CreateFolder(path); + checkSourceElement(node.statement); + } + function checkBreakOrContinueStatement(node) { + } + function checkReturnStatement(node) { + if (node.expression && !(getNodeLinks(node.expression).flags & 1 /* TypeChecked */)) { + var func = ts.getContainingFunction(node); + if (func) { + if (func.kind === 128 /* SetAccessor */) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - } catch (e) { - IOUtils.throwIOError(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Could_not_create_directory_0, [path]), e); } - }, - dir: function (path, spec, options) { - options = options || {}; - function filesInFolder(folder, root) { - var paths = []; - var fc; - - if (options.recursive) { - fc = new Enumerator(folder.subfolders); - - for (; !fc.atEnd(); fc.moveNext()) { - paths = paths.concat(filesInFolder(fc.item(), root + "/" + fc.item().Name)); - } + else { + var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + var checkAssignability = func.type || (func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))); + if (checkAssignability) { + checkTypeAssignableTo(checkExpression(node.expression), returnType, node.expression, undefined); } - - fc = new Enumerator(folder.files); - - for (; !fc.atEnd(); fc.moveNext()) { - if (!spec || fc.item().Name.match(spec)) { - paths.push(root + "/" + fc.item().Name); + else if (func.kind == 126 /* Constructor */) { + if (!isTypeAssignableTo(checkExpression(node.expression), returnType)) { + error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } - - return paths; - } - - var folder = fso.GetFolder(path); - var paths = []; - - return filesInFolder(folder, path); - }, - print: function (str) { - WScript.StdOut.Write(str); - }, - printLine: function (str) { - WScript.Echo(str); - }, - arguments: args, - stderr: WScript.StdErr, - stdout: WScript.StdOut, - watchFile: null, - run: function (source, fileName) { - try { - eval(source); - } catch (e) { - IOUtils.throwIOError(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Error_while_executing_file_0, [fileName]), e); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - quit: function (exitCode) { - if (typeof exitCode === "undefined") { exitCode = 0; } - try { - WScript.Quit(exitCode); - } catch (e) { } } - }; + } } - ; - - function getNodeIO() { - var _fs = require('fs'); - var _path = require('path'); - var _module = require('module'); - - return { - appendFile: function (path, content) { - _fs.appendFileSync(path, content); - }, - readFile: function (file, codepage) { - return TypeScript.Environment.readFile(file, codepage); - }, - writeFile: function (path, contents, writeByteOrderMark) { - TypeScript.Environment.writeFile(path, contents, writeByteOrderMark); - }, - deleteFile: function (path) { - try { - _fs.unlinkSync(path); - } catch (e) { - IOUtils.throwIOError(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Could_not_delete_file_0, [path]), e); - } - }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - dir: function dir(path, spec, options) { - options = options || {}; - - function filesInFolder(folder) { - var paths = []; - - try { - var files = _fs.readdirSync(folder); - for (var i = 0; i < files.length; i++) { - var stat = _fs.statSync(folder + "/" + files[i]); - if (options.recursive && stat.isDirectory()) { - paths = paths.concat(filesInFolder(folder + "/" + files[i])); - } else if (stat.isFile() && (!spec || files[i].match(spec))) { - paths.push(folder + "/" + files[i]); - } - } - } catch (err) { - } - - return paths; - } - - return filesInFolder(path); - }, - createDirectory: function (path) { - try { - if (!this.directoryExists(path)) { - _fs.mkdirSync(path); - } - } catch (e) { - IOUtils.throwIOError(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Could_not_create_directory_0, [path]), e); - } - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, - resolvePath: function (path) { - return _path.resolve(path); - }, - dirName: function (path) { - var dirPath = _path.dirname(path); - - if (dirPath === path) { - dirPath = null; - } - - return dirPath; - }, - findFile: function (rootPath, partialFilePath) { - var path = rootPath + "/" + partialFilePath; - - while (true) { - if (_fs.existsSync(path)) { - return { fileInformation: this.readFile(path), path: path }; - } else { - var parentPath = _path.resolve(rootPath, ".."); - - if (rootPath === parentPath) { - return null; - } else { - rootPath = parentPath; - path = _path.resolve(rootPath, partialFilePath); - } - } - } - }, - print: function (str) { - process.stdout.write(str); - }, - printLine: function (str) { - process.stdout.write(str + '\n'); - }, - arguments: process.argv.slice(2), - stderr: { - Write: function (str) { - process.stderr.write(str); - }, - WriteLine: function (str) { - process.stderr.write(str + '\n'); - }, - Close: function () { - } - }, - stdout: { - Write: function (str) { - process.stdout.write(str); - }, - WriteLine: function (str) { - process.stdout.write(str + '\n'); - }, - Close: function () { + function checkWithStatement(node) { + checkExpression(node.expression); + error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); + } + function checkSwitchStatement(node) { + var expressionType = checkExpression(node.expression); + ts.forEach(node.clauses, function (clause) { + if (fullTypeCheck && clause.kind === 194 /* CaseClause */) { + var caseClause = clause; + var caseType = checkExpression(caseClause.expression); + if (!isTypeAssignableTo(expressionType, caseType)) { + checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); } - }, - watchFile: function (fileName, callback) { - var firstRun = true; - var processingChange = false; - - var fileChanged = function (curr, prev) { - if (!firstRun) { - if (curr.mtime < prev.mtime) { - return; - } - - _fs.unwatchFile(fileName, fileChanged); - if (!processingChange) { - processingChange = true; - callback(fileName); - setTimeout(function () { - processingChange = false; - }, 100); - } - } - firstRun = false; - _fs.watchFile(fileName, { persistent: true, interval: 500 }, fileChanged); - }; - - fileChanged(); - return { - fileName: fileName, - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } - }; - }, - run: function (source, fileName) { - require.main.fileName = fileName; - require.main.paths = _module._nodeModulePaths(_path.dirname(_fs.realpathSync(fileName))); - require.main._compile(source, fileName); - }, - getExecutingFilePath: function () { - return process.mainModule.filename; - }, - quit: function (code) { - var stderrFlushed = process.stderr.write(''); - var stdoutFlushed = process.stdout.write(''); - process.stderr.on('drain', function () { - stderrFlushed = true; - if (stdoutFlushed) { - process.exit(code); - } - }); - process.stdout.on('drain', function () { - stdoutFlushed = true; - if (stderrFlushed) { - process.exit(code); - } - }); - setTimeout(function () { - process.exit(code); - }, 5); } - }; + ts.forEach(clause.statements, checkSourceElement); + }); } - ; - - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") - return getWindowsScriptHostIO(); - else if (typeof module !== 'undefined' && module.exports) - return getNodeIO(); - else - return null; - })(); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var OptionsParser = (function () { - function OptionsParser(host, version) { - this.host = host; - this.version = version; - this.DEFAULT_SHORT_FLAG = "-"; - this.DEFAULT_LONG_FLAG = "--"; - this.printedVersion = false; - this.unnamed = []; - this.options = []; - } - OptionsParser.prototype.findOption = function (arg) { - 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; - } + function checkLabeledStatement(node) { + checkSourceElement(node.statement); + } + function checkThrowStatement(node) { + if (node.expression) { + checkExpression(node.expression); } - - return null; - }; - - OptionsParser.prototype.printUsage = function () { - this.printVersion(); - - var optionsWord = TypeScript.getLocalizedText(TypeScript.DiagnosticCode.options, null); - var fileWord = TypeScript.getLocalizedText(TypeScript.DiagnosticCode.file1, null); - var tscSyntax = "tsc [" + optionsWord + "] [" + fileWord + " ..]"; - var syntaxHelp = TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Syntax_0, [tscSyntax]); - this.host.printLine(syntaxHelp); - this.host.printLine(""); - this.host.printLine(TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Examples, null) + " tsc hello.ts"); - this.host.printLine(" tsc --out foo.js foo.ts"); - this.host.printLine(" tsc @args.txt"); - this.host.printLine(""); - this.host.printLine(TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Options, null)); - - var output = []; - 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; + } + function checkTryStatement(node) { + checkBlock(node.tryBlock); + if (node.catchClause) + checkBlock(node.catchClause.block); + if (node.finallyBlock) + checkBlock(node.finallyBlock); + } + function checkIndexConstraints(type) { + function checkIndexConstraintForProperty(prop, propertyType, indexDeclaration, indexType, indexKind) { + if (!indexType) { + return; } - }); - - for (i = 0; i < this.options.length; i++) { - var option = this.options[i]; - - if (option.experimental) { - continue; + if (indexKind === 1 /* Number */ && !isNumericName(prop.name)) { + return; } - - if (!option.usage) { - break; + var errorNode; + if (prop.parent === type.symbol) { + errorNode = prop.valueDeclaration; } - - var usageString = " "; - var type = option.type ? (" " + TypeScript.getLocalizedText(option.type, null)) : ""; - - if (option.short) { - usageString += this.DEFAULT_SHORT_FLAG + option.short + type + ", "; + else if (indexDeclaration) { + errorNode = indexDeclaration; } - - 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; + 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 fileDescription = TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Insert_command_line_options_and_files_from_a_file, null); - output.push([" @<" + fileWord + ">", fileDescription]); - - for (i = 0; i < output.length; i++) { - this.host.printLine(output[i][0] + (new Array(maxLength - output[i][0].length + 3)).join(" ") + output[i][1]); - } - }; - - OptionsParser.prototype.printVersion = function () { - if (!this.printedVersion) { - this.host.printLine(TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Version_0, [this.version])); - this.printedVersion = true; - } - }; - - OptionsParser.prototype.option = function (name, config, short) { - if (!config) { - config = short; - short = null; + var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */); + var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */); + var stringIndexType = getIndexTypeOfType(type, 0 /* String */); + var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + 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 */); + }); } - - config.name = name; - config.short = short; - config.flag = false; - - this.options.push(config); - }; - - OptionsParser.prototype.flag = function (name, config, short) { - if (!config) { - config = short; - short = null; + var errorNode; + if (stringIndexType && numberIndexType) { + errorNode = declaredNumberIndexer || declaredStringIndexer; + if (!errorNode && (type.flags & 2048 /* Interface */)) { + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0 /* String */) && getIndexTypeOfType(base, 1 /* Number */); }); + errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; + } + } + 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 checkTypeNameIsReserved(name, message) { + switch (name.text) { + case "any": + case "number": + case "boolean": + case "string": + case "void": + error(name, message, name.text); + } + } + function checkTypeParameters(typeParameterDeclarations) { + if (typeParameterDeclarations) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { + var node = typeParameterDeclarations[i]; + checkTypeParameter(node); + if (fullTypeCheck) { + for (var j = 0; j < i; j++) { + if (typeParameterDeclarations[j].symbol === node.symbol) { + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); + } + } + } + } } - - config.name = name; - config.short = short; - config.flag = true; - - this.options.push(config); - }; - - OptionsParser.prototype.parseString = function (argString) { - var position = 0; - var tokens = argString.match(/\s+|"|[^\s"]+/g); - - function peek() { - return tokens[position]; + } + function checkClassDeclaration(node) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); + checkTypeParameters(node.typeParameters); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var staticType = getTypeOfSymbol(symbol); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitExtends = emitExtends || !ts.isInAmbientContext(node); + checkTypeReference(baseTypeNode); + } + if (type.baseTypes.length) { + if (fullTypeCheck) { + var baseType = type.baseTypes[0]; + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + var staticBaseType = getTypeOfSymbol(baseType.symbol); + checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); + if (baseType.symbol !== resolveEntityName(node, baseTypeNode.typeName, 107455 /* Value */)) { + error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); + } + checkKindsOfPropertyMemberOverrides(type, baseType); + } + checkExpressionOrQualifiedName(baseTypeNode.typeName); + } + var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (implementedTypeNodes) { + ts.forEach(implementedTypeNodes, function (typeRefNode) { + checkTypeReference(typeRefNode); + if (fullTypeCheck) { + var t = getTypeFromTypeReferenceNode(typeRefNode); + if (t !== unknownType) { + var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; + if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { + checkTypeAssignableTo(type, t, node.name, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + } + else { + error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); + } + } + } + }); } - - function consume() { - return tokens[position++]; + ts.forEach(node.members, checkSourceElement); + if (fullTypeCheck) { + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); } - - function consumeQuotedString() { - var value = ''; - consume(); - - var token = peek(); - - while (token && token !== '"') { - consume(); - - value += token; - - token = peek(); + } + function getTargetSymbol(s) { + return s.flags & 67108864 /* Instantiated */ ? getSymbolLinks(s).target : s; + } + function checkKindsOfPropertyMemberOverrides(type, baseType) { + var baseProperties = getPropertiesOfObjectType(baseType); + for (var i = 0, len = baseProperties.length; i < len; ++i) { + var base = getTargetSymbol(baseProperties[i]); + if (base.flags & 536870912 /* Prototype */) { + continue; } - - consume(); - - return value; - } - - var args = []; - 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 = ''; + var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + if (derived) { + var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { + continue; } - - consume(); - } else { - consume(); - currentArg += token; + if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { + continue; + } + if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & 98308 /* PropertyOrAccessor */) && (derived.flags & 98308 /* PropertyOrAccessor */))) { + continue; + } + var errorMessage; + if (base.flags & 8192 /* Method */) { + if (derived.flags & 98304 /* Accessor */) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; + } + else { + ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; + } + } + else if (base.flags & 4 /* Property */) { + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + } + else { + ts.Debug.assert((base.flags & 98304 /* Accessor */) !== 0); + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + } + error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } - - if (currentArg.length > 0) { - args.push(currentArg); + } + function isAccessor(kind) { + return kind === 127 /* GetAccessor */ || kind === 128 /* SetAccessor */; + } + function areTypeParametersIdentical(list1, list2) { + if (!list1 && !list2) { + return true; } - - this.parse(args); - }; - - OptionsParser.prototype.parse = function (args) { - var position = 0; - - function consume() { - return args[position++]; + if (!list1 || !list2 || list1.length !== list2.length) { + return false; + } + for (var i = 0, len = list1.length; i < len; i++) { + var tp1 = list1[i]; + var tp2 = list2[i]; + if (tp1.name.text !== tp2.name.text) { + return false; + } + if (!tp1.constraint && !tp2.constraint) { + continue; + } + if (!tp1.constraint || !tp2.constraint) { + return false; + } + if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + return false; + } } - - while (position < args.length) { - var current = consume(); - var match = current.match(/^(--?|@)(.*)/); - var value = 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.printLine(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Unknown_option_0, [arg])); - this.host.printLine(TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"])); - } else { - if (!option.flag) { - value = consume(); - if (value === undefined) { - this.host.printLine(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Option_0_specified_without_1, [arg, TypeScript.getLocalizedText(option.type, null)])); - this.host.printLine(TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"])); - continue; - } + return true; + } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + if (!type.baseTypes.length || type.baseTypes.length === 1) { + return true; + } + var seen = {}; + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { prop: p, containingType: type }; + }); + var ok = true; + for (var i = 0, len = type.baseTypes.length; i < len; ++i) { + var base = type.baseTypes[i]; + var properties = getPropertiesOfObjectType(base); + for (var j = 0, proplen = properties.length; j < proplen; ++j) { + var prop = properties[j]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, program.getCompilerHost().getNewLine())); + } + } + } + } + return ok; + } + function checkInterfaceDeclaration(node) { + checkTypeParameters(node.typeParameters); + if (fullTypeCheck) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 186 /* InterfaceDeclaration */); + if (symbol.declarations.length > 1) { + if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); + } + } + if (node === firstInterfaceDecl) { + var type = getDeclaredTypeOfSymbol(symbol); + if (checkInheritedPropertiesAreIdentical(type, node.name)) { + ts.forEach(type.baseTypes, function (baseType) { + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + }); + checkIndexConstraints(type); + } + } + } + ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(node.members, checkSourceElement); + if (fullTypeCheck) { + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkTypeAliasDeclaration(node) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); + checkSourceElement(node.type); + } + function computeEnumMemberValues(node) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 128 /* EnumValuesComputed */)) { + var enumSymbol = getSymbolOfNode(node); + var enumType = getDeclaredTypeOfSymbol(enumSymbol); + var autoValue = 0; + var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConst(node); + ts.forEach(node.members, function (member) { + if (isNumericName(member.name.text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + var initializer = member.initializer; + if (initializer) { + autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); + if (autoValue === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); } - - option.set(value); } } - } else { - this.unnamed.push(current); + else if (ambient && !enumIsConst) { + autoValue = undefined; + } + if (autoValue !== undefined) { + getNodeLinks(member).enumMemberValue = autoValue++; + } + }); + nodeLinks.flags |= 128 /* EnumValuesComputed */; + } + function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { + return evalConstant(initializer); + function evalConstant(e) { + switch (e.kind) { + case 155 /* PrefixUnaryExpression */: + var value = evalConstant(e.operand); + if (value === undefined) { + return undefined; + } + switch (e.operator) { + case 32 /* PlusToken */: return value; + case 33 /* MinusToken */: return -value; + case 46 /* TildeToken */: return enumIsConst ? ~value : undefined; + } + return undefined; + case 157 /* BinaryExpression */: + if (!enumIsConst) { + return undefined; + } + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operator) { + case 43 /* BarToken */: return left | right; + case 42 /* AmpersandToken */: return left & right; + case 40 /* GreaterThanGreaterThanToken */: return left >> right; + case 41 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 39 /* LessThanLessThanToken */: return left << right; + case 44 /* CaretToken */: return left ^ right; + case 34 /* AsteriskToken */: return left * right; + case 35 /* SlashToken */: return left / right; + case 32 /* PlusToken */: return left + right; + case 33 /* MinusToken */: return left - right; + case 36 /* PercentToken */: return left % right; + } + return undefined; + case 6 /* NumericLiteral */: + return +e.text; + case 149 /* ParenthesizedExpression */: + return enumIsConst ? evalConstant(e.expression) : undefined; + case 63 /* Identifier */: + case 144 /* ElementAccessExpression */: + case 143 /* PropertyAccessExpression */: + if (!enumIsConst) { + return undefined; + } + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType; + var propertyName; + if (e.kind === 63 /* Identifier */) { + enumType = currentType; + propertyName = e.text; + } + else { + if (e.kind === 144 /* ElementAccessExpression */) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 7 /* StringLiteral */) { + return undefined; + } + var enumType = getTypeOfNode(e.expression); + propertyName = e.argumentExpression.text; + } + else { + var enumType = getTypeOfNode(e.expression); + propertyName = e.name.text; + } + if (enumType !== currentType) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType, propertyName); + if (!property || !(property.flags & 8 /* EnumMember */)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isDefinedBefore(propertyDecl, member)) { + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } } } - }; - return OptionsParser; - })(); - TypeScript.OptionsParser = OptionsParser; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SourceFile = (function () { - function SourceFile(scriptSnapshot, byteOrderMark) { - this.scriptSnapshot = scriptSnapshot; - this.byteOrderMark = byteOrderMark; - } - return SourceFile; - })(); - - var DiagnosticsLogger = (function () { - function DiagnosticsLogger(ioHost) { - this.ioHost = ioHost; - } - DiagnosticsLogger.prototype.information = function () { - return false; - }; - DiagnosticsLogger.prototype.debug = function () { - return false; - }; - DiagnosticsLogger.prototype.warning = function () { - return false; - }; - DiagnosticsLogger.prototype.error = function () { - return false; - }; - DiagnosticsLogger.prototype.fatal = function () { - return false; - }; - DiagnosticsLogger.prototype.log = function (s) { - this.ioHost.stdout.WriteLine(s); - }; - return DiagnosticsLogger; - })(); - - var FileLogger = (function () { - function FileLogger(ioHost) { - this.ioHost = ioHost; - var file = "tsc." + Date.now() + ".log"; - - this.fileName = this.ioHost.resolvePath(file); } - FileLogger.prototype.information = function () { - return false; - }; - FileLogger.prototype.debug = function () { - return false; - }; - FileLogger.prototype.warning = function () { - return false; - }; - FileLogger.prototype.error = function () { - return false; - }; - FileLogger.prototype.fatal = function () { - return false; - }; - FileLogger.prototype.log = function (s) { - this.ioHost.appendFile(this.fileName, s + '\r\n'); - }; - return FileLogger; - })(); - - var BatchCompiler = (function () { - function BatchCompiler(ioHost) { - this.ioHost = ioHost; - this.compilerVersion = "1.0.1.0"; - this.inputFiles = []; - this.resolvedFiles = []; - this.fileNameToSourceFile = new TypeScript.StringHashTable(); - this.hasErrors = false; - this.logger = null; - this.fileExistsCache = TypeScript.createIntrinsicsObject(); - this.resolvePathCache = TypeScript.createIntrinsicsObject(); - } - BatchCompiler.prototype.batchCompile = function () { - var _this = this; - var start = new Date().getTime(); - - TypeScript.CompilerDiagnostics.diagnosticWriter = { Alert: function (s) { - _this.ioHost.printLine(s); - } }; - - if (this.parseOptions()) { - if (this.compilationSettings.createFileLog()) { - this.logger = new FileLogger(this.ioHost); - } else if (this.compilationSettings.gatherDiagnostics()) { - this.logger = new DiagnosticsLogger(this.ioHost); - } else { - this.logger = new TypeScript.NullLogger(); - } - - if (this.compilationSettings.watch()) { - this.watchFiles(); - return; - } - - this.resolve(); - - this.compile(); - - if (this.compilationSettings.createFileLog()) { - this.logger.log("Compilation settings:"); - this.logger.log(" propagateEnumConstants " + this.compilationSettings.propagateEnumConstants()); - this.logger.log(" removeComments " + this.compilationSettings.removeComments()); - this.logger.log(" watch " + this.compilationSettings.watch()); - this.logger.log(" noResolve " + this.compilationSettings.noResolve()); - this.logger.log(" noImplicitAny " + this.compilationSettings.noImplicitAny()); - this.logger.log(" nolib " + this.compilationSettings.noLib()); - this.logger.log(" target " + this.compilationSettings.codeGenTarget()); - this.logger.log(" module " + this.compilationSettings.moduleGenTarget()); - this.logger.log(" out " + this.compilationSettings.outFileOption()); - this.logger.log(" outDir " + this.compilationSettings.outDirOption()); - this.logger.log(" sourcemap " + this.compilationSettings.mapSourceFiles()); - this.logger.log(" mapRoot " + this.compilationSettings.mapRoot()); - this.logger.log(" sourceroot " + this.compilationSettings.sourceRoot()); - this.logger.log(" declaration " + this.compilationSettings.generateDeclarationFiles()); - this.logger.log(" useCaseSensitiveFileResolution " + this.compilationSettings.useCaseSensitiveFileResolution()); - this.logger.log(" diagnostics " + this.compilationSettings.gatherDiagnostics()); - this.logger.log(" codepage " + this.compilationSettings.codepage()); - - this.logger.log(""); - - this.logger.log("Input files:"); - this.inputFiles.forEach(function (file) { - _this.logger.log(" " + file); - }); - - this.logger.log(""); - - this.logger.log("Resolved Files:"); - this.resolvedFiles.forEach(function (file) { - file.importedFiles.forEach(function (file) { - _this.logger.log(" " + file); - }); - file.referencedFiles.forEach(function (file) { - _this.logger.log(" " + file); - }); + function checkEnumDeclaration(node) { + if (!fullTypeCheck) { + return; + } + checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + computeEnumMemberValues(node); + var enumSymbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); + if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + var enumIsConst = ts.isConst(node); + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } }); } - - 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("AST translation time: " + TypeScript.astTranslationTime); - 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); + var seenEnumMissingInitialInitializer = false; + ts.forEach(enumSymbol.declarations, function (declaration) { + if (declaration.kind !== 188 /* EnumDeclaration */) { + return false; + } + var enumDeclaration = declaration; + if (!enumDeclaration.members.length) { + return false; + } + var firstEnumMember = enumDeclaration.members[0]; + if (!firstEnumMember.initializer) { + if (seenEnumMissingInitialInitializer) { + error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + } + else { + seenEnumMissingInitialInitializer = true; + } + } + }); + } + } + function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if ((declaration.kind === 185 /* ClassDeclaration */ || (declaration.kind === 184 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + return declaration; } } - - this.ioHost.quit(this.hasErrors ? 1 : 0); - }; - - BatchCompiler.prototype.resolve = function () { - var _this = this; - var includeDefaultLibrary = !this.compilationSettings.noLib(); - var resolvedFiles = []; - - var start = new Date().getTime(); - - if (!this.compilationSettings.noResolve()) { - var resolutionResults = TypeScript.ReferenceResolver.resolve(this.inputFiles, this, this.compilationSettings.useCaseSensitiveFileResolution()); - resolvedFiles = resolutionResults.resolvedFiles; - - includeDefaultLibrary = !this.compilationSettings.noLib() && !resolutionResults.seenNoDefaultLibTag; - - resolutionResults.diagnostics.forEach(function (d) { - return _this.addDiagnostic(d); - }); - } else { - for (var i = 0, n = this.inputFiles.length; i < n; i++) { - var inputFile = this.inputFiles[i]; - var referencedFiles = []; - var importedFiles = []; - - if (this.compilationSettings.generateDeclarationFiles()) { - var references = TypeScript.getReferencedFiles(inputFile, this.getScriptSnapshot(inputFile)); - for (var j = 0; j < references.length; j++) { - referencedFiles.push(references[j].path); + return undefined; + } + function checkModuleDeclaration(node) { + if (fullTypeCheck) { + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node)) { + var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + if (classOrFunc) { + if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + } + else if (node.pos < classOrFunc.pos) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } - - inputFile = this.resolvePath(inputFile); } - - resolvedFiles.push({ - path: inputFile, - referencedFiles: referencedFiles, - importedFiles: importedFiles - }); + } + if (node.name.kind === 7 /* StringLiteral */) { + if (!isGlobalSourceFile(node.parent)) { + error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + } + if (isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name); + } } } - - var defaultLibStart = new Date().getTime(); - if (includeDefaultLibrary) { - var libraryResolvedFile = { - path: this.getDefaultLibraryFilePath(), - referencedFiles: [], - importedFiles: [] - }; - - resolvedFiles = [libraryResolvedFile].concat(resolvedFiles); + checkSourceElement(node.body); + } + function getFirstIdentifier(node) { + while (node.kind === 120 /* QualifiedName */) { + node = node.left; } - TypeScript.fileResolutionGetDefaultLibraryTime += new Date().getTime() - defaultLibStart; - - this.resolvedFiles = resolvedFiles; - - TypeScript.fileResolutionTime = new Date().getTime() - start; - }; - - BatchCompiler.prototype.compile = function () { - var _this = this; - var compiler = new TypeScript.TypeScriptCompiler(this.logger, this.compilationSettings); - - this.resolvedFiles.forEach(function (resolvedFile) { - var sourceFile = _this.getSourceFile(resolvedFile.path); - compiler.addFile(resolvedFile.path, sourceFile.scriptSnapshot, sourceFile.byteOrderMark, 0, false, resolvedFile.referencedFiles); - }); - - for (var it = compiler.compile(function (path) { - return _this.resolvePath(path); - }); it.moveNext();) { - var result = it.current(); - - result.diagnostics.forEach(function (d) { - return _this.addDiagnostic(d); - }); - if (!this.tryWriteOutputFiles(result.outputFiles)) { - return; + return node; + } + function checkImportDeclaration(node) { + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + var symbol = getSymbolOfNode(node); + var target; + if (ts.isInternalModuleImportDeclaration(node)) { + target = resolveImport(symbol); + if (target !== unknownSymbol) { + if (target.flags & 107455 /* Value */) { + var moduleName = getFirstIdentifier(node.moduleReference); + if (resolveEntityName(node, moduleName, 107455 /* Value */ | 1536 /* Namespace */).flags & 1536 /* Namespace */) { + checkExpressionOrQualifiedName(node.moduleReference); + } + else { + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); + } + } + if (target.flags & 3152352 /* Type */) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); + } } } - }; - - BatchCompiler.prototype.parseOptions = function () { - var _this = this; - var opts = new TypeScript.OptionsParser(this.ioHost, this.compilerVersion); - - var mutableSettings = new TypeScript.CompilationSettings(); - opts.option('out', { - usage: { - locCode: TypeScript.DiagnosticCode.Concatenate_and_emit_output_to_single_file, - args: null - }, - type: TypeScript.DiagnosticCode.file2, - set: function (str) { - mutableSettings.outFileOption = str; - } - }); - - opts.option('outDir', { - usage: { - locCode: TypeScript.DiagnosticCode.Redirect_output_structure_to_the_directory, - args: null - }, - type: TypeScript.DiagnosticCode.DIRECTORY, - set: function (str) { - mutableSettings.outDirOption = str; - } - }); - - opts.flag('sourcemap', { - usage: { - locCode: TypeScript.DiagnosticCode.Generates_corresponding_0_file, - args: ['.map'] - }, - set: function () { - mutableSettings.mapSourceFiles = true; + else { + if (node.parent.kind === 201 /* SourceFile */) { + target = resolveImport(symbol); } - }); - - opts.option('mapRoot', { - usage: { - locCode: TypeScript.DiagnosticCode.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - args: null - }, - type: TypeScript.DiagnosticCode.LOCATION, - set: function (str) { - mutableSettings.mapRoot = str; + else if (node.parent.kind === 190 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { + if (ts.getExternalModuleImportDeclarationExpression(node).kind === 7 /* StringLiteral */) { + if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { + error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + target = unknownSymbol; + } + else { + target = resolveImport(symbol); + } + } + else { + target = unknownSymbol; + } } - }); - - opts.option('sourceRoot', { - usage: { - locCode: TypeScript.DiagnosticCode.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - args: null - }, - type: TypeScript.DiagnosticCode.LOCATION, - set: function (str) { - mutableSettings.sourceRoot = str; + else { + target = unknownSymbol; } - }); - - opts.flag('declaration', { - usage: { - locCode: TypeScript.DiagnosticCode.Generates_corresponding_0_file, - args: ['.d.ts'] - }, - set: function () { - mutableSettings.generateDeclarationFiles = true; + } + if (target !== unknownSymbol) { + var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | (symbol.flags & 3152352 /* Type */ ? 3152352 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); + if (target.flags & excludedMeanings) { + error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); } - }, 'd'); - - if (this.ioHost.watchFile) { - opts.flag('watch', { - usage: { - locCode: TypeScript.DiagnosticCode.Watch_input_files, - args: null - }, - set: function () { - mutableSettings.watch = true; + } + } + function checkExportAssignment(node) { + var container = node.parent; + if (container.kind !== 201 /* SourceFile */) { + container = container.parent; + } + checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); + } + function checkSourceElement(node) { + if (!node) + return; + switch (node.kind) { + case 122 /* TypeParameter */: + return checkTypeParameter(node); + case 123 /* Parameter */: + return checkParameter(node); + case 124 /* Property */: + return checkPropertyDeclaration(node); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return checkSignatureDeclaration(node); + case 125 /* Method */: + return checkMethodDeclaration(node); + case 126 /* Constructor */: + return checkConstructorDeclaration(node); + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return checkAccessorDeclaration(node); + case 132 /* TypeReference */: + return checkTypeReference(node); + case 135 /* TypeQuery */: + return checkTypeQuery(node); + case 136 /* TypeLiteral */: + return checkTypeLiteral(node); + case 137 /* ArrayType */: + return checkArrayType(node); + case 138 /* TupleType */: + return checkTupleType(node); + case 139 /* UnionType */: + return checkUnionType(node); + case 140 /* ParenthesizedType */: + return checkSourceElement(node.type); + case 184 /* FunctionDeclaration */: + return checkFunctionDeclaration(node); + case 163 /* Block */: + case 190 /* ModuleBlock */: + return checkBlock(node); + case 164 /* VariableStatement */: + return checkVariableStatement(node); + case 166 /* ExpressionStatement */: + return checkExpressionStatement(node); + case 167 /* IfStatement */: + return checkIfStatement(node); + case 168 /* DoStatement */: + return checkDoStatement(node); + case 169 /* WhileStatement */: + return checkWhileStatement(node); + case 170 /* ForStatement */: + return checkForStatement(node); + case 171 /* ForInStatement */: + return checkForInStatement(node); + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + return checkBreakOrContinueStatement(node); + case 174 /* ReturnStatement */: + return checkReturnStatement(node); + case 175 /* WithStatement */: + return checkWithStatement(node); + case 176 /* SwitchStatement */: + return checkSwitchStatement(node); + case 177 /* LabeledStatement */: + return checkLabeledStatement(node); + case 178 /* ThrowStatement */: + return checkThrowStatement(node); + case 179 /* TryStatement */: + return checkTryStatement(node); + case 183 /* VariableDeclaration */: + return ts.Debug.fail("Checker encountered variable declaration"); + case 185 /* ClassDeclaration */: + return checkClassDeclaration(node); + case 186 /* InterfaceDeclaration */: + return checkInterfaceDeclaration(node); + case 187 /* TypeAliasDeclaration */: + return checkTypeAliasDeclaration(node); + case 188 /* EnumDeclaration */: + return checkEnumDeclaration(node); + case 189 /* ModuleDeclaration */: + return checkModuleDeclaration(node); + case 191 /* ImportDeclaration */: + return checkImportDeclaration(node); + case 192 /* ExportAssignment */: + return checkExportAssignment(node); + } + } + function checkFunctionExpressionBodies(node) { + switch (node.kind) { + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + checkFunctionExpressionOrObjectLiteralMethodBody(node); + break; + case 125 /* Method */: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + if (ts.isObjectLiteralMethod(node)) { + checkFunctionExpressionOrObjectLiteralMethodBody(node); } - }, 'w'); + break; + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + break; + case 175 /* WithStatement */: + checkFunctionExpressionBodies(node.expression); + break; + case 123 /* Parameter */: + case 124 /* Property */: + case 141 /* ArrayLiteralExpression */: + case 142 /* ObjectLiteralExpression */: + case 198 /* PropertyAssignment */: + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 147 /* TaggedTemplateExpression */: + case 159 /* TemplateExpression */: + case 162 /* TemplateSpan */: + case 148 /* TypeAssertionExpression */: + case 149 /* ParenthesizedExpression */: + case 153 /* TypeOfExpression */: + case 154 /* VoidExpression */: + case 152 /* DeleteExpression */: + case 155 /* PrefixUnaryExpression */: + case 156 /* PostfixUnaryExpression */: + case 157 /* BinaryExpression */: + case 158 /* ConditionalExpression */: + case 163 /* Block */: + case 190 /* ModuleBlock */: + case 164 /* VariableStatement */: + case 166 /* ExpressionStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + case 174 /* ReturnStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + case 183 /* VariableDeclaration */: + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + case 200 /* EnumMember */: + case 201 /* SourceFile */: + ts.forEachChild(node, checkFunctionExpressionBodies); + break; } - - opts.flag('propagateEnumConstants', { - experimental: true, - set: function () { - mutableSettings.propagateEnumConstants = true; - } - }); - - opts.flag('removeComments', { - usage: { - locCode: TypeScript.DiagnosticCode.Do_not_emit_comments_to_output, - args: null - }, - set: function () { - mutableSettings.removeComments = true; - } - }); - - opts.flag('noResolve', { - experimental: true, - usage: { - locCode: TypeScript.DiagnosticCode.Skip_resolution_and_preprocessing, - args: null - }, - set: function () { - mutableSettings.noResolve = true; + } + function checkSourceFile(node) { + var links = getNodeLinks(node); + if (!(links.flags & 1 /* TypeChecked */)) { + emitExtends = false; + potentialThisCollisions.length = 0; + ts.forEach(node.statements, checkSourceElement); + checkFunctionExpressionBodies(node); + if (ts.isExternalModule(node)) { + var symbol = getExportAssignmentSymbol(node.symbol); + if (symbol && symbol.flags & 33554432 /* Import */) { + getSymbolLinks(symbol).referenced = true; + } } - }); - - opts.flag('noLib', { - experimental: true, - set: function () { - mutableSettings.noLib = true; + if (potentialThisCollisions.length) { + ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); + potentialThisCollisions.length = 0; } - }); - - opts.flag('diagnostics', { - experimental: true, - set: function () { - mutableSettings.gatherDiagnostics = true; + if (emitExtends) { + links.flags |= 8 /* EmitExtends */; } - }); - - opts.flag('logFile', { - experimental: true, - set: function () { - mutableSettings.createFileLog = true; + links.flags |= 1 /* TypeChecked */; + } + } + function getSortedDiagnostics() { + ts.Debug.assert(fullTypeCheck, "diagnostics are available only in the full typecheck mode"); + if (diagnosticsModified) { + diagnostics.sort(ts.compareDiagnostics); + diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); + diagnosticsModified = false; + } + return diagnostics; + } + function getDiagnostics(sourceFile) { + if (sourceFile) { + checkSourceFile(sourceFile); + return ts.filter(getSortedDiagnostics(), function (d) { return d.file === sourceFile; }); + } + ts.forEach(program.getSourceFiles(), checkSourceFile); + return getSortedDiagnostics(); + } + function getDeclarationDiagnostics(targetSourceFile) { + var resolver = createResolver(); + checkSourceFile(targetSourceFile); + return ts.getDeclarationDiagnostics(program, resolver, targetSourceFile); + } + function getGlobalDiagnostics() { + return ts.filter(getSortedDiagnostics(), function (d) { return !d.file; }); + } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 175 /* WithStatement */ && node.parent.statement === node) { + return true; + } + node = node.parent; } - }); - - opts.option('target', { - usage: { - locCode: TypeScript.DiagnosticCode.Specify_ECMAScript_target_version_0_default_or_1, - args: ['ES3', 'ES5'] - }, - type: TypeScript.DiagnosticCode.VERSION, - set: function (type) { - type = type.toLowerCase(); - - if (type === 'es3') { - mutableSettings.codeGenTarget = 0 /* EcmaScript3 */; - } else if (type === 'es5') { - mutableSettings.codeGenTarget = 1 /* EcmaScript5 */; - } else { - _this.addDiagnostic(new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.ECMAScript_target_version_0_not_supported_Specify_a_valid_target_version_1_default_or_2, [type, "ES3", "ES5"])); + } + return false; + } + function getSymbolsInScope(location, meaning) { + var symbols = {}; + var memberFlags = 0; + function copySymbol(symbol, meaning) { + if (symbol.flags & meaning) { + var id = symbol.name; + if (!isReservedMemberName(id) && !ts.hasProperty(symbols, id)) { + symbols[id] = symbol; } } - }, 't'); - - opts.option('module', { - usage: { - locCode: TypeScript.DiagnosticCode.Specify_module_code_generation_0_or_1, - args: ['commonjs', 'amd'] - }, - type: TypeScript.DiagnosticCode.KIND, - set: function (type) { - type = type.toLowerCase(); - - if (type === 'commonjs') { - mutableSettings.moduleGenTarget = 1 /* Synchronous */; - } else if (type === 'amd') { - mutableSettings.moduleGenTarget = 2 /* Asynchronous */; - } else { - _this.addDiagnostic(new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Module_code_generation_0_not_supported, [type])); + } + function copySymbols(source, meaning) { + if (meaning) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + copySymbol(source[id], meaning); + } } } - }, 'm'); - - var needsHelp = false; - opts.flag('help', { - usage: { - locCode: TypeScript.DiagnosticCode.Print_this_message, - args: null - }, - set: function () { - needsHelp = true; + } + if (isInsideWithStatementBody(location)) { + return []; + } + while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + copySymbols(location.locals, meaning); + } + switch (location.kind) { + case 201 /* SourceFile */: + if (!ts.isExternalModule(location)) + break; + case 189 /* ModuleDeclaration */: + copySymbols(getSymbolOfNode(location).exports, meaning & 35653619 /* ModuleMember */); + break; + case 188 /* EnumDeclaration */: + copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + if (!(memberFlags & 128 /* Static */)) { + copySymbols(getSymbolOfNode(location).members, meaning & 3152352 /* Type */); + } + break; + case 150 /* FunctionExpression */: + if (location.name) { + copySymbol(location.symbol, meaning); + } + break; + case 197 /* CatchClause */: + if (location.name.text) { + copySymbol(location.symbol, meaning); + } + break; + } + memberFlags = location.flags; + location = location.parent; + } + copySymbols(globals, meaning); + return ts.mapToArray(symbols); + } + function isTypeDeclarationName(name) { + return name.kind == 63 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + } + function isTypeDeclaration(node) { + switch (node.kind) { + case 122 /* TypeParameter */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 188 /* EnumDeclaration */: + return true; + } + } + function isTypeReferenceIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 120 /* QualifiedName */) + node = node.parent; + return node.parent && node.parent.kind === 132 /* TypeReference */; + } + function isTypeNode(node) { + if (132 /* FirstTypeNode */ <= node.kind && node.kind <= 140 /* LastTypeNode */) { + return true; + } + switch (node.kind) { + case 109 /* AnyKeyword */: + case 116 /* NumberKeyword */: + case 118 /* StringKeyword */: + case 110 /* BooleanKeyword */: + return true; + case 97 /* VoidKeyword */: + return node.parent.kind !== 154 /* VoidExpression */; + case 7 /* StringLiteral */: + return node.parent.kind === 123 /* Parameter */; + case 63 /* Identifier */: + if (node.parent.kind === 120 /* QualifiedName */ && node.parent.right === node) { + node = node.parent; + } + case 120 /* QualifiedName */: + ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 120 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + var parent = node.parent; + if (parent.kind === 135 /* TypeQuery */) { + return false; + } + if (132 /* FirstTypeNode */ <= parent.kind && parent.kind <= 140 /* LastTypeNode */) { + return true; + } + switch (parent.kind) { + case 122 /* TypeParameter */: + return node === parent.constraint; + case 124 /* Property */: + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + return node === parent.type; + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 126 /* Constructor */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return node === parent.type; + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return node === parent.type; + case 148 /* TypeAssertionExpression */: + return node === parent.type; + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 147 /* TaggedTemplateExpression */: + return false; + } + } + return false; + } + function isInRightSideOfImportOrExportAssignment(node) { + while (node.parent.kind === 120 /* QualifiedName */) { + node = node.parent; + } + if (node.parent.kind === 191 /* ImportDeclaration */) { + return node.parent.moduleReference === node; + } + if (node.parent.kind === 192 /* ExportAssignment */) { + return node.parent.exportName === node; + } + return false; + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 120 /* QualifiedName */ && node.parent.right === node) || (node.parent.kind === 143 /* PropertyAccessExpression */ && node.parent.name === node); + } + function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { + return getSymbolOfNode(entityName.parent); + } + if (entityName.parent.kind === 192 /* ExportAssignment */) { + return resolveEntityName(entityName.parent.parent, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */ | 33554432 /* Import */); + } + if (entityName.kind !== 143 /* PropertyAccessExpression */) { + if (isInRightSideOfImportOrExportAssignment(entityName)) { + return getSymbolOfPartOfRightHandSideOfImport(entityName); } - }, 'h'); - - opts.flag('useCaseSensitiveFileResolution', { - experimental: true, - set: function () { - mutableSettings.useCaseSensitiveFileResolution = true; + } + if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (ts.isExpression(entityName)) { + if (ts.getFullWidth(entityName) === 0) { + return undefined; } - }); - var shouldPrintVersionOnly = false; - opts.flag('version', { - usage: { - locCode: TypeScript.DiagnosticCode.Print_the_compiler_s_version_0, - args: [this.compilerVersion] - }, - set: function () { - shouldPrintVersionOnly = true; + if (entityName.kind === 63 /* Identifier */) { + var meaning = 107455 /* Value */ | 33554432 /* Import */; + return resolveEntityName(entityName, entityName, meaning); } - }, 'v'); - - var locale = null; - opts.option('locale', { - experimental: true, - usage: { - locCode: TypeScript.DiagnosticCode.Specify_locale_for_errors_and_messages_For_example_0_or_1, - args: ['en', 'ja-jp'] - }, - type: TypeScript.DiagnosticCode.STRING, - set: function (value) { - locale = value; + else if (entityName.kind === 143 /* PropertyAccessExpression */) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkPropertyAccessExpression(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; } - }); - - opts.flag('noImplicitAny', { - usage: { - locCode: TypeScript.DiagnosticCode.Warn_on_expressions_and_declarations_with_an_implied_any_type, - args: null - }, - set: function () { - mutableSettings.noImplicitAny = true; + else if (entityName.kind === 120 /* QualifiedName */) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkQualifiedName(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; } - }); - - if (TypeScript.Environment.supportsCodePage()) { - opts.option('codepage', { - usage: { - locCode: TypeScript.DiagnosticCode.Specify_the_codepage_to_use_when_opening_source_files, - args: null - }, - type: TypeScript.DiagnosticCode.NUMBER, - set: function (arg) { - mutableSettings.codepage = parseInt(arg, 10); + } + else if (isTypeReferenceIdentifier(entityName)) { + var meaning = entityName.parent.kind === 132 /* TypeReference */ ? 3152352 /* Type */ : 1536 /* Namespace */; + meaning |= 33554432 /* Import */; + return resolveEntityName(entityName, entityName, meaning); + } + return undefined; + } + function getSymbolInfo(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getSymbolOfNode(node.parent); + } + if (node.kind === 63 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 192 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + } + switch (node.kind) { + case 63 /* Identifier */: + case 143 /* PropertyAccessExpression */: + case 120 /* QualifiedName */: + return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + var type = checkExpression(node); + return type.symbol; + case 111 /* ConstructorKeyword */: + var constructorDeclaration = node.parent; + if (constructorDeclaration && constructorDeclaration.kind === 126 /* Constructor */) { + return constructorDeclaration.parent.symbol; + } + return undefined; + case 7 /* StringLiteral */: + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + var importSymbol = getSymbolOfNode(node.parent.parent); + var moduleType = getTypeOfSymbol(importSymbol); + return moduleType ? moduleType.symbol : undefined; + } + case 6 /* NumericLiteral */: + if (node.parent.kind == 144 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + var objectType = checkExpression(node.parent.expression); + if (objectType === unknownType) + return undefined; + var apparentType = getApparentType(objectType); + if (apparentType === unknownType) + return undefined; + return getPropertyOfType(apparentType, node.text); } - }); + break; } - - opts.parse(this.ioHost.arguments); - - this.compilationSettings = TypeScript.ImmutableCompilationSettings.fromCompilationSettings(mutableSettings); - - if (locale) { - if (!this.setLocale(locale)) { - return false; - } + return undefined; + } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 199 /* ShorthandPropertyAssignment */) { + return resolveEntityName(location, location.name, 107455 /* Value */); } - - this.inputFiles.push.apply(this.inputFiles, opts.unnamed); - - if (shouldPrintVersionOnly) { - opts.printVersion(); - return false; - } else if (this.inputFiles.length === 0 || needsHelp) { - opts.printUsage(); - return false; + return undefined; + } + function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; } - - return !this.hasErrors; - }; - - BatchCompiler.prototype.setLocale = function (locale) { - var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); - if (!matchResult) { - this.addDiagnostic(new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, ['en', 'ja-jp'])); - return false; + if (ts.isExpression(node)) { + return getTypeOfExpression(node); } - - var language = matchResult[1]; - var territory = matchResult[3]; - - if (!this.setLanguageAndTerritory(language, territory) && !this.setLanguageAndTerritory(language, null)) { - this.addDiagnostic(new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Unsupported_locale_0, [locale])); - return false; + if (isTypeNode(node)) { + return getTypeFromTypeNode(node); } - - return true; - }; - - BatchCompiler.prototype.setLanguageAndTerritory = function (language, territory) { - var compilerFilePath = this.ioHost.getExecutingFilePath(); - var containingDirectoryPath = this.ioHost.dirName(compilerFilePath); - - var filePath = TypeScript.IOUtils.combine(containingDirectoryPath, language); - if (territory) { - filePath = filePath + "-" + territory; + if (isTypeDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getDeclaredTypeOfSymbol(symbol); } - - filePath = this.resolvePath(TypeScript.IOUtils.combine(filePath, "diagnosticMessages.generated.json")); - - if (!this.fileExists(filePath)) { - return false; + if (isTypeDeclarationName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + } + if (ts.isDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getTypeOfSymbol(symbol); + } + if (isInRightSideOfImportOrExportAssignment(node)) { + var symbol = getSymbolInfo(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + } + return unknownType; + } + function getTypeOfExpression(expr) { + if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + expr = expr.parent; + } + return checkExpression(expr); + } + function getAugmentedPropertiesOfType(type) { + var type = getApparentType(type); + var propsByName = createSymbolTable(getPropertiesOfType(type)); + if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { + ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { + if (!ts.hasProperty(propsByName, p.name)) { + propsByName[p.name] = p; + } + }); + } + return getNamedMembers(propsByName); + } + function getRootSymbols(symbol) { + if (symbol.flags & 1073741824 /* UnionProperty */) { + var symbols = []; + var name = symbol.name; + ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { + symbols.push(getPropertyOfType(t, name)); + }); + return symbols; + } + else if (symbol.flags & 268435456 /* Transient */) { + var target = getSymbolLinks(symbol).target; + if (target) { + return [target]; + } + } + return [symbol]; + } + function isExternalModuleSymbol(symbol) { + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 201 /* SourceFile */; + } + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + var symbolWithRelevantName = node.locals[name]; + if (symbolWithRelevantName.flags & (107455 /* Value */ | 4194304 /* ExportValue */)) { + return false; + } + if (symbolWithRelevantName.flags & 33554432 /* Import */) { + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 191 /* ImportDeclaration */); + if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { + return false; + } + } + } } - - var fileContents = this.ioHost.readFile(filePath, this.compilationSettings.codepage()); - TypeScript.LocalizedDiagnosticMessages = JSON.parse(fileContents.contents); return true; - }; - - BatchCompiler.prototype.watchFiles = function () { - var _this = this; - if (!this.ioHost.watchFile) { - this.addDiagnostic(new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Current_host_does_not_support_0_option, ['-w[atch]'])); - return; + } + function getLocalNameOfContainer(container) { + var links = getNodeLinks(container); + if (!links.localModuleName) { + var prefix = ""; + var name = ts.unescapeIdentifier(container.name.text); + while (!isUniqueLocalName(ts.escapeIdentifier(prefix + name), container)) { + prefix += "_"; + } + links.localModuleName = prefix + ts.getTextOfNode(container.name); } - - var lastResolvedFileSet = []; - var watchers = {}; - var firstTime = true; - - var addWatcher = function (fileName) { - if (!watchers[fileName]) { - var watcher = _this.ioHost.watchFile(fileName, onWatchedFileChange); - watchers[fileName] = watcher; - } else { - TypeScript.CompilerDiagnostics.debugPrint("Cannot watch file, it is already watched."); + return links.localModuleName; + } + function getLocalNameForSymbol(symbol, location) { + var node = location; + while (node) { + if ((node.kind === 189 /* ModuleDeclaration */ || node.kind === 188 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + return getLocalNameOfContainer(node); } - }; - - var removeWatcher = function (fileName) { - if (watchers[fileName]) { - watchers[fileName].close(); - delete watchers[fileName]; - } else { - TypeScript.CompilerDiagnostics.debugPrint("Cannot stop watching file, it is not being watched."); + node = node.parent; + } + ts.Debug.fail("getLocalNameForSymbol failed"); + } + function getExpressionNamePrefix(node) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol) { + var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (symbol !== exportSymbol && !(exportSymbol.flags & 944 /* ExportHasLocal */)) { + symbol = exportSymbol; } - }; - - var onWatchedFileChange = function () { - _this.hasErrors = false; - - _this.fileNameToSourceFile = new TypeScript.StringHashTable(); - - _this.resolve(); - - var oldFiles = lastResolvedFileSet; - var newFiles = _this.resolvedFiles.map(function (resolvedFile) { - return 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) { - i++; - j++; - } else if (compareResult < 0) { - removeWatcher(oldFiles[i]); - i++; - } else { - addWatcher(newFiles[j]); - j++; - } + if (symbol.parent) { + return isExternalModuleSymbol(symbol.parent) ? "exports" : getLocalNameForSymbol(getParentOfSymbol(symbol), node.parent); } - - for (var k = i; k < oldFiles.length; k++) { - removeWatcher(oldFiles[k]); + } + } + function getExportAssignmentName(node) { + var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); + return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; + } + function isTopLevelValueImportWithEntityName(node) { + if (node.parent.kind !== 201 /* SourceFile */ || !ts.isInternalModuleImportDeclaration(node)) { + return false; + } + return isImportResolvedToValue(getSymbolOfNode(node)); + } + function hasSemanticErrors(sourceFile) { + return getDiagnostics(sourceFile).length > 0 || getGlobalDiagnostics().length > 0; + } + function isEmitBlocked(sourceFile) { + return program.getDiagnostics(sourceFile).length !== 0 || hasEarlyErrors(sourceFile) || (compilerOptions.noEmitOnError && getDiagnostics(sourceFile).length !== 0); + } + function hasEarlyErrors(sourceFile) { + return ts.forEach(getDiagnostics(sourceFile), function (d) { return d.isEarly; }); + } + function isImportResolvedToValue(symbol) { + var target = resolveImport(symbol); + return target !== unknownSymbol && target.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } + function isReferencedImportDeclaration(node) { + var symbol = getSymbolOfNode(node); + if (getSymbolLinks(symbol).referenced) { + return true; + } + if (node.flags & 1 /* Export */) { + return isImportResolvedToValue(symbol); + } + return false; + } + function isImplementationOfOverload(node) { + if (node.body) { + var symbol = getSymbolOfNode(node); + var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + } + return false; + } + function getNodeCheckFlags(node) { + return getNodeLinks(node).flags; + } + function getEnumMemberValue(node) { + computeEnumMemberValues(node.parent); + return getNodeLinks(node).enumMemberValue; + } + function getConstantValue(node) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && (symbol.flags & 8 /* EnumMember */)) { + var declaration = symbol.valueDeclaration; + var constantValue; + if (declaration.kind === 200 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + return constantValue; } - - for (k = j; k < newFiles.length; k++) { - addWatcher(newFiles[k]); + } + return undefined; + } + function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { + var symbol = getSymbolOfNode(declaration); + var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* CallSignature */ | 262144 /* ConstructSignature */)) ? getTypeOfSymbol(symbol) : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + } + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { + var signature = getSignatureFromDeclaration(signatureDeclaration); + getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); + } + function createResolver() { + return { + getProgram: function () { return program; }, + getLocalNameOfContainer: getLocalNameOfContainer, + getExpressionNamePrefix: getExpressionNamePrefix, + getExportAssignmentName: getExportAssignmentName, + isReferencedImportDeclaration: isReferencedImportDeclaration, + getNodeCheckFlags: getNodeCheckFlags, + getEnumMemberValue: getEnumMemberValue, + isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, + hasSemanticErrors: hasSemanticErrors, + isEmitBlocked: isEmitBlocked, + isDeclarationVisible: isDeclarationVisible, + isImplementationOfOverload: isImplementationOfOverload, + writeTypeOfDeclaration: writeTypeOfDeclaration, + writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, + isSymbolAccessible: isSymbolAccessible, + isEntityNameVisible: isEntityNameVisible, + getConstantValue: getConstantValue + }; + } + function invokeEmitter(targetSourceFile) { + var resolver = createResolver(); + return ts.emitFiles(resolver, targetSourceFile); + } + function initializeTypeChecker() { + ts.forEach(program.getSourceFiles(), function (file) { + ts.bindSourceFile(file); + ts.forEach(file.semanticDiagnostics, addDiagnostic); + }); + ts.forEach(program.getSourceFiles(), function (file) { + if (!ts.isExternalModule(file)) { + extendSymbolTable(globals, file.locals); } - - lastResolvedFileSet = newFiles; - - if (!firstTime) { - var fileNames = ""; - for (var k = 0; k < lastResolvedFileSet.length; k++) { - fileNames += TypeScript.Environment.newLine + " " + lastResolvedFileSet[k]; + }); + getSymbolLinks(undefinedSymbol).type = undefinedType; + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(unknownSymbol).type = unknownType; + globals[undefinedSymbol.name] = undefinedSymbol; + globalArraySymbol = getGlobalSymbol("Array"); + globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); + globalObjectType = getGlobalType("Object"); + globalFunctionType = getGlobalType("Function"); + globalStringType = getGlobalType("String"); + globalNumberType = getGlobalType("Number"); + globalBooleanType = getGlobalType("Boolean"); + globalRegExpType = getGlobalType("RegExp"); + globalTemplateStringsArrayType = compilerOptions.target >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; + } + initializeTypeChecker(); + return checker; + } + ts.createTypeChecker = createTypeChecker; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.optionDeclarations = [ + { + name: "charset", + type: "string" + }, + { + name: "codepage", + type: "number" + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_d_ts_file + }, + { + name: "diagnostics", + type: "boolean" + }, + { + name: "emitBOM", + type: "boolean" + }, + { + name: "help", + shortName: "h", + type: "boolean", + description: ts.Diagnostics.Print_this_message + }, + { + name: "locale", + type: "string" + }, + { + name: "mapRoot", + type: "string", + description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "module", + shortName: "m", + type: { + "commonjs": 1 /* CommonJS */, + "amd": 2 /* AMD */ + }, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd, + paramType: ts.Diagnostics.KIND, + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd + }, + { + name: "noEmitOnError", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + }, + { + name: "noImplicitAny", + type: "boolean", + description: ts.Diagnostics.Warn_on_expressions_and_declarations_with_an_implied_any_type + }, + { + name: "noLib", + type: "boolean" + }, + { + name: "noLibCheck", + type: "boolean" + }, + { + name: "noResolve", + type: "boolean" + }, + { + name: "out", + type: "string", + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + paramType: ts.Diagnostics.FILE + }, + { + name: "outDir", + type: "string", + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "preserveConstEnums", + type: "boolean", + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "removeComments", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_comments_to_output + }, + { + name: "sourceMap", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_map_file + }, + { + name: "sourceRoot", + type: "string", + description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures + }, + { + name: "target", + shortName: "t", + type: { "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES6 */ }, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, + paramType: ts.Diagnostics.VERSION, + error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 + }, + { + name: "version", + shortName: "v", + type: "boolean", + description: ts.Diagnostics.Print_the_compiler_s_version + }, + { + name: "watch", + shortName: "w", + type: "boolean", + 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 filenames = []; + var errors = []; + parseStrings(commandLine); + return { + options: options, + filenames: filenames, + errors: errors + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i++]; + if (s.charCodeAt(0) === 64 /* at */) { + parseResponseFile(s.slice(1)); + } + else if (s.charCodeAt(0) === 45 /* minus */) { + s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase(); + if (ts.hasProperty(shortOptionNames, s)) { + s = shortOptionNames[s]; + } + if (ts.hasProperty(optionNameMap, s)) { + var opt = optionNameMap[s]; + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i++]); + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i++] || ""; + break; + default: + var map = opt.type; + var key = (args[i++] || "").toLowerCase(); + if (ts.hasProperty(map, key)) { + options[opt.name] = map[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + } + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); } - _this.ioHost.printLine(TypeScript.getLocalizedText(TypeScript.DiagnosticCode.NL_Recompiling_0, [fileNames])); - } else { - firstTime = false; } - - _this.compile(); - }; - - this.ioHost.stderr = this.ioHost.stdout; - - onWatchedFileChange(); - }; - - BatchCompiler.prototype.getSourceFile = function (fileName) { - var sourceFile = this.fileNameToSourceFile.lookup(fileName); - if (!sourceFile) { - var fileInformation; - - try { - fileInformation = this.ioHost.readFile(fileName, this.compilationSettings.codepage()); - } catch (e) { - this.addDiagnostic(new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Cannot_read_file_0_1, [fileName, e.message])); - fileInformation = new TypeScript.FileInformation("", 0 /* None */); + else { + filenames.push(s); } - - var snapshot = TypeScript.ScriptSnapshot.fromString(fileInformation.contents); - var sourceFile = new SourceFile(snapshot, fileInformation.byteOrderMark); - this.fileNameToSourceFile.add(fileName, sourceFile); } - - return sourceFile; - }; - - BatchCompiler.prototype.getDefaultLibraryFilePath = function () { - var compilerFilePath = this.ioHost.getExecutingFilePath(); - var containingDirectoryPath = this.ioHost.dirName(compilerFilePath); - var libraryFilePath = this.resolvePath(TypeScript.IOUtils.combine(containingDirectoryPath, "lib.d.ts")); - - return libraryFilePath; - }; - - BatchCompiler.prototype.getScriptSnapshot = function (fileName) { - return this.getSourceFile(fileName).scriptSnapshot; - }; - - BatchCompiler.prototype.resolveRelativePath = function (path, directory) { - var start = new Date().getTime(); - - var unQuotedPath = TypeScript.stripStartAndEndQuotes(path); - var normalizedPath; - - if (TypeScript.isRooted(unQuotedPath) || !directory) { - normalizedPath = unQuotedPath; - } else { - normalizedPath = TypeScript.IOUtils.combine(directory, unQuotedPath); - } - - normalizedPath = this.resolvePath(normalizedPath); - - normalizedPath = TypeScript.switchToForwardSlashes(normalizedPath); - - return normalizedPath; - }; - - BatchCompiler.prototype.fileExists = function (path) { - 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; + } + function parseResponseFile(filename) { + var text = ts.sys.readFile(filename); + if (!text) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, filename)); + return; } - - return exists; - }; - - BatchCompiler.prototype.getParentDirectory = function (path) { - var start = new Date().getTime(); - var result = this.ioHost.dirName(path); - TypeScript.compilerDirectoryNameTime += new Date().getTime() - start; - - return result; - }; - - BatchCompiler.prototype.addDiagnostic = function (diagnostic) { - var _this = this; - var diagnosticInfo = diagnostic.info(); - if (diagnosticInfo.category === 1 /* Error */) { - this.hasErrors = true; + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32 /* space */) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34 /* doubleQuote */) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34 /* doubleQuote */) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, filename)); + } + } + else { + while (text.charCodeAt(pos) > 32 /* space */) + pos++; + args.push(text.substring(start, pos)); + } } - - this.ioHost.stderr.Write(TypeScript.TypeScriptCompiler.getFullDiagnosticText(diagnostic, function (path) { - return _this.resolvePath(path); - })); - }; - - BatchCompiler.prototype.tryWriteOutputFiles = function (outputFiles) { - 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 TypeScript.Diagnostic(outputFile.name, null, 0, 0, TypeScript.DiagnosticCode.Emit_Error_0, [e.message])); - return false; + parseStrings(args); + } + } + ts.parseCommandLine = parseCommandLine; +})(ts || (ts = {})); +var ts; +(function (ts) { + var version = "1.4.1.0"; + function validateLocaleAndSetLanguage(locale, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.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]; + if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); + return false; + } + return true; + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(ts.sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; + } + filePath = ts.sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!ts.sys.fileExists(filePath)) { + return false; + } + try { + var fileContents = ts.sys.readFile(filePath); + } + catch (e) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + return false; + } + return true; + } + function countLines(program) { + var count = 0; + ts.forEach(program.getSourceFiles(), function (file) { + count += file.getLineAndCharacterFromPosition(file.end).line; + }); + return count; + } + function getDiagnosticText(message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments); + return diagnostic.messageText; + } + function reportDiagnostic(diagnostic) { + var output = ""; + if (diagnostic.file) { + var loc = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + output += diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): "; + } + var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); + output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + ts.sys.newLine; + ts.sys.write(output); + } + function reportDiagnostics(diagnostics) { + for (var i = 0; i < diagnostics.length; i++) { + reportDiagnostic(diagnostics[i]); + } + } + function padLeft(s, length) { + while (s.length < length) { + s = " " + s; + } + return s; + } + function padRight(s, length) { + while (s.length < length) { + s = s + " "; + } + return s; + } + function reportStatisticalValue(name, value) { + ts.sys.write(padRight(name + ":", 12) + padLeft(value.toString(), 10) + ts.sys.newLine); + } + function reportCountStatistic(name, count) { + reportStatisticalValue(name, "" + count); + } + function reportTimeStatistic(name, time) { + reportStatisticalValue(name, (time / 1000).toFixed(2) + "s"); + } + function executeCommandLine(args) { + var commandLine = ts.parseCommandLine(args); + var compilerOptions = commandLine.options; + if (compilerOptions.locale) { + if (typeof JSON === "undefined") { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); + return ts.sys.exit(1); + } + validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); + } + if (commandLine.errors.length > 0) { + reportDiagnostics(commandLine.errors); + return ts.sys.exit(5 /* CompilerOptionsErrors */); + } + if (compilerOptions.version) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, version)); + return ts.sys.exit(0 /* Succeeded */); + } + if (compilerOptions.help) { + printVersion(); + printHelp(); + return ts.sys.exit(0 /* Succeeded */); + } + if (commandLine.filenames.length === 0) { + printVersion(); + printHelp(); + return ts.sys.exit(5 /* CompilerOptionsErrors */); + } + var defaultCompilerHost = ts.createCompilerHost(compilerOptions); + if (compilerOptions.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); + } + else { + var result = compile(commandLine, defaultCompilerHost).exitStatus; + return ts.sys.exit(result); + } + } + 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) { + var parseStart = new Date().getTime(); + var compilerOptions = commandLine.options; + var program = ts.createProgram(commandLine.filenames, compilerOptions, compilerHost); + var bindStart = new Date().getTime(); + var errors = program.getDiagnostics(); + var exitStatus; + if (errors.length) { + var checkStart = bindStart; + var emitStart = bindStart; + var reportStart = bindStart; + exitStatus = 1 /* AllOutputGenerationSkipped */; + } + else { + var checker = program.getTypeChecker(true); + var checkStart = new Date().getTime(); + errors = checker.getDiagnostics(); + if (checker.isEmitBlocked()) { + exitStatus = 1 /* AllOutputGenerationSkipped */; + } + else { + var emitStart = new Date().getTime(); + var emitOutput = checker.emitFiles(); + var emitErrors = emitOutput.diagnostics; + exitStatus = emitOutput.emitResultStatus; + var reportStart = new Date().getTime(); + errors = ts.concatenate(errors, emitErrors); + } + } + reportDiagnostics(errors); + if (commandLine.options.diagnostics) { + var memoryUsed = ts.sys.getMemoryUsage ? ts.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); + 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); + } + return { program: program, exitStatus: exitStatus }; + } + function printVersion() { + ts.sys.write(getDiagnosticText(ts.Diagnostics.Version_0, version) + ts.sys.newLine); + } + function printHelp() { + var output = ""; + var syntaxLength = getDiagnosticText(ts.Diagnostics.Syntax_Colon_0, "").length; + var examplesLength = getDiagnosticText(ts.Diagnostics.Examples_Colon_0, "").length; + var marginLength = Math.max(syntaxLength, examplesLength); + var syntax = makePadding(marginLength - syntaxLength); + syntax += "tsc [" + getDiagnosticText(ts.Diagnostics.options) + "] [" + getDiagnosticText(ts.Diagnostics.file) + " ...]"; + output += getDiagnosticText(ts.Diagnostics.Syntax_Colon_0, syntax); + output += ts.sys.newLine + ts.sys.newLine; + var padding = makePadding(marginLength); + output += getDiagnosticText(ts.Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + ts.sys.newLine; + output += padding + "tsc --out file.js file.ts" + ts.sys.newLine; + output += padding + "tsc @args.txt" + ts.sys.newLine; + output += ts.sys.newLine; + output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine; + var optsList = ts.optionDeclarations.slice(); + optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }); + var marginLength = 0; + var usageColumn = []; + var descriptionColumn = []; + for (var i = 0; i < optsList.length; i++) { + var option = optsList[i]; + if (!option.description) { + continue; } - - return true; - }; - - BatchCompiler.prototype.writeFile = function (fileName, contents, writeByteOrderMark) { - var start = new Date().getTime(); - TypeScript.IOUtils.writeFileAndFolderStructure(this.ioHost, fileName, contents, writeByteOrderMark); - TypeScript.emitWriteFileTime += new Date().getTime() - start; - }; - - BatchCompiler.prototype.directoryExists = function (path) { - var start = new Date().getTime(); - var result = this.ioHost.directoryExists(path); - TypeScript.compilerDirectoryExistsTime += new Date().getTime() - start; - return result; - }; - - BatchCompiler.prototype.resolvePath = function (path) { - var cachedValue = this.resolvePathCache[path]; - if (!cachedValue) { - var start = new Date().getTime(); - cachedValue = this.ioHost.resolvePath(path); - this.resolvePathCache[path] = cachedValue; - TypeScript.compilerResolvePathTime += new Date().getTime() - start; + var usageText = " "; + if (option.shortName) { + usageText += "-" + option.shortName; + usageText += getParamType(option); + usageText += ", "; + } + usageText += "--" + option.name; + usageText += getParamType(option); + usageColumn.push(usageText); + descriptionColumn.push(getDiagnosticText(option.description)); + marginLength = Math.max(usageText.length, marginLength); + } + var usageText = " @<" + getDiagnosticText(ts.Diagnostics.file) + ">"; + usageColumn.push(usageText); + descriptionColumn.push(getDiagnosticText(ts.Diagnostics.Insert_command_line_options_and_files_from_a_file)); + marginLength = Math.max(usageText.length, marginLength); + for (var i = 0; i < usageColumn.length; i++) { + var usage = usageColumn[i]; + var description = descriptionColumn[i]; + output += usage + makePadding(marginLength - usage.length + 2) + description + ts.sys.newLine; + } + ts.sys.write(output); + return; + function getParamType(option) { + if (option.paramType !== undefined) { + return " " + getDiagnosticText(option.paramType); } - - return cachedValue; - }; - return BatchCompiler; - })(); - TypeScript.BatchCompiler = BatchCompiler; - - var batch = new TypeScript.BatchCompiler(TypeScript.IO); - batch.batchCompile(); -})(TypeScript || (TypeScript = {})); + return ""; + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + } +})(ts || (ts = {})); +ts.executeCommandLine(ts.sys.args); diff --git a/lib/typescript-src/support/typescript/bin/typescript.d.ts b/lib/typescript-src/support/typescript/bin/typescript.d.ts new file mode 100644 index 0000000..2d507f0 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/typescript.d.ts @@ -0,0 +1,1849 @@ +/*! ***************************************************************************** +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, + NumericLiteral = 6, + StringLiteral = 7, + RegularExpressionLiteral = 8, + NoSubstitutionTemplateLiteral = 9, + TemplateHead = 10, + TemplateMiddle = 11, + TemplateTail = 12, + OpenBraceToken = 13, + CloseBraceToken = 14, + OpenParenToken = 15, + CloseParenToken = 16, + OpenBracketToken = 17, + CloseBracketToken = 18, + DotToken = 19, + DotDotDotToken = 20, + SemicolonToken = 21, + CommaToken = 22, + LessThanToken = 23, + GreaterThanToken = 24, + LessThanEqualsToken = 25, + GreaterThanEqualsToken = 26, + EqualsEqualsToken = 27, + ExclamationEqualsToken = 28, + EqualsEqualsEqualsToken = 29, + ExclamationEqualsEqualsToken = 30, + EqualsGreaterThanToken = 31, + PlusToken = 32, + MinusToken = 33, + AsteriskToken = 34, + SlashToken = 35, + PercentToken = 36, + PlusPlusToken = 37, + MinusMinusToken = 38, + LessThanLessThanToken = 39, + GreaterThanGreaterThanToken = 40, + GreaterThanGreaterThanGreaterThanToken = 41, + AmpersandToken = 42, + BarToken = 43, + CaretToken = 44, + ExclamationToken = 45, + TildeToken = 46, + AmpersandAmpersandToken = 47, + BarBarToken = 48, + QuestionToken = 49, + ColonToken = 50, + EqualsToken = 51, + PlusEqualsToken = 52, + MinusEqualsToken = 53, + AsteriskEqualsToken = 54, + SlashEqualsToken = 55, + PercentEqualsToken = 56, + LessThanLessThanEqualsToken = 57, + GreaterThanGreaterThanEqualsToken = 58, + GreaterThanGreaterThanGreaterThanEqualsToken = 59, + AmpersandEqualsToken = 60, + BarEqualsToken = 61, + CaretEqualsToken = 62, + Identifier = 63, + BreakKeyword = 64, + CaseKeyword = 65, + CatchKeyword = 66, + ClassKeyword = 67, + ConstKeyword = 68, + ContinueKeyword = 69, + DebuggerKeyword = 70, + DefaultKeyword = 71, + DeleteKeyword = 72, + DoKeyword = 73, + ElseKeyword = 74, + EnumKeyword = 75, + ExportKeyword = 76, + ExtendsKeyword = 77, + FalseKeyword = 78, + FinallyKeyword = 79, + ForKeyword = 80, + FunctionKeyword = 81, + IfKeyword = 82, + ImportKeyword = 83, + InKeyword = 84, + InstanceOfKeyword = 85, + NewKeyword = 86, + NullKeyword = 87, + ReturnKeyword = 88, + SuperKeyword = 89, + SwitchKeyword = 90, + ThisKeyword = 91, + ThrowKeyword = 92, + TrueKeyword = 93, + TryKeyword = 94, + TypeOfKeyword = 95, + VarKeyword = 96, + VoidKeyword = 97, + WhileKeyword = 98, + WithKeyword = 99, + ImplementsKeyword = 100, + InterfaceKeyword = 101, + LetKeyword = 102, + PackageKeyword = 103, + PrivateKeyword = 104, + ProtectedKeyword = 105, + PublicKeyword = 106, + StaticKeyword = 107, + YieldKeyword = 108, + AnyKeyword = 109, + BooleanKeyword = 110, + ConstructorKeyword = 111, + DeclareKeyword = 112, + GetKeyword = 113, + ModuleKeyword = 114, + RequireKeyword = 115, + NumberKeyword = 116, + SetKeyword = 117, + StringKeyword = 118, + TypeKeyword = 119, + QualifiedName = 120, + ComputedPropertyName = 121, + TypeParameter = 122, + Parameter = 123, + Property = 124, + Method = 125, + Constructor = 126, + GetAccessor = 127, + SetAccessor = 128, + CallSignature = 129, + ConstructSignature = 130, + IndexSignature = 131, + TypeReference = 132, + FunctionType = 133, + ConstructorType = 134, + TypeQuery = 135, + TypeLiteral = 136, + ArrayType = 137, + TupleType = 138, + UnionType = 139, + ParenthesizedType = 140, + ArrayLiteralExpression = 141, + ObjectLiteralExpression = 142, + PropertyAccessExpression = 143, + ElementAccessExpression = 144, + CallExpression = 145, + NewExpression = 146, + TaggedTemplateExpression = 147, + TypeAssertionExpression = 148, + ParenthesizedExpression = 149, + FunctionExpression = 150, + ArrowFunction = 151, + DeleteExpression = 152, + TypeOfExpression = 153, + VoidExpression = 154, + PrefixUnaryExpression = 155, + PostfixUnaryExpression = 156, + BinaryExpression = 157, + ConditionalExpression = 158, + TemplateExpression = 159, + YieldExpression = 160, + OmittedExpression = 161, + TemplateSpan = 162, + Block = 163, + VariableStatement = 164, + EmptyStatement = 165, + ExpressionStatement = 166, + IfStatement = 167, + DoStatement = 168, + WhileStatement = 169, + ForStatement = 170, + ForInStatement = 171, + ContinueStatement = 172, + BreakStatement = 173, + ReturnStatement = 174, + WithStatement = 175, + SwitchStatement = 176, + LabeledStatement = 177, + ThrowStatement = 178, + TryStatement = 179, + TryBlock = 180, + FinallyBlock = 181, + DebuggerStatement = 182, + VariableDeclaration = 183, + FunctionDeclaration = 184, + ClassDeclaration = 185, + InterfaceDeclaration = 186, + TypeAliasDeclaration = 187, + EnumDeclaration = 188, + ModuleDeclaration = 189, + ModuleBlock = 190, + ImportDeclaration = 191, + ExportAssignment = 192, + ExternalModuleReference = 193, + CaseClause = 194, + DefaultClause = 195, + HeritageClause = 196, + CatchClause = 197, + PropertyAssignment = 198, + ShorthandPropertyAssignment = 199, + EnumMember = 200, + SourceFile = 201, + Program = 202, + SyntaxList = 203, + Count = 204, + FirstAssignment = 51, + LastAssignment = 62, + FirstReservedWord = 64, + LastReservedWord = 99, + FirstKeyword = 64, + LastKeyword = 119, + FirstFutureReservedWord = 100, + LastFutureReservedWord = 108, + FirstTypeNode = 132, + LastTypeNode = 140, + FirstPunctuation = 13, + LastPunctuation = 62, + FirstToken = 0, + LastToken = 119, + FirstTriviaToken = 2, + LastTriviaToken = 5, + FirstLiteralToken = 6, + LastLiteralToken = 9, + FirstTemplateToken = 9, + LastTemplateToken = 12, + FirstOperator = 21, + LastOperator = 62, + FirstBinaryOperator = 23, + LastBinaryOperator = 62, + FirstNode = 120, + } + 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, + ContainsError = 16, + HasPropagatedChildContainsErrorFlag = 32, + } + 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; + 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 { + name: Identifier; + type?: TypeNode; + initializer?: Expression; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier; + questionToken?: Node; + type?: TypeNode | StringLiteralExpression; + initializer?: Expression; + } + interface PropertyDeclaration extends Declaration, ClassElement { + _propertyDeclarationBrand: any; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + type VariableOrParameterDeclaration = VariableDeclaration | ParameterDeclaration; + type VariableOrParameterOrPropertyDeclaration = VariableOrParameterDeclaration | PropertyDeclaration; + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: DeclarationName; + questionToken?: Node; + initializer: Expression; + } + /** + * 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 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 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 { + declarations: NodeArray; + } + 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 { + declarations?: NodeArray; + initializer?: Expression; + condition?: Expression; + iterator?: Expression; + } + interface ForInStatement extends IterationStatement { + declarations?: NodeArray; + variable?: 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; + getLineAndCharacterFromPosition(position: number): LineAndCharacter; + getPositionFromLineAndCharacter(line: number, character: number): number; + getLineStarts(): number[]; + amdDependencies: string[]; + amdModuleName: string; + referencedFiles: FileReference[]; + referenceDiagnostics: Diagnostic[]; + parseDiagnostics: Diagnostic[]; + grammarDiagnostics: Diagnostic[]; + getSyntacticDiagnostics(): Diagnostic[]; + semanticDiagnostics: Diagnostic[]; + hasNoDefaultLib: boolean; + externalModuleIndicator: Node; + nodeCount: number; + identifierCount: number; + symbolCount: number; + isOpen: boolean; + version: string; + languageVersion: ScriptTarget; + identifiers: Map; + } + interface Program { + getSourceFile(filename: string): SourceFile; + getSourceFiles(): SourceFile[]; + getCompilerOptions(): CompilerOptions; + getCompilerHost(): CompilerHost; + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getTypeChecker(fullTypeCheckMode: boolean): 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 EmitReturnStatus { + Succeeded = 0, + AllOutputGenerationSkipped = 1, + JSGeneratedWithSemanticErrors = 2, + DeclarationGenerationSkipped = 3, + EmitErrorsEncountered = 4, + CompilerOptionsErrors = 5, + } + interface EmitResult { + emitResultStatus: EmitReturnStatus; + diagnostics: Diagnostic[]; + sourceMaps: SourceMapData[]; + } + interface TypeChecker { + getProgram(): Program; + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + emitFiles(targetSourceFile?: SourceFile): EmitResult; + 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; + isEmitBlocked(sourceFile?: SourceFile): boolean; + getEnumMemberValue(node: EnumMember): 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, + } + 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 { + getProgram(): Program; + 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; + getEnumMemberValue(node: EnumMember): number; + hasSemanticErrors(sourceFile?: SourceFile): boolean; + isDeclarationVisible(node: Declaration): boolean; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableOrParameterDeclaration, 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: PropertyAccessExpression | ElementAccessExpression): number; + isEmitBlocked(sourceFile?: SourceFile): 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, + CallSignature = 131072, + ConstructSignature = 262144, + IndexSignature = 524288, + TypeParameter = 1048576, + TypeAlias = 2097152, + ExportValue = 4194304, + ExportType = 8388608, + ExportNamespace = 16777216, + Import = 33554432, + Instantiated = 67108864, + Merged = 134217728, + Transient = 268435456, + Prototype = 536870912, + UnionProperty = 1073741824, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 3152352, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + Signature = 917504, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 3258879, + InterfaceExcludes = 3152288, + RegularEnumExcludes = 3258623, + ConstEnumExcludes = 3259263, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 2103776, + TypeAliasExcludes = 3152352, + ImportExcludes = 33554432, + ModuleMember = 35653619, + ExportHasLocal = 944, + HasLocals = 1041936, + HasExports = 1952, + HasMembers = 6240, + IsContainer = 1048560, + PropertyOrAccessor = 98308, + Export = 29360128, + } + 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; + } + 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, + Intrinsic = 127, + StringLike = 258, + NumberLike = 132, + ObjectType = 48128, + } + 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; + openReferenceTargets: GenericType[]; + openReferenceChecks: 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; + isEarly?: boolean; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string; + category: DiagnosticCategory; + code: number; + /** + * Early error - any error (can be produced at parsing\binding\typechecking step) that blocks emit + */ + isEarly?: boolean; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + codepage?: number; + declaration?: boolean; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noLib?: boolean; + noLibCheck?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + preserveConstEnums?: boolean; + removeComments?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: 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; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + error?: DiagnosticMessage; + } + 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(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + } +} +declare module "typescript" { + interface ErrorCallback { + (message: DiagnosticMessage): void; + } + interface CommentCallback { + (pos: number, end: 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(lineStarts: number[], line: number, character: number): number; + function getLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function positionToLineAndCharacter(text: string, pos: number): { + line: number; + character: number; + }; + 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 forEachChild(node: Node, cbNode: (node: Node) => T, cbNodes?: (nodes: Node[]) => T): T; + function createCompilerHost(options: CompilerOptions): CompilerHost; + function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, version: string, isOpen?: boolean): SourceFile; + function createProgram(rootNames: string[], options: CompilerOptions, host: CompilerHost): Program; +} +declare module "typescript" { + function createTypeChecker(program: Program, fullTypeCheck: boolean): TypeChecker; +} +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 { + getScriptSnapshot(): IScriptSnapshot; + getNamedDeclarations(): Declaration[]; + update(scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean, 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; + /** + * 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 + * 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 Logger { + log(s: string): void; + } + interface LanguageServiceHost extends Logger { + getCompilationSettings(): CompilerOptions; + getScriptFileNames(): string[]; + getScriptVersion(fileName: string): string; + getScriptIsOpen(fileName: string): boolean; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFilename(options: CompilerOptions): string; + } + 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; + getSourceFile(filename: string): SourceFile; + dispose(): void; + } + class TextSpan { + private _start; + private _length; + /** + * Creates a TextSpan instance beginning with the position Start and having the Length + * specified with length. + */ + constructor(start: number, length: number); + toJSON(key: any): any; + start(): number; + length(): number; + end(): number; + isEmpty(): boolean; + /** + * Determines whether the position lies within the span. Returns true if the position is greater than or equal to Start and strictly less + * than End, otherwise false. + * @param position The position to check. + */ + containsPosition(position: number): boolean; + /** + * Determines whether span falls completely within this span. Returns true if the specified span falls completely within this span, otherwise false. + * @param span The span to check. + */ + containsTextSpan(span: TextSpan): boolean; + /** + * Determines whether the given span overlaps this span. Two spans are considered to overlap + * if they have positions in common and neither is empty. Empty spans do not overlap with any + * other span. Returns true if the spans overlap, false otherwise. + * @param span The span to check. + */ + overlapsWith(span: TextSpan): boolean; + /** + * Returns the overlap with the given span, or undefined if there is no overlap. + * @param span The span to check. + */ + overlap(span: TextSpan): TextSpan; + /** + * Determines whether span intersects this span. Two spans are considered to + * intersect if they have positions in common or the end of one span + * coincides with the start of the other span. Returns true if the spans intersect, false otherwise. + * @param The span to check. + */ + intersectsWithTextSpan(span: TextSpan): boolean; + intersectsWith(start: number, length: number): boolean; + /** + * Determines whether the given position intersects this span. + * A position is considered to intersect if it is between the start and + * end positions (inclusive) of this span. Returns true if the position intersects, false otherwise. + * @param position The position to check. + */ + intersectsWithPosition(position: number): boolean; + /** + * Returns the intersection with the given span, or undefined if there is no intersection. + * @param span The span to check. + */ + intersection(span: TextSpan): TextSpan; + /** + * Creates a new TextSpan from the given start and end positions + * as opposed to a position and length. + */ + static fromBounds(start: number, end: number): TextSpan; + } + class TextChangeRange { + static unchanged: TextChangeRange; + private _span; + private _newLength; + /** + * Initializes a new instance of TextChangeRange. + */ + constructor(span: TextSpan, newLength: number); + /** + * The span of text before the edit which is being changed + */ + span(): TextSpan; + /** + * Width of the span after the edit. A 0 here would represent a delete + */ + newLength(): number; + newSpan(): TextSpan; + isUnchanged(): boolean; + /** + * Called to merge all the changes that occurred across several versions of a script snapshot + * into a single change. i.e. if a user keeps making successive edits to a script we will + * have a text change from V1 to V2, V2 to V3, ..., Vn. + * + * This function will then merge those changes into a single change range valid between V1 and + * Vn. + */ + static collapseChangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; + } + 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; + 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[]; + emitOutputStatus: EmitReturnStatus; + } + 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; + } + interface DocumentRegistry { + acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean): SourceFile; + updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TextChangeRange): SourceFile; + 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 createDocumentRegistry(): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry): LanguageService; + function createClassifier(host: Logger): Classifier; +} diff --git a/lib/typescript-src/support/typescript/bin/typescript.js b/lib/typescript-src/support/typescript/bin/typescript.js deleted file mode 100644 index bc994ab..0000000 --- a/lib/typescript-src/support/typescript/bin/typescript.js +++ /dev/null @@ -1,61516 +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 - -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. -***************************************************************************** */ - -var TypeScript; -(function (TypeScript) { - TypeScript.DiagnosticCode = { - error_TS_0_1: "error TS{0}: {1}", - warning_TS_0_1: "warning TS{0}: {1}", - Unrecognized_escape_sequence: "Unrecognized escape sequence.", - Unexpected_character_0: "Unexpected character {0}.", - Missing_close_quote_character: "Missing close quote character.", - Identifier_expected: "Identifier expected.", - _0_keyword_expected: "'{0}' keyword expected.", - _0_expected: "'{0}' expected.", - Identifier_expected_0_is_a_keyword: "Identifier expected; '{0}' is a keyword.", - Automatic_semicolon_insertion_not_allowed: "Automatic semicolon insertion not allowed.", - Unexpected_token_0_expected: "Unexpected token; '{0}' expected.", - Trailing_separator_not_allowed: "Trailing separator not allowed.", - AsteriskSlash_expected: "'*/' expected.", - public_or_private_modifier_must_precede_static: "'public' or 'private' modifier must precede 'static'.", - Unexpected_token: "Unexpected token.", - Catch_clause_parameter_cannot_have_a_type_annotation: "Catch clause parameter cannot have a type annotation.", - Rest_parameter_must_be_last_in_list: "Rest parameter must be last in list.", - Parameter_cannot_have_question_mark_and_initializer: "Parameter cannot have question mark and initializer.", - Required_parameter_cannot_follow_optional_parameter: "Required parameter cannot follow optional parameter.", - Index_signatures_cannot_have_rest_parameters: "Index signatures cannot have rest parameters.", - Index_signature_parameter_cannot_have_accessibility_modifiers: "Index signature parameter cannot have accessibility modifiers.", - Index_signature_parameter_cannot_have_a_question_mark: "Index signature parameter cannot have a question mark.", - Index_signature_parameter_cannot_have_an_initializer: "Index signature parameter cannot have an initializer.", - Index_signature_must_have_a_type_annotation: "Index signature must have a type annotation.", - Index_signature_parameter_must_have_a_type_annotation: "Index signature parameter must have a type annotation.", - Index_signature_parameter_type_must_be_string_or_number: "Index signature parameter type must be 'string' or 'number'.", - extends_clause_already_seen: "'extends' clause already seen.", - extends_clause_must_precede_implements_clause: "'extends' clause must precede 'implements' clause.", - Classes_can_only_extend_a_single_class: "Classes can only extend a single class.", - implements_clause_already_seen: "'implements' clause already seen.", - Accessibility_modifier_already_seen: "Accessibility modifier already seen.", - _0_modifier_must_precede_1_modifier: "'{0}' modifier must precede '{1}' modifier.", - _0_modifier_already_seen: "'{0}' modifier already seen.", - _0_modifier_cannot_appear_on_a_class_element: "'{0}' modifier cannot appear on a class element.", - Interface_declaration_cannot_have_implements_clause: "Interface declaration cannot have 'implements' clause.", - super_invocation_cannot_have_type_arguments: "'super' invocation cannot have type arguments.", - Only_ambient_modules_can_use_quoted_names: "Only ambient modules can use quoted names.", - Statements_are_not_allowed_in_ambient_contexts: "Statements are not allowed in ambient contexts.", - Implementations_are_not_allowed_in_ambient_contexts: "Implementations are not allowed in ambient contexts.", - declare_modifier_not_allowed_for_code_already_in_an_ambient_context: "'declare' modifier not allowed for code already in an ambient context.", - Initializers_are_not_allowed_in_ambient_contexts: "Initializers are not allowed in ambient contexts.", - Parameter_property_declarations_can_only_be_used_in_a_non_ambient_constructor_declaration: "Parameter property declarations can only be used in a non-ambient constructor declaration.", - Function_implementation_expected: "Function implementation expected.", - Constructor_implementation_expected: "Constructor implementation expected.", - Function_overload_name_must_be_0: "Function overload name must be '{0}'.", - _0_modifier_cannot_appear_on_a_module_element: "'{0}' modifier cannot appear on a module element.", - declare_modifier_cannot_appear_on_an_interface_declaration: "'declare' modifier cannot appear on an interface declaration.", - declare_modifier_required_for_top_level_element: "'declare' modifier required for top level element.", - Rest_parameter_cannot_be_optional: "Rest parameter cannot be optional.", - Rest_parameter_cannot_have_an_initializer: "Rest parameter cannot have an initializer.", - set_accessor_must_have_one_and_only_one_parameter: "'set' accessor must have one and only one parameter.", - set_accessor_parameter_cannot_be_optional: "'set' accessor parameter cannot be optional.", - set_accessor_parameter_cannot_have_an_initializer: "'set' accessor parameter cannot have an initializer.", - set_accessor_cannot_have_rest_parameter: "'set' accessor cannot have rest parameter.", - get_accessor_cannot_have_parameters: "'get' accessor cannot have parameters.", - Modifiers_cannot_appear_here: "Modifiers cannot appear here.", - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: "Accessors are only available when targeting ECMAScript 5 and higher.", - Class_name_cannot_be_0: "Class name cannot be '{0}'.", - Interface_name_cannot_be_0: "Interface name cannot be '{0}'.", - Enum_name_cannot_be_0: "Enum name cannot be '{0}'.", - Module_name_cannot_be_0: "Module name cannot be '{0}'.", - Enum_member_must_have_initializer: "Enum member must have initializer.", - Export_assignment_cannot_be_used_in_internal_modules: "Export assignment cannot be used in internal modules.", - Export_assignment_not_allowed_in_module_with_exported_element: "Export assignment not allowed in module with exported element.", - Module_cannot_have_multiple_export_assignments: "Module cannot have multiple export assignments.", - Ambient_enum_elements_can_only_have_integer_literal_initializers: "Ambient enum elements can only have integer literal initializers.", - module_class_interface_enum_import_or_statement: "module, class, interface, enum, import or statement", - constructor_function_accessor_or_variable: "constructor, function, accessor or variable", - statement: "statement", - case_or_default_clause: "case or default clause", - identifier: "identifier", - call_construct_index_property_or_function_signature: "call, construct, index, property or function signature", - expression: "expression", - type_name: "type name", - property_or_accessor: "property or accessor", - parameter: "parameter", - type: "type", - type_parameter: "type parameter", - declare_modifier_not_allowed_on_import_declaration: "'declare' modifier not allowed on import declaration.", - Function_overload_must_be_static: "Function overload must be static.", - Function_overload_must_not_be_static: "Function overload must not be static.", - Parameter_property_declarations_cannot_be_used_in_a_constructor_overload: "Parameter property declarations cannot be used in a constructor overload.", - Invalid_reference_directive_syntax: "Invalid 'reference' directive syntax.", - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: "Octal literals are not available when targeting ECMAScript 5 and higher.", - Accessors_are_not_allowed_in_ambient_contexts: "Accessors are not allowed in ambient contexts.", - _0_modifier_cannot_appear_on_a_constructor_declaration: "'{0}' modifier cannot appear on a constructor declaration.", - _0_modifier_cannot_appear_on_a_parameter: "'{0}' modifier cannot appear on a parameter.", - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: "Only a single variable declaration is allowed in a 'for...in' statement.", - Type_parameters_cannot_appear_on_a_constructor_declaration: "Type parameters cannot appear on a constructor declaration.", - Type_annotation_cannot_appear_on_a_constructor_declaration: "Type annotation cannot appear on a constructor declaration.", - Duplicate_identifier_0: "Duplicate identifier '{0}'.", - The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.", - The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.", - super_can_only_be_used_inside_a_class_instance_method: "'super' can only be used inside a class instance method.", - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_property_or_indexer: "The left-hand side of an assignment expression must be a variable, property or indexer.", - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: "Value of type '{0}' is not callable. Did you mean to include 'new'?", - Value_of_type_0_is_not_callable: "Value of type '{0}' is not callable.", - Value_of_type_0_is_not_newable: "Value of type '{0}' is not newable.", - Value_of_type_0_is_not_indexable_by_type_1: "Value of type '{0}' is not indexable by type '{1}'.", - Operator_0_cannot_be_applied_to_types_1_and_2: "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - Operator_0_cannot_be_applied_to_types_1_and_2_3: "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}", - Cannot_convert_0_to_1: "Cannot convert '{0}' to '{1}'.", - Cannot_convert_0_to_1_NL_2: "Cannot convert '{0}' to '{1}':{NL}{2}", - Expected_var_class_interface_or_module: "Expected var, class, interface, or module.", - Operator_0_cannot_be_applied_to_type_1: "Operator '{0}' cannot be applied to type '{1}'.", - Getter_0_already_declared: "Getter '{0}' already declared.", - Setter_0_already_declared: "Setter '{0}' already declared.", - Exported_class_0_extends_private_class_1: "Exported class '{0}' extends private class '{1}'.", - Exported_class_0_implements_private_interface_1: "Exported class '{0}' implements private interface '{1}'.", - Exported_interface_0_extends_private_interface_1: "Exported interface '{0}' extends private interface '{1}'.", - Exported_class_0_extends_class_from_inaccessible_module_1: "Exported class '{0}' extends class from inaccessible module {1}.", - Exported_class_0_implements_interface_from_inaccessible_module_1: "Exported class '{0}' implements interface from inaccessible module {1}.", - Exported_interface_0_extends_interface_from_inaccessible_module_1: "Exported interface '{0}' extends interface from inaccessible module {1}.", - Public_static_property_0_of_exported_class_has_or_is_using_private_type_1: "Public static property '{0}' of exported class has or is using private type '{1}'.", - Public_property_0_of_exported_class_has_or_is_using_private_type_1: "Public property '{0}' of exported class has or is using private type '{1}'.", - Property_0_of_exported_interface_has_or_is_using_private_type_1: "Property '{0}' of exported interface has or is using private type '{1}'.", - Exported_variable_0_has_or_is_using_private_type_1: "Exported variable '{0}' has or is using private type '{1}'.", - Public_static_property_0_of_exported_class_is_using_inaccessible_module_1: "Public static property '{0}' of exported class is using inaccessible module {1}.", - Public_property_0_of_exported_class_is_using_inaccessible_module_1: "Public property '{0}' of exported class is using inaccessible module {1}.", - Property_0_of_exported_interface_is_using_inaccessible_module_1: "Property '{0}' of exported interface is using inaccessible module {1}.", - Exported_variable_0_is_using_inaccessible_module_1: "Exported variable '{0}' is using inaccessible module {1}.", - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - Parameter_0_of_exported_function_has_or_is_using_private_type_1: "Parameter '{0}' of exported function has or is using private type '{1}'.", - Parameter_0_of_constructor_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - Parameter_0_of_public_static_property_setter_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - Parameter_0_of_public_property_setter_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - Parameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - Parameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - Parameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - Parameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - Parameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - Parameter_0_of_exported_function_is_using_inaccessible_module_1: "Parameter '{0}' of exported function is using inaccessible module {1}.", - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_type_0: "Return type of public static property getter from exported class has or is using private type '{0}'.", - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_type_0: "Return type of public property getter from exported class has or is using private type '{0}'.", - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of constructor signature from exported interface has or is using private type '{0}'.", - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of call signature from exported interface has or is using private type '{0}'.", - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of index signature from exported interface has or is using private type '{0}'.", - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_type_0: "Return type of public static method from exported class has or is using private type '{0}'.", - Return_type_of_public_method_from_exported_class_has_or_is_using_private_type_0: "Return type of public method from exported class has or is using private type '{0}'.", - Return_type_of_method_from_exported_interface_has_or_is_using_private_type_0: "Return type of method from exported interface has or is using private type '{0}'.", - Return_type_of_exported_function_has_or_is_using_private_type_0: "Return type of exported function has or is using private type '{0}'.", - Return_type_of_public_static_property_getter_from_exported_class_is_using_inaccessible_module_0: "Return type of public static property getter from exported class is using inaccessible module {0}.", - Return_type_of_public_property_getter_from_exported_class_is_using_inaccessible_module_0: "Return type of public property getter from exported class is using inaccessible module {0}.", - Return_type_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of constructor signature from exported interface is using inaccessible module {0}.", - Return_type_of_call_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of call signature from exported interface is using inaccessible module {0}.", - Return_type_of_index_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of index signature from exported interface is using inaccessible module {0}.", - Return_type_of_public_static_method_from_exported_class_is_using_inaccessible_module_0: "Return type of public static method from exported class is using inaccessible module {0}.", - Return_type_of_public_method_from_exported_class_is_using_inaccessible_module_0: "Return type of public method from exported class is using inaccessible module {0}.", - Return_type_of_method_from_exported_interface_is_using_inaccessible_module_0: "Return type of method from exported interface is using inaccessible module {0}.", - Return_type_of_exported_function_is_using_inaccessible_module_0: "Return type of exported function is using inaccessible module {0}.", - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - A_parameter_list_must_follow_a_generic_type_argument_list_expected: "A parameter list must follow a generic type argument list. '(' expected.", - Multiple_constructor_implementations_are_not_allowed: "Multiple constructor implementations are not allowed.", - Unable_to_resolve_external_module_0: "Unable to resolve external module '{0}'.", - Module_cannot_be_aliased_to_a_non_module_type: "Module cannot be aliased to a non-module type.", - A_class_may_only_extend_another_class: "A class may only extend another class.", - A_class_may_only_implement_another_class_or_interface: "A class may only implement another class or interface.", - An_interface_may_only_extend_another_class_or_interface: "An interface may only extend another class or interface.", - Unable_to_resolve_type: "Unable to resolve type.", - Unable_to_resolve_type_of_0: "Unable to resolve type of '{0}'.", - Unable_to_resolve_type_parameter_constraint: "Unable to resolve type parameter constraint.", - Type_parameter_constraint_cannot_be_a_primitive_type: "Type parameter constraint cannot be a primitive type.", - Supplied_parameters_do_not_match_any_signature_of_call_target: "Supplied parameters do not match any signature of call target.", - Supplied_parameters_do_not_match_any_signature_of_call_target_NL_0: "Supplied parameters do not match any signature of call target:{NL}{0}", - Invalid_new_expression: "Invalid 'new' expression.", - Call_signatures_used_in_a_new_expression_must_have_a_void_return_type: "Call signatures used in a 'new' expression must have a 'void' return type.", - Could_not_select_overload_for_new_expression: "Could not select overload for 'new' expression.", - Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2: "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.", - Could_not_select_overload_for_call_expression: "Could not select overload for 'call' expression.", - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: "Cannot invoke an expression whose type lacks a call signature.", - Calls_to_super_are_only_valid_inside_a_class: "Calls to 'super' are only valid inside a class.", - Generic_type_0_requires_1_type_argument_s: "Generic type '{0}' requires {1} type argument(s).", - Type_of_array_literal_cannot_be_determined_Best_common_type_could_not_be_found_for_array_elements: "Type of array literal cannot be determined. Best common type could not be found for array elements.", - Could_not_find_enclosing_symbol_for_dotted_name_0: "Could not find enclosing symbol for dotted name '{0}'.", - The_property_0_does_not_exist_on_value_of_type_1: "The property '{0}' does not exist on value of type '{1}'.", - Could_not_find_symbol_0: "Could not find symbol '{0}'.", - get_and_set_accessor_must_have_the_same_type: "'get' and 'set' accessor must have the same type.", - this_cannot_be_referenced_in_current_location: "'this' cannot be referenced in current location.", - Static_members_cannot_reference_class_type_parameters: "Static members cannot reference class type parameters.", - Class_0_is_recursively_referenced_as_a_base_type_of_itself: "Class '{0}' is recursively referenced as a base type of itself.", - Interface_0_is_recursively_referenced_as_a_base_type_of_itself: "Interface '{0}' is recursively referenced as a base type of itself.", - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.", - super_cannot_be_referenced_in_non_derived_classes: "'super' cannot be referenced in non-derived classes.", - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - Constructors_for_derived_classes_must_contain_a_super_call: "Constructors for derived classes must contain a 'super' call.", - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: "Super calls are not permitted outside constructors or in nested functions inside constructors.", - _0_1_is_inaccessible: "'{0}.{1}' is inaccessible.", - this_cannot_be_referenced_within_module_bodies: "'this' cannot be referenced within module bodies.", - Invalid_expression_types_not_known_to_support_the_addition_operator: "Invalid '+' expression - types not known to support the addition operator.", - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - The_type_of_a_unary_arithmetic_operation_operand_must_be_of_type_any_number_or_an_enum_type: "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.", - Variable_declarations_of_a_for_statement_cannot_use_a_type_annotation: "Variable declarations of a 'for' statement cannot use a type annotation.", - Variable_declarations_of_a_for_statement_must_be_of_types_string_or_any: "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.", - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.", - Setters_cannot_return_a_value: "Setters cannot return a value.", - Tried_to_query_type_of_uninitialized_module_0: "Tried to query type of uninitialized module '{0}'.", - Tried_to_set_variable_type_to_uninitialized_module_type_0: "Tried to set variable type to uninitialized module type '{0}'.", - Type_0_does_not_have_type_parameters: "Type '{0}' does not have type parameters.", - Getters_must_return_a_value: "Getters must return a value.", - Getter_and_setter_accessors_do_not_agree_in_visibility: "Getter and setter accessors do not agree in visibility.", - Invalid_left_hand_side_of_assignment_expression: "Invalid left-hand side of assignment expression.", - Function_declared_a_non_void_return_type_but_has_no_return_expression: "Function declared a non-void return type, but has no return expression.", - Cannot_resolve_return_type_reference: "Cannot resolve return type reference.", - Constructors_cannot_have_a_return_type_of_void: "Constructors cannot have a return type of 'void'.", - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - All_symbols_within_a_with_block_will_be_resolved_to_any: "All symbols within a with block will be resolved to 'any'.", - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: "Import declarations in an internal module cannot reference an external module.", - Class_0_declares_interface_1_but_does_not_implement_it_NL_2: "Class {0} declares interface {1} but does not implement it:{NL}{2}", - Class_0_declares_class_1_as_an_interface_but_does_not_implement_it_NL_2: "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: "The operand of an increment or decrement operator must be a variable, property or indexer.", - this_cannot_be_referenced_in_static_initializers_in_a_class_body: "'this' cannot be referenced in static initializers in a class body.", - Class_0_cannot_extend_class_1_NL_2: "Class '{0}' cannot extend class '{1}':{NL}{2}", - Interface_0_cannot_extend_class_1_NL_2: "Interface '{0}' cannot extend class '{1}':{NL}{2}", - Interface_0_cannot_extend_interface_1_NL_2: "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - Duplicate_overload_signature_for_0: "Duplicate overload signature for '{0}'.", - Duplicate_constructor_overload_signature: "Duplicate constructor overload signature.", - Duplicate_overload_call_signature: "Duplicate overload call signature.", - Duplicate_overload_construct_signature: "Duplicate overload construct signature.", - Overload_signature_is_not_compatible_with_function_definition: "Overload signature is not compatible with function definition.", - Overload_signature_is_not_compatible_with_function_definition_NL_0: "Overload signature is not compatible with function definition:{NL}{0}", - Overload_signatures_must_all_be_public_or_private: "Overload signatures must all be public or private.", - Overload_signatures_must_all_be_exported_or_not_exported: "Overload signatures must all be exported or not exported.", - Overload_signatures_must_all_be_ambient_or_non_ambient: "Overload signatures must all be ambient or non-ambient.", - Overload_signatures_must_all_be_optional_or_required: "Overload signatures must all be optional or required.", - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: "Specialized overload signature is not assignable to any non-specialized signature.", - this_cannot_be_referenced_in_constructor_arguments: "'this' cannot be referenced in constructor arguments.", - Instance_member_cannot_be_accessed_off_a_class: "Instance member cannot be accessed off a class.", - Untyped_function_calls_may_not_accept_type_arguments: "Untyped function calls may not accept type arguments.", - Non_generic_functions_may_not_accept_type_arguments: "Non-generic functions may not accept type arguments.", - A_generic_type_may_not_reference_itself_with_a_wrapped_form_of_its_own_type_parameters: "A generic type may not reference itself with a wrapped form of its own type parameters.", - Rest_parameters_must_be_array_types: "Rest parameters must be array types.", - Overload_signature_implementation_cannot_use_specialized_type: "Overload signature implementation cannot use specialized type.", - Export_assignments_may_only_be_used_at_the_top_level_of_external_modules: "Export assignments may only be used at the top-level of external modules.", - Export_assignments_may_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules: "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules.", - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: "Only public methods of the base class are accessible via the 'super' keyword.", - Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1: "Numeric indexer type '{0}' must be assignable to string indexer type '{1}'.", - Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1_NL_2: "Numeric indexer type '{0}' must be assignable to string indexer type '{1}':{NL}{2}", - All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0: "All numerically named properties must be assignable to numeric indexer type '{0}'.", - All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0_NL_1: "All numerically named properties must be assignable to numeric indexer type '{0}':{NL}{1}", - All_named_properties_must_be_assignable_to_string_indexer_type_0: "All named properties must be assignable to string indexer type '{0}'.", - All_named_properties_must_be_assignable_to_string_indexer_type_0_NL_1: "All named properties must be assignable to string indexer type '{0}':{NL}{1}", - Generic_type_references_must_include_all_type_arguments: "Generic type references must include all type arguments.", - Default_arguments_are_only_allowed_in_implementation: "Default arguments are only allowed in implementation.", - Overloads_cannot_differ_only_by_return_type: "Overloads cannot differ only by return type.", - Function_expression_declared_a_non_void_return_type_but_has_no_return_expression: "Function expression declared a non-void return type, but has no return expression.", - Import_declaration_referencing_identifier_from_internal_module_can_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules: "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - Could_not_find_symbol_0_in_module_1: "Could not find symbol '{0}' in module '{1}'.", - Unable_to_resolve_module_reference_0: "Unable to resolve module reference '{0}'.", - Could_not_find_module_0_in_module_1: "Could not find module '{0}' in module '{1}'.", - Exported_import_declaration_0_is_assigned_value_with_type_that_has_or_is_using_private_type_1: "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - Exported_import_declaration_0_is_assigned_value_with_type_that_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - Exported_import_declaration_0_is_assigned_type_that_has_or_is_using_private_type_1: "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - Exported_import_declaration_0_is_assigned_type_that_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - Exported_import_declaration_0_is_assigned_container_that_is_or_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_1: "Type name '{0}' in extends clause does not reference constructor function for '{1}'.", - Internal_module_reference_0_in_import_declaration_does_not_reference_module_instance_for_1: "Internal module reference '{0}' in import declaration does not reference module instance for '{1}'.", - Module_0_cannot_merge_with_previous_declaration_of_1_in_a_different_file_2: "Module '{0}' cannot merge with previous declaration of '{1}' in a different file '{2}'.", - Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':{NL}{3}", - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.", - Ambient_external_module_declaration_cannot_be_reopened: "Ambient external module declaration cannot be reopened.", - All_declarations_of_merged_declaration_0_must_be_exported_or_not_exported: "All declarations of merged declaration '{0}' must be exported or not exported.", - super_cannot_be_referenced_in_constructor_arguments: "'super' cannot be referenced in constructor arguments.", - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: "Return type of constructor signature must be assignable to the instance type of the class.", - Ambient_external_module_declaration_must_be_defined_in_global_context: "Ambient external module declaration must be defined in global context.", - Ambient_external_module_declaration_cannot_specify_relative_module_name: "Ambient external module declaration cannot specify relative module name.", - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.", - Could_not_find_the_best_common_type_of_types_of_all_return_statement_expressions: "Could not find the best common type of types of all return statement expressions.", - Import_declaration_cannot_refer_to_external_module_reference_when_noResolve_option_is_set: "Import declaration cannot refer to external module reference when --noResolve option is set.", - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.", - continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: "'continue' statement can only be used within an enclosing iteration statement.", - break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: "'break' statement can only be used within an enclosing iteration or switch statement.", - Jump_target_not_found: "Jump target not found.", - Jump_target_cannot_cross_function_boundary: "Jump target cannot cross function boundary.", - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.", - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.", - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: "Expression resolves to '_super' that compiler uses to capture base class reference.", - TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of public static method from exported class has or is using private type '{1}'.", - TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of public method from exported class has or is using private type '{1}'.", - TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of method from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_exported_function_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported function has or is using private type '{1}'.", - TypeParameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - TypeParameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of call signature from exported interface is using inaccessible module {1}", - TypeParameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of public static method from exported class is using inaccessible module {1}.", - TypeParameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of public method from exported class is using inaccessible module {1}.", - TypeParameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of method from exported interface is using inaccessible module {1}.", - TypeParameter_0_of_exported_function_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported function is using inaccessible module {1}.", - TypeParameter_0_of_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported class has or is using private type '{1}'.", - TypeParameter_0_of_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported interface has or is using private type '{1}'.", - TypeParameter_0_of_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported class is using inaccessible module {1}.", - TypeParameter_0_of_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported interface is using inaccessible module {1}.", - Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter.", - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", - Type_of_conditional_0_must_be_identical_to_1_or_2: "Type of conditional '{0}' must be identical to '{1}' or '{2}'.", - Type_of_conditional_0_must_be_identical_to_1_2_or_3: "Type of conditional '{0}' must be identical to '{1}', '{2}' or '{3}'.", - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.", - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list.", - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.", - Parameter_0_cannot_be_referenced_in_its_initializer: "Parameter '{0}' cannot be referenced in its initializer.", - Duplicate_string_index_signature: "Duplicate string index signature.", - Duplicate_number_index_signature: "Duplicate number index signature.", - All_declarations_of_an_interface_must_have_identical_type_parameters: "All declarations of an interface must have identical type parameters.", - Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.", - Type_0_is_missing_property_1_from_type_2: "Type '{0}' is missing property '{1}' from type '{2}'.", - Types_of_property_0_of_types_1_and_2_are_incompatible: "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - Types_of_property_0_of_types_1_and_2_are_incompatible_NL_3: "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - Property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2: "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - Property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2: "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - Types_0_and_1_define_property_2_as_private: "Types '{0}' and '{1}' define property '{2}' as private.", - Call_signatures_of_types_0_and_1_are_incompatible: "Call signatures of types '{0}' and '{1}' are incompatible.", - Call_signatures_of_types_0_and_1_are_incompatible_NL_2: "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Type_0_requires_a_call_signature_but_type_1_lacks_one: "Type '{0}' requires a call signature, but type '{1}' lacks one.", - Construct_signatures_of_types_0_and_1_are_incompatible: "Construct signatures of types '{0}' and '{1}' are incompatible.", - Construct_signatures_of_types_0_and_1_are_incompatible_NL_2: "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Type_0_requires_a_construct_signature_but_type_1_lacks_one: "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - Index_signatures_of_types_0_and_1_are_incompatible: "Index signatures of types '{0}' and '{1}' are incompatible.", - Index_signatures_of_types_0_and_1_are_incompatible_NL_2: "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Call_signature_expects_0_or_fewer_parameters: "Call signature expects {0} or fewer parameters.", - Could_not_apply_type_0_to_argument_1_which_is_of_type_2: "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - Types_of_static_property_0_of_class_1_and_class_2_are_incompatible: "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - Types_of_static_property_0_of_class_1_and_class_2_are_incompatible_NL_3: "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - Type_reference_cannot_refer_to_container_0: "Type reference cannot refer to container '{0}'.", - Type_reference_must_refer_to_type: "Type reference must refer to type.", - In_enums_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_the_first_enum_element: "In enums with multiple declarations only one declaration can omit an initializer for the first enum element.", - _0_overload_s: " (+ {0} overload(s))", - Variable_declaration_cannot_have_the_same_name_as_an_import_declaration: "Variable declaration cannot have the same name as an import declaration.", - Signature_expected_0_type_arguments_got_1_instead: "Signature expected {0} type arguments, got {1} instead.", - Property_0_defined_as_optional_in_type_1_but_is_required_in_type_2: "Property '{0}' defined as optional in type '{1}', but is required in type '{2}'.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_do_not_refer_to_same_named_type: "Types '{0}' and '{1}' originating in infinitely expanding type reference do not refer to same named type.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments: "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments_NL_2: "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments:{NL}{2}", - Named_properties_0_of_types_1_and_2_are_not_identical: "Named properties '{0}' of types '{1}' and '{2}' are not identical.", - Types_of_string_indexer_of_types_0_and_1_are_not_identical: "Types of string indexer of types '{0}' and '{1}' are not identical.", - Types_of_number_indexer_of_types_0_and_1_are_not_identical: "Types of number indexer of types '{0}' and '{1}' are not identical.", - Type_of_number_indexer_in_type_0_is_not_assignable_to_string_indexer_type_in_type_1_NL_2: "Type of number indexer in type '{0}' is not assignable to string indexer type in type '{1}'.{NL}{2}", - Type_of_property_0_in_type_1_is_not_assignable_to_string_indexer_type_in_type_2_NL_3: "Type of property '{0}' in type '{1}' is not assignable to string indexer type in type '{2}'.{NL}{3}", - Type_of_property_0_in_type_1_is_not_assignable_to_number_indexer_type_in_type_2_NL_3: "Type of property '{0}' in type '{1}' is not assignable to number indexer type in type '{2}'.{NL}{3}", - Static_property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2: "Static property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - Static_property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2: "Static property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - Types_0_and_1_define_static_property_2_as_private: "Types '{0}' and '{1}' define static property '{2}' as private.", - Current_host_does_not_support_0_option: "Current host does not support '{0}' option.", - ECMAScript_target_version_0_not_supported_Specify_a_valid_target_version_1_default_or_2: "ECMAScript target version '{0}' not supported. Specify a valid target version: '{1}' (default), or '{2}'", - Module_code_generation_0_not_supported: "Module code generation '{0}' not supported.", - Could_not_find_file_0: "Could not find file: '{0}'.", - A_file_cannot_have_a_reference_to_itself: "A file cannot have a reference to itself.", - Cannot_resolve_referenced_file_0: "Cannot resolve referenced file: '{0}'.", - Cannot_find_the_common_subdirectory_path_for_the_input_files: "Cannot find the common subdirectory path for the input files.", - Emit_Error_0: "Emit Error: {0}.", - Cannot_read_file_0_1: "Cannot read file '{0}': {1}", - Unsupported_file_encoding: "Unsupported file encoding.", - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: "Locale must be of the form or -. For example '{0}' or '{1}'.", - Unsupported_locale_0: "Unsupported locale: '{0}'.", - Execution_Failed_NL: "Execution Failed.{NL}", - Invalid_call_to_up: "Invalid call to 'up'", - Invalid_call_to_down: "Invalid call to 'down'", - Base64_value_0_finished_with_a_continuation_bit: "Base64 value '{0}' finished with a continuation bit.", - Unknown_option_0: "Unknown option '{0}'", - Expected_0_arguments_to_message_got_1_instead: "Expected {0} arguments to message, got {1} instead.", - Expected_the_message_0_to_have_1_arguments_but_it_had_2: "Expected the message '{0}' to have {1} arguments, but it had {2}", - Could_not_delete_file_0: "Could not delete file '{0}'", - Could_not_create_directory_0: "Could not create directory '{0}'", - Error_while_executing_file_0: "Error while executing file '{0}': ", - Cannot_compile_external_modules_unless_the_module_flag_is_provided: "Cannot compile external modules unless the '--module' flag is provided.", - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: "Option mapRoot cannot be specified without specifying sourcemap option.", - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: "Option sourceRoot cannot be specified without specifying sourcemap option.", - Options_mapRoot_and_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - 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", - Examples: "Examples:", - Options: "Options:", - Insert_command_line_options_and_files_from_a_file: "Insert command line options and files from a file.", - Version_0: "Version {0}", - Use_the_0_flag_to_see_options: "Use the '{0}' flag to see options.", - NL_Recompiling_0: "{NL}Recompiling ({0}):", - STRING: "STRING", - KIND: "KIND", - file2: "FILE", - VERSION: "VERSION", - 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.", - Invalid_line_number_0: "Invalid line number ({0})", - Warn_on_expressions_and_declarations_with_an_implied_any_type: "Warn on expressions and declarations with an implied 'any' type.", - Variable_0_implicitly_has_an_any_type: "Variable '{0}' implicitly has an 'any' type.", - Parameter_0_of_1_implicitly_has_an_any_type: "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - Parameter_0_of_function_type_implicitly_has_an_any_type: "Parameter '{0}' of function type implicitly has an 'any' type.", - Member_0_of_object_type_implicitly_has_an_any_type: "Member '{0}' of object type implicitly has an 'any' type.", - new_expression_which_lacks_a_constructor_signature_implicitly_has_an_any_type: "'new' expression, which lacks a constructor signature, implicitly has an 'any' type.", - _0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - Parameter_0_of_lambda_function_implicitly_has_an_any_type: "Parameter '{0}' of lambda function implicitly has an 'any' type.", - Constructor_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - Lambda_Function_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - Array_Literal_implicitly_has_an_any_type_from_widening: "Array Literal implicitly has an 'any' type from widening.", - _0_which_lacks_get_accessor_and_parameter_type_annotation_on_set_accessor_implicitly_has_an_any_type: "'{0}', which lacks 'get' accessor and parameter type annotation on 'set' accessor, implicitly has an 'any' type.", - Index_signature_of_object_type_implicitly_has_an_any_type: "Index signature of object type implicitly has an 'any' type.", - Object_literal_s_property_0_implicitly_has_an_any_type_from_widening: "Object literal's property '{0}' implicitly has an 'any' type from widening." - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ArrayUtilities = (function () { - function ArrayUtilities() { - } - ArrayUtilities.isArray = function (value) { - return Object.prototype.toString.apply(value, []) === '[object Array]'; - }; - - ArrayUtilities.sequenceEquals = function (array1, array2, equals) { - if (array1 === array2) { - return true; - } - - if (array1 === null || array2 === null) { - return false; - } - - if (array1.length !== array2.length) { - return false; - } - - for (var i = 0, n = array1.length; i < n; i++) { - if (!equals(array1[i], array2[i])) { - return false; - } - } - - return true; - }; - - ArrayUtilities.contains = function (array, value) { - for (var i = 0; i < array.length; i++) { - if (array[i] === value) { - return true; - } - } - - return false; - }; - - ArrayUtilities.groupBy = function (array, func) { - var result = {}; - - for (var i = 0, n = array.length; i < n; i++) { - var v = array[i]; - var k = func(v); - - var list = result[k] || []; - list.push(v); - result[k] = list; - } - - return result; - }; - - ArrayUtilities.distinct = function (array, equalsFn) { - var result = []; - - for (var i = 0, n = array.length; i < n; i++) { - var current = array[i]; - for (var j = 0; j < result.length; j++) { - if (equalsFn(result[j], current)) { - break; - } - } - - if (j === result.length) { - result.push(current); - } - } - - return result; - }; - - ArrayUtilities.min = function (array, func) { - var min = func(array[0]); - - for (var i = 1; i < array.length; i++) { - var next = func(array[i]); - if (next < min) { - min = next; - } - } - - return min; - }; - - ArrayUtilities.max = function (array, func) { - var max = func(array[0]); - - for (var i = 1; i < array.length; i++) { - var next = func(array[i]); - if (next > max) { - max = next; - } - } - - return max; - }; - - ArrayUtilities.last = function (array) { - if (array.length === 0) { - throw TypeScript.Errors.argumentOutOfRange('array'); - } - - return array[array.length - 1]; - }; - - ArrayUtilities.lastOrDefault = function (array, predicate) { - for (var i = array.length - 1; i >= 0; i--) { - var v = array[i]; - if (predicate(v, i)) { - return v; - } - } - - return null; - }; - - ArrayUtilities.firstOrDefault = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - var value = array[i]; - if (func(value, i)) { - return value; - } - } - - return null; - }; - - ArrayUtilities.first = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - var value = array[i]; - if (!func || func(value, i)) { - return value; - } - } - - throw TypeScript.Errors.invalidOperation(); - }; - - ArrayUtilities.sum = function (array, func) { - var result = 0; - - for (var i = 0, n = array.length; i < n; i++) { - result += func(array[i]); - } - - return result; - }; - - ArrayUtilities.select = function (values, func) { - var result = new Array(values.length); - - for (var i = 0; i < values.length; i++) { - result[i] = func(values[i]); - } - - return result; - }; - - ArrayUtilities.where = function (values, func) { - var result = new Array(); - - for (var i = 0; i < values.length; i++) { - if (func(values[i])) { - result.push(values[i]); - } - } - - return result; - }; - - ArrayUtilities.any = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - if (func(array[i])) { - return true; - } - } - - return false; - }; - - ArrayUtilities.all = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - if (!func(array[i])) { - return false; - } - } - - return true; - }; - - ArrayUtilities.binarySearch = function (array, value) { - var low = 0; - var high = array.length - 1; - - while (low <= high) { - var middle = low + ((high - low) >> 1); - var midValue = array[middle]; - - if (midValue === value) { - return middle; - } else if (midValue > value) { - high = middle - 1; - } else { - low = middle + 1; - } - } - - return ~low; - }; - - ArrayUtilities.createArray = function (length, defaultValue) { - var result = new Array(length); - for (var i = 0; i < length; i++) { - result[i] = defaultValue; - } - - return result; - }; - - ArrayUtilities.grow = function (array, length, defaultValue) { - var count = length - array.length; - for (var i = 0; i < count; i++) { - array.push(defaultValue); - } - }; - - ArrayUtilities.copy = function (sourceArray, sourceIndex, destinationArray, destinationIndex, length) { - for (var i = 0; i < length; i++) { - destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i]; - } - }; - - ArrayUtilities.indexOf = function (array, predicate) { - for (var i = 0, n = array.length; i < n; i++) { - if (predicate(array[i])) { - return i; - } - } - - return -1; - }; - return ArrayUtilities; - })(); - TypeScript.ArrayUtilities = ArrayUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (BitVector) { - var pool = []; - var Constants; - (function (Constants) { - Constants[Constants["MaxBitsPerEncodedNumber"] = 30] = "MaxBitsPerEncodedNumber"; - Constants[Constants["BitsPerEncodedBiStateValue"] = 1] = "BitsPerEncodedBiStateValue"; - - Constants[Constants["BitsPerEncodedTriStateValue"] = 2] = "BitsPerEncodedTriStateValue"; - - Constants[Constants["BiStateEncodedTrue"] = 1] = "BiStateEncodedTrue"; - Constants[Constants["BiStateClearBitsMask"] = 1] = "BiStateClearBitsMask"; - - Constants[Constants["TriStateEncodedFalse"] = 1] = "TriStateEncodedFalse"; - Constants[Constants["TriStateEncodedTrue"] = 2] = "TriStateEncodedTrue"; - Constants[Constants["TriStateClearBitsMask"] = 3] = "TriStateClearBitsMask"; - })(Constants || (Constants = {})); - - var BitVectorImpl = (function () { - function BitVectorImpl(allowUndefinedValues) { - this.allowUndefinedValues = allowUndefinedValues; - this.isReleased = false; - this.bits = []; - } - BitVectorImpl.prototype.computeTriStateArrayIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 2 /* BitsPerEncodedTriStateValue */; - - return (index / encodedValuesPerNumber) >>> 0; - }; - - BitVectorImpl.prototype.computeBiStateArrayIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 1 /* BitsPerEncodedBiStateValue */; - - return (index / encodedValuesPerNumber) >>> 0; - }; - - BitVectorImpl.prototype.computeTriStateEncodedValueIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 2 /* BitsPerEncodedTriStateValue */; - - return (index % encodedValuesPerNumber) * 2 /* BitsPerEncodedTriStateValue */; - }; - - BitVectorImpl.prototype.computeBiStateEncodedValueIndex = function (index) { - var encodedValuesPerNumber = 30 /* MaxBitsPerEncodedNumber */ / 1 /* BitsPerEncodedBiStateValue */; - - return (index % encodedValuesPerNumber) * 1 /* BitsPerEncodedBiStateValue */; - }; - - BitVectorImpl.prototype.valueAt = function (index) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - if (this.allowUndefinedValues) { - var arrayIndex = this.computeTriStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - return undefined; - } - - var bitIndex = this.computeTriStateEncodedValueIndex(index); - if (encoded & (2 /* TriStateEncodedTrue */ << bitIndex)) { - return true; - } else if (encoded & (1 /* TriStateEncodedFalse */ << bitIndex)) { - return false; - } else { - return undefined; - } - } else { - var arrayIndex = this.computeBiStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - return false; - } - - var bitIndex = this.computeBiStateEncodedValueIndex(index); - if (encoded & (1 /* BiStateEncodedTrue */ << bitIndex)) { - return true; - } else { - return false; - } - } - }; - - BitVectorImpl.prototype.setValueAt = function (index, value) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - if (this.allowUndefinedValues) { - TypeScript.Debug.assert(value === true || value === false || value === undefined, "value must only be true, false or undefined."); - - var arrayIndex = this.computeTriStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - if (value === undefined) { - return; - } - - encoded = 0; - } - - var bitIndex = this.computeTriStateEncodedValueIndex(index); - - var clearMask = ~(3 /* TriStateClearBitsMask */ << bitIndex); - encoded = encoded & clearMask; - - if (value === true) { - encoded = encoded | (2 /* TriStateEncodedTrue */ << bitIndex); - } else if (value === false) { - encoded = encoded | (1 /* TriStateEncodedFalse */ << bitIndex); - } - - this.bits[arrayIndex] = encoded; - } else { - TypeScript.Debug.assert(value === true || value === false, "value must only be true or false."); - - var arrayIndex = this.computeBiStateArrayIndex(index); - var encoded = this.bits[arrayIndex]; - if (encoded === undefined) { - if (value === false) { - return; - } - - encoded = 0; - } - - var bitIndex = this.computeBiStateEncodedValueIndex(index); - - encoded = encoded & ~(1 /* BiStateClearBitsMask */ << bitIndex); - - if (value) { - encoded = encoded | (1 /* BiStateEncodedTrue */ << bitIndex); - } - - this.bits[arrayIndex] = encoded; - } - }; - - BitVectorImpl.prototype.release = function () { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - this.isReleased = true; - this.bits.length = 0; - pool.push(this); - }; - return BitVectorImpl; - })(); - - function getBitVector(allowUndefinedValues) { - if (pool.length === 0) { - return new BitVectorImpl(allowUndefinedValues); - } - - var vector = pool.pop(); - vector.isReleased = false; - vector.allowUndefinedValues = allowUndefinedValues; - - return vector; - } - BitVector.getBitVector = getBitVector; - })(TypeScript.BitVector || (TypeScript.BitVector = {})); - var BitVector = TypeScript.BitVector; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (BitMatrix) { - var pool = []; - - var BitMatrixImpl = (function () { - function BitMatrixImpl(allowUndefinedValues) { - this.allowUndefinedValues = allowUndefinedValues; - this.isReleased = false; - this.vectors = []; - } - BitMatrixImpl.prototype.valueAt = function (x, y) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - var vector = this.vectors[x]; - if (!vector) { - return this.allowUndefinedValues ? undefined : false; - } - - return vector.valueAt(y); - }; - - BitMatrixImpl.prototype.setValueAt = function (x, y, value) { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - var vector = this.vectors[x]; - if (!vector) { - if (value === undefined) { - return; - } - - vector = TypeScript.BitVector.getBitVector(this.allowUndefinedValues); - this.vectors[x] = vector; - } - - vector.setValueAt(y, value); - }; - - BitMatrixImpl.prototype.release = function () { - TypeScript.Debug.assert(!this.isReleased, "Should not use a released bitvector"); - this.isReleased = true; - - for (var name in this.vectors) { - if (this.vectors.hasOwnProperty(name)) { - var vector = this.vectors[name]; - vector.release(); - } - } - - this.vectors.length = 0; - pool.push(this); - }; - return BitMatrixImpl; - })(); - - function getBitMatrix(allowUndefinedValues) { - if (pool.length === 0) { - return new BitMatrixImpl(allowUndefinedValues); - } - - var matrix = pool.pop(); - matrix.isReleased = false; - matrix.allowUndefinedValues = allowUndefinedValues; - - return matrix; - } - BitMatrix.getBitMatrix = getBitMatrix; - })(TypeScript.BitMatrix || (TypeScript.BitMatrix = {})); - var BitMatrix = TypeScript.BitMatrix; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Constants) { - Constants[Constants["Max31BitInteger"] = 1073741823] = "Max31BitInteger"; - Constants[Constants["Min31BitInteger"] = -1073741824] = "Min31BitInteger"; - })(TypeScript.Constants || (TypeScript.Constants = {})); - var Constants = TypeScript.Constants; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (AssertionLevel) { - AssertionLevel[AssertionLevel["None"] = 0] = "None"; - AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; - AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; - AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; - })(TypeScript.AssertionLevel || (TypeScript.AssertionLevel = {})); - var AssertionLevel = TypeScript.AssertionLevel; - - var Debug = (function () { - function Debug() { - } - Debug.shouldAssert = function (level) { - return this.currentAssertionLevel >= level; - }; - - Debug.assert = function (expression, message, verboseDebugInfo) { - if (typeof message === "undefined") { message = ""; } - if (typeof verboseDebugInfo === "undefined") { verboseDebugInfo = null; } - if (!expression) { - var verboseDebugString = ""; - if (verboseDebugInfo) { - verboseDebugString = "\r\nVerbose Debug Information:" + verboseDebugInfo(); - } - - throw new Error("Debug Failure. False expression: " + message + verboseDebugString); - } - }; - - Debug.fail = function (message) { - Debug.assert(false, message); - }; - Debug.currentAssertionLevel = 0 /* None */; - return Debug; - })(); - TypeScript.Debug = Debug; -})(TypeScript || (TypeScript = {})); -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) { - TypeScript.LocalizedDiagnosticMessages = null; - - var Location = (function () { - function Location(fileName, lineMap, start, length) { - this._fileName = fileName; - this._lineMap = lineMap; - this._start = start; - this._length = length; - } - Location.prototype.fileName = function () { - return this._fileName; - }; - - Location.prototype.lineMap = function () { - return this._lineMap; - }; - - Location.prototype.line = function () { - return this._lineMap ? this._lineMap.getLineNumberFromPosition(this.start()) : 0; - }; - - Location.prototype.character = function () { - return this._lineMap ? this._lineMap.getLineAndCharacterFromPosition(this.start()).character() : 0; - }; - - Location.prototype.start = function () { - return this._start; - }; - - Location.prototype.length = function () { - return this._length; - }; - - Location.equals = function (location1, location2) { - return location1._fileName === location2._fileName && location1._start === location2._start && location1._length === location2._length; - }; - return Location; - })(); - TypeScript.Location = Location; - - var Diagnostic = (function (_super) { - __extends(Diagnostic, _super); - function Diagnostic(fileName, lineMap, start, length, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - _super.call(this, fileName, lineMap, start, length); - this._diagnosticKey = diagnosticKey; - this._arguments = (_arguments && _arguments.length > 0) ? _arguments : null; - this._additionalLocations = (additionalLocations && additionalLocations.length > 0) ? additionalLocations : null; - } - Diagnostic.prototype.toJSON = function (key) { - var result = {}; - result.start = this.start(); - result.length = this.length(); - - result.diagnosticCode = this._diagnosticKey; - - var _arguments = this.arguments(); - if (_arguments && _arguments.length > 0) { - result.arguments = _arguments; - } - - return result; - }; - - Diagnostic.prototype.diagnosticKey = function () { - return this._diagnosticKey; - }; - - Diagnostic.prototype.arguments = function () { - return this._arguments; - }; - - Diagnostic.prototype.text = function () { - return TypeScript.getLocalizedText(this._diagnosticKey, this._arguments); - }; - - Diagnostic.prototype.message = function () { - return TypeScript.getDiagnosticMessage(this._diagnosticKey, this._arguments); - }; - - Diagnostic.prototype.additionalLocations = function () { - return this._additionalLocations || []; - }; - - Diagnostic.equals = function (diagnostic1, diagnostic2) { - return Location.equals(diagnostic1, diagnostic2) && diagnostic1._diagnosticKey === diagnostic2._diagnosticKey && TypeScript.ArrayUtilities.sequenceEquals(diagnostic1._arguments, diagnostic2._arguments, function (v1, v2) { - return v1 === v2; - }); - }; - - Diagnostic.prototype.info = function () { - return getDiagnosticInfoFromKey(this.diagnosticKey()); - }; - return Diagnostic; - })(Location); - TypeScript.Diagnostic = Diagnostic; - - function newLine() { - return TypeScript.Environment ? TypeScript.Environment.newLine : "\r\n"; - } - TypeScript.newLine = newLine; - - function getLargestIndex(diagnostic) { - var largest = -1; - var regex = /\{(\d+)\}/g; - - var match; - while (match = regex.exec(diagnostic)) { - var val = parseInt(match[1]); - if (!isNaN(val) && val > largest) { - largest = val; - } - } - - return largest; - } - - function getDiagnosticInfoFromKey(diagnosticKey) { - var result = TypeScript.diagnosticInformationMap[diagnosticKey]; - TypeScript.Debug.assert(result); - return result; - } - - function getLocalizedText(diagnosticKey, args) { - if (TypeScript.LocalizedDiagnosticMessages) { - } - - var diagnosticMessageText = TypeScript.LocalizedDiagnosticMessages ? TypeScript.LocalizedDiagnosticMessages[diagnosticKey] : diagnosticKey; - TypeScript.Debug.assert(diagnosticMessageText !== undefined && diagnosticMessageText !== null); - - var actualCount = args ? args.length : 0; - - var expectedCount = 1 + getLargestIndex(diagnosticKey); - - if (expectedCount !== actualCount) { - throw new Error(getLocalizedText(TypeScript.DiagnosticCode.Expected_0_arguments_to_message_got_1_instead, [expectedCount, actualCount])); - } - - var valueCount = 1 + getLargestIndex(diagnosticMessageText); - if (valueCount !== expectedCount) { - throw new Error(getLocalizedText(TypeScript.DiagnosticCode.Expected_the_message_0_to_have_1_arguments_but_it_had_2, [diagnosticMessageText, expectedCount, valueCount])); - } - - diagnosticMessageText = diagnosticMessageText.replace(/{(\d+)}/g, function (match, num) { - return typeof args[num] !== 'undefined' ? args[num] : match; - }); - - diagnosticMessageText = diagnosticMessageText.replace(/{(NL)}/g, function (match) { - return TypeScript.newLine(); - }); - - return diagnosticMessageText; - } - TypeScript.getLocalizedText = getLocalizedText; - - function getDiagnosticMessage(diagnosticKey, args) { - var diagnostic = getDiagnosticInfoFromKey(diagnosticKey); - var diagnosticMessageText = getLocalizedText(diagnosticKey, args); - - var message; - if (diagnostic.category === 1 /* Error */) { - message = getLocalizedText(TypeScript.DiagnosticCode.error_TS_0_1, [diagnostic.code, diagnosticMessageText]); - } else if (diagnostic.category === 0 /* Warning */) { - message = getLocalizedText(TypeScript.DiagnosticCode.warning_TS_0_1, [diagnostic.code, diagnosticMessageText]); - } else { - message = diagnosticMessageText; - } - - return message; - } - TypeScript.getDiagnosticMessage = getDiagnosticMessage; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Errors = (function () { - function Errors() { - } - Errors.argument = function (argument, message) { - return new Error("Invalid argument: " + argument + ". " + message); - }; - - Errors.argumentOutOfRange = function (argument) { - return new Error("Argument out of range: " + argument); - }; - - Errors.argumentNull = function (argument) { - return new Error("Argument null: " + argument); - }; - - Errors.abstract = function () { - return new Error("Operation not implemented properly by subclass."); - }; - - Errors.notYetImplemented = function () { - return new Error("Not yet implemented."); - }; - - Errors.invalidOperation = function (message) { - return new Error("Invalid operation: " + message); - }; - return Errors; - })(); - TypeScript.Errors = Errors; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Hash = (function () { - function Hash() { - } - Hash.computeFnv1aCharArrayHashCode = function (text, start, len) { - var hashCode = Hash.FNV_BASE; - var end = start + len; - - for (var i = start; i < end; i++) { - hashCode = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(hashCode ^ text[i], Hash.FNV_PRIME); - } - - return hashCode; - }; - - Hash.computeSimple31BitCharArrayHashCode = function (key, start, len) { - var hash = 0; - - for (var i = 0; i < len; i++) { - var ch = key[start + i]; - - hash = ((((hash << 5) - hash) | 0) + ch) | 0; - } - - return hash & 0x7FFFFFFF; - }; - - Hash.computeSimple31BitStringHashCode = function (key) { - var hash = 0; - - var start = 0; - var len = key.length; - - for (var i = 0; i < len; i++) { - var ch = key.charCodeAt(start + i); - - hash = ((((hash << 5) - hash) | 0) + ch) | 0; - } - - return hash & 0x7FFFFFFF; - }; - - Hash.computeMurmur2StringHashCode = function (key, seed) { - var m = 0x5bd1e995; - var r = 24; - - var numberOfCharsLeft = key.length; - var h = Math.abs(seed ^ numberOfCharsLeft); - - var index = 0; - while (numberOfCharsLeft >= 2) { - var c1 = key.charCodeAt(index); - var c2 = key.charCodeAt(index + 1); - - var k = Math.abs(c1 | (c2 << 16)); - - k = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(k, m); - k ^= k >> r; - k = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(k, m); - - h = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(h, m); - h ^= k; - - index += 2; - numberOfCharsLeft -= 2; - } - - if (numberOfCharsLeft === 1) { - h ^= key.charCodeAt(index); - h = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(h, m); - } - - h ^= h >> 13; - h = TypeScript.IntegerUtilities.integerMultiplyLow32Bits(h, m); - h ^= h >> 15; - - return h; - }; - - Hash.getPrime = function (min) { - for (var i = 0; i < Hash.primes.length; i++) { - var num = Hash.primes[i]; - if (num >= min) { - return num; - } - } - - throw TypeScript.Errors.notYetImplemented(); - }; - - Hash.expandPrime = function (oldSize) { - var num = oldSize << 1; - if (num > 2146435069 && 2146435069 > oldSize) { - return 2146435069; - } - return Hash.getPrime(num); - }; - - Hash.combine = function (value, currentHash) { - return (((currentHash << 5) + currentHash) + value) & 0x7FFFFFFF; - }; - Hash.FNV_BASE = 2166136261; - Hash.FNV_PRIME = 16777619; - - Hash.primes = [ - 3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, - 631, 761, 919, 1103, 1327, 1597, 1931, 2333, 2801, 3371, 4049, 4861, 5839, 7013, 8419, - 10103, 12143, 14591, 17519, 21023, 25229, 30293, 36353, 43627, 52361, 62851, 75431, - 90523, 108631, 130363, 156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, - 672827, 807403, 968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, - 4166287, 4999559, 5999471, 7199369]; - return Hash; - })(); - TypeScript.Hash = Hash; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Collections) { - Collections.DefaultHashTableCapacity = 1024; - - var HashTableEntry = (function () { - function HashTableEntry(Key, Value, HashCode, Next) { - this.Key = Key; - this.Value = Value; - this.HashCode = HashCode; - this.Next = Next; - } - return HashTableEntry; - })(); - - var HashTable = (function () { - function HashTable(capacity, hash) { - this.hash = hash; - this.count = 0; - var size = TypeScript.Hash.getPrime(capacity); - this.entries = TypeScript.ArrayUtilities.createArray(size, null); - } - HashTable.prototype.set = function (key, value) { - this.addOrSet(key, value, false); - }; - - HashTable.prototype.add = function (key, value) { - this.addOrSet(key, value, true); - }; - - HashTable.prototype.containsKey = function (key) { - var hashCode = this.computeHashCode(key); - var entry = this.findEntry(key, hashCode); - return entry !== null; - }; - - HashTable.prototype.get = function (key) { - var hashCode = this.computeHashCode(key); - var entry = this.findEntry(key, hashCode); - - return entry === null ? null : entry.Value; - }; - - HashTable.prototype.computeHashCode = function (key) { - var hashCode = this.hash === null ? key.hashCode : this.hash(key); - - hashCode = hashCode & 0x7FFFFFFF; - TypeScript.Debug.assert(hashCode >= 0); - - return hashCode; - }; - - HashTable.prototype.addOrSet = function (key, value, throwOnExistingEntry) { - var hashCode = this.computeHashCode(key); - - var entry = this.findEntry(key, hashCode); - if (entry !== null) { - if (throwOnExistingEntry) { - throw TypeScript.Errors.argument('key', "Key was already in table."); - } - - entry.Key = key; - entry.Value = value; - return; - } - - return this.addEntry(key, value, hashCode); - }; - - HashTable.prototype.findEntry = function (key, hashCode) { - for (var e = this.entries[hashCode % this.entries.length]; e !== null; e = e.Next) { - if (e.HashCode === hashCode && key === e.Key) { - return e; - } - } - - return null; - }; - - HashTable.prototype.addEntry = function (key, value, hashCode) { - var index = hashCode % this.entries.length; - - var e = new HashTableEntry(key, value, hashCode, this.entries[index]); - - this.entries[index] = e; - - if (this.count >= (this.entries.length / 2)) { - this.grow(); - } - - this.count++; - return e.Key; - }; - - HashTable.prototype.grow = function () { - var newSize = TypeScript.Hash.expandPrime(this.entries.length); - - var oldEntries = this.entries; - var newEntries = TypeScript.ArrayUtilities.createArray(newSize, null); - - this.entries = newEntries; - - for (var i = 0; i < oldEntries.length; i++) { - var e = oldEntries[i]; - - while (e !== null) { - var newIndex = e.HashCode % newSize; - var tmp = e.Next; - e.Next = newEntries[newIndex]; - newEntries[newIndex] = e; - e = tmp; - } - } - }; - return HashTable; - })(); - Collections.HashTable = HashTable; - - function createHashTable(capacity, hash) { - if (typeof capacity === "undefined") { capacity = Collections.DefaultHashTableCapacity; } - if (typeof hash === "undefined") { hash = null; } - return new HashTable(capacity, hash); - } - Collections.createHashTable = createHashTable; - - var currentHashCode = 1; - function identityHashCode(value) { - if (value.__hash === undefined) { - value.__hash = currentHashCode; - currentHashCode++; - } - - return value.__hash; - } - Collections.identityHashCode = identityHashCode; - })(TypeScript.Collections || (TypeScript.Collections = {})); - var Collections = TypeScript.Collections; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - TypeScript.nodeMakeDirectoryTime = 0; - TypeScript.nodeCreateBufferTime = 0; - TypeScript.nodeWriteFileSyncTime = 0; - - (function (ByteOrderMark) { - ByteOrderMark[ByteOrderMark["None"] = 0] = "None"; - ByteOrderMark[ByteOrderMark["Utf8"] = 1] = "Utf8"; - ByteOrderMark[ByteOrderMark["Utf16BigEndian"] = 2] = "Utf16BigEndian"; - ByteOrderMark[ByteOrderMark["Utf16LittleEndian"] = 3] = "Utf16LittleEndian"; - })(TypeScript.ByteOrderMark || (TypeScript.ByteOrderMark = {})); - var ByteOrderMark = TypeScript.ByteOrderMark; - - var FileInformation = (function () { - function FileInformation(contents, byteOrderMark) { - this.contents = contents; - this.byteOrderMark = byteOrderMark; - } - return FileInformation; - })(); - TypeScript.FileInformation = FileInformation; - - TypeScript.Environment = (function () { - function getWindowsScriptHostEnvironment() { - try { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - } catch (e) { - return null; - } - - var streamObjectPool = []; - - function getStreamObject() { - if (streamObjectPool.length > 0) { - return streamObjectPool.pop(); - } else { - return new ActiveXObject("ADODB.Stream"); - } - } - - function releaseStreamObject(obj) { - streamObjectPool.push(obj); - } - - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - - return { - newLine: "\r\n", - currentDirectory: function () { - return WScript.CreateObject("WScript.Shell").CurrentDirectory; - }, - supportsCodePage: function () { - return WScript.ReadFile; - }, - readFile: function (path, codepage) { - try { - if (codepage !== null && this.supportsCodePage()) { - try { - var contents = WScript.ReadFile(path, codepage); - return new FileInformation(contents, 0 /* None */); - } catch (e) { - } - } - - var streamObj = getStreamObject(); - streamObj.Open(); - streamObj.Type = 2; - - streamObj.Charset = 'x-ansi'; - - streamObj.LoadFromFile(path); - var bomChar = streamObj.ReadText(2); - - streamObj.Position = 0; - - var byteOrderMark = 0 /* None */; - - if (bomChar.charCodeAt(0) === 0xFE && bomChar.charCodeAt(1) === 0xFF) { - streamObj.Charset = 'unicode'; - byteOrderMark = 2 /* Utf16BigEndian */; - } else if (bomChar.charCodeAt(0) === 0xFF && bomChar.charCodeAt(1) === 0xFE) { - streamObj.Charset = 'unicode'; - byteOrderMark = 3 /* Utf16LittleEndian */; - } else if (bomChar.charCodeAt(0) === 0xEF && bomChar.charCodeAt(1) === 0xBB) { - streamObj.Charset = 'utf-8'; - byteOrderMark = 1 /* Utf8 */; - } else { - streamObj.Charset = 'utf-8'; - } - - var contents = streamObj.ReadText(-1); - streamObj.Close(); - releaseStreamObject(streamObj); - return new FileInformation(contents, byteOrderMark); - } catch (err) { - var message; - if (err.number === -2147024809) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Unsupported_file_encoding, null); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Cannot_read_file_0_1, [path, err.message]); - } - - throw new Error(message); - } - }, - writeFile: function (path, contents, writeByteOrderMark) { - var textStream = getStreamObject(); - textStream.Charset = 'utf-8'; - textStream.Open(); - textStream.WriteText(contents, 0); - - if (!writeByteOrderMark) { - textStream.Position = 3; - } else { - textStream.Position = 0; - } - - var fileStream = getStreamObject(); - fileStream.Type = 1; - fileStream.Open(); - - textStream.CopyTo(fileStream); - - fileStream.Flush(); - fileStream.SaveToFile(path, 2); - fileStream.Close(); - - textStream.Flush(); - textStream.Close(); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - deleteFile: function (path) { - if (fso.FileExists(path)) { - fso.DeleteFile(path, true); - } - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - listFiles: function (path, spec, options) { - options = options || {}; - function filesInFolder(folder, root) { - var paths = []; - var fc; - - if (options.recursive) { - fc = new Enumerator(folder.subfolders); - - for (; !fc.atEnd(); fc.moveNext()) { - paths = paths.concat(filesInFolder(fc.item(), root + "\\" + fc.item().Name)); - } - } - - fc = new Enumerator(folder.files); - - for (; !fc.atEnd(); fc.moveNext()) { - if (!spec || fc.item().Name.match(spec)) { - paths.push(root + "\\" + fc.item().Name); - } - } - - return paths; - } - - var folder = fso.GetFolder(path); - var paths = []; - - return filesInFolder(folder, path); - }, - arguments: args, - standardOut: WScript.StdOut - }; - } - ; - - function getNodeEnvironment() { - var _fs = require('fs'); - var _path = require('path'); - var _module = require('module'); - var _os = require('os'); - - return { - newLine: _os.EOL, - currentDirectory: function () { - return process.cwd(); - }, - supportsCodePage: function () { - return false; - }, - readFile: function (file, codepage) { - if (codepage !== null) { - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.codepage_option_not_supported_on_current_platform, null)); - } - - var buffer = _fs.readFileSync(file); - switch (buffer[0]) { - case 0xFE: - if (buffer[1] === 0xFF) { - var i = 0; - while ((i + 1) < buffer.length) { - var temp = buffer[i]; - buffer[i] = buffer[i + 1]; - buffer[i + 1] = temp; - i += 2; - } - return new FileInformation(buffer.toString("ucs2", 2), 2 /* Utf16BigEndian */); - } - break; - case 0xFF: - if (buffer[1] === 0xFE) { - return new FileInformation(buffer.toString("ucs2", 2), 3 /* Utf16LittleEndian */); - } - break; - case 0xEF: - if (buffer[1] === 0xBB) { - return new FileInformation(buffer.toString("utf8", 3), 1 /* Utf8 */); - } - } - - return new FileInformation(buffer.toString("utf8", 0), 0 /* None */); - }, - writeFile: function (path, contents, writeByteOrderMark) { - function mkdirRecursiveSync(path) { - var stats = _fs.statSync(path); - if (stats.isFile()) { - throw "\"" + path + "\" exists but isn't a directory."; - } else if (stats.isDirectory()) { - return; - } else { - mkdirRecursiveSync(_path.dirname(path)); - _fs.mkdirSync(path, 509); - } - } - var start = new Date().getTime(); - mkdirRecursiveSync(_path.dirname(path)); - TypeScript.nodeMakeDirectoryTime += new Date().getTime() - start; - - if (writeByteOrderMark) { - contents = '\uFEFF' + contents; - } - - var start = new Date().getTime(); - - var chunkLength = 4 * 1024; - var fileDescriptor = _fs.openSync(path, "w"); - try { - for (var index = 0; index < contents.length; index += chunkLength) { - var bufferStart = new Date().getTime(); - var buffer = new Buffer(contents.substr(index, chunkLength), "utf8"); - TypeScript.nodeCreateBufferTime += new Date().getTime() - bufferStart; - - _fs.writeSync(fileDescriptor, buffer, 0, buffer.length, null); - } - } finally { - _fs.closeSync(fileDescriptor); - } - - TypeScript.nodeWriteFileSyncTime += new Date().getTime() - start; - }, - fileExists: function (path) { - return _fs.existsSync(path); - }, - deleteFile: function (path) { - try { - _fs.unlinkSync(path); - } catch (e) { - } - }, - directoryExists: function (path) { - return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); - }, - listFiles: function dir(path, spec, options) { - options = options || {}; - - function filesInFolder(folder) { - var paths = []; - - var files = _fs.readdirSync(folder); - for (var i = 0; i < files.length; i++) { - var stat = _fs.statSync(folder + "\\" + files[i]); - if (options.recursive && stat.isDirectory()) { - paths = paths.concat(filesInFolder(folder + "\\" + files[i])); - } else if (stat.isFile() && (!spec || files[i].match(spec))) { - paths.push(folder + "\\" + files[i]); - } - } - - return paths; - } - - return filesInFolder(path); - }, - arguments: process.argv.slice(2), - standardOut: { - Write: function (str) { - process.stdout.write(str); - }, - WriteLine: function (str) { - process.stdout.write(str + '\n'); - }, - Close: function () { - } - } - }; - } - ; - - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - return getWindowsScriptHostEnvironment(); - } else if (typeof module !== 'undefined' && module.exports) { - return getNodeEnvironment(); - } else { - return null; - } - })(); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (IntegerUtilities) { - function integerDivide(numerator, denominator) { - return (numerator / denominator) >> 0; - } - IntegerUtilities.integerDivide = integerDivide; - - function integerMultiplyLow32Bits(n1, n2) { - var n1Low16 = n1 & 0x0000ffff; - var n1High16 = n1 >>> 16; - - var n2Low16 = n2 & 0x0000ffff; - var n2High16 = n2 >>> 16; - - var resultLow32 = (((n1 & 0xffff0000) * n2) >>> 0) + (((n1 & 0x0000ffff) * n2) >>> 0) >>> 0; - return resultLow32; - } - IntegerUtilities.integerMultiplyLow32Bits = integerMultiplyLow32Bits; - - function integerMultiplyHigh32Bits(n1, n2) { - var n1Low16 = n1 & 0x0000ffff; - var n1High16 = n1 >>> 16; - - var n2Low16 = n2 & 0x0000ffff; - var n2High16 = n2 >>> 16; - - var resultHigh32 = n1High16 * n2High16 + ((((n1Low16 * n2Low16) >>> 17) + n1Low16 * n2High16) >>> 15); - return resultHigh32; - } - IntegerUtilities.integerMultiplyHigh32Bits = integerMultiplyHigh32Bits; - - function isInteger(text) { - return /^[0-9]+$/.test(text); - } - IntegerUtilities.isInteger = isInteger; - - function isHexInteger(text) { - return /^0(x|X)[0-9a-fA-F]+$/.test(text); - } - IntegerUtilities.isHexInteger = isHexInteger; - })(TypeScript.IntegerUtilities || (TypeScript.IntegerUtilities = {})); - var IntegerUtilities = TypeScript.IntegerUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineMap = (function () { - function LineMap(_computeLineStarts, length) { - this._computeLineStarts = _computeLineStarts; - this.length = length; - this._lineStarts = null; - } - LineMap.prototype.toJSON = function (key) { - return { lineStarts: this.lineStarts(), length: this.length }; - }; - - LineMap.prototype.equals = function (other) { - return this.length === other.length && TypeScript.ArrayUtilities.sequenceEquals(this.lineStarts(), other.lineStarts(), function (v1, v2) { - return v1 === v2; - }); - }; - - LineMap.prototype.lineStarts = function () { - if (this._lineStarts === null) { - this._lineStarts = this._computeLineStarts(); - } - - return this._lineStarts; - }; - - LineMap.prototype.lineCount = function () { - return this.lineStarts().length; - }; - - LineMap.prototype.getPosition = function (line, character) { - return this.lineStarts()[line] + character; - }; - - LineMap.prototype.getLineNumberFromPosition = function (position) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - if (position === this.length) { - return this.lineCount() - 1; - } - - var lineNumber = TypeScript.ArrayUtilities.binarySearch(this.lineStarts(), position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; - } - - return lineNumber; - }; - - LineMap.prototype.getLineStartPosition = function (lineNumber) { - return this.lineStarts()[lineNumber]; - }; - - LineMap.prototype.fillLineAndCharacterFromPosition = function (position, lineAndCharacter) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - var lineNumber = this.getLineNumberFromPosition(position); - lineAndCharacter.line = lineNumber; - lineAndCharacter.character = position - this.lineStarts()[lineNumber]; - }; - - LineMap.prototype.getLineAndCharacterFromPosition = function (position) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - var lineNumber = this.getLineNumberFromPosition(position); - - return new TypeScript.LineAndCharacter(lineNumber, position - this.lineStarts()[lineNumber]); - }; - LineMap.empty = new LineMap(function () { - return [0]; - }, 0); - return LineMap; - })(); - TypeScript.LineMap = LineMap; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineAndCharacter = (function () { - function LineAndCharacter(line, character) { - this._line = 0; - this._character = 0; - if (line < 0) { - throw TypeScript.Errors.argumentOutOfRange("line"); - } - - if (character < 0) { - throw TypeScript.Errors.argumentOutOfRange("character"); - } - - this._line = line; - this._character = character; - } - LineAndCharacter.prototype.line = function () { - return this._line; - }; - - LineAndCharacter.prototype.character = function () { - return this._character; - }; - return LineAndCharacter; - })(); - TypeScript.LineAndCharacter = LineAndCharacter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var MathPrototype = (function () { - function MathPrototype() { - } - MathPrototype.max = function (a, b) { - return a >= b ? a : b; - }; - - MathPrototype.min = function (a, b) { - return a <= b ? a : b; - }; - return MathPrototype; - })(); - TypeScript.MathPrototype = MathPrototype; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Collections) { - Collections.DefaultStringTableCapacity = 256; - - var StringTableEntry = (function () { - function StringTableEntry(Text, HashCode, Next) { - this.Text = Text; - this.HashCode = HashCode; - this.Next = Next; - } - return StringTableEntry; - })(); - - var StringTable = (function () { - function StringTable(capacity) { - this.count = 0; - var size = TypeScript.Hash.getPrime(capacity); - this.entries = TypeScript.ArrayUtilities.createArray(size, null); - } - StringTable.prototype.addCharArray = function (key, start, len) { - var hashCode = TypeScript.Hash.computeSimple31BitCharArrayHashCode(key, start, len) & 0x7FFFFFFF; - - var entry = this.findCharArrayEntry(key, start, len, hashCode); - if (entry !== null) { - return entry.Text; - } - - var slice = key.slice(start, start + len); - return this.addEntry(TypeScript.StringUtilities.fromCharCodeArray(slice), hashCode); - }; - - StringTable.prototype.findCharArrayEntry = function (key, start, len, hashCode) { - for (var e = this.entries[hashCode % this.entries.length]; e !== null; e = e.Next) { - if (e.HashCode === hashCode && StringTable.textCharArrayEquals(e.Text, key, start, len)) { - return e; - } - } - - return null; - }; - - StringTable.prototype.addEntry = function (text, hashCode) { - var index = hashCode % this.entries.length; - - var e = new StringTableEntry(text, hashCode, this.entries[index]); - - this.entries[index] = e; - - if (this.count === this.entries.length) { - this.grow(); - } - - this.count++; - return e.Text; - }; - - StringTable.prototype.grow = function () { - var newSize = TypeScript.Hash.expandPrime(this.entries.length); - - var oldEntries = this.entries; - var newEntries = TypeScript.ArrayUtilities.createArray(newSize, null); - - this.entries = newEntries; - - for (var i = 0; i < oldEntries.length; i++) { - var e = oldEntries[i]; - while (e !== null) { - var newIndex = e.HashCode % newSize; - var tmp = e.Next; - e.Next = newEntries[newIndex]; - newEntries[newIndex] = e; - e = tmp; - } - } - }; - - StringTable.textCharArrayEquals = function (text, array, start, length) { - if (text.length !== length) { - return false; - } - - var s = start; - for (var i = 0; i < length; i++) { - if (text.charCodeAt(i) !== array[s]) { - return false; - } - - s++; - } - - return true; - }; - return StringTable; - })(); - Collections.StringTable = StringTable; - - Collections.DefaultStringTable = new StringTable(Collections.DefaultStringTableCapacity); - })(TypeScript.Collections || (TypeScript.Collections = {})); - var Collections = TypeScript.Collections; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var StringUtilities = (function () { - function StringUtilities() { - } - StringUtilities.isString = function (value) { - return Object.prototype.toString.apply(value, []) === '[object String]'; - }; - - StringUtilities.fromCharCodeArray = function (array) { - return String.fromCharCode.apply(null, array); - }; - - StringUtilities.endsWith = function (string, value) { - return string.substring(string.length - value.length, string.length) === value; - }; - - StringUtilities.startsWith = function (string, value) { - return string.substr(0, value.length) === value; - }; - - StringUtilities.copyTo = function (source, sourceIndex, destination, destinationIndex, count) { - for (var i = 0; i < count; i++) { - destination[destinationIndex + i] = source.charCodeAt(sourceIndex + i); - } - }; - - StringUtilities.repeat = function (value, count) { - return Array(count + 1).join(value); - }; - - StringUtilities.stringEquals = function (val1, val2) { - return val1 === val2; - }; - return StringUtilities; - })(); - TypeScript.StringUtilities = StringUtilities; -})(TypeScript || (TypeScript = {})); -var global = Function("return this").call(null); - -var TypeScript; -(function (TypeScript) { - var Clock; - (function (Clock) { - Clock.now; - Clock.resolution; - - if (typeof WScript !== "undefined" && typeof global['WScript'].InitializeProjection !== "undefined") { - global['WScript'].InitializeProjection(); - - Clock.now = function () { - return TestUtilities.QueryPerformanceCounter(); - }; - - Clock.resolution = TestUtilities.QueryPerformanceFrequency(); - } else { - Clock.now = function () { - return Date.now(); - }; - - Clock.resolution = 1000; - } - })(Clock || (Clock = {})); - - var Timer = (function () { - function Timer() { - this.time = 0; - } - Timer.prototype.start = function () { - this.time = 0; - this.startTime = Clock.now(); - }; - - Timer.prototype.end = function () { - this.time = (Clock.now() - this.startTime); - }; - return Timer; - })(); - TypeScript.Timer = Timer; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (DiagnosticCategory) { - DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; - DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; - DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; - DiagnosticCategory[DiagnosticCategory["NoPrefix"] = 3] = "NoPrefix"; - })(TypeScript.DiagnosticCategory || (TypeScript.DiagnosticCategory = {})); - var DiagnosticCategory = TypeScript.DiagnosticCategory; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.diagnosticInformationMap = { - "error TS{0}: {1}": { - "code": 0, - "category": 3 /* NoPrefix */ - }, - "warning TS{0}: {1}": { - "code": 1, - "category": 3 /* NoPrefix */ - }, - "Unrecognized escape sequence.": { - "code": 1000, - "category": 1 /* Error */ - }, - "Unexpected character {0}.": { - "code": 1001, - "category": 1 /* Error */ - }, - "Missing close quote character.": { - "code": 1002, - "category": 1 /* Error */ - }, - "Identifier expected.": { - "code": 1003, - "category": 1 /* Error */ - }, - "'{0}' keyword expected.": { - "code": 1004, - "category": 1 /* Error */ - }, - "'{0}' expected.": { - "code": 1005, - "category": 1 /* Error */ - }, - "Identifier expected; '{0}' is a keyword.": { - "code": 1006, - "category": 1 /* Error */ - }, - "Automatic semicolon insertion not allowed.": { - "code": 1007, - "category": 1 /* Error */ - }, - "Unexpected token; '{0}' expected.": { - "code": 1008, - "category": 1 /* Error */ - }, - "Trailing separator not allowed.": { - "code": 1009, - "category": 1 /* Error */ - }, - "'*/' expected.": { - "code": 1010, - "category": 1 /* Error */ - }, - "'public' or 'private' modifier must precede 'static'.": { - "code": 1011, - "category": 1 /* Error */ - }, - "Unexpected token.": { - "code": 1012, - "category": 1 /* Error */ - }, - "Catch clause parameter cannot have a type annotation.": { - "code": 1013, - "category": 1 /* Error */ - }, - "Rest parameter must be last in list.": { - "code": 1014, - "category": 1 /* Error */ - }, - "Parameter cannot have question mark and initializer.": { - "code": 1015, - "category": 1 /* Error */ - }, - "Required parameter cannot follow optional parameter.": { - "code": 1016, - "category": 1 /* Error */ - }, - "Index signatures cannot have rest parameters.": { - "code": 1017, - "category": 1 /* Error */ - }, - "Index signature parameter cannot have accessibility modifiers.": { - "code": 1018, - "category": 1 /* Error */ - }, - "Index signature parameter cannot have a question mark.": { - "code": 1019, - "category": 1 /* Error */ - }, - "Index signature parameter cannot have an initializer.": { - "code": 1020, - "category": 1 /* Error */ - }, - "Index signature must have a type annotation.": { - "code": 1021, - "category": 1 /* Error */ - }, - "Index signature parameter must have a type annotation.": { - "code": 1022, - "category": 1 /* Error */ - }, - "Index signature parameter type must be 'string' or 'number'.": { - "code": 1023, - "category": 1 /* Error */ - }, - "'extends' clause already seen.": { - "code": 1024, - "category": 1 /* Error */ - }, - "'extends' clause must precede 'implements' clause.": { - "code": 1025, - "category": 1 /* Error */ - }, - "Classes can only extend a single class.": { - "code": 1026, - "category": 1 /* Error */ - }, - "'implements' clause already seen.": { - "code": 1027, - "category": 1 /* Error */ - }, - "Accessibility modifier already seen.": { - "code": 1028, - "category": 1 /* Error */ - }, - "'{0}' modifier must precede '{1}' modifier.": { - "code": 1029, - "category": 1 /* Error */ - }, - "'{0}' modifier already seen.": { - "code": 1030, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a class element.": { - "code": 1031, - "category": 1 /* Error */ - }, - "Interface declaration cannot have 'implements' clause.": { - "code": 1032, - "category": 1 /* Error */ - }, - "'super' invocation cannot have type arguments.": { - "code": 1034, - "category": 1 /* Error */ - }, - "Only ambient modules can use quoted names.": { - "code": 1035, - "category": 1 /* Error */ - }, - "Statements are not allowed in ambient contexts.": { - "code": 1036, - "category": 1 /* Error */ - }, - "Implementations are not allowed in ambient contexts.": { - "code": 1037, - "category": 1 /* Error */ - }, - "'declare' modifier not allowed for code already in an ambient context.": { - "code": 1038, - "category": 1 /* Error */ - }, - "Initializers are not allowed in ambient contexts.": { - "code": 1039, - "category": 1 /* Error */ - }, - "Parameter property declarations can only be used in a non-ambient constructor declaration.": { - "code": 1040, - "category": 1 /* Error */ - }, - "Function implementation expected.": { - "code": 1041, - "category": 1 /* Error */ - }, - "Constructor implementation expected.": { - "code": 1042, - "category": 1 /* Error */ - }, - "Function overload name must be '{0}'.": { - "code": 1043, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a module element.": { - "code": 1044, - "category": 1 /* Error */ - }, - "'declare' modifier cannot appear on an interface declaration.": { - "code": 1045, - "category": 1 /* Error */ - }, - "'declare' modifier required for top level element.": { - "code": 1046, - "category": 1 /* Error */ - }, - "Rest parameter cannot be optional.": { - "code": 1047, - "category": 1 /* Error */ - }, - "Rest parameter cannot have an initializer.": { - "code": 1048, - "category": 1 /* Error */ - }, - "'set' accessor must have one and only one parameter.": { - "code": 1049, - "category": 1 /* Error */ - }, - "'set' accessor parameter cannot be optional.": { - "code": 1051, - "category": 1 /* Error */ - }, - "'set' accessor parameter cannot have an initializer.": { - "code": 1052, - "category": 1 /* Error */ - }, - "'set' accessor cannot have rest parameter.": { - "code": 1053, - "category": 1 /* Error */ - }, - "'get' accessor cannot have parameters.": { - "code": 1054, - "category": 1 /* Error */ - }, - "Modifiers cannot appear here.": { - "code": 1055, - "category": 1 /* Error */ - }, - "Accessors are only available when targeting ECMAScript 5 and higher.": { - "code": 1056, - "category": 1 /* Error */ - }, - "Class name cannot be '{0}'.": { - "code": 1057, - "category": 1 /* Error */ - }, - "Interface name cannot be '{0}'.": { - "code": 1058, - "category": 1 /* Error */ - }, - "Enum name cannot be '{0}'.": { - "code": 1059, - "category": 1 /* Error */ - }, - "Module name cannot be '{0}'.": { - "code": 1060, - "category": 1 /* Error */ - }, - "Enum member must have initializer.": { - "code": 1061, - "category": 1 /* Error */ - }, - "Export assignment cannot be used in internal modules.": { - "code": 1063, - "category": 1 /* Error */ - }, - "Export assignment not allowed in module with exported element.": { - "code": 1064, - "category": 1 /* Error */ - }, - "Module cannot have multiple export assignments.": { - "code": 1065, - "category": 1 /* Error */ - }, - "Ambient enum elements can only have integer literal initializers.": { - "code": 1066, - "category": 1 /* Error */ - }, - "module, class, interface, enum, import or statement": { - "code": 1067, - "category": 3 /* NoPrefix */ - }, - "constructor, function, accessor or variable": { - "code": 1068, - "category": 3 /* NoPrefix */ - }, - "statement": { - "code": 1069, - "category": 3 /* NoPrefix */ - }, - "case or default clause": { - "code": 1070, - "category": 3 /* NoPrefix */ - }, - "identifier": { - "code": 1071, - "category": 3 /* NoPrefix */ - }, - "call, construct, index, property or function signature": { - "code": 1072, - "category": 3 /* NoPrefix */ - }, - "expression": { - "code": 1073, - "category": 3 /* NoPrefix */ - }, - "type name": { - "code": 1074, - "category": 3 /* NoPrefix */ - }, - "property or accessor": { - "code": 1075, - "category": 3 /* NoPrefix */ - }, - "parameter": { - "code": 1076, - "category": 3 /* NoPrefix */ - }, - "type": { - "code": 1077, - "category": 3 /* NoPrefix */ - }, - "type parameter": { - "code": 1078, - "category": 3 /* NoPrefix */ - }, - "'declare' modifier not allowed on import declaration.": { - "code": 1079, - "category": 1 /* Error */ - }, - "Function overload must be static.": { - "code": 1080, - "category": 1 /* Error */ - }, - "Function overload must not be static.": { - "code": 1081, - "category": 1 /* Error */ - }, - "Parameter property declarations cannot be used in a constructor overload.": { - "code": 1083, - "category": 1 /* Error */ - }, - "Invalid 'reference' directive syntax.": { - "code": 1084, - "category": 1 /* Error */ - }, - "Octal literals are not available when targeting ECMAScript 5 and higher.": { - "code": 1085, - "category": 1 /* Error */ - }, - "Accessors are not allowed in ambient contexts.": { - "code": 1086, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a constructor declaration.": { - "code": 1089, - "category": 1 /* Error */ - }, - "'{0}' modifier cannot appear on a parameter.": { - "code": 1090, - "category": 1 /* Error */ - }, - "Only a single variable declaration is allowed in a 'for...in' statement.": { - "code": 1091, - "category": 1 /* Error */ - }, - "Type parameters cannot appear on a constructor declaration.": { - "code": 1091, - "category": 1 /* Error */ - }, - "Type annotation cannot appear on a constructor declaration.": { - "code": 1092, - "category": 1 /* Error */ - }, - "Duplicate identifier '{0}'.": { - "code": 2000, - "category": 1 /* Error */ - }, - "The name '{0}' does not exist in the current scope.": { - "code": 2001, - "category": 1 /* Error */ - }, - "The name '{0}' does not refer to a value.": { - "code": 2002, - "category": 1 /* Error */ - }, - "'super' can only be used inside a class instance method.": { - "code": 2003, - "category": 1 /* Error */ - }, - "The left-hand side of an assignment expression must be a variable, property or indexer.": { - "code": 2004, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not callable. Did you mean to include 'new'?": { - "code": 2161, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not callable.": { - "code": 2006, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not newable.": { - "code": 2007, - "category": 1 /* Error */ - }, - "Value of type '{0}' is not indexable by type '{1}'.": { - "code": 2008, - "category": 1 /* Error */ - }, - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": { - "code": 2009, - "category": 1 /* Error */ - }, - "Operator '{0}' cannot be applied to types '{1}' and '{2}': {3}": { - "code": 2010, - "category": 1 /* Error */ - }, - "Cannot convert '{0}' to '{1}'.": { - "code": 2011, - "category": 1 /* Error */ - }, - "Cannot convert '{0}' to '{1}':{NL}{2}": { - "code": 2012, - "category": 1 /* Error */ - }, - "Expected var, class, interface, or module.": { - "code": 2013, - "category": 1 /* Error */ - }, - "Operator '{0}' cannot be applied to type '{1}'.": { - "code": 2014, - "category": 1 /* Error */ - }, - "Getter '{0}' already declared.": { - "code": 2015, - "category": 1 /* Error */ - }, - "Setter '{0}' already declared.": { - "code": 2016, - "category": 1 /* Error */ - }, - "Exported class '{0}' extends private class '{1}'.": { - "code": 2018, - "category": 1 /* Error */ - }, - "Exported class '{0}' implements private interface '{1}'.": { - "code": 2019, - "category": 1 /* Error */ - }, - "Exported interface '{0}' extends private interface '{1}'.": { - "code": 2020, - "category": 1 /* Error */ - }, - "Exported class '{0}' extends class from inaccessible module {1}.": { - "code": 2021, - "category": 1 /* Error */ - }, - "Exported class '{0}' implements interface from inaccessible module {1}.": { - "code": 2022, - "category": 1 /* Error */ - }, - "Exported interface '{0}' extends interface from inaccessible module {1}.": { - "code": 2023, - "category": 1 /* Error */ - }, - "Public static property '{0}' of exported class has or is using private type '{1}'.": { - "code": 2024, - "category": 1 /* Error */ - }, - "Public property '{0}' of exported class has or is using private type '{1}'.": { - "code": 2025, - "category": 1 /* Error */ - }, - "Property '{0}' of exported interface has or is using private type '{1}'.": { - "code": 2026, - "category": 1 /* Error */ - }, - "Exported variable '{0}' has or is using private type '{1}'.": { - "code": 2027, - "category": 1 /* Error */ - }, - "Public static property '{0}' of exported class is using inaccessible module {1}.": { - "code": 2028, - "category": 1 /* Error */ - }, - "Public property '{0}' of exported class is using inaccessible module {1}.": { - "code": 2029, - "category": 1 /* Error */ - }, - "Property '{0}' of exported interface is using inaccessible module {1}.": { - "code": 2030, - "category": 1 /* Error */ - }, - "Exported variable '{0}' is using inaccessible module {1}.": { - "code": 2031, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": { - "code": 2032, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": { - "code": 2033, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": { - "code": 2034, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": { - "code": 2035, - "category": 1 /* Error */ - }, - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": { - "code": 2036, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": { - "code": 2037, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": { - "code": 2038, - "category": 1 /* Error */ - }, - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": { - "code": 2039, - "category": 1 /* Error */ - }, - "Parameter '{0}' of exported function has or is using private type '{1}'.": { - "code": 2040, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": { - "code": 2041, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": { - "code": 2042, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": { - "code": 2043, - "category": 1 /* Error */ - }, - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": { - "code": 2044, - "category": 1 /* Error */ - }, - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": { - "code": 2045, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": { - "code": 2046, - "category": 1 /* Error */ - }, - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": { - "code": 2047, - "category": 1 /* Error */ - }, - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": { - "code": 2048, - "category": 1 /* Error */ - }, - "Parameter '{0}' of exported function is using inaccessible module {1}.": { - "code": 2049, - "category": 1 /* Error */ - }, - "Return type of public static property getter from exported class has or is using private type '{0}'.": { - "code": 2050, - "category": 1 /* Error */ - }, - "Return type of public property getter from exported class has or is using private type '{0}'.": { - "code": 2051, - "category": 1 /* Error */ - }, - "Return type of constructor signature from exported interface has or is using private type '{0}'.": { - "code": 2052, - "category": 1 /* Error */ - }, - "Return type of call signature from exported interface has or is using private type '{0}'.": { - "code": 2053, - "category": 1 /* Error */ - }, - "Return type of index signature from exported interface has or is using private type '{0}'.": { - "code": 2054, - "category": 1 /* Error */ - }, - "Return type of public static method from exported class has or is using private type '{0}'.": { - "code": 2055, - "category": 1 /* Error */ - }, - "Return type of public method from exported class has or is using private type '{0}'.": { - "code": 2056, - "category": 1 /* Error */ - }, - "Return type of method from exported interface has or is using private type '{0}'.": { - "code": 2057, - "category": 1 /* Error */ - }, - "Return type of exported function has or is using private type '{0}'.": { - "code": 2058, - "category": 1 /* Error */ - }, - "Return type of public static property getter from exported class is using inaccessible module {0}.": { - "code": 2059, - "category": 1 /* Error */ - }, - "Return type of public property getter from exported class is using inaccessible module {0}.": { - "code": 2060, - "category": 1 /* Error */ - }, - "Return type of constructor signature from exported interface is using inaccessible module {0}.": { - "code": 2061, - "category": 1 /* Error */ - }, - "Return type of call signature from exported interface is using inaccessible module {0}.": { - "code": 2062, - "category": 1 /* Error */ - }, - "Return type of index signature from exported interface is using inaccessible module {0}.": { - "code": 2063, - "category": 1 /* Error */ - }, - "Return type of public static method from exported class is using inaccessible module {0}.": { - "code": 2064, - "category": 1 /* Error */ - }, - "Return type of public method from exported class is using inaccessible module {0}.": { - "code": 2065, - "category": 1 /* Error */ - }, - "Return type of method from exported interface is using inaccessible module {0}.": { - "code": 2066, - "category": 1 /* Error */ - }, - "Return type of exported function is using inaccessible module {0}.": { - "code": 2067, - "category": 1 /* Error */ - }, - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": { - "code": 2068, - "category": 1 /* Error */ - }, - "A parameter list must follow a generic type argument list. '(' expected.": { - "code": 2069, - "category": 1 /* Error */ - }, - "Multiple constructor implementations are not allowed.": { - "code": 2070, - "category": 1 /* Error */ - }, - "Unable to resolve external module '{0}'.": { - "code": 2071, - "category": 1 /* Error */ - }, - "Module cannot be aliased to a non-module type.": { - "code": 2072, - "category": 1 /* Error */ - }, - "A class may only extend another class.": { - "code": 2073, - "category": 1 /* Error */ - }, - "A class may only implement another class or interface.": { - "code": 2074, - "category": 1 /* Error */ - }, - "An interface may only extend another class or interface.": { - "code": 2075, - "category": 1 /* Error */ - }, - "Unable to resolve type.": { - "code": 2077, - "category": 1 /* Error */ - }, - "Unable to resolve type of '{0}'.": { - "code": 2078, - "category": 1 /* Error */ - }, - "Unable to resolve type parameter constraint.": { - "code": 2079, - "category": 1 /* Error */ - }, - "Type parameter constraint cannot be a primitive type.": { - "code": 2080, - "category": 1 /* Error */ - }, - "Supplied parameters do not match any signature of call target.": { - "code": 2081, - "category": 1 /* Error */ - }, - "Supplied parameters do not match any signature of call target:{NL}{0}": { - "code": 2082, - "category": 1 /* Error */ - }, - "Invalid 'new' expression.": { - "code": 2083, - "category": 1 /* Error */ - }, - "Call signatures used in a 'new' expression must have a 'void' return type.": { - "code": 2084, - "category": 1 /* Error */ - }, - "Could not select overload for 'new' expression.": { - "code": 2085, - "category": 1 /* Error */ - }, - "Type '{0}' does not satisfy the constraint '{1}' for type parameter '{2}'.": { - "code": 2086, - "category": 1 /* Error */ - }, - "Could not select overload for 'call' expression.": { - "code": 2087, - "category": 1 /* Error */ - }, - "Cannot invoke an expression whose type lacks a call signature.": { - "code": 2088, - "category": 1 /* Error */ - }, - "Calls to 'super' are only valid inside a class.": { - "code": 2089, - "category": 1 /* Error */ - }, - "Generic type '{0}' requires {1} type argument(s).": { - "code": 2090, - "category": 1 /* Error */ - }, - "Type of array literal cannot be determined. Best common type could not be found for array elements.": { - "code": 2092, - "category": 1 /* Error */ - }, - "Could not find enclosing symbol for dotted name '{0}'.": { - "code": 2093, - "category": 1 /* Error */ - }, - "The property '{0}' does not exist on value of type '{1}'.": { - "code": 2094, - "category": 1 /* Error */ - }, - "Could not find symbol '{0}'.": { - "code": 2095, - "category": 1 /* Error */ - }, - "'get' and 'set' accessor must have the same type.": { - "code": 2096, - "category": 1 /* Error */ - }, - "'this' cannot be referenced in current location.": { - "code": 2097, - "category": 1 /* Error */ - }, - "Static members cannot reference class type parameters.": { - "code": 2099, - "category": 1 /* Error */ - }, - "Class '{0}' is recursively referenced as a base type of itself.": { - "code": 2100, - "category": 1 /* Error */ - }, - "Interface '{0}' is recursively referenced as a base type of itself.": { - "code": 2101, - "category": 1 /* Error */ - }, - "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.": { - "code": 2102, - "category": 1 /* Error */ - }, - "'super' cannot be referenced in non-derived classes.": { - "code": 2103, - "category": 1 /* Error */ - }, - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": { - "code": 2104, - "category": 1 /* Error */ - }, - "Constructors for derived classes must contain a 'super' call.": { - "code": 2105, - "category": 1 /* Error */ - }, - "Super calls are not permitted outside constructors or in nested functions inside constructors.": { - "code": 2106, - "category": 1 /* Error */ - }, - "'{0}.{1}' is inaccessible.": { - "code": 2107, - "category": 1 /* Error */ - }, - "'this' cannot be referenced within module bodies.": { - "code": 2108, - "category": 1 /* Error */ - }, - "Invalid '+' expression - types not known to support the addition operator.": { - "code": 2111, - "category": 1 /* Error */ - }, - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": { - "code": 2112, - "category": 1 /* Error */ - }, - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": { - "code": 2113, - "category": 1 /* Error */ - }, - "The type of a unary arithmetic operation operand must be of type 'any', 'number' or an enum type.": { - "code": 2114, - "category": 1 /* Error */ - }, - "Variable declarations of a 'for' statement cannot use a type annotation.": { - "code": 2115, - "category": 1 /* Error */ - }, - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": { - "code": 2116, - "category": 1 /* Error */ - }, - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": { - "code": 2117, - "category": 1 /* Error */ - }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { - "code": 2118, - "category": 1 /* Error */ - }, - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": { - "code": 2119, - "category": 1 /* Error */ - }, - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": { - "code": 2120, - "category": 1 /* Error */ - }, - "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.": { - "code": 2121, - "category": 1 /* Error */ - }, - "Setters cannot return a value.": { - "code": 2122, - "category": 1 /* Error */ - }, - "Tried to query type of uninitialized module '{0}'.": { - "code": 2123, - "category": 1 /* Error */ - }, - "Tried to set variable type to uninitialized module type '{0}'.": { - "code": 2124, - "category": 1 /* Error */ - }, - "Type '{0}' does not have type parameters.": { - "code": 2125, - "category": 1 /* Error */ - }, - "Getters must return a value.": { - "code": 2126, - "category": 1 /* Error */ - }, - "Getter and setter accessors do not agree in visibility.": { - "code": 2127, - "category": 1 /* Error */ - }, - "Invalid left-hand side of assignment expression.": { - "code": 2130, - "category": 1 /* Error */ - }, - "Function declared a non-void return type, but has no return expression.": { - "code": 2131, - "category": 1 /* Error */ - }, - "Cannot resolve return type reference.": { - "code": 2132, - "category": 1 /* Error */ - }, - "Constructors cannot have a return type of 'void'.": { - "code": 2133, - "category": 1 /* Error */ - }, - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": { - "code": 2134, - "category": 1 /* Error */ - }, - "All symbols within a with block will be resolved to 'any'.": { - "code": 2135, - "category": 1 /* Error */ - }, - "Import declarations in an internal module cannot reference an external module.": { - "code": 2136, - "category": 1 /* Error */ - }, - "Class {0} declares interface {1} but does not implement it:{NL}{2}": { - "code": 2137, - "category": 1 /* Error */ - }, - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": { - "code": 2138, - "category": 1 /* Error */ - }, - "The operand of an increment or decrement operator must be a variable, property or indexer.": { - "code": 2139, - "category": 1 /* Error */ - }, - "'this' cannot be referenced in static initializers in a class body.": { - "code": 2140, - "category": 1 /* Error */ - }, - "Class '{0}' cannot extend class '{1}':{NL}{2}": { - "code": 2141, - "category": 1 /* Error */ - }, - "Interface '{0}' cannot extend class '{1}':{NL}{2}": { - "code": 2142, - "category": 1 /* Error */ - }, - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": { - "code": 2143, - "category": 1 /* Error */ - }, - "Duplicate overload signature for '{0}'.": { - "code": 2144, - "category": 1 /* Error */ - }, - "Duplicate constructor overload signature.": { - "code": 2145, - "category": 1 /* Error */ - }, - "Duplicate overload call signature.": { - "code": 2146, - "category": 1 /* Error */ - }, - "Duplicate overload construct signature.": { - "code": 2147, - "category": 1 /* Error */ - }, - "Overload signature is not compatible with function definition.": { - "code": 2148, - "category": 1 /* Error */ - }, - "Overload signature is not compatible with function definition:{NL}{0}": { - "code": 2149, - "category": 1 /* Error */ - }, - "Overload signatures must all be public or private.": { - "code": 2150, - "category": 1 /* Error */ - }, - "Overload signatures must all be exported or not exported.": { - "code": 2151, - "category": 1 /* Error */ - }, - "Overload signatures must all be ambient or non-ambient.": { - "code": 2152, - "category": 1 /* Error */ - }, - "Overload signatures must all be optional or required.": { - "code": 2153, - "category": 1 /* Error */ - }, - "Specialized overload signature is not assignable to any non-specialized signature.": { - "code": 2154, - "category": 1 /* Error */ - }, - "'this' cannot be referenced in constructor arguments.": { - "code": 2155, - "category": 1 /* Error */ - }, - "Instance member cannot be accessed off a class.": { - "code": 2157, - "category": 1 /* Error */ - }, - "Untyped function calls may not accept type arguments.": { - "code": 2158, - "category": 1 /* Error */ - }, - "Non-generic functions may not accept type arguments.": { - "code": 2159, - "category": 1 /* Error */ - }, - "A generic type may not reference itself with a wrapped form of its own type parameters.": { - "code": 2160, - "category": 1 /* Error */ - }, - "Rest parameters must be array types.": { - "code": 2162, - "category": 1 /* Error */ - }, - "Overload signature implementation cannot use specialized type.": { - "code": 2163, - "category": 1 /* Error */ - }, - "Export assignments may only be used at the top-level of external modules.": { - "code": 2164, - "category": 1 /* Error */ - }, - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules.": { - "code": 2165, - "category": 1 /* Error */ - }, - "Only public methods of the base class are accessible via the 'super' keyword.": { - "code": 2166, - "category": 1 /* Error */ - }, - "Numeric indexer type '{0}' must be assignable to string indexer type '{1}'.": { - "code": 2167, - "category": 1 /* Error */ - }, - "Numeric indexer type '{0}' must be assignable to string indexer type '{1}':{NL}{2}": { - "code": 2168, - "category": 1 /* Error */ - }, - "All numerically named properties must be assignable to numeric indexer type '{0}'.": { - "code": 2169, - "category": 1 /* Error */ - }, - "All numerically named properties must be assignable to numeric indexer type '{0}':{NL}{1}": { - "code": 2170, - "category": 1 /* Error */ - }, - "All named properties must be assignable to string indexer type '{0}'.": { - "code": 2171, - "category": 1 /* Error */ - }, - "All named properties must be assignable to string indexer type '{0}':{NL}{1}": { - "code": 2172, - "category": 1 /* Error */ - }, - "Generic type references must include all type arguments.": { - "code": 2173, - "category": 1 /* Error */ - }, - "Default arguments are only allowed in implementation.": { - "code": 2174, - "category": 1 /* Error */ - }, - "Overloads cannot differ only by return type.": { - "code": 2175, - "category": 1 /* Error */ - }, - "Function expression declared a non-void return type, but has no return expression.": { - "code": 2176, - "category": 1 /* Error */ - }, - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": { - "code": 2177, - "category": 1 /* Error */ - }, - "Could not find symbol '{0}' in module '{1}'.": { - "code": 2178, - "category": 1 /* Error */ - }, - "Unable to resolve module reference '{0}'.": { - "code": 2179, - "category": 1 /* Error */ - }, - "Could not find module '{0}' in module '{1}'.": { - "code": 2180, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": { - "code": 2181, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": { - "code": 2182, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": { - "code": 2183, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": { - "code": 2184, - "category": 1 /* Error */ - }, - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": { - "code": 2185, - "category": 1 /* Error */ - }, - "Type name '{0}' in extends clause does not reference constructor function for '{1}'.": { - "code": 2186, - "category": 1 /* Error */ - }, - "Internal module reference '{0}' in import declaration does not reference module instance for '{1}'.": { - "code": 2187, - "category": 1 /* Error */ - }, - "Module '{0}' cannot merge with previous declaration of '{1}' in a different file '{2}'.": { - "code": 2188, - "category": 1 /* Error */ - }, - "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':{NL}{3}": { - "code": 2189, - "category": 1 /* Error */ - }, - "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.": { - "code": 2190, - "category": 1 /* Error */ - }, - "Ambient external module declaration cannot be reopened.": { - "code": 2191, - "category": 1 /* Error */ - }, - "All declarations of merged declaration '{0}' must be exported or not exported.": { - "code": 2192, - "category": 1 /* Error */ - }, - "'super' cannot be referenced in constructor arguments.": { - "code": 2193, - "category": 1 /* Error */ - }, - "Return type of constructor signature must be assignable to the instance type of the class.": { - "code": 2194, - "category": 1 /* Error */ - }, - "Ambient external module declaration must be defined in global context.": { - "code": 2195, - "category": 1 /* Error */ - }, - "Ambient external module declaration cannot specify relative module name.": { - "code": 2196, - "category": 1 /* Error */ - }, - "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.": { - "code": 2197, - "category": 1 /* Error */ - }, - "Could not find the best common type of types of all return statement expressions.": { - "code": 2198, - "category": 1 /* Error */ - }, - "Import declaration cannot refer to external module reference when --noResolve option is set.": { - "code": 2199, - "category": 1 /* Error */ - }, - "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": { - "code": 2200, - "category": 1 /* Error */ - }, - "'continue' statement can only be used within an enclosing iteration statement.": { - "code": 2201, - "category": 1 /* Error */ - }, - "'break' statement can only be used within an enclosing iteration or switch statement.": { - "code": 2202, - "category": 1 /* Error */ - }, - "Jump target not found.": { - "code": 2203, - "category": 1 /* Error */ - }, - "Jump target cannot cross function boundary.": { - "code": 2204, - "category": 1 /* Error */ - }, - "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.": { - "code": 2205, - "category": 1 /* Error */ - }, - "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.": { - "code": 2206, - "category": 1 /* Error */ - }, - "Expression resolves to '_super' that compiler uses to capture base class reference.": { - "code": 2207, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": { - "code": 2208, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of call signature from exported interface has or is using private type '{1}'.": { - "code": 2209, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public static method from exported class has or is using private type '{1}'.": { - "code": 2210, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public method from exported class has or is using private type '{1}'.": { - "code": 2211, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of method from exported interface has or is using private type '{1}'.": { - "code": 2212, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported function has or is using private type '{1}'.": { - "code": 2213, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": { - "code": 2214, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of call signature from exported interface is using inaccessible module {1}": { - "code": 2215, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public static method from exported class is using inaccessible module {1}.": { - "code": 2216, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of public method from exported class is using inaccessible module {1}.": { - "code": 2217, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of method from exported interface is using inaccessible module {1}.": { - "code": 2218, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported function is using inaccessible module {1}.": { - "code": 2219, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported class has or is using private type '{1}'.": { - "code": 2220, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported interface has or is using private type '{1}'.": { - "code": 2221, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported class is using inaccessible module {1}.": { - "code": 2222, - "category": 1 /* Error */ - }, - "TypeParameter '{0}' of exported interface is using inaccessible module {1}.": { - "code": 2223, - "category": 1 /* Error */ - }, - "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter.": { - "code": 2224, - "category": 1 /* Error */ - }, - "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.": { - "code": 2225, - "category": 1 /* Error */ - }, - "Type of conditional '{0}' must be identical to '{1}' or '{2}'.": { - "code": 2226, - "category": 1 /* Error */ - }, - "Type of conditional '{0}' must be identical to '{1}', '{2}' or '{3}'.": { - "code": 2227, - "category": 1 /* Error */ - }, - "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.": { - "code": 2228, - "category": 1 /* Error */ - }, - "Constraint of a type parameter cannot reference any type parameter from the same type parameter list.": { - "code": 2229, - "category": 1 /* Error */ - }, - "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.": { - "code": 2230, - "category": 1 /* Error */ - }, - "Parameter '{0}' cannot be referenced in its initializer.": { - "code": 2231, - "category": 1 /* Error */ - }, - "Duplicate string index signature.": { - "code": 2232, - "category": 1 /* Error */ - }, - "Duplicate number index signature.": { - "code": 2233, - "category": 1 /* Error */ - }, - "All declarations of an interface must have identical type parameters.": { - "code": 2234, - "category": 1 /* Error */ - }, - "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.": { - "code": 2235, - "category": 1 /* Error */ - }, - "Type '{0}' is missing property '{1}' from type '{2}'.": { - "code": 4000, - "category": 3 /* NoPrefix */ - }, - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": { - "code": 4001, - "category": 3 /* NoPrefix */ - }, - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": { - "code": 4002, - "category": 3 /* NoPrefix */ - }, - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": { - "code": 4003, - "category": 3 /* NoPrefix */ - }, - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": { - "code": 4004, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' define property '{2}' as private.": { - "code": 4005, - "category": 3 /* NoPrefix */ - }, - "Call signatures of types '{0}' and '{1}' are incompatible.": { - "code": 4006, - "category": 3 /* NoPrefix */ - }, - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { - "code": 4007, - "category": 3 /* NoPrefix */ - }, - "Type '{0}' requires a call signature, but type '{1}' lacks one.": { - "code": 4008, - "category": 3 /* NoPrefix */ - }, - "Construct signatures of types '{0}' and '{1}' are incompatible.": { - "code": 4009, - "category": 3 /* NoPrefix */ - }, - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { - "code": 4010, - "category": 3 /* NoPrefix */ - }, - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": { - "code": 4011, - "category": 3 /* NoPrefix */ - }, - "Index signatures of types '{0}' and '{1}' are incompatible.": { - "code": 4012, - "category": 3 /* NoPrefix */ - }, - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { - "code": 4013, - "category": 3 /* NoPrefix */ - }, - "Call signature expects {0} or fewer parameters.": { - "code": 4014, - "category": 3 /* NoPrefix */ - }, - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": { - "code": 4015, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": { - "code": 4016, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": { - "code": 4017, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": { - "code": 4018, - "category": 3 /* NoPrefix */ - }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": { - "code": 4019, - "category": 3 /* NoPrefix */ - }, - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": { - "code": 4020, - "category": 3 /* NoPrefix */ - }, - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": { - "code": 4021, - "category": 3 /* NoPrefix */ - }, - "Type reference cannot refer to container '{0}'.": { - "code": 4022, - "category": 1 /* Error */ - }, - "Type reference must refer to type.": { - "code": 4023, - "category": 1 /* Error */ - }, - "In enums with multiple declarations only one declaration can omit an initializer for the first enum element.": { - "code": 4024, - "category": 1 /* Error */ - }, - " (+ {0} overload(s))": { - "code": 4025, - "category": 2 /* Message */ - }, - "Variable declaration cannot have the same name as an import declaration.": { - "code": 4026, - "category": 1 /* Error */ - }, - "Signature expected {0} type arguments, got {1} instead.": { - "code": 4027, - "category": 1 /* Error */ - }, - "Property '{0}' defined as optional in type '{1}', but is required in type '{2}'.": { - "code": 4028, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference do not refer to same named type.": { - "code": 4029, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments.": { - "code": 4030, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments:{NL}{2}": { - "code": 4031, - "category": 3 /* NoPrefix */ - }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { - "code": 4032, - "category": 3 /* NoPrefix */ - }, - "Types of string indexer of types '{0}' and '{1}' are not identical.": { - "code": 4033, - "category": 3 /* NoPrefix */ - }, - "Types of number indexer of types '{0}' and '{1}' are not identical.": { - "code": 4034, - "category": 3 /* NoPrefix */ - }, - "Type of number indexer in type '{0}' is not assignable to string indexer type in type '{1}'.{NL}{2}": { - "code": 4035, - "category": 3 /* NoPrefix */ - }, - "Type of property '{0}' in type '{1}' is not assignable to string indexer type in type '{2}'.{NL}{3}": { - "code": 4036, - "category": 3 /* NoPrefix */ - }, - "Type of property '{0}' in type '{1}' is not assignable to number indexer type in type '{2}'.{NL}{3}": { - "code": 4037, - "category": 3 /* NoPrefix */ - }, - "Static property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": { - "code": 4038, - "category": 3 /* NoPrefix */ - }, - "Static property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": { - "code": 4039, - "category": 3 /* NoPrefix */ - }, - "Types '{0}' and '{1}' define static property '{2}' as private.": { - "code": 4040, - "category": 3 /* NoPrefix */ - }, - "Current host does not support '{0}' option.": { - "code": 5001, - "category": 1 /* Error */ - }, - "ECMAScript target version '{0}' not supported. Specify a valid target version: '{1}' (default), or '{2}'": { - "code": 5002, - "category": 1 /* Error */ - }, - "Module code generation '{0}' not supported.": { - "code": 5003, - "category": 1 /* Error */ - }, - "Could not find file: '{0}'.": { - "code": 5004, - "category": 1 /* Error */ - }, - "A file cannot have a reference to itself.": { - "code": 5006, - "category": 1 /* Error */ - }, - "Cannot resolve referenced file: '{0}'.": { - "code": 5007, - "category": 1 /* Error */ - }, - "Cannot find the common subdirectory path for the input files.": { - "code": 5009, - "category": 1 /* Error */ - }, - "Emit Error: {0}.": { - "code": 5011, - "category": 1 /* Error */ - }, - "Cannot read file '{0}': {1}": { - "code": 5012, - "category": 1 /* Error */ - }, - "Unsupported file encoding.": { - "code": 5013, - "category": 3 /* NoPrefix */ - }, - "Locale must be of the form or -. For example '{0}' or '{1}'.": { - "code": 5014, - "category": 1 /* Error */ - }, - "Unsupported locale: '{0}'.": { - "code": 5015, - "category": 1 /* Error */ - }, - "Execution Failed.{NL}": { - "code": 5016, - "category": 1 /* Error */ - }, - "Invalid call to 'up'": { - "code": 5019, - "category": 1 /* Error */ - }, - "Invalid call to 'down'": { - "code": 5020, - "category": 1 /* Error */ - }, - "Base64 value '{0}' finished with a continuation bit.": { - "code": 5021, - "category": 1 /* Error */ - }, - "Unknown option '{0}'": { - "code": 5023, - "category": 1 /* Error */ - }, - "Expected {0} arguments to message, got {1} instead.": { - "code": 5024, - "category": 1 /* Error */ - }, - "Expected the message '{0}' to have {1} arguments, but it had {2}": { - "code": 5025, - "category": 1 /* Error */ - }, - "Could not delete file '{0}'": { - "code": 5034, - "category": 1 /* Error */ - }, - "Could not create directory '{0}'": { - "code": 5035, - "category": 1 /* Error */ - }, - "Error while executing file '{0}': ": { - "code": 5036, - "category": 1 /* Error */ - }, - "Cannot compile external modules unless the '--module' flag is provided.": { - "code": 5037, - "category": 1 /* Error */ - }, - "Option mapRoot cannot be specified without specifying sourcemap option.": { - "code": 5038, - "category": 1 /* Error */ - }, - "Option sourceRoot cannot be specified without specifying sourcemap option.": { - "code": 5039, - "category": 1 /* Error */ - }, - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": { - "code": 5040, - "category": 1 /* Error */ - }, - "Option '{0}' specified without '{1}'": { - "code": 5041, - "category": 1 /* Error */ - }, - "'codepage' option not supported on current platform.": { - "code": 5042, - "category": 1 /* Error */ - }, - "Concatenate and emit output to single file.": { - "code": 6001, - "category": 2 /* Message */ - }, - "Generates corresponding {0} file.": { - "code": 6002, - "category": 2 /* Message */ - }, - "Specifies the location where debugger should locate map files instead of generated locations.": { - "code": 6003, - "category": 2 /* Message */ - }, - "Specifies the location where debugger should locate TypeScript files instead of source locations.": { - "code": 6004, - "category": 2 /* Message */ - }, - "Watch input files.": { - "code": 6005, - "category": 2 /* Message */ - }, - "Redirect output structure to the directory.": { - "code": 6006, - "category": 2 /* Message */ - }, - "Do not emit comments to output.": { - "code": 6009, - "category": 2 /* Message */ - }, - "Skip resolution and preprocessing.": { - "code": 6010, - "category": 2 /* Message */ - }, - "Specify ECMAScript target version: '{0}' (default), or '{1}'": { - "code": 6015, - "category": 2 /* Message */ - }, - "Specify module code generation: '{0}' or '{1}'": { - "code": 6016, - "category": 2 /* Message */ - }, - "Print this message.": { - "code": 6017, - "category": 2 /* Message */ - }, - "Print the compiler's version: {0}": { - "code": 6019, - "category": 2 /* Message */ - }, - "Allow use of deprecated '{0}' keyword when referencing an external module.": { - "code": 6021, - "category": 2 /* Message */ - }, - "Specify locale for errors and messages. For example '{0}' or '{1}'": { - "code": 6022, - "category": 2 /* Message */ - }, - "Syntax: {0}": { - "code": 6023, - "category": 2 /* Message */ - }, - "options": { - "code": 6024, - "category": 2 /* Message */ - }, - "file1": { - "code": 6025, - "category": 2 /* Message */ - }, - "Examples:": { - "code": 6026, - "category": 2 /* Message */ - }, - "Options:": { - "code": 6027, - "category": 2 /* Message */ - }, - "Insert command line options and files from a file.": { - "code": 6030, - "category": 2 /* Message */ - }, - "Version {0}": { - "code": 6029, - "category": 2 /* Message */ - }, - "Use the '{0}' flag to see options.": { - "code": 6031, - "category": 2 /* Message */ - }, - "{NL}Recompiling ({0}):": { - "code": 6032, - "category": 2 /* Message */ - }, - "STRING": { - "code": 6033, - "category": 2 /* Message */ - }, - "KIND": { - "code": 6034, - "category": 2 /* Message */ - }, - "file2": { - "code": 6035, - "category": 2 /* Message */ - }, - "VERSION": { - "code": 6036, - "category": 2 /* Message */ - }, - "LOCATION": { - "code": 6037, - "category": 2 /* Message */ - }, - "DIRECTORY": { - "code": 6038, - "category": 2 /* Message */ - }, - "NUMBER": { - "code": 6039, - "category": 2 /* Message */ - }, - "Specify the codepage to use when opening source files.": { - "code": 6040, - "category": 2 /* Message */ - }, - "Additional locations:": { - "code": 6041, - "category": 2 /* Message */ - }, - "This version of the Javascript runtime does not support the '{0}' function.": { - "code": 7000, - "category": 1 /* Error */ - }, - "Unknown rule.": { - "code": 7002, - "category": 1 /* Error */ - }, - "Invalid line number ({0})": { - "code": 7003, - "category": 1 /* Error */ - }, - "Warn on expressions and declarations with an implied 'any' type.": { - "code": 7004, - "category": 2 /* Message */ - }, - "Variable '{0}' implicitly has an 'any' type.": { - "code": 7005, - "category": 1 /* Error */ - }, - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": { - "code": 7006, - "category": 1 /* Error */ - }, - "Parameter '{0}' of function type implicitly has an 'any' type.": { - "code": 7007, - "category": 1 /* Error */ - }, - "Member '{0}' of object type implicitly has an 'any' type.": { - "code": 7008, - "category": 1 /* Error */ - }, - "'new' expression, which lacks a constructor signature, implicitly has an 'any' type.": { - "code": 7009, - "category": 1 /* Error */ - }, - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7010, - "category": 1 /* Error */ - }, - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7011, - "category": 1 /* Error */ - }, - "Parameter '{0}' of lambda function implicitly has an 'any' type.": { - "code": 7012, - "category": 1 /* Error */ - }, - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7013, - "category": 1 /* Error */ - }, - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": { - "code": 7014, - "category": 1 /* Error */ - }, - "Array Literal implicitly has an 'any' type from widening.": { - "code": 7015, - "category": 1 /* Error */ - }, - "'{0}', which lacks 'get' accessor and parameter type annotation on 'set' accessor, implicitly has an 'any' type.": { - "code": 7016, - "category": 1 /* Error */ - }, - "Index signature of object type implicitly has an 'any' type.": { - "code": 7017, - "category": 1 /* Error */ - }, - "Object literal's property '{0}' implicitly has an 'any' type from widening.": { - "code": 7018, - "category": 1 /* Error */ - } - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (CharacterCodes) { - CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; - CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; - - CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; - CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; - CharacterCodes[CharacterCodes["lineSeparator"] = 0x2028] = "lineSeparator"; - CharacterCodes[CharacterCodes["paragraphSeparator"] = 0x2029] = "paragraphSeparator"; - - CharacterCodes[CharacterCodes["nextLine"] = 0x0085] = "nextLine"; - - CharacterCodes[CharacterCodes["space"] = 0x0020] = "space"; - CharacterCodes[CharacterCodes["nonBreakingSpace"] = 0x00A0] = "nonBreakingSpace"; - CharacterCodes[CharacterCodes["enQuad"] = 0x2000] = "enQuad"; - CharacterCodes[CharacterCodes["emQuad"] = 0x2001] = "emQuad"; - CharacterCodes[CharacterCodes["enSpace"] = 0x2002] = "enSpace"; - CharacterCodes[CharacterCodes["emSpace"] = 0x2003] = "emSpace"; - CharacterCodes[CharacterCodes["threePerEmSpace"] = 0x2004] = "threePerEmSpace"; - CharacterCodes[CharacterCodes["fourPerEmSpace"] = 0x2005] = "fourPerEmSpace"; - CharacterCodes[CharacterCodes["sixPerEmSpace"] = 0x2006] = "sixPerEmSpace"; - CharacterCodes[CharacterCodes["figureSpace"] = 0x2007] = "figureSpace"; - CharacterCodes[CharacterCodes["punctuationSpace"] = 0x2008] = "punctuationSpace"; - CharacterCodes[CharacterCodes["thinSpace"] = 0x2009] = "thinSpace"; - CharacterCodes[CharacterCodes["hairSpace"] = 0x200A] = "hairSpace"; - CharacterCodes[CharacterCodes["zeroWidthSpace"] = 0x200B] = "zeroWidthSpace"; - CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 0x202F] = "narrowNoBreakSpace"; - CharacterCodes[CharacterCodes["ideographicSpace"] = 0x3000] = "ideographicSpace"; - - CharacterCodes[CharacterCodes["_"] = 95] = "_"; - CharacterCodes[CharacterCodes["$"] = 36] = "$"; - - CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; - CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; - CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; - - CharacterCodes[CharacterCodes["a"] = 97] = "a"; - CharacterCodes[CharacterCodes["b"] = 98] = "b"; - CharacterCodes[CharacterCodes["c"] = 99] = "c"; - CharacterCodes[CharacterCodes["d"] = 100] = "d"; - CharacterCodes[CharacterCodes["e"] = 101] = "e"; - CharacterCodes[CharacterCodes["f"] = 102] = "f"; - CharacterCodes[CharacterCodes["g"] = 103] = "g"; - CharacterCodes[CharacterCodes["h"] = 104] = "h"; - CharacterCodes[CharacterCodes["i"] = 105] = "i"; - CharacterCodes[CharacterCodes["k"] = 107] = "k"; - CharacterCodes[CharacterCodes["l"] = 108] = "l"; - CharacterCodes[CharacterCodes["m"] = 109] = "m"; - CharacterCodes[CharacterCodes["n"] = 110] = "n"; - CharacterCodes[CharacterCodes["o"] = 111] = "o"; - CharacterCodes[CharacterCodes["p"] = 112] = "p"; - CharacterCodes[CharacterCodes["q"] = 113] = "q"; - CharacterCodes[CharacterCodes["r"] = 114] = "r"; - CharacterCodes[CharacterCodes["s"] = 115] = "s"; - CharacterCodes[CharacterCodes["t"] = 116] = "t"; - CharacterCodes[CharacterCodes["u"] = 117] = "u"; - CharacterCodes[CharacterCodes["v"] = 118] = "v"; - CharacterCodes[CharacterCodes["w"] = 119] = "w"; - CharacterCodes[CharacterCodes["x"] = 120] = "x"; - CharacterCodes[CharacterCodes["y"] = 121] = "y"; - CharacterCodes[CharacterCodes["z"] = 122] = "z"; - - CharacterCodes[CharacterCodes["A"] = 65] = "A"; - CharacterCodes[CharacterCodes["E"] = 69] = "E"; - CharacterCodes[CharacterCodes["F"] = 70] = "F"; - CharacterCodes[CharacterCodes["X"] = 88] = "X"; - CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; - - CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; - CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; - CharacterCodes[CharacterCodes["at"] = 64] = "at"; - CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; - CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; - CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; - CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; - CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; - CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; - CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; - CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; - CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; - CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; - CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; - CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; - CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; - CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; - CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; - CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; - CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; - CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; - CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; - CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; - CharacterCodes[CharacterCodes["question"] = 63] = "question"; - CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; - CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; - CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; - CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; - - CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; - CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; - CharacterCodes[CharacterCodes["byteOrderMark"] = 0xFEFF] = "byteOrderMark"; - CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; - CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; - })(TypeScript.CharacterCodes || (TypeScript.CharacterCodes = {})); - var CharacterCodes = TypeScript.CharacterCodes; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - - - (function (ScriptSnapshot) { - var StringScriptSnapshot = (function () { - function StringScriptSnapshot(text) { - this.text = text; - this._lineStartPositions = null; - } - StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); - }; - - StringScriptSnapshot.prototype.getLength = function () { - return this.text.length; - }; - - StringScriptSnapshot.prototype.getLineStartPositions = function () { - if (!this._lineStartPositions) { - this._lineStartPositions = TypeScript.TextUtilities.parseLineStarts(this.text); - } - - return this._lineStartPositions; - }; - - StringScriptSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { - throw TypeScript.Errors.notYetImplemented(); - }; - return StringScriptSnapshot; - })(); - - function fromString(text) { - return new StringScriptSnapshot(text); - } - ScriptSnapshot.fromString = fromString; - })(TypeScript.ScriptSnapshot || (TypeScript.ScriptSnapshot = {})); - var ScriptSnapshot = TypeScript.ScriptSnapshot; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (LineMap1) { - function fromSimpleText(text) { - return new TypeScript.LineMap(function () { - return TypeScript.TextUtilities.parseLineStarts({ charCodeAt: function (index) { - return text.charCodeAt(index); - }, length: text.length() }); - }, text.length()); - } - LineMap1.fromSimpleText = fromSimpleText; - - function fromScriptSnapshot(scriptSnapshot) { - return new TypeScript.LineMap(function () { - return scriptSnapshot.getLineStartPositions(); - }, scriptSnapshot.getLength()); - } - LineMap1.fromScriptSnapshot = fromScriptSnapshot; - - function fromString(text) { - return new TypeScript.LineMap(function () { - return TypeScript.TextUtilities.parseLineStarts(text); - }, text.length); - } - LineMap1.fromString = fromString; - })(TypeScript.LineMap1 || (TypeScript.LineMap1 = {})); - var LineMap1 = TypeScript.LineMap1; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (TextFactory) { - function getStartAndLengthOfLineBreakEndingAt(text, index, info) { - var c = text.charCodeAt(index); - if (c === 10 /* lineFeed */) { - if (index > 0 && text.charCodeAt(index - 1) === 13 /* carriageReturn */) { - info.startPosition = index - 1; - info.length = 2; - } else { - info.startPosition = index; - info.length = 1; - } - } else if (TypeScript.TextUtilities.isAnyLineBreakCharacter(c)) { - info.startPosition = index; - info.length = 1; - } else { - info.startPosition = index + 1; - info.length = 0; - } - } - - var LinebreakInfo = (function () { - function LinebreakInfo(startPosition, length) { - this.startPosition = startPosition; - this.length = length; - } - return LinebreakInfo; - })(); - - var TextLine = (function () { - function TextLine(text, body, lineBreakLength, lineNumber) { - this._text = null; - this._textSpan = null; - if (text === null) { - throw TypeScript.Errors.argumentNull('text'); - } - TypeScript.Debug.assert(lineBreakLength >= 0); - TypeScript.Debug.assert(lineNumber >= 0); - this._text = text; - this._textSpan = body; - this._lineBreakLength = lineBreakLength; - this._lineNumber = lineNumber; - } - TextLine.prototype.start = function () { - return this._textSpan.start(); - }; - - TextLine.prototype.end = function () { - return this._textSpan.end(); - }; - - TextLine.prototype.endIncludingLineBreak = function () { - return this.end() + this._lineBreakLength; - }; - - TextLine.prototype.extent = function () { - return this._textSpan; - }; - - TextLine.prototype.extentIncludingLineBreak = function () { - return TypeScript.TextSpan.fromBounds(this.start(), this.endIncludingLineBreak()); - }; - - TextLine.prototype.toString = function () { - return this._text.toString(this._textSpan); - }; - - TextLine.prototype.lineNumber = function () { - return this._lineNumber; - }; - return TextLine; - })(); - - var TextBase = (function () { - function TextBase() { - this.linebreakInfo = new LinebreakInfo(0, 0); - this.lastLineFoundForPosition = null; - } - TextBase.prototype.length = function () { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.charCodeAt = function (position) { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.checkSubSpan = function (span) { - if (span.start() < 0 || span.start() > this.length() || span.end() > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("span"); - } - }; - - TextBase.prototype.toString = function (span) { - if (typeof span === "undefined") { span = null; } - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.subText = function (span) { - this.checkSubSpan(span); - - return new SubText(this, span); - }; - - TextBase.prototype.substr = function (start, length, intern) { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.lineCount = function () { - return this._lineStarts().length; - }; - - TextBase.prototype.lines = function () { - var lines = []; - - var length = this.lineCount(); - for (var i = 0; i < length; ++i) { - lines[i] = this.getLineFromLineNumber(i); - } - - return lines; - }; - - TextBase.prototype.lineMap = function () { - var _this = this; - return new TypeScript.LineMap(function () { - return _this._lineStarts(); - }, this.length()); - }; - - TextBase.prototype._lineStarts = function () { - throw TypeScript.Errors.abstract(); - }; - - TextBase.prototype.getLineFromLineNumber = function (lineNumber) { - var lineStarts = this._lineStarts(); - - if (lineNumber < 0 || lineNumber >= lineStarts.length) { - throw TypeScript.Errors.argumentOutOfRange("lineNumber"); - } - - var first = lineStarts[lineNumber]; - if (lineNumber === lineStarts.length - 1) { - return new TextLine(this, new TypeScript.TextSpan(first, this.length() - first), 0, lineNumber); - } else { - getStartAndLengthOfLineBreakEndingAt(this, lineStarts[lineNumber + 1] - 1, this.linebreakInfo); - return new TextLine(this, new TypeScript.TextSpan(first, this.linebreakInfo.startPosition - first), this.linebreakInfo.length, lineNumber); - } - }; - - TextBase.prototype.getLineFromPosition = function (position) { - var lastFound = this.lastLineFoundForPosition; - if (lastFound !== null && lastFound.start() <= position && lastFound.endIncludingLineBreak() > position) { - return lastFound; - } - - var lineNumber = this.getLineNumberFromPosition(position); - - var result = this.getLineFromLineNumber(lineNumber); - this.lastLineFoundForPosition = result; - return result; - }; - - TextBase.prototype.getLineNumberFromPosition = function (position) { - if (position < 0 || position > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - if (position === this.length()) { - return this.lineCount() - 1; - } - - var lineNumber = TypeScript.ArrayUtilities.binarySearch(this._lineStarts(), position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; - } - - return lineNumber; - }; - - TextBase.prototype.getLinePosition = function (position) { - if (position < 0 || position > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - var lineNumber = this.getLineNumberFromPosition(position); - - return new TypeScript.LineAndCharacter(lineNumber, position - this._lineStarts()[lineNumber]); - }; - return TextBase; - })(); - - var SubText = (function (_super) { - __extends(SubText, _super); - function SubText(text, span) { - _super.call(this); - this._lazyLineStarts = null; - - if (text === null) { - throw TypeScript.Errors.argumentNull("text"); - } - - if (span.start() < 0 || span.start() >= text.length() || span.end() < 0 || span.end() > text.length()) { - throw TypeScript.Errors.argument("span"); - } - - this.text = text; - this.span = span; - } - SubText.prototype.length = function () { - return this.span.length(); - }; - - SubText.prototype.charCodeAt = function (position) { - if (position < 0 || position > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - return this.text.charCodeAt(this.span.start() + position); - }; - - SubText.prototype.subText = function (span) { - this.checkSubSpan(span); - - return new SubText(this.text, this.getCompositeSpan(span.start(), span.length())); - }; - - SubText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - var span = this.getCompositeSpan(sourceIndex, count); - this.text.copyTo(span.start(), destination, destinationIndex, span.length()); - }; - - SubText.prototype.substr = function (start, length, intern) { - var startInOriginalText = this.span.start() + start; - return this.text.substr(startInOriginalText, length, intern); - }; - - SubText.prototype.getCompositeSpan = function (start, length) { - var compositeStart = TypeScript.MathPrototype.min(this.text.length(), this.span.start() + start); - var compositeEnd = TypeScript.MathPrototype.min(this.text.length(), compositeStart + length); - return new TypeScript.TextSpan(compositeStart, compositeEnd - compositeStart); - }; - - SubText.prototype._lineStarts = function () { - var _this = this; - if (!this._lazyLineStarts) { - this._lazyLineStarts = TypeScript.TextUtilities.parseLineStarts({ charCodeAt: function (index) { - return _this.charCodeAt(index); - }, length: this.length() }); - } - - return this._lazyLineStarts; - }; - return SubText; - })(TextBase); - - var StringText = (function (_super) { - __extends(StringText, _super); - function StringText(data) { - _super.call(this); - this.source = null; - this._lazyLineStarts = null; - - if (data === null) { - throw TypeScript.Errors.argumentNull("data"); - } - - this.source = data; - } - StringText.prototype.length = function () { - return this.source.length; - }; - - StringText.prototype.charCodeAt = function (position) { - if (position < 0 || position >= this.source.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - return this.source.charCodeAt(position); - }; - - StringText.prototype.substr = function (start, length, intern) { - return this.source.substr(start, length); - }; - - StringText.prototype.toString = function (span) { - if (typeof span === "undefined") { span = null; } - if (span === null) { - span = new TypeScript.TextSpan(0, this.length()); - } - - this.checkSubSpan(span); - - if (span.start() === 0 && span.length() === this.length()) { - return this.source; - } - - return this.source.substr(span.start(), span.length()); - }; - - StringText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - TypeScript.StringUtilities.copyTo(this.source, sourceIndex, destination, destinationIndex, count); - }; - - StringText.prototype._lineStarts = function () { - if (this._lazyLineStarts === null) { - this._lazyLineStarts = TypeScript.TextUtilities.parseLineStarts(this.source); - } - - return this._lazyLineStarts; - }; - return StringText; - })(TextBase); - - function createText(value) { - return new StringText(value); - } - TextFactory.createText = createText; - })(TypeScript.TextFactory || (TypeScript.TextFactory = {})); - var TextFactory = TypeScript.TextFactory; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (SimpleText) { - var SimpleSubText = (function () { - function SimpleSubText(text, span) { - this.text = null; - this.span = null; - if (text === null) { - throw TypeScript.Errors.argumentNull("text"); - } - - if (span.start() < 0 || span.start() >= text.length() || span.end() < 0 || span.end() > text.length()) { - throw TypeScript.Errors.argument("span"); - } - - this.text = text; - this.span = span; - } - SimpleSubText.prototype.checkSubSpan = function (span) { - if (span.start() < 0 || span.start() > this.length() || span.end() > this.length()) { - throw TypeScript.Errors.argumentOutOfRange("span"); - } - }; - - SimpleSubText.prototype.checkSubPosition = function (position) { - if (position < 0 || position >= this.length()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - }; - - SimpleSubText.prototype.length = function () { - return this.span.length(); - }; - - SimpleSubText.prototype.subText = function (span) { - this.checkSubSpan(span); - - return new SimpleSubText(this.text, this.getCompositeSpan(span.start(), span.length())); - }; - - SimpleSubText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - var span = this.getCompositeSpan(sourceIndex, count); - this.text.copyTo(span.start(), destination, destinationIndex, span.length()); - }; - - SimpleSubText.prototype.substr = function (start, length, intern) { - var span = this.getCompositeSpan(start, length); - return this.text.substr(span.start(), span.length(), intern); - }; - - SimpleSubText.prototype.getCompositeSpan = function (start, length) { - var compositeStart = TypeScript.MathPrototype.min(this.text.length(), this.span.start() + start); - var compositeEnd = TypeScript.MathPrototype.min(this.text.length(), compositeStart + length); - return new TypeScript.TextSpan(compositeStart, compositeEnd - compositeStart); - }; - - SimpleSubText.prototype.charCodeAt = function (index) { - this.checkSubPosition(index); - return this.text.charCodeAt(this.span.start() + index); - }; - - SimpleSubText.prototype.lineMap = function () { - return TypeScript.LineMap1.fromSimpleText(this); - }; - return SimpleSubText; - })(); - - var SimpleStringText = (function () { - function SimpleStringText(value) { - this.value = value; - this._lineMap = null; - } - SimpleStringText.prototype.length = function () { - return this.value.length; - }; - - SimpleStringText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - TypeScript.StringUtilities.copyTo(this.value, sourceIndex, destination, destinationIndex, count); - }; - - SimpleStringText.prototype.substr = function (start, length, intern) { - if (intern) { - var array = length <= SimpleStringText.charArray.length ? SimpleStringText.charArray : TypeScript.ArrayUtilities.createArray(length, 0); - this.copyTo(start, array, 0, length); - return TypeScript.Collections.DefaultStringTable.addCharArray(array, 0, length); - } - - return this.value.substr(start, length); - }; - - SimpleStringText.prototype.subText = function (span) { - return new SimpleSubText(this, span); - }; - - SimpleStringText.prototype.charCodeAt = function (index) { - return this.value.charCodeAt(index); - }; - - SimpleStringText.prototype.lineMap = function () { - if (!this._lineMap) { - this._lineMap = TypeScript.LineMap1.fromString(this.value); - } - - return this._lineMap; - }; - SimpleStringText.charArray = TypeScript.ArrayUtilities.createArray(1024, 0); - return SimpleStringText; - })(); - - var SimpleScriptSnapshotText = (function () { - function SimpleScriptSnapshotText(scriptSnapshot) { - this.scriptSnapshot = scriptSnapshot; - } - SimpleScriptSnapshotText.prototype.charCodeAt = function (index) { - return this.scriptSnapshot.getText(index, index + 1).charCodeAt(0); - }; - - SimpleScriptSnapshotText.prototype.length = function () { - return this.scriptSnapshot.getLength(); - }; - - SimpleScriptSnapshotText.prototype.copyTo = function (sourceIndex, destination, destinationIndex, count) { - var text = this.scriptSnapshot.getText(sourceIndex, sourceIndex + count); - TypeScript.StringUtilities.copyTo(text, 0, destination, destinationIndex, count); - }; - - SimpleScriptSnapshotText.prototype.substr = function (start, length, intern) { - return this.scriptSnapshot.getText(start, start + length); - }; - - SimpleScriptSnapshotText.prototype.subText = function (span) { - return new SimpleSubText(this, span); - }; - - SimpleScriptSnapshotText.prototype.lineMap = function () { - var _this = this; - return new TypeScript.LineMap(function () { - return _this.scriptSnapshot.getLineStartPositions(); - }, this.length()); - }; - return SimpleScriptSnapshotText; - })(); - - function fromString(value) { - return new SimpleStringText(value); - } - SimpleText.fromString = fromString; - - function fromScriptSnapshot(scriptSnapshot) { - return new SimpleScriptSnapshotText(scriptSnapshot); - } - SimpleText.fromScriptSnapshot = fromScriptSnapshot; - })(TypeScript.SimpleText || (TypeScript.SimpleText = {})); - var SimpleText = TypeScript.SimpleText; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (TextUtilities) { - function parseLineStarts(text) { - var length = text.length; - - if (0 === length) { - var result = new Array(); - result.push(0); - return result; - } - - var position = 0; - var index = 0; - var arrayBuilder = new Array(); - var lineNumber = 0; - - while (index < length) { - var c = text.charCodeAt(index); - var lineBreakLength; - - if (c > 13 /* carriageReturn */ && c <= 127) { - index++; - continue; - } else if (c === 13 /* carriageReturn */ && index + 1 < length && text.charCodeAt(index + 1) === 10 /* lineFeed */) { - lineBreakLength = 2; - } else if (c === 10 /* lineFeed */) { - lineBreakLength = 1; - } else { - lineBreakLength = TextUtilities.getLengthOfLineBreak(text, index); - } - - if (0 === lineBreakLength) { - index++; - } else { - arrayBuilder.push(position); - index += lineBreakLength; - position = index; - lineNumber++; - } - } - - arrayBuilder.push(position); - - return arrayBuilder; - } - TextUtilities.parseLineStarts = parseLineStarts; - - function getLengthOfLineBreakSlow(text, index, c) { - if (c === 13 /* carriageReturn */) { - var next = index + 1; - return (next < text.length) && 10 /* lineFeed */ === text.charCodeAt(next) ? 2 : 1; - } else if (isAnyLineBreakCharacter(c)) { - return 1; - } else { - return 0; - } - } - TextUtilities.getLengthOfLineBreakSlow = getLengthOfLineBreakSlow; - - function getLengthOfLineBreak(text, index) { - var c = text.charCodeAt(index); - - if (c > 13 /* carriageReturn */ && c <= 127) { - return 0; - } - - return getLengthOfLineBreakSlow(text, index, c); - } - TextUtilities.getLengthOfLineBreak = getLengthOfLineBreak; - - function isAnyLineBreakCharacter(c) { - return c === 10 /* lineFeed */ || c === 13 /* carriageReturn */ || c === 133 /* nextLine */ || c === 8232 /* lineSeparator */ || c === 8233 /* paragraphSeparator */; - } - TextUtilities.isAnyLineBreakCharacter = isAnyLineBreakCharacter; - })(TypeScript.TextUtilities || (TypeScript.TextUtilities = {})); - var TextUtilities = TypeScript.TextUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextSpan = (function () { - function TextSpan(start, length) { - if (start < 0) { - TypeScript.Errors.argument("start"); - } - - if (length < 0) { - TypeScript.Errors.argument("length"); - } - - this._start = start; - this._length = length; - } - TextSpan.prototype.start = function () { - return this._start; - }; - - TextSpan.prototype.length = function () { - return this._length; - }; - - TextSpan.prototype.end = function () { - return this._start + this._length; - }; - - TextSpan.prototype.isEmpty = function () { - return this._length === 0; - }; - - TextSpan.prototype.containsPosition = function (position) { - return position >= this._start && position < this.end(); - }; - - TextSpan.prototype.containsTextSpan = function (span) { - return span._start >= this._start && span.end() <= this.end(); - }; - - TextSpan.prototype.overlapsWith = function (span) { - var overlapStart = TypeScript.MathPrototype.max(this._start, span._start); - var overlapEnd = TypeScript.MathPrototype.min(this.end(), span.end()); - - return overlapStart < overlapEnd; - }; - - TextSpan.prototype.overlap = function (span) { - var overlapStart = TypeScript.MathPrototype.max(this._start, span._start); - var overlapEnd = TypeScript.MathPrototype.min(this.end(), span.end()); - - if (overlapStart < overlapEnd) { - return TextSpan.fromBounds(overlapStart, overlapEnd); - } - - return null; - }; - - TextSpan.prototype.intersectsWithTextSpan = function (span) { - return span._start <= this.end() && span.end() >= this._start; - }; - - TextSpan.prototype.intersectsWith = function (start, length) { - var end = start + length; - return start <= this.end() && end >= this._start; - }; - - TextSpan.prototype.intersectsWithPosition = function (position) { - return position <= this.end() && position >= this._start; - }; - - TextSpan.prototype.intersection = function (span) { - var intersectStart = TypeScript.MathPrototype.max(this._start, span._start); - var intersectEnd = TypeScript.MathPrototype.min(this.end(), span.end()); - - if (intersectStart <= intersectEnd) { - return TextSpan.fromBounds(intersectStart, intersectEnd); - } - - return null; - }; - - TextSpan.fromBounds = function (start, end) { - TypeScript.Debug.assert(start >= 0); - TypeScript.Debug.assert(end - start >= 0); - return new TextSpan(start, end - start); - }; - return TextSpan; - })(); - TypeScript.TextSpan = TextSpan; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextChangeRange = (function () { - function TextChangeRange(span, newLength) { - if (newLength < 0) { - throw TypeScript.Errors.argumentOutOfRange("newLength"); - } - - this._span = span; - this._newLength = newLength; - } - TextChangeRange.prototype.span = function () { - return this._span; - }; - - TextChangeRange.prototype.newLength = function () { - return this._newLength; - }; - - TextChangeRange.prototype.newSpan = function () { - return new TypeScript.TextSpan(this.span().start(), this.newLength()); - }; - - TextChangeRange.prototype.isUnchanged = function () { - return this.span().isEmpty() && this.newLength() === 0; - }; - - TextChangeRange.collapseChangesFromSingleVersion = function (changes) { - var diff = 0; - var start = 1073741823 /* Max31BitInteger */; - var end = 0; - - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - diff += change.newLength() - change.span().length(); - - if (change.span().start() < start) { - start = change.span().start(); - } - - if (change.span().end() > end) { - end = change.span().end(); - } - } - - if (start > end) { - return null; - } - - var combined = TypeScript.TextSpan.fromBounds(start, end); - var newLen = combined.length() + diff; - - return new TextChangeRange(combined, newLen); - }; - - TextChangeRange.collapseChangesAcrossMultipleVersions = function (changes) { - if (changes.length === 0) { - return TextChangeRange.unchanged; - } - - if (changes.length === 1) { - return changes[0]; - } - - var change0 = changes[0]; - - var oldStartN = change0.span().start(); - var oldEndN = change0.span().end(); - var newEndN = oldStartN + change0.newLength(); - - for (var i = 1; i < changes.length; i++) { - var nextChange = changes[i]; - - var oldStart1 = oldStartN; - var oldEnd1 = oldEndN; - var newEnd1 = newEndN; - - var oldStart2 = nextChange.span().start(); - var oldEnd2 = nextChange.span().end(); - var newEnd2 = oldStart2 + nextChange.newLength(); - - oldStartN = TypeScript.MathPrototype.min(oldStart1, oldStart2); - oldEndN = TypeScript.MathPrototype.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); - newEndN = TypeScript.MathPrototype.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); - } - - return new TextChangeRange(TypeScript.TextSpan.fromBounds(oldStartN, oldEndN), newEndN - oldStartN); - }; - TextChangeRange.unchanged = new TextChangeRange(new TypeScript.TextSpan(0, 0), 0); - return TextChangeRange; - })(); - TypeScript.TextChangeRange = TextChangeRange; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CharacterInfo = (function () { - function CharacterInfo() { - } - CharacterInfo.isDecimalDigit = function (c) { - return c >= 48 /* _0 */ && c <= 57 /* _9 */; - }; - CharacterInfo.isOctalDigit = function (c) { - return c >= 48 /* _0 */ && c <= 55 /* _7 */; - }; - - CharacterInfo.isHexDigit = function (c) { - return CharacterInfo.isDecimalDigit(c) || (c >= 65 /* A */ && c <= 70 /* F */) || (c >= 97 /* a */ && c <= 102 /* f */); - }; - - CharacterInfo.hexValue = function (c) { - return CharacterInfo.isDecimalDigit(c) ? (c - 48 /* _0 */) : (c >= 65 /* A */ && c <= 70 /* F */) ? c - 65 /* A */ + 10 : c - 97 /* a */ + 10; - }; - - CharacterInfo.isWhitespace = function (ch) { - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - return true; - } - - return false; - }; - - CharacterInfo.isLineTerminator = function (ch) { - switch (ch) { - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - return true; - } - - return false; - }; - return CharacterInfo; - })(); - TypeScript.CharacterInfo = CharacterInfo; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxConstants) { - SyntaxConstants[SyntaxConstants["TriviaNewLineMask"] = 0x00000001] = "TriviaNewLineMask"; - SyntaxConstants[SyntaxConstants["TriviaCommentMask"] = 0x00000002] = "TriviaCommentMask"; - SyntaxConstants[SyntaxConstants["TriviaFullWidthShift"] = 2] = "TriviaFullWidthShift"; - - SyntaxConstants[SyntaxConstants["NodeDataComputed"] = 0x00000001] = "NodeDataComputed"; - SyntaxConstants[SyntaxConstants["NodeIncrementallyUnusableMask"] = 0x00000002] = "NodeIncrementallyUnusableMask"; - SyntaxConstants[SyntaxConstants["NodeParsedInStrictModeMask"] = 0x00000004] = "NodeParsedInStrictModeMask"; - SyntaxConstants[SyntaxConstants["NodeFullWidthShift"] = 3] = "NodeFullWidthShift"; - - SyntaxConstants[SyntaxConstants["IsVariableWidthKeyword"] = 1 << 31] = "IsVariableWidthKeyword"; - })(TypeScript.SyntaxConstants || (TypeScript.SyntaxConstants = {})); - var SyntaxConstants = TypeScript.SyntaxConstants; -})(TypeScript || (TypeScript = {})); -var FormattingOptions = (function () { - function FormattingOptions(useTabs, spacesPerTab, indentSpaces, newLineCharacter) { - this.useTabs = useTabs; - this.spacesPerTab = spacesPerTab; - this.indentSpaces = indentSpaces; - this.newLineCharacter = newLineCharacter; - } - FormattingOptions.defaultOptions = new FormattingOptions(false, 4, 4, "\r\n"); - return FormattingOptions; -})(); -var TypeScript; -(function (TypeScript) { - (function (Indentation) { - function columnForEndOfToken(token, syntaxInformationMap, options) { - return columnForStartOfToken(token, syntaxInformationMap, options) + token.width(); - } - Indentation.columnForEndOfToken = columnForEndOfToken; - - function columnForStartOfToken(token, syntaxInformationMap, options) { - var firstTokenInLine = syntaxInformationMap.firstTokenInLineContainingToken(token); - var leadingTextInReverse = []; - - var current = token; - while (current !== firstTokenInLine) { - current = syntaxInformationMap.previousToken(current); - - if (current === firstTokenInLine) { - leadingTextInReverse.push(current.trailingTrivia().fullText()); - leadingTextInReverse.push(current.text()); - } else { - leadingTextInReverse.push(current.fullText()); - } - } - - collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse); - - return columnForLeadingTextInReverse(leadingTextInReverse, options); - } - Indentation.columnForStartOfToken = columnForStartOfToken; - - function columnForStartOfFirstTokenInLineContainingToken(token, syntaxInformationMap, options) { - var firstTokenInLine = syntaxInformationMap.firstTokenInLineContainingToken(token); - var leadingTextInReverse = []; - - collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse); - - return columnForLeadingTextInReverse(leadingTextInReverse, options); - } - Indentation.columnForStartOfFirstTokenInLineContainingToken = columnForStartOfFirstTokenInLineContainingToken; - - function collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse) { - var leadingTrivia = firstTokenInLine.leadingTrivia(); - - for (var i = leadingTrivia.count() - 1; i >= 0; i--) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.kind() === 5 /* NewLineTrivia */) { - break; - } - - if (trivia.kind() === 6 /* MultiLineCommentTrivia */) { - var lineSegments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - leadingTextInReverse.push(TypeScript.ArrayUtilities.last(lineSegments)); - - if (lineSegments.length > 0) { - break; - } - } - - leadingTextInReverse.push(trivia.fullText()); - } - } - - function columnForLeadingTextInReverse(leadingTextInReverse, options) { - var column = 0; - - for (var i = leadingTextInReverse.length - 1; i >= 0; i--) { - var text = leadingTextInReverse[i]; - column = columnForPositionInStringWorker(text, text.length, column, options); - } - - return column; - } - - function columnForPositionInString(input, position, options) { - return columnForPositionInStringWorker(input, position, 0, options); - } - Indentation.columnForPositionInString = columnForPositionInString; - - function columnForPositionInStringWorker(input, position, startColumn, options) { - var column = startColumn; - var spacesPerTab = options.spacesPerTab; - - for (var j = 0; j < position; j++) { - var ch = input.charCodeAt(j); - - if (ch === 9 /* tab */) { - column += spacesPerTab - column % spacesPerTab; - } else { - column++; - } - } - - return column; - } - - function indentationString(column, options) { - var numberOfTabs = 0; - var numberOfSpaces = TypeScript.MathPrototype.max(0, column); - - if (options.useTabs) { - numberOfTabs = Math.floor(column / options.spacesPerTab); - numberOfSpaces -= numberOfTabs * options.spacesPerTab; - } - - return TypeScript.StringUtilities.repeat('\t', numberOfTabs) + TypeScript.StringUtilities.repeat(' ', numberOfSpaces); - } - Indentation.indentationString = indentationString; - - function indentationTrivia(column, options) { - return TypeScript.Syntax.whitespace(this.indentationString(column, options)); - } - Indentation.indentationTrivia = indentationTrivia; - - function firstNonWhitespacePosition(value) { - for (var i = 0; i < value.length; i++) { - var ch = value.charCodeAt(i); - if (!TypeScript.CharacterInfo.isWhitespace(ch)) { - return i; - } - } - - return value.length; - } - Indentation.firstNonWhitespacePosition = firstNonWhitespacePosition; - })(TypeScript.Indentation || (TypeScript.Indentation = {})); - var Indentation = TypeScript.Indentation; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (LanguageVersion) { - LanguageVersion[LanguageVersion["EcmaScript3"] = 0] = "EcmaScript3"; - LanguageVersion[LanguageVersion["EcmaScript5"] = 1] = "EcmaScript5"; - })(TypeScript.LanguageVersion || (TypeScript.LanguageVersion = {})); - var LanguageVersion = TypeScript.LanguageVersion; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ParseOptions = (function () { - function ParseOptions(languageVersion, allowAutomaticSemicolonInsertion) { - this._languageVersion = languageVersion; - this._allowAutomaticSemicolonInsertion = allowAutomaticSemicolonInsertion; - } - ParseOptions.prototype.toJSON = function (key) { - return { allowAutomaticSemicolonInsertion: this._allowAutomaticSemicolonInsertion }; - }; - - ParseOptions.prototype.languageVersion = function () { - return this._languageVersion; - }; - - ParseOptions.prototype.allowAutomaticSemicolonInsertion = function () { - return this._allowAutomaticSemicolonInsertion; - }; - return ParseOptions; - })(); - TypeScript.ParseOptions = ParseOptions; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var PositionedElement = (function () { - function PositionedElement(parent, element, fullStart) { - this._parent = parent; - this._element = element; - this._fullStart = fullStart; - } - PositionedElement.create = function (parent, element, fullStart) { - if (element === null) { - return null; - } - - if (element.isNode()) { - return new PositionedNode(parent, element, fullStart); - } else if (element.isToken()) { - return new PositionedToken(parent, element, fullStart); - } else if (element.isList()) { - return new PositionedList(parent, element, fullStart); - } else if (element.isSeparatedList()) { - return new PositionedSeparatedList(parent, element, fullStart); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - PositionedElement.prototype.parent = function () { - return this._parent; - }; - - PositionedElement.prototype.parentElement = function () { - return this._parent && this._parent._element; - }; - - PositionedElement.prototype.element = function () { - return this._element; - }; - - PositionedElement.prototype.kind = function () { - return this.element().kind(); - }; - - PositionedElement.prototype.childIndex = function (child) { - return TypeScript.Syntax.childIndex(this.element(), child); - }; - - PositionedElement.prototype.childCount = function () { - return this.element().childCount(); - }; - - PositionedElement.prototype.childAt = function (index) { - var offset = TypeScript.Syntax.childOffsetAt(this.element(), index); - return PositionedElement.create(this, this.element().childAt(index), this.fullStart() + offset); - }; - - PositionedElement.prototype.childStart = function (child) { - var offset = TypeScript.Syntax.childOffset(this.element(), child); - return this.fullStart() + offset + child.leadingTriviaWidth(); - }; - - PositionedElement.prototype.childEnd = function (child) { - var offset = TypeScript.Syntax.childOffset(this.element(), child); - return this.fullStart() + offset + child.leadingTriviaWidth() + child.width(); - }; - - PositionedElement.prototype.childStartAt = function (index) { - var offset = TypeScript.Syntax.childOffsetAt(this.element(), index); - var child = this.element().childAt(index); - return this.fullStart() + offset + child.leadingTriviaWidth(); - }; - - PositionedElement.prototype.childEndAt = function (index) { - var offset = TypeScript.Syntax.childOffsetAt(this.element(), index); - var child = this.element().childAt(index); - return this.fullStart() + offset + child.leadingTriviaWidth() + child.width(); - }; - - PositionedElement.prototype.getPositionedChild = function (child) { - var offset = TypeScript.Syntax.childOffset(this.element(), child); - return PositionedElement.create(this, child, this.fullStart() + offset); - }; - - PositionedElement.prototype.fullStart = function () { - return this._fullStart; - }; - - PositionedElement.prototype.fullEnd = function () { - return this.fullStart() + this.element().fullWidth(); - }; - - PositionedElement.prototype.fullWidth = function () { - return this.element().fullWidth(); - }; - - PositionedElement.prototype.start = function () { - return this.fullStart() + this.element().leadingTriviaWidth(); - }; - - PositionedElement.prototype.end = function () { - return this.fullStart() + this.element().leadingTriviaWidth() + this.element().width(); - }; - - PositionedElement.prototype.root = function () { - var current = this; - while (current.parent() !== null) { - current = current.parent(); - } - - return current; - }; - - PositionedElement.prototype.containingNode = function () { - var current = this.parent(); - - while (current !== null && !current.element().isNode()) { - current = current.parent(); - } - - return current; - }; - return PositionedElement; - })(); - TypeScript.PositionedElement = PositionedElement; - - var PositionedNodeOrToken = (function (_super) { - __extends(PositionedNodeOrToken, _super); - function PositionedNodeOrToken(parent, nodeOrToken, fullStart) { - _super.call(this, parent, nodeOrToken, fullStart); - } - PositionedNodeOrToken.prototype.nodeOrToken = function () { - return this.element(); - }; - return PositionedNodeOrToken; - })(PositionedElement); - TypeScript.PositionedNodeOrToken = PositionedNodeOrToken; - - var PositionedNode = (function (_super) { - __extends(PositionedNode, _super); - function PositionedNode(parent, node, fullStart) { - _super.call(this, parent, node, fullStart); - } - PositionedNode.prototype.node = function () { - return this.element(); - }; - return PositionedNode; - })(PositionedNodeOrToken); - TypeScript.PositionedNode = PositionedNode; - - var PositionedToken = (function (_super) { - __extends(PositionedToken, _super); - function PositionedToken(parent, token, fullStart) { - _super.call(this, parent, token, fullStart); - } - PositionedToken.prototype.token = function () { - return this.element(); - }; - - PositionedToken.prototype.previousToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var triviaList = this.token().leadingTrivia(); - if (includeSkippedTokens && triviaList && triviaList.hasSkippedToken()) { - var currentTriviaEndPosition = this.start(); - for (var i = triviaList.count() - 1; i >= 0; i--) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isSkippedToken()) { - return new PositionedSkippedToken(this, trivia.skippedToken(), currentTriviaEndPosition - trivia.fullWidth()); - } - - currentTriviaEndPosition -= trivia.fullWidth(); - } - } - - var start = this.fullStart(); - if (start === 0) { - return null; - } - - return this.root().node().findToken(start - 1, includeSkippedTokens); - }; - - PositionedToken.prototype.nextToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - if (this.token().tokenKind === 10 /* EndOfFileToken */) { - return null; - } - - var triviaList = this.token().trailingTrivia(); - if (includeSkippedTokens && triviaList && triviaList.hasSkippedToken()) { - var fullStart = this.end(); - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isSkippedToken()) { - return new PositionedSkippedToken(this, trivia.skippedToken(), fullStart); - } - - fullStart += trivia.fullWidth(); - } - } - - return this.root().node().findToken(this.fullEnd(), includeSkippedTokens); - }; - return PositionedToken; - })(PositionedNodeOrToken); - TypeScript.PositionedToken = PositionedToken; - - var PositionedList = (function (_super) { - __extends(PositionedList, _super); - function PositionedList(parent, list, fullStart) { - _super.call(this, parent, list, fullStart); - } - PositionedList.prototype.list = function () { - return this.element(); - }; - return PositionedList; - })(PositionedElement); - TypeScript.PositionedList = PositionedList; - - var PositionedSeparatedList = (function (_super) { - __extends(PositionedSeparatedList, _super); - function PositionedSeparatedList(parent, list, fullStart) { - _super.call(this, parent, list, fullStart); - } - PositionedSeparatedList.prototype.list = function () { - return this.element(); - }; - return PositionedSeparatedList; - })(PositionedElement); - TypeScript.PositionedSeparatedList = PositionedSeparatedList; - - var PositionedSkippedToken = (function (_super) { - __extends(PositionedSkippedToken, _super); - function PositionedSkippedToken(parentToken, token, fullStart) { - _super.call(this, parentToken.parent(), token, fullStart); - this._parentToken = parentToken; - } - PositionedSkippedToken.prototype.parentToken = function () { - return this._parentToken; - }; - - PositionedSkippedToken.prototype.previousToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var start = this.fullStart(); - - if (includeSkippedTokens) { - var previousToken; - - if (start >= this.parentToken().end()) { - previousToken = TypeScript.Syntax.findSkippedTokenInTrailingTriviaList(this.parentToken(), start - 1); - - if (previousToken) { - return previousToken; - } - - return this.parentToken(); - } else { - previousToken = TypeScript.Syntax.findSkippedTokenInLeadingTriviaList(this.parentToken(), start - 1); - - if (previousToken) { - return previousToken; - } - } - } - - var start = this.parentToken().fullStart(); - if (start === 0) { - return null; - } - - return this.root().node().findToken(start - 1, includeSkippedTokens); - }; - - PositionedSkippedToken.prototype.nextToken = function (includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - if (this.token().tokenKind === 10 /* EndOfFileToken */) { - return null; - } - - if (includeSkippedTokens) { - var end = this.end(); - var nextToken; - - if (end <= this.parentToken().start()) { - nextToken = TypeScript.Syntax.findSkippedTokenInLeadingTriviaList(this.parentToken(), end); - - if (nextToken) { - return nextToken; - } - - return this.parentToken(); - } else { - nextToken = TypeScript.Syntax.findSkippedTokenInTrailingTriviaList(this.parentToken(), end); - - if (nextToken) { - return nextToken; - } - } - } - - return this.root().node().findToken(this.parentToken().fullEnd(), includeSkippedTokens); - }; - return PositionedSkippedToken; - })(PositionedToken); - TypeScript.PositionedSkippedToken = PositionedSkippedToken; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxKind) { - SyntaxKind[SyntaxKind["None"] = 0] = "None"; - SyntaxKind[SyntaxKind["List"] = 1] = "List"; - SyntaxKind[SyntaxKind["SeparatedList"] = 2] = "SeparatedList"; - SyntaxKind[SyntaxKind["TriviaList"] = 3] = "TriviaList"; - - SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 4] = "WhitespaceTrivia"; - SyntaxKind[SyntaxKind["NewLineTrivia"] = 5] = "NewLineTrivia"; - SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 6] = "MultiLineCommentTrivia"; - SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 7] = "SingleLineCommentTrivia"; - SyntaxKind[SyntaxKind["SkippedTokenTrivia"] = 8] = "SkippedTokenTrivia"; - - SyntaxKind[SyntaxKind["ErrorToken"] = 9] = "ErrorToken"; - SyntaxKind[SyntaxKind["EndOfFileToken"] = 10] = "EndOfFileToken"; - - SyntaxKind[SyntaxKind["IdentifierName"] = 11] = "IdentifierName"; - - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 12] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NumericLiteral"] = 13] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 14] = "StringLiteral"; - - SyntaxKind[SyntaxKind["BreakKeyword"] = 15] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 16] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 17] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 18] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 19] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 20] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 21] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 22] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 23] = "ElseKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 24] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 25] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 26] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 27] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 28] = "IfKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 29] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 30] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 31] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 32] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 33] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 34] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 35] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 36] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 37] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 38] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 39] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 40] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 41] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 42] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 43] = "WithKeyword"; - - SyntaxKind[SyntaxKind["ClassKeyword"] = 44] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 45] = "ConstKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 46] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 47] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 48] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 49] = "ImportKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 50] = "SuperKeyword"; - - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 51] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 52] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 53] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 54] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 55] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 56] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 57] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 58] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 59] = "YieldKeyword"; - - SyntaxKind[SyntaxKind["AnyKeyword"] = 60] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 61] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 62] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 63] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 64] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 65] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 66] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 67] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 68] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 69] = "StringKeyword"; - - SyntaxKind[SyntaxKind["OpenBraceToken"] = 70] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 71] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 72] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 73] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 74] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 75] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 76] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 77] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 78] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 79] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 80] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 81] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 82] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 83] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 84] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 85] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 86] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 87] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 88] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 89] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 90] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 91] = "AsteriskToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 92] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 93] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 94] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 95] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 96] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 97] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 98] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 99] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 100] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 101] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 102] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 103] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 104] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 105] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 106] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 107] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 108] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 109] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 110] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 111] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 112] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 113] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 114] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 115] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 116] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 117] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 118] = "SlashToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 119] = "SlashEqualsToken"; - - SyntaxKind[SyntaxKind["SourceUnit"] = 120] = "SourceUnit"; - - SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; - - SyntaxKind[SyntaxKind["ObjectType"] = 122] = "ObjectType"; - SyntaxKind[SyntaxKind["FunctionType"] = 123] = "FunctionType"; - SyntaxKind[SyntaxKind["ArrayType"] = 124] = "ArrayType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 125] = "ConstructorType"; - SyntaxKind[SyntaxKind["GenericType"] = 126] = "GenericType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 127] = "TypeQuery"; - - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 128] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 129] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 130] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 131] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 132] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 133] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 134] = "ExportAssignment"; - - SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 135] = "MemberFunctionDeclaration"; - SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 136] = "MemberVariableDeclaration"; - SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 137] = "ConstructorDeclaration"; - SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 138] = "IndexMemberDeclaration"; - - SyntaxKind[SyntaxKind["GetAccessor"] = 139] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 140] = "SetAccessor"; - - SyntaxKind[SyntaxKind["PropertySignature"] = 141] = "PropertySignature"; - SyntaxKind[SyntaxKind["CallSignature"] = 142] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 143] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 144] = "IndexSignature"; - SyntaxKind[SyntaxKind["MethodSignature"] = 145] = "MethodSignature"; - - SyntaxKind[SyntaxKind["Block"] = 146] = "Block"; - SyntaxKind[SyntaxKind["IfStatement"] = 147] = "IfStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 148] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 149] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 150] = "ReturnStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 151] = "SwitchStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 152] = "BreakStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 153] = "ContinueStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 154] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 155] = "ForInStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 156] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 157] = "ThrowStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 158] = "WhileStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 159] = "TryStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 160] = "LabeledStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 161] = "DoStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 162] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 163] = "WithStatement"; - - SyntaxKind[SyntaxKind["PlusExpression"] = 164] = "PlusExpression"; - SyntaxKind[SyntaxKind["NegateExpression"] = 165] = "NegateExpression"; - SyntaxKind[SyntaxKind["BitwiseNotExpression"] = 166] = "BitwiseNotExpression"; - SyntaxKind[SyntaxKind["LogicalNotExpression"] = 167] = "LogicalNotExpression"; - SyntaxKind[SyntaxKind["PreIncrementExpression"] = 168] = "PreIncrementExpression"; - SyntaxKind[SyntaxKind["PreDecrementExpression"] = 169] = "PreDecrementExpression"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 170] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 171] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 172] = "VoidExpression"; - SyntaxKind[SyntaxKind["CommaExpression"] = 173] = "CommaExpression"; - SyntaxKind[SyntaxKind["AssignmentExpression"] = 174] = "AssignmentExpression"; - SyntaxKind[SyntaxKind["AddAssignmentExpression"] = 175] = "AddAssignmentExpression"; - SyntaxKind[SyntaxKind["SubtractAssignmentExpression"] = 176] = "SubtractAssignmentExpression"; - SyntaxKind[SyntaxKind["MultiplyAssignmentExpression"] = 177] = "MultiplyAssignmentExpression"; - SyntaxKind[SyntaxKind["DivideAssignmentExpression"] = 178] = "DivideAssignmentExpression"; - SyntaxKind[SyntaxKind["ModuloAssignmentExpression"] = 179] = "ModuloAssignmentExpression"; - SyntaxKind[SyntaxKind["AndAssignmentExpression"] = 180] = "AndAssignmentExpression"; - SyntaxKind[SyntaxKind["ExclusiveOrAssignmentExpression"] = 181] = "ExclusiveOrAssignmentExpression"; - SyntaxKind[SyntaxKind["OrAssignmentExpression"] = 182] = "OrAssignmentExpression"; - SyntaxKind[SyntaxKind["LeftShiftAssignmentExpression"] = 183] = "LeftShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftAssignmentExpression"] = 184] = "SignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftAssignmentExpression"] = 185] = "UnsignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 186] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["LogicalOrExpression"] = 187] = "LogicalOrExpression"; - SyntaxKind[SyntaxKind["LogicalAndExpression"] = 188] = "LogicalAndExpression"; - SyntaxKind[SyntaxKind["BitwiseOrExpression"] = 189] = "BitwiseOrExpression"; - SyntaxKind[SyntaxKind["BitwiseExclusiveOrExpression"] = 190] = "BitwiseExclusiveOrExpression"; - SyntaxKind[SyntaxKind["BitwiseAndExpression"] = 191] = "BitwiseAndExpression"; - SyntaxKind[SyntaxKind["EqualsWithTypeConversionExpression"] = 192] = "EqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["NotEqualsWithTypeConversionExpression"] = 193] = "NotEqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["EqualsExpression"] = 194] = "EqualsExpression"; - SyntaxKind[SyntaxKind["NotEqualsExpression"] = 195] = "NotEqualsExpression"; - SyntaxKind[SyntaxKind["LessThanExpression"] = 196] = "LessThanExpression"; - SyntaxKind[SyntaxKind["GreaterThanExpression"] = 197] = "GreaterThanExpression"; - SyntaxKind[SyntaxKind["LessThanOrEqualExpression"] = 198] = "LessThanOrEqualExpression"; - SyntaxKind[SyntaxKind["GreaterThanOrEqualExpression"] = 199] = "GreaterThanOrEqualExpression"; - SyntaxKind[SyntaxKind["InstanceOfExpression"] = 200] = "InstanceOfExpression"; - SyntaxKind[SyntaxKind["InExpression"] = 201] = "InExpression"; - SyntaxKind[SyntaxKind["LeftShiftExpression"] = 202] = "LeftShiftExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftExpression"] = 203] = "SignedRightShiftExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftExpression"] = 204] = "UnsignedRightShiftExpression"; - SyntaxKind[SyntaxKind["MultiplyExpression"] = 205] = "MultiplyExpression"; - SyntaxKind[SyntaxKind["DivideExpression"] = 206] = "DivideExpression"; - SyntaxKind[SyntaxKind["ModuloExpression"] = 207] = "ModuloExpression"; - SyntaxKind[SyntaxKind["AddExpression"] = 208] = "AddExpression"; - SyntaxKind[SyntaxKind["SubtractExpression"] = 209] = "SubtractExpression"; - SyntaxKind[SyntaxKind["PostIncrementExpression"] = 210] = "PostIncrementExpression"; - SyntaxKind[SyntaxKind["PostDecrementExpression"] = 211] = "PostDecrementExpression"; - SyntaxKind[SyntaxKind["MemberAccessExpression"] = 212] = "MemberAccessExpression"; - SyntaxKind[SyntaxKind["InvocationExpression"] = 213] = "InvocationExpression"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 214] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 215] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 216] = "ObjectCreationExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 217] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 218] = "ParenthesizedArrowFunctionExpression"; - SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 219] = "SimpleArrowFunctionExpression"; - SyntaxKind[SyntaxKind["CastExpression"] = 220] = "CastExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 221] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 222] = "FunctionExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 223] = "OmittedExpression"; - - SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarator"] = 225] = "VariableDeclarator"; - - SyntaxKind[SyntaxKind["ArgumentList"] = 226] = "ArgumentList"; - SyntaxKind[SyntaxKind["ParameterList"] = 227] = "ParameterList"; - SyntaxKind[SyntaxKind["TypeArgumentList"] = 228] = "TypeArgumentList"; - SyntaxKind[SyntaxKind["TypeParameterList"] = 229] = "TypeParameterList"; - - SyntaxKind[SyntaxKind["ExtendsHeritageClause"] = 230] = "ExtendsHeritageClause"; - SyntaxKind[SyntaxKind["ImplementsHeritageClause"] = 231] = "ImplementsHeritageClause"; - SyntaxKind[SyntaxKind["EqualsValueClause"] = 232] = "EqualsValueClause"; - SyntaxKind[SyntaxKind["CaseSwitchClause"] = 233] = "CaseSwitchClause"; - SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 234] = "DefaultSwitchClause"; - SyntaxKind[SyntaxKind["ElseClause"] = 235] = "ElseClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 236] = "CatchClause"; - SyntaxKind[SyntaxKind["FinallyClause"] = 237] = "FinallyClause"; - - SyntaxKind[SyntaxKind["TypeParameter"] = 238] = "TypeParameter"; - SyntaxKind[SyntaxKind["Constraint"] = 239] = "Constraint"; - - SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 240] = "SimplePropertyAssignment"; - - SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 241] = "FunctionPropertyAssignment"; - - SyntaxKind[SyntaxKind["Parameter"] = 242] = "Parameter"; - SyntaxKind[SyntaxKind["EnumElement"] = 243] = "EnumElement"; - SyntaxKind[SyntaxKind["TypeAnnotation"] = 244] = "TypeAnnotation"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 246] = "ModuleNameModuleReference"; - SyntaxKind[SyntaxKind["Last"] = SyntaxKind.ModuleNameModuleReference] = "Last"; - - SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword"; - SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword"; - - SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword"; - SyntaxKind[SyntaxKind["LastFutureReservedKeyword"] = SyntaxKind.SuperKeyword] = "LastFutureReservedKeyword"; - - SyntaxKind[SyntaxKind["FirstFutureReservedStrictKeyword"] = SyntaxKind.ImplementsKeyword] = "FirstFutureReservedStrictKeyword"; - SyntaxKind[SyntaxKind["LastFutureReservedStrictKeyword"] = SyntaxKind.YieldKeyword] = "LastFutureReservedStrictKeyword"; - - SyntaxKind[SyntaxKind["FirstTypeScriptKeyword"] = SyntaxKind.AnyKeyword] = "FirstTypeScriptKeyword"; - SyntaxKind[SyntaxKind["LastTypeScriptKeyword"] = SyntaxKind.StringKeyword] = "LastTypeScriptKeyword"; - - SyntaxKind[SyntaxKind["FirstKeyword"] = SyntaxKind.FirstStandardKeyword] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = SyntaxKind.LastTypeScriptKeyword] = "LastKeyword"; - - SyntaxKind[SyntaxKind["FirstToken"] = SyntaxKind.ErrorToken] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.SlashEqualsToken] = "LastToken"; - - SyntaxKind[SyntaxKind["FirstPunctuation"] = SyntaxKind.OpenBraceToken] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = SyntaxKind.SlashEqualsToken] = "LastPunctuation"; - - SyntaxKind[SyntaxKind["FirstFixedWidth"] = SyntaxKind.FirstKeyword] = "FirstFixedWidth"; - SyntaxKind[SyntaxKind["LastFixedWidth"] = SyntaxKind.LastPunctuation] = "LastFixedWidth"; - - SyntaxKind[SyntaxKind["FirstTrivia"] = SyntaxKind.WhitespaceTrivia] = "FirstTrivia"; - SyntaxKind[SyntaxKind["LastTrivia"] = SyntaxKind.SkippedTokenTrivia] = "LastTrivia"; - })(TypeScript.SyntaxKind || (TypeScript.SyntaxKind = {})); - var SyntaxKind = TypeScript.SyntaxKind; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxFacts) { - var textToKeywordKind = { - "any": 60 /* AnyKeyword */, - "boolean": 61 /* BooleanKeyword */, - "break": 15 /* BreakKeyword */, - "case": 16 /* CaseKeyword */, - "catch": 17 /* CatchKeyword */, - "class": 44 /* ClassKeyword */, - "continue": 18 /* ContinueKeyword */, - "const": 45 /* ConstKeyword */, - "constructor": 62 /* ConstructorKeyword */, - "debugger": 19 /* DebuggerKeyword */, - "declare": 63 /* DeclareKeyword */, - "default": 20 /* DefaultKeyword */, - "delete": 21 /* DeleteKeyword */, - "do": 22 /* DoKeyword */, - "else": 23 /* ElseKeyword */, - "enum": 46 /* EnumKeyword */, - "export": 47 /* ExportKeyword */, - "extends": 48 /* ExtendsKeyword */, - "false": 24 /* FalseKeyword */, - "finally": 25 /* FinallyKeyword */, - "for": 26 /* ForKeyword */, - "function": 27 /* FunctionKeyword */, - "get": 64 /* GetKeyword */, - "if": 28 /* IfKeyword */, - "implements": 51 /* ImplementsKeyword */, - "import": 49 /* ImportKeyword */, - "in": 29 /* InKeyword */, - "instanceof": 30 /* InstanceOfKeyword */, - "interface": 52 /* InterfaceKeyword */, - "let": 53 /* LetKeyword */, - "module": 65 /* ModuleKeyword */, - "new": 31 /* NewKeyword */, - "null": 32 /* NullKeyword */, - "number": 67 /* NumberKeyword */, - "package": 54 /* PackageKeyword */, - "private": 55 /* PrivateKeyword */, - "protected": 56 /* ProtectedKeyword */, - "public": 57 /* PublicKeyword */, - "require": 66 /* RequireKeyword */, - "return": 33 /* ReturnKeyword */, - "set": 68 /* SetKeyword */, - "static": 58 /* StaticKeyword */, - "string": 69 /* StringKeyword */, - "super": 50 /* SuperKeyword */, - "switch": 34 /* SwitchKeyword */, - "this": 35 /* ThisKeyword */, - "throw": 36 /* ThrowKeyword */, - "true": 37 /* TrueKeyword */, - "try": 38 /* TryKeyword */, - "typeof": 39 /* TypeOfKeyword */, - "var": 40 /* VarKeyword */, - "void": 41 /* VoidKeyword */, - "while": 42 /* WhileKeyword */, - "with": 43 /* WithKeyword */, - "yield": 59 /* YieldKeyword */, - "{": 70 /* OpenBraceToken */, - "}": 71 /* CloseBraceToken */, - "(": 72 /* OpenParenToken */, - ")": 73 /* CloseParenToken */, - "[": 74 /* OpenBracketToken */, - "]": 75 /* CloseBracketToken */, - ".": 76 /* DotToken */, - "...": 77 /* DotDotDotToken */, - ";": 78 /* SemicolonToken */, - ",": 79 /* CommaToken */, - "<": 80 /* LessThanToken */, - ">": 81 /* GreaterThanToken */, - "<=": 82 /* LessThanEqualsToken */, - ">=": 83 /* GreaterThanEqualsToken */, - "==": 84 /* EqualsEqualsToken */, - "=>": 85 /* EqualsGreaterThanToken */, - "!=": 86 /* ExclamationEqualsToken */, - "===": 87 /* EqualsEqualsEqualsToken */, - "!==": 88 /* ExclamationEqualsEqualsToken */, - "+": 89 /* PlusToken */, - "-": 90 /* MinusToken */, - "*": 91 /* AsteriskToken */, - "%": 92 /* PercentToken */, - "++": 93 /* PlusPlusToken */, - "--": 94 /* MinusMinusToken */, - "<<": 95 /* LessThanLessThanToken */, - ">>": 96 /* GreaterThanGreaterThanToken */, - ">>>": 97 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 98 /* AmpersandToken */, - "|": 99 /* BarToken */, - "^": 100 /* CaretToken */, - "!": 101 /* ExclamationToken */, - "~": 102 /* TildeToken */, - "&&": 103 /* AmpersandAmpersandToken */, - "||": 104 /* BarBarToken */, - "?": 105 /* QuestionToken */, - ":": 106 /* ColonToken */, - "=": 107 /* EqualsToken */, - "+=": 108 /* PlusEqualsToken */, - "-=": 109 /* MinusEqualsToken */, - "*=": 110 /* AsteriskEqualsToken */, - "%=": 111 /* PercentEqualsToken */, - "<<=": 112 /* LessThanLessThanEqualsToken */, - ">>=": 113 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 115 /* AmpersandEqualsToken */, - "|=": 116 /* BarEqualsToken */, - "^=": 117 /* CaretEqualsToken */, - "/": 118 /* SlashToken */, - "/=": 119 /* SlashEqualsToken */ - }; - - var kindToText = new Array(); - - for (var name in textToKeywordKind) { - if (textToKeywordKind.hasOwnProperty(name)) { - kindToText[textToKeywordKind[name]] = name; - } - } - - kindToText[62 /* ConstructorKeyword */] = "constructor"; - - function getTokenKind(text) { - if (textToKeywordKind.hasOwnProperty(text)) { - return textToKeywordKind[text]; - } - - return 0 /* None */; - } - SyntaxFacts.getTokenKind = getTokenKind; - - function getText(kind) { - var result = kindToText[kind]; - return result !== undefined ? result : null; - } - SyntaxFacts.getText = getText; - - function isTokenKind(kind) { - return kind >= 9 /* FirstToken */ && kind <= 119 /* LastToken */; - } - SyntaxFacts.isTokenKind = isTokenKind; - - function isAnyKeyword(kind) { - return kind >= 15 /* FirstKeyword */ && kind <= 69 /* LastKeyword */; - } - SyntaxFacts.isAnyKeyword = isAnyKeyword; - - function isStandardKeyword(kind) { - return kind >= 15 /* FirstStandardKeyword */ && kind <= 43 /* LastStandardKeyword */; - } - SyntaxFacts.isStandardKeyword = isStandardKeyword; - - function isFutureReservedKeyword(kind) { - return kind >= 44 /* FirstFutureReservedKeyword */ && kind <= 50 /* LastFutureReservedKeyword */; - } - SyntaxFacts.isFutureReservedKeyword = isFutureReservedKeyword; - - function isFutureReservedStrictKeyword(kind) { - return kind >= 51 /* FirstFutureReservedStrictKeyword */ && kind <= 59 /* LastFutureReservedStrictKeyword */; - } - SyntaxFacts.isFutureReservedStrictKeyword = isFutureReservedStrictKeyword; - - function isAnyPunctuation(kind) { - return kind >= 70 /* FirstPunctuation */ && kind <= 119 /* LastPunctuation */; - } - SyntaxFacts.isAnyPunctuation = isAnyPunctuation; - - function isPrefixUnaryExpressionOperatorToken(tokenKind) { - return getPrefixUnaryExpressionFromOperatorToken(tokenKind) !== 0 /* None */; - } - SyntaxFacts.isPrefixUnaryExpressionOperatorToken = isPrefixUnaryExpressionOperatorToken; - - function isBinaryExpressionOperatorToken(tokenKind) { - return getBinaryExpressionFromOperatorToken(tokenKind) !== 0 /* None */; - } - SyntaxFacts.isBinaryExpressionOperatorToken = isBinaryExpressionOperatorToken; - - function getPrefixUnaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 89 /* PlusToken */: - return 164 /* PlusExpression */; - case 90 /* MinusToken */: - return 165 /* NegateExpression */; - case 102 /* TildeToken */: - return 166 /* BitwiseNotExpression */; - case 101 /* ExclamationToken */: - return 167 /* LogicalNotExpression */; - case 93 /* PlusPlusToken */: - return 168 /* PreIncrementExpression */; - case 94 /* MinusMinusToken */: - return 169 /* PreDecrementExpression */; - - default: - return 0 /* None */; - } - } - SyntaxFacts.getPrefixUnaryExpressionFromOperatorToken = getPrefixUnaryExpressionFromOperatorToken; - - function getPostfixUnaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 93 /* PlusPlusToken */: - return 210 /* PostIncrementExpression */; - case 94 /* MinusMinusToken */: - return 211 /* PostDecrementExpression */; - default: - return 0 /* None */; - } - } - SyntaxFacts.getPostfixUnaryExpressionFromOperatorToken = getPostfixUnaryExpressionFromOperatorToken; - - function getBinaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 91 /* AsteriskToken */: - return 205 /* MultiplyExpression */; - - case 118 /* SlashToken */: - return 206 /* DivideExpression */; - - case 92 /* PercentToken */: - return 207 /* ModuloExpression */; - - case 89 /* PlusToken */: - return 208 /* AddExpression */; - - case 90 /* MinusToken */: - return 209 /* SubtractExpression */; - - case 95 /* LessThanLessThanToken */: - return 202 /* LeftShiftExpression */; - - case 96 /* GreaterThanGreaterThanToken */: - return 203 /* SignedRightShiftExpression */; - - case 97 /* GreaterThanGreaterThanGreaterThanToken */: - return 204 /* UnsignedRightShiftExpression */; - - case 80 /* LessThanToken */: - return 196 /* LessThanExpression */; - - case 81 /* GreaterThanToken */: - return 197 /* GreaterThanExpression */; - - case 82 /* LessThanEqualsToken */: - return 198 /* LessThanOrEqualExpression */; - - case 83 /* GreaterThanEqualsToken */: - return 199 /* GreaterThanOrEqualExpression */; - - case 30 /* InstanceOfKeyword */: - return 200 /* InstanceOfExpression */; - - case 29 /* InKeyword */: - return 201 /* InExpression */; - - case 84 /* EqualsEqualsToken */: - return 192 /* EqualsWithTypeConversionExpression */; - - case 86 /* ExclamationEqualsToken */: - return 193 /* NotEqualsWithTypeConversionExpression */; - - case 87 /* EqualsEqualsEqualsToken */: - return 194 /* EqualsExpression */; - - case 88 /* ExclamationEqualsEqualsToken */: - return 195 /* NotEqualsExpression */; - - case 98 /* AmpersandToken */: - return 191 /* BitwiseAndExpression */; - - case 100 /* CaretToken */: - return 190 /* BitwiseExclusiveOrExpression */; - - case 99 /* BarToken */: - return 189 /* BitwiseOrExpression */; - - case 103 /* AmpersandAmpersandToken */: - return 188 /* LogicalAndExpression */; - - case 104 /* BarBarToken */: - return 187 /* LogicalOrExpression */; - - case 116 /* BarEqualsToken */: - return 182 /* OrAssignmentExpression */; - - case 115 /* AmpersandEqualsToken */: - return 180 /* AndAssignmentExpression */; - - case 117 /* CaretEqualsToken */: - return 181 /* ExclusiveOrAssignmentExpression */; - - case 112 /* LessThanLessThanEqualsToken */: - return 183 /* LeftShiftAssignmentExpression */; - - case 113 /* GreaterThanGreaterThanEqualsToken */: - return 184 /* SignedRightShiftAssignmentExpression */; - - case 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - return 185 /* UnsignedRightShiftAssignmentExpression */; - - case 108 /* PlusEqualsToken */: - return 175 /* AddAssignmentExpression */; - - case 109 /* MinusEqualsToken */: - return 176 /* SubtractAssignmentExpression */; - - case 110 /* AsteriskEqualsToken */: - return 177 /* MultiplyAssignmentExpression */; - - case 119 /* SlashEqualsToken */: - return 178 /* DivideAssignmentExpression */; - - case 111 /* PercentEqualsToken */: - return 179 /* ModuloAssignmentExpression */; - - case 107 /* EqualsToken */: - return 174 /* AssignmentExpression */; - - case 79 /* CommaToken */: - return 173 /* CommaExpression */; - - default: - return 0 /* None */; - } - } - SyntaxFacts.getBinaryExpressionFromOperatorToken = getBinaryExpressionFromOperatorToken; - - function getOperatorTokenFromBinaryExpression(tokenKind) { - switch (tokenKind) { - case 205 /* MultiplyExpression */: - return 91 /* AsteriskToken */; - - case 206 /* DivideExpression */: - return 118 /* SlashToken */; - - case 207 /* ModuloExpression */: - return 92 /* PercentToken */; - - case 208 /* AddExpression */: - return 89 /* PlusToken */; - - case 209 /* SubtractExpression */: - return 90 /* MinusToken */; - - case 202 /* LeftShiftExpression */: - return 95 /* LessThanLessThanToken */; - - case 203 /* SignedRightShiftExpression */: - return 96 /* GreaterThanGreaterThanToken */; - - case 204 /* UnsignedRightShiftExpression */: - return 97 /* GreaterThanGreaterThanGreaterThanToken */; - - case 196 /* LessThanExpression */: - return 80 /* LessThanToken */; - - case 197 /* GreaterThanExpression */: - return 81 /* GreaterThanToken */; - - case 198 /* LessThanOrEqualExpression */: - return 82 /* LessThanEqualsToken */; - - case 199 /* GreaterThanOrEqualExpression */: - return 83 /* GreaterThanEqualsToken */; - - case 200 /* InstanceOfExpression */: - return 30 /* InstanceOfKeyword */; - - case 201 /* InExpression */: - return 29 /* InKeyword */; - - case 192 /* EqualsWithTypeConversionExpression */: - return 84 /* EqualsEqualsToken */; - - case 193 /* NotEqualsWithTypeConversionExpression */: - return 86 /* ExclamationEqualsToken */; - - case 194 /* EqualsExpression */: - return 87 /* EqualsEqualsEqualsToken */; - - case 195 /* NotEqualsExpression */: - return 88 /* ExclamationEqualsEqualsToken */; - - case 191 /* BitwiseAndExpression */: - return 98 /* AmpersandToken */; - - case 190 /* BitwiseExclusiveOrExpression */: - return 100 /* CaretToken */; - - case 189 /* BitwiseOrExpression */: - return 99 /* BarToken */; - - case 188 /* LogicalAndExpression */: - return 103 /* AmpersandAmpersandToken */; - - case 187 /* LogicalOrExpression */: - return 104 /* BarBarToken */; - - case 182 /* OrAssignmentExpression */: - return 116 /* BarEqualsToken */; - - case 180 /* AndAssignmentExpression */: - return 115 /* AmpersandEqualsToken */; - - case 181 /* ExclusiveOrAssignmentExpression */: - return 117 /* CaretEqualsToken */; - - case 183 /* LeftShiftAssignmentExpression */: - return 112 /* LessThanLessThanEqualsToken */; - - case 184 /* SignedRightShiftAssignmentExpression */: - return 113 /* GreaterThanGreaterThanEqualsToken */; - - case 185 /* UnsignedRightShiftAssignmentExpression */: - return 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - - case 175 /* AddAssignmentExpression */: - return 108 /* PlusEqualsToken */; - - case 176 /* SubtractAssignmentExpression */: - return 109 /* MinusEqualsToken */; - - case 177 /* MultiplyAssignmentExpression */: - return 110 /* AsteriskEqualsToken */; - - case 178 /* DivideAssignmentExpression */: - return 119 /* SlashEqualsToken */; - - case 179 /* ModuloAssignmentExpression */: - return 111 /* PercentEqualsToken */; - - case 174 /* AssignmentExpression */: - return 107 /* EqualsToken */; - - case 173 /* CommaExpression */: - return 79 /* CommaToken */; - - default: - return 0 /* None */; - } - } - SyntaxFacts.getOperatorTokenFromBinaryExpression = getOperatorTokenFromBinaryExpression; - - function isAnyDivideToken(kind) { - switch (kind) { - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - return true; - default: - return false; - } - } - SyntaxFacts.isAnyDivideToken = isAnyDivideToken; - - function isAnyDivideOrRegularExpressionToken(kind) { - switch (kind) { - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - case 12 /* RegularExpressionLiteral */: - return true; - default: - return false; - } - } - SyntaxFacts.isAnyDivideOrRegularExpressionToken = isAnyDivideOrRegularExpressionToken; - })(TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); - var SyntaxFacts = TypeScript.SyntaxFacts; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var isKeywordStartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isIdentifierStartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isIdentifierPartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isNumericLiteralStart = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - - for (var character = 0; character < 127 /* maxAsciiCharacter */; character++) { - if (character >= 97 /* a */ && character <= 122 /* z */) { - isIdentifierStartCharacter[character] = true; - isIdentifierPartCharacter[character] = true; - } else if ((character >= 65 /* A */ && character <= 90 /* Z */) || character === 95 /* _ */ || character === 36 /* $ */) { - isIdentifierStartCharacter[character] = true; - isIdentifierPartCharacter[character] = true; - } else if (character >= 48 /* _0 */ && character <= 57 /* _9 */) { - isIdentifierPartCharacter[character] = true; - isNumericLiteralStart[character] = true; - } - } - - isNumericLiteralStart[46 /* dot */] = true; - - for (var keywordKind = 15 /* FirstKeyword */; keywordKind <= 69 /* LastKeyword */; keywordKind++) { - var keyword = TypeScript.SyntaxFacts.getText(keywordKind); - isKeywordStartCharacter[keyword.charCodeAt(0)] = true; - } - - var Scanner = (function () { - function Scanner(fileName, text, languageVersion, window) { - if (typeof window === "undefined") { window = TypeScript.ArrayUtilities.createArray(2048, 0); } - this.slidingWindow = new TypeScript.SlidingWindow(this, window, 0, text.length()); - this.fileName = fileName; - this.text = text; - this._languageVersion = languageVersion; - } - Scanner.prototype.languageVersion = function () { - return this._languageVersion; - }; - - Scanner.prototype.fetchMoreItems = function (argument, sourceIndex, window, destinationIndex, spaceAvailable) { - var charactersRemaining = this.text.length() - sourceIndex; - var amountToRead = TypeScript.MathPrototype.min(charactersRemaining, spaceAvailable); - this.text.copyTo(sourceIndex, window, destinationIndex, amountToRead); - return amountToRead; - }; - - Scanner.prototype.currentCharCode = function () { - return this.slidingWindow.currentItem(null); - }; - - Scanner.prototype.absoluteIndex = function () { - return this.slidingWindow.absoluteIndex(); - }; - - Scanner.prototype.setAbsoluteIndex = function (index) { - this.slidingWindow.setAbsoluteIndex(index); - }; - - Scanner.prototype.scan = function (diagnostics, allowRegularExpression) { - var diagnosticsLength = diagnostics.length; - var fullStart = this.slidingWindow.absoluteIndex(); - var leadingTriviaInfo = this.scanTriviaInfo(diagnostics, false); - - var start = this.slidingWindow.absoluteIndex(); - var kindAndFlags = this.scanSyntaxToken(diagnostics, allowRegularExpression); - var end = this.slidingWindow.absoluteIndex(); - - var trailingTriviaInfo = this.scanTriviaInfo(diagnostics, true); - var fullEnd = this.slidingWindow.absoluteIndex(); - - var isVariableWidthKeyword = (kindAndFlags & -2147483648 /* IsVariableWidthKeyword */) !== 0; - var kind = kindAndFlags & ~-2147483648 /* IsVariableWidthKeyword */; - - var token = this.createToken(fullStart, leadingTriviaInfo, start, kind, end, fullEnd, trailingTriviaInfo, isVariableWidthKeyword); - - return diagnosticsLength !== diagnostics.length ? TypeScript.Syntax.realizeToken(token) : token; - }; - - Scanner.prototype.createToken = function (fullStart, leadingTriviaInfo, start, kind, end, fullEnd, trailingTriviaInfo, isVariableWidthKeyword) { - if (!isVariableWidthKeyword && kind >= 15 /* FirstFixedWidth */) { - if (leadingTriviaInfo === 0) { - if (trailingTriviaInfo === 0) { - return new TypeScript.Syntax.FixedWidthTokenWithNoTrivia(kind); - } else { - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - return new TypeScript.Syntax.FixedWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo); - } - } else if (trailingTriviaInfo === 0) { - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - return new TypeScript.Syntax.FixedWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo); - } else { - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - return new TypeScript.Syntax.FixedWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo); - } - } else { - var width = end - start; - - var fullText = this.text.substr(fullStart, fullEnd - fullStart, false); - - if (leadingTriviaInfo === 0) { - if (trailingTriviaInfo === 0) { - return new TypeScript.Syntax.VariableWidthTokenWithNoTrivia(fullText, kind); - } else { - return new TypeScript.Syntax.VariableWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo); - } - } else if (trailingTriviaInfo === 0) { - return new TypeScript.Syntax.VariableWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo); - } else { - return new TypeScript.Syntax.VariableWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo); - } - } - }; - - Scanner.scanTrivia = function (text, start, length, isTrailing) { - var scanner = new Scanner(null, text.subText(new TypeScript.TextSpan(start, length)), 1 /* EcmaScript5 */, Scanner.triviaWindow); - return scanner.scanTrivia(text, start, isTrailing); - }; - - Scanner.prototype.scanTrivia = function (underlyingText, underlyingTextStart, isTrailing) { - var trivia = new Array(); - - while (true) { - if (!this.slidingWindow.isAtEndOfSource()) { - var ch = this.currentCharCode(); - - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - trivia.push(this.scanWhitespaceTrivia(underlyingText, underlyingTextStart)); - continue; - - case 47 /* slash */: - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 47 /* slash */) { - trivia.push(this.scanSingleLineCommentTrivia(underlyingText, underlyingTextStart)); - continue; - } - - if (ch2 === 42 /* asterisk */) { - trivia.push(this.scanMultiLineCommentTrivia(underlyingText, underlyingTextStart)); - continue; - } - - throw TypeScript.Errors.invalidOperation(); - - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - trivia.push(this.scanLineTerminatorSequenceTrivia(ch)); - - if (!isTrailing) { - continue; - } - - break; - - default: - throw TypeScript.Errors.invalidOperation(); - } - } - - return TypeScript.Syntax.triviaList(trivia); - } - }; - - Scanner.prototype.scanTriviaInfo = function (diagnostics, isTrailing) { - var width = 0; - var hasCommentOrNewLine = 0; - - while (true) { - var ch = this.currentCharCode(); - - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - this.slidingWindow.moveToNextItem(); - width++; - continue; - - case 47 /* slash */: - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 47 /* slash */) { - hasCommentOrNewLine |= 2 /* TriviaCommentMask */; - width += this.scanSingleLineCommentTriviaLength(); - continue; - } - - if (ch2 === 42 /* asterisk */) { - hasCommentOrNewLine |= 2 /* TriviaCommentMask */; - width += this.scanMultiLineCommentTriviaLength(diagnostics); - continue; - } - - break; - - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - hasCommentOrNewLine |= 1 /* TriviaNewLineMask */; - width += this.scanLineTerminatorSequenceLength(ch); - - if (!isTrailing) { - continue; - } - - break; - } - - return (width << 2 /* TriviaFullWidthShift */) | hasCommentOrNewLine; - } - }; - - Scanner.prototype.isNewLineCharacter = function (ch) { - switch (ch) { - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - return true; - default: - return false; - } - }; - - Scanner.prototype.scanWhitespaceTrivia = function (underlyingText, underlyingTextStart) { - var absoluteStartIndex = this.absoluteIndex(); - - var width = 0; - while (true) { - var ch = this.currentCharCode(); - - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - this.slidingWindow.moveToNextItem(); - width++; - continue; - } - - break; - } - - return TypeScript.Syntax.deferredTrivia(4 /* WhitespaceTrivia */, underlyingText, underlyingTextStart + absoluteStartIndex, width); - }; - - Scanner.prototype.scanSingleLineCommentTrivia = function (underlyingText, underlyingTextStart) { - var absoluteStartIndex = this.slidingWindow.absoluteIndex(); - var width = this.scanSingleLineCommentTriviaLength(); - - return TypeScript.Syntax.deferredTrivia(7 /* SingleLineCommentTrivia */, underlyingText, underlyingTextStart + absoluteStartIndex, width); - }; - - Scanner.prototype.scanSingleLineCommentTriviaLength = function () { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - - var width = 2; - while (true) { - if (this.slidingWindow.isAtEndOfSource() || this.isNewLineCharacter(this.currentCharCode())) { - return width; - } - - this.slidingWindow.moveToNextItem(); - width++; - } - }; - - Scanner.prototype.scanMultiLineCommentTrivia = function (underlyingText, underlyingTextStart) { - var absoluteStartIndex = this.absoluteIndex(); - var width = this.scanMultiLineCommentTriviaLength(null); - - return TypeScript.Syntax.deferredTrivia(6 /* MultiLineCommentTrivia */, underlyingText, underlyingTextStart + absoluteStartIndex, width); - }; - - Scanner.prototype.scanMultiLineCommentTriviaLength = function (diagnostics) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - - var width = 2; - while (true) { - if (this.slidingWindow.isAtEndOfSource()) { - if (diagnostics !== null) { - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), this.slidingWindow.absoluteIndex(), 0, TypeScript.DiagnosticCode.AsteriskSlash_expected, null)); - } - - return width; - } - - var ch = this.currentCharCode(); - if (ch === 42 /* asterisk */ && this.slidingWindow.peekItemN(1) === 47 /* slash */) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - width += 2; - return width; - } - - this.slidingWindow.moveToNextItem(); - width++; - } - }; - - Scanner.prototype.scanLineTerminatorSequenceTrivia = function (ch) { - var absoluteStartIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - var width = this.scanLineTerminatorSequenceLength(ch); - - var text = this.substring(absoluteStartIndex, absoluteStartIndex + width, false); - this.slidingWindow.releaseAndUnpinAbsoluteIndex(absoluteStartIndex); - - return TypeScript.Syntax.trivia(5 /* NewLineTrivia */, text); - }; - - Scanner.prototype.scanLineTerminatorSequenceLength = function (ch) { - this.slidingWindow.moveToNextItem(); - - if (ch === 13 /* carriageReturn */ && this.currentCharCode() === 10 /* lineFeed */) { - this.slidingWindow.moveToNextItem(); - return 2; - } else { - return 1; - } - }; - - Scanner.prototype.scanSyntaxToken = function (diagnostics, allowRegularExpression) { - if (this.slidingWindow.isAtEndOfSource()) { - return 10 /* EndOfFileToken */; - } - - var character = this.currentCharCode(); - - switch (character) { - case 34 /* doubleQuote */: - case 39 /* singleQuote */: - return this.scanStringLiteral(diagnostics); - - case 47 /* slash */: - return this.scanSlashToken(allowRegularExpression); - - case 46 /* dot */: - return this.scanDotToken(diagnostics); - - case 45 /* minus */: - return this.scanMinusToken(); - - case 33 /* exclamation */: - return this.scanExclamationToken(); - - case 61 /* equals */: - return this.scanEqualsToken(); - - case 124 /* bar */: - return this.scanBarToken(); - - case 42 /* asterisk */: - return this.scanAsteriskToken(); - - case 43 /* plus */: - return this.scanPlusToken(); - - case 37 /* percent */: - return this.scanPercentToken(); - - case 38 /* ampersand */: - return this.scanAmpersandToken(); - - case 94 /* caret */: - return this.scanCaretToken(); - - case 60 /* lessThan */: - return this.scanLessThanToken(); - - case 62 /* greaterThan */: - return this.advanceAndSetTokenKind(81 /* GreaterThanToken */); - - case 44 /* comma */: - return this.advanceAndSetTokenKind(79 /* CommaToken */); - - case 58 /* colon */: - return this.advanceAndSetTokenKind(106 /* ColonToken */); - - case 59 /* semicolon */: - return this.advanceAndSetTokenKind(78 /* SemicolonToken */); - - case 126 /* tilde */: - return this.advanceAndSetTokenKind(102 /* TildeToken */); - - case 40 /* openParen */: - return this.advanceAndSetTokenKind(72 /* OpenParenToken */); - - case 41 /* closeParen */: - return this.advanceAndSetTokenKind(73 /* CloseParenToken */); - - case 123 /* openBrace */: - return this.advanceAndSetTokenKind(70 /* OpenBraceToken */); - - case 125 /* closeBrace */: - return this.advanceAndSetTokenKind(71 /* CloseBraceToken */); - - case 91 /* openBracket */: - return this.advanceAndSetTokenKind(74 /* OpenBracketToken */); - - case 93 /* closeBracket */: - return this.advanceAndSetTokenKind(75 /* CloseBracketToken */); - - case 63 /* question */: - return this.advanceAndSetTokenKind(105 /* QuestionToken */); - } - - if (isNumericLiteralStart[character]) { - return this.scanNumericLiteral(diagnostics); - } - - if (isIdentifierStartCharacter[character]) { - var result = this.tryFastScanIdentifierOrKeyword(character); - if (result !== 0 /* None */) { - return result; - } - } - - if (this.isIdentifierStart(this.peekCharOrUnicodeEscape())) { - return this.slowScanIdentifierOrKeyword(diagnostics); - } - - return this.scanDefaultCharacter(character, diagnostics); - }; - - Scanner.prototype.isIdentifierStart = function (interpretedChar) { - if (isIdentifierStartCharacter[interpretedChar]) { - return true; - } - - return interpretedChar > 127 /* maxAsciiCharacter */ && TypeScript.Unicode.isIdentifierStart(interpretedChar, this._languageVersion); - }; - - Scanner.prototype.isIdentifierPart = function (interpretedChar) { - if (isIdentifierPartCharacter[interpretedChar]) { - return true; - } - - return interpretedChar > 127 /* maxAsciiCharacter */ && TypeScript.Unicode.isIdentifierPart(interpretedChar, this._languageVersion); - }; - - Scanner.prototype.tryFastScanIdentifierOrKeyword = function (firstCharacter) { - var slidingWindow = this.slidingWindow; - var window = slidingWindow.window; - - var startIndex = slidingWindow.currentRelativeItemIndex; - var endIndex = slidingWindow.windowCount; - var currentIndex = startIndex; - var character = 0; - - while (currentIndex < endIndex) { - character = window[currentIndex]; - if (!isIdentifierPartCharacter[character]) { - break; - } - - currentIndex++; - } - - if (currentIndex === endIndex) { - return 0 /* None */; - } else if (character === 92 /* backslash */ || character > 127 /* maxAsciiCharacter */) { - return 0 /* None */; - } else { - var kind; - var identifierLength = currentIndex - startIndex; - if (isKeywordStartCharacter[firstCharacter]) { - kind = TypeScript.ScannerUtilities.identifierKind(window, startIndex, identifierLength); - } else { - kind = 11 /* IdentifierName */; - } - - slidingWindow.setAbsoluteIndex(slidingWindow.absoluteIndex() + identifierLength); - - return kind; - } - }; - - Scanner.prototype.slowScanIdentifierOrKeyword = function (diagnostics) { - var startIndex = this.slidingWindow.absoluteIndex(); - var sawUnicodeEscape = false; - - do { - var unicodeEscape = this.scanCharOrUnicodeEscape(diagnostics); - sawUnicodeEscape = sawUnicodeEscape || unicodeEscape; - } while(this.isIdentifierPart(this.peekCharOrUnicodeEscape())); - - var length = this.slidingWindow.absoluteIndex() - startIndex; - var text = this.text.substr(startIndex, length, false); - var valueText = TypeScript.Syntax.massageEscapes(text); - - var keywordKind = TypeScript.SyntaxFacts.getTokenKind(valueText); - if (keywordKind >= 15 /* FirstKeyword */ && keywordKind <= 69 /* LastKeyword */) { - if (sawUnicodeEscape) { - return keywordKind | -2147483648 /* IsVariableWidthKeyword */; - } else { - return keywordKind; - } - } - - return 11 /* IdentifierName */; - }; - - Scanner.prototype.scanNumericLiteral = function (diagnostics) { - if (this.isHexNumericLiteral()) { - this.scanHexNumericLiteral(); - } else if (this.isOctalNumericLiteral()) { - this.scanOctalNumericLiteral(diagnostics); - } else { - this.scanDecimalNumericLiteral(); - } - - return 13 /* NumericLiteral */; - }; - - Scanner.prototype.isOctalNumericLiteral = function () { - return this.currentCharCode() === 48 /* _0 */ && TypeScript.CharacterInfo.isOctalDigit(this.slidingWindow.peekItemN(1)); - }; - - Scanner.prototype.scanOctalNumericLiteral = function (diagnostics) { - var position = this.absoluteIndex(); - - while (TypeScript.CharacterInfo.isOctalDigit(this.currentCharCode())) { - this.slidingWindow.moveToNextItem(); - } - - if (this.languageVersion() >= 1 /* EcmaScript5 */) { - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), position, this.absoluteIndex() - position, TypeScript.DiagnosticCode.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher, null)); - } - }; - - Scanner.prototype.scanDecimalDigits = function () { - while (TypeScript.CharacterInfo.isDecimalDigit(this.currentCharCode())) { - this.slidingWindow.moveToNextItem(); - } - }; - - Scanner.prototype.scanDecimalNumericLiteral = function () { - this.scanDecimalDigits(); - - if (this.currentCharCode() === 46 /* dot */) { - this.slidingWindow.moveToNextItem(); - } - - this.scanDecimalDigits(); - - var ch = this.currentCharCode(); - if (ch === 101 /* e */ || ch === 69 /* E */) { - var nextChar1 = this.slidingWindow.peekItemN(1); - - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar1)) { - this.slidingWindow.moveToNextItem(); - this.scanDecimalDigits(); - } else if (nextChar1 === 45 /* minus */ || nextChar1 === 43 /* plus */) { - var nextChar2 = this.slidingWindow.peekItemN(2); - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar2)) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - this.scanDecimalDigits(); - } - } - } - }; - - Scanner.prototype.scanHexNumericLiteral = function () { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - - while (TypeScript.CharacterInfo.isHexDigit(this.currentCharCode())) { - this.slidingWindow.moveToNextItem(); - } - }; - - Scanner.prototype.isHexNumericLiteral = function () { - if (this.currentCharCode() === 48 /* _0 */) { - var ch = this.slidingWindow.peekItemN(1); - - if (ch === 120 /* x */ || ch === 88 /* X */) { - ch = this.slidingWindow.peekItemN(2); - - return TypeScript.CharacterInfo.isHexDigit(ch); - } - } - - return false; - }; - - Scanner.prototype.advanceAndSetTokenKind = function (kind) { - this.slidingWindow.moveToNextItem(); - return kind; - }; - - Scanner.prototype.scanLessThanToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 82 /* LessThanEqualsToken */; - } else if (this.currentCharCode() === 60 /* lessThan */) { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 112 /* LessThanLessThanEqualsToken */; - } else { - return 95 /* LessThanLessThanToken */; - } - } else { - return 80 /* LessThanToken */; - } - }; - - Scanner.prototype.scanBarToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 116 /* BarEqualsToken */; - } else if (this.currentCharCode() === 124 /* bar */) { - this.slidingWindow.moveToNextItem(); - return 104 /* BarBarToken */; - } else { - return 99 /* BarToken */; - } - }; - - Scanner.prototype.scanCaretToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 117 /* CaretEqualsToken */; - } else { - return 100 /* CaretToken */; - } - }; - - Scanner.prototype.scanAmpersandToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 115 /* AmpersandEqualsToken */; - } else if (this.currentCharCode() === 38 /* ampersand */) { - this.slidingWindow.moveToNextItem(); - return 103 /* AmpersandAmpersandToken */; - } else { - return 98 /* AmpersandToken */; - } - }; - - Scanner.prototype.scanPercentToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 111 /* PercentEqualsToken */; - } else { - return 92 /* PercentToken */; - } - }; - - Scanner.prototype.scanMinusToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 109 /* MinusEqualsToken */; - } else if (character === 45 /* minus */) { - this.slidingWindow.moveToNextItem(); - return 94 /* MinusMinusToken */; - } else { - return 90 /* MinusToken */; - } - }; - - Scanner.prototype.scanPlusToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 108 /* PlusEqualsToken */; - } else if (character === 43 /* plus */) { - this.slidingWindow.moveToNextItem(); - return 93 /* PlusPlusToken */; - } else { - return 89 /* PlusToken */; - } - }; - - Scanner.prototype.scanAsteriskToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 110 /* AsteriskEqualsToken */; - } else { - return 91 /* AsteriskToken */; - } - }; - - Scanner.prototype.scanEqualsToken = function () { - this.slidingWindow.moveToNextItem(); - var character = this.currentCharCode(); - if (character === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - return 87 /* EqualsEqualsEqualsToken */; - } else { - return 84 /* EqualsEqualsToken */; - } - } else if (character === 62 /* greaterThan */) { - this.slidingWindow.moveToNextItem(); - return 85 /* EqualsGreaterThanToken */; - } else { - return 107 /* EqualsToken */; - } - }; - - Scanner.prototype.isDotPrefixedNumericLiteral = function () { - if (this.currentCharCode() === 46 /* dot */) { - var ch = this.slidingWindow.peekItemN(1); - return TypeScript.CharacterInfo.isDecimalDigit(ch); - } - - return false; - }; - - Scanner.prototype.scanDotToken = function (diagnostics) { - if (this.isDotPrefixedNumericLiteral()) { - return this.scanNumericLiteral(diagnostics); - } - - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 46 /* dot */ && this.slidingWindow.peekItemN(1) === 46 /* dot */) { - this.slidingWindow.moveToNextItem(); - this.slidingWindow.moveToNextItem(); - return 77 /* DotDotDotToken */; - } else { - return 76 /* DotToken */; - } - }; - - Scanner.prototype.scanSlashToken = function (allowRegularExpression) { - if (allowRegularExpression) { - var result = this.tryScanRegularExpressionToken(); - if (result !== 0 /* None */) { - return result; - } - } - - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - return 119 /* SlashEqualsToken */; - } else { - return 118 /* SlashToken */; - } - }; - - Scanner.prototype.tryScanRegularExpressionToken = function () { - var startIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - - this.slidingWindow.moveToNextItem(); - - var inEscape = false; - var inCharacterClass = false; - while (true) { - var ch = this.currentCharCode(); - - if (this.isNewLineCharacter(ch) || this.slidingWindow.isAtEndOfSource()) { - this.slidingWindow.rewindToPinnedIndex(startIndex); - this.slidingWindow.releaseAndUnpinAbsoluteIndex(startIndex); - return 0 /* None */; - } - - this.slidingWindow.moveToNextItem(); - if (inEscape) { - inEscape = false; - continue; - } - - switch (ch) { - case 92 /* backslash */: - inEscape = true; - continue; - - case 91 /* openBracket */: - inCharacterClass = true; - continue; - - case 93 /* closeBracket */: - inCharacterClass = false; - continue; - - case 47 /* slash */: - if (inCharacterClass) { - continue; - } - - break; - - default: - continue; - } - - break; - } - - while (isIdentifierPartCharacter[this.currentCharCode()]) { - this.slidingWindow.moveToNextItem(); - } - - this.slidingWindow.releaseAndUnpinAbsoluteIndex(startIndex); - return 12 /* RegularExpressionLiteral */; - }; - - Scanner.prototype.scanExclamationToken = function () { - this.slidingWindow.moveToNextItem(); - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - if (this.currentCharCode() === 61 /* equals */) { - this.slidingWindow.moveToNextItem(); - - return 88 /* ExclamationEqualsEqualsToken */; - } else { - return 86 /* ExclamationEqualsToken */; - } - } else { - return 101 /* ExclamationToken */; - } - }; - - Scanner.prototype.scanDefaultCharacter = function (character, diagnostics) { - var position = this.slidingWindow.absoluteIndex(); - this.slidingWindow.moveToNextItem(); - - var text = String.fromCharCode(character); - var messageText = this.getErrorMessageText(text); - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), position, 1, TypeScript.DiagnosticCode.Unexpected_character_0, [messageText])); - - return 9 /* ErrorToken */; - }; - - Scanner.prototype.getErrorMessageText = function (text) { - if (text === "\\") { - return '"\\"'; - } - - return JSON.stringify(text); - }; - - Scanner.prototype.skipEscapeSequence = function (diagnostics) { - var rewindPoint = this.slidingWindow.getAndPinAbsoluteIndex(); - - this.slidingWindow.moveToNextItem(); - - var ch = this.currentCharCode(); - this.slidingWindow.moveToNextItem(); - switch (ch) { - case 120 /* x */: - case 117 /* u */: - this.slidingWindow.rewindToPinnedIndex(rewindPoint); - var value = this.scanUnicodeOrHexEscape(diagnostics); - break; - - case 13 /* carriageReturn */: - if (this.currentCharCode() === 10 /* lineFeed */) { - this.slidingWindow.moveToNextItem(); - } - break; - - default: - break; - } - - this.slidingWindow.releaseAndUnpinAbsoluteIndex(rewindPoint); - }; - - Scanner.prototype.scanStringLiteral = function (diagnostics) { - var quoteCharacter = this.currentCharCode(); - - this.slidingWindow.moveToNextItem(); - - while (true) { - var ch = this.currentCharCode(); - if (ch === 92 /* backslash */) { - this.skipEscapeSequence(diagnostics); - } else if (ch === quoteCharacter) { - this.slidingWindow.moveToNextItem(); - break; - } else if (this.isNewLineCharacter(ch) || this.slidingWindow.isAtEndOfSource()) { - diagnostics.push(new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), TypeScript.MathPrototype.min(this.slidingWindow.absoluteIndex(), this.text.length()), 1, TypeScript.DiagnosticCode.Missing_close_quote_character, null)); - break; - } else { - this.slidingWindow.moveToNextItem(); - } - } - - return 14 /* StringLiteral */; - }; - - Scanner.prototype.isUnicodeEscape = function (character) { - if (character === 92 /* backslash */) { - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 117 /* u */) { - return true; - } - } - - return false; - }; - - Scanner.prototype.peekCharOrUnicodeEscape = function () { - var character = this.currentCharCode(); - if (this.isUnicodeEscape(character)) { - return this.peekUnicodeOrHexEscape(); - } else { - return character; - } - }; - - Scanner.prototype.peekUnicodeOrHexEscape = function () { - var startIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - - var ch = this.scanUnicodeOrHexEscape(null); - - this.slidingWindow.rewindToPinnedIndex(startIndex); - this.slidingWindow.releaseAndUnpinAbsoluteIndex(startIndex); - - return ch; - }; - - Scanner.prototype.scanCharOrUnicodeEscape = function (errors) { - var ch = this.currentCharCode(); - if (ch === 92 /* backslash */) { - var ch2 = this.slidingWindow.peekItemN(1); - if (ch2 === 117 /* u */) { - this.scanUnicodeOrHexEscape(errors); - return true; - } - } - - this.slidingWindow.moveToNextItem(); - return false; - }; - - Scanner.prototype.scanUnicodeOrHexEscape = function (errors) { - var start = this.slidingWindow.absoluteIndex(); - var character = this.currentCharCode(); - - this.slidingWindow.moveToNextItem(); - - character = this.currentCharCode(); - - var intChar = 0; - this.slidingWindow.moveToNextItem(); - - var count = character === 117 /* u */ ? 4 : 2; - - for (var i = 0; i < count; i++) { - var ch2 = this.currentCharCode(); - if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { - if (errors !== null) { - var end = this.slidingWindow.absoluteIndex(); - var info = this.createIllegalEscapeDiagnostic(start, end); - errors.push(info); - } - - break; - } - - intChar = (intChar << 4) + TypeScript.CharacterInfo.hexValue(ch2); - this.slidingWindow.moveToNextItem(); - } - - return intChar; - }; - - Scanner.prototype.substring = function (start, end, intern) { - var length = end - start; - var offset = start - this.slidingWindow.windowAbsoluteStartIndex; - - if (intern) { - return TypeScript.Collections.DefaultStringTable.addCharArray(this.slidingWindow.window, offset, length); - } else { - return TypeScript.StringUtilities.fromCharCodeArray(this.slidingWindow.window.slice(offset, offset + length)); - } - }; - - Scanner.prototype.createIllegalEscapeDiagnostic = function (start, end) { - return new TypeScript.Diagnostic(this.fileName, this.text.lineMap(), start, end - start, TypeScript.DiagnosticCode.Unrecognized_escape_sequence, null); - }; - - Scanner.isValidIdentifier = function (text, languageVersion) { - var scanner = new Scanner(null, text, languageVersion, Scanner.triviaWindow); - var errors = new Array(); - var token = scanner.scan(errors, false); - - return errors.length === 0 && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token) && token.width() === text.length(); - }; - Scanner.triviaWindow = TypeScript.ArrayUtilities.createArray(2048, 0); - return Scanner; - })(); - TypeScript.Scanner = Scanner; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ScannerUtilities = (function () { - function ScannerUtilities() { - } - ScannerUtilities.identifierKind = function (array, startIndex, length) { - switch (length) { - case 2: - switch (array[startIndex]) { - case 100 /* d */: - return (array[startIndex + 1] === 111 /* o */) ? 22 /* DoKeyword */ : 11 /* IdentifierName */; - case 105 /* i */: - switch (array[startIndex + 1]) { - case 102 /* f */: - return 28 /* IfKeyword */; - case 110 /* n */: - return 29 /* InKeyword */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 3: - switch (array[startIndex]) { - case 102 /* f */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 114 /* r */) ? 26 /* ForKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 119 /* w */) ? 31 /* NewKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - return (array[startIndex + 1] === 114 /* r */ && array[startIndex + 2] === 121 /* y */) ? 38 /* TryKeyword */ : 11 /* IdentifierName */; - case 118 /* v */: - return (array[startIndex + 1] === 97 /* a */ && array[startIndex + 2] === 114 /* r */) ? 40 /* VarKeyword */ : 11 /* IdentifierName */; - case 108 /* l */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */) ? 53 /* LetKeyword */ : 11 /* IdentifierName */; - case 97 /* a */: - return (array[startIndex + 1] === 110 /* n */ && array[startIndex + 2] === 121 /* y */) ? 60 /* AnyKeyword */ : 11 /* IdentifierName */; - case 103 /* g */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */) ? 64 /* GetKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */) ? 68 /* SetKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 4: - switch (array[startIndex]) { - case 99 /* c */: - return (array[startIndex + 1] === 97 /* a */ && array[startIndex + 2] === 115 /* s */ && array[startIndex + 3] === 101 /* e */) ? 16 /* CaseKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - switch (array[startIndex + 1]) { - case 108 /* l */: - return (array[startIndex + 2] === 115 /* s */ && array[startIndex + 3] === 101 /* e */) ? 23 /* ElseKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (array[startIndex + 2] === 117 /* u */ && array[startIndex + 3] === 109 /* m */) ? 46 /* EnumKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 110 /* n */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 108 /* l */ && array[startIndex + 3] === 108 /* l */) ? 32 /* NullKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - switch (array[startIndex + 1]) { - case 104 /* h */: - return (array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 115 /* s */) ? 35 /* ThisKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 2] === 117 /* u */ && array[startIndex + 3] === 101 /* e */) ? 37 /* TrueKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 118 /* v */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 100 /* d */) ? 41 /* VoidKeyword */ : 11 /* IdentifierName */; - case 119 /* w */: - return (array[startIndex + 1] === 105 /* i */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 104 /* h */) ? 43 /* WithKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 5: - switch (array[startIndex]) { - case 98 /* b */: - return (array[startIndex + 1] === 114 /* r */ && array[startIndex + 2] === 101 /* e */ && array[startIndex + 3] === 97 /* a */ && array[startIndex + 4] === 107 /* k */) ? 15 /* BreakKeyword */ : 11 /* IdentifierName */; - case 99 /* c */: - switch (array[startIndex + 1]) { - case 97 /* a */: - return (array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 99 /* c */ && array[startIndex + 4] === 104 /* h */) ? 17 /* CatchKeyword */ : 11 /* IdentifierName */; - case 108 /* l */: - return (array[startIndex + 2] === 97 /* a */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 115 /* s */) ? 44 /* ClassKeyword */ : 11 /* IdentifierName */; - case 111 /* o */: - return (array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 116 /* t */) ? 45 /* ConstKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 102 /* f */: - return (array[startIndex + 1] === 97 /* a */ && array[startIndex + 2] === 108 /* l */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 101 /* e */) ? 24 /* FalseKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - return (array[startIndex + 1] === 104 /* h */ && array[startIndex + 2] === 114 /* r */ && array[startIndex + 3] === 111 /* o */ && array[startIndex + 4] === 119 /* w */) ? 36 /* ThrowKeyword */ : 11 /* IdentifierName */; - case 119 /* w */: - return (array[startIndex + 1] === 104 /* h */ && array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 101 /* e */) ? 42 /* WhileKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 114 /* r */) ? 50 /* SuperKeyword */ : 11 /* IdentifierName */; - case 121 /* y */: - return (array[startIndex + 1] === 105 /* i */ && array[startIndex + 2] === 101 /* e */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 100 /* d */) ? 59 /* YieldKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 6: - switch (array[startIndex]) { - case 100 /* d */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 108 /* l */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 116 /* t */ && array[startIndex + 5] === 101 /* e */) ? 21 /* DeleteKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 110 /* n */) ? 33 /* ReturnKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - switch (array[startIndex + 1]) { - case 119 /* w */: - return (array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 99 /* c */ && array[startIndex + 5] === 104 /* h */) ? 34 /* SwitchKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - switch (array[startIndex + 2]) { - case 97 /* a */: - return (array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 99 /* c */) ? 58 /* StaticKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 3] === 105 /* i */ && array[startIndex + 4] === 110 /* n */ && array[startIndex + 5] === 103 /* g */) ? 69 /* StringKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 116 /* t */: - return (array[startIndex + 1] === 121 /* y */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 111 /* o */ && array[startIndex + 5] === 102 /* f */) ? 39 /* TypeOfKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - return (array[startIndex + 1] === 120 /* x */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 111 /* o */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 116 /* t */) ? 47 /* ExportKeyword */ : 11 /* IdentifierName */; - case 105 /* i */: - return (array[startIndex + 1] === 109 /* m */ && array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 111 /* o */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 116 /* t */) ? 49 /* ImportKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 98 /* b */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 99 /* c */) ? 57 /* PublicKeyword */ : 11 /* IdentifierName */; - case 109 /* m */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 100 /* d */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 108 /* l */ && array[startIndex + 5] === 101 /* e */) ? 65 /* ModuleKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 109 /* m */ && array[startIndex + 3] === 98 /* b */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 114 /* r */) ? 67 /* NumberKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 7: - switch (array[startIndex]) { - case 100 /* d */: - switch (array[startIndex + 1]) { - case 101 /* e */: - switch (array[startIndex + 2]) { - case 102 /* f */: - return (array[startIndex + 3] === 97 /* a */ && array[startIndex + 4] === 117 /* u */ && array[startIndex + 5] === 108 /* l */ && array[startIndex + 6] === 116 /* t */) ? 20 /* DefaultKeyword */ : 11 /* IdentifierName */; - case 99 /* c */: - return (array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 114 /* r */ && array[startIndex + 6] === 101 /* e */) ? 63 /* DeclareKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 102 /* f */: - return (array[startIndex + 1] === 105 /* i */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 97 /* a */ && array[startIndex + 4] === 108 /* l */ && array[startIndex + 5] === 108 /* l */ && array[startIndex + 6] === 121 /* y */) ? 25 /* FinallyKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - return (array[startIndex + 1] === 120 /* x */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 110 /* n */ && array[startIndex + 5] === 100 /* d */ && array[startIndex + 6] === 115 /* s */) ? 48 /* ExtendsKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - switch (array[startIndex + 1]) { - case 97 /* a */: - return (array[startIndex + 2] === 99 /* c */ && array[startIndex + 3] === 107 /* k */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 103 /* g */ && array[startIndex + 6] === 101 /* e */) ? 54 /* PackageKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 2] === 105 /* i */ && array[startIndex + 3] === 118 /* v */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 116 /* t */ && array[startIndex + 6] === 101 /* e */) ? 55 /* PrivateKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 98 /* b */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 111 /* o */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 97 /* a */ && array[startIndex + 6] === 110 /* n */) ? 61 /* BooleanKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 113 /* q */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 114 /* r */ && array[startIndex + 6] === 101 /* e */) ? 66 /* RequireKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 8: - switch (array[startIndex]) { - case 99 /* c */: - return (array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 105 /* i */ && array[startIndex + 5] === 110 /* n */ && array[startIndex + 6] === 117 /* u */ && array[startIndex + 7] === 101 /* e */) ? 18 /* ContinueKeyword */ : 11 /* IdentifierName */; - case 100 /* d */: - return (array[startIndex + 1] === 101 /* e */ && array[startIndex + 2] === 98 /* b */ && array[startIndex + 3] === 117 /* u */ && array[startIndex + 4] === 103 /* g */ && array[startIndex + 5] === 103 /* g */ && array[startIndex + 6] === 101 /* e */ && array[startIndex + 7] === 114 /* r */) ? 19 /* DebuggerKeyword */ : 11 /* IdentifierName */; - case 102 /* f */: - return (array[startIndex + 1] === 117 /* u */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 99 /* c */ && array[startIndex + 4] === 116 /* t */ && array[startIndex + 5] === 105 /* i */ && array[startIndex + 6] === 111 /* o */ && array[startIndex + 7] === 110 /* n */) ? 27 /* FunctionKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 9: - switch (array[startIndex]) { - case 105 /* i */: - return (array[startIndex + 1] === 110 /* n */ && array[startIndex + 2] === 116 /* t */ && array[startIndex + 3] === 101 /* e */ && array[startIndex + 4] === 114 /* r */ && array[startIndex + 5] === 102 /* f */ && array[startIndex + 6] === 97 /* a */ && array[startIndex + 7] === 99 /* c */ && array[startIndex + 8] === 101 /* e */) ? 52 /* InterfaceKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - return (array[startIndex + 1] === 114 /* r */ && array[startIndex + 2] === 111 /* o */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 99 /* c */ && array[startIndex + 6] === 116 /* t */ && array[startIndex + 7] === 101 /* e */ && array[startIndex + 8] === 100 /* d */) ? 56 /* ProtectedKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - case 10: - switch (array[startIndex]) { - case 105 /* i */: - switch (array[startIndex + 1]) { - case 110 /* n */: - return (array[startIndex + 2] === 115 /* s */ && array[startIndex + 3] === 116 /* t */ && array[startIndex + 4] === 97 /* a */ && array[startIndex + 5] === 110 /* n */ && array[startIndex + 6] === 99 /* c */ && array[startIndex + 7] === 101 /* e */ && array[startIndex + 8] === 111 /* o */ && array[startIndex + 9] === 102 /* f */) ? 30 /* InstanceOfKeyword */ : 11 /* IdentifierName */; - case 109 /* m */: - return (array[startIndex + 2] === 112 /* p */ && array[startIndex + 3] === 108 /* l */ && array[startIndex + 4] === 101 /* e */ && array[startIndex + 5] === 109 /* m */ && array[startIndex + 6] === 101 /* e */ && array[startIndex + 7] === 110 /* n */ && array[startIndex + 8] === 116 /* t */ && array[startIndex + 9] === 115 /* s */) ? 51 /* ImplementsKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - - default: - return 11 /* IdentifierName */; - } - - case 11: - return (array[startIndex] === 99 /* c */ && array[startIndex + 1] === 111 /* o */ && array[startIndex + 2] === 110 /* n */ && array[startIndex + 3] === 115 /* s */ && array[startIndex + 4] === 116 /* t */ && array[startIndex + 5] === 114 /* r */ && array[startIndex + 6] === 117 /* u */ && array[startIndex + 7] === 99 /* c */ && array[startIndex + 8] === 116 /* t */ && array[startIndex + 9] === 111 /* o */ && array[startIndex + 10] === 114 /* r */) ? 62 /* ConstructorKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; - } - }; - return ScannerUtilities; - })(); - TypeScript.ScannerUtilities = ScannerUtilities; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var EmptySeparatedSyntaxList = (function () { - function EmptySeparatedSyntaxList() { - } - EmptySeparatedSyntaxList.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - EmptySeparatedSyntaxList.prototype.isNode = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isToken = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isList = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isSeparatedList = function () { - return true; - }; - - EmptySeparatedSyntaxList.prototype.toJSON = function (key) { - return []; - }; - - EmptySeparatedSyntaxList.prototype.childCount = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.nonSeparatorCount = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.separatorCount = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.toArray = function () { - return []; - }; - - EmptySeparatedSyntaxList.prototype.toNonSeparatorArray = function () { - return []; - }; - - EmptySeparatedSyntaxList.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySeparatedSyntaxList.prototype.nonSeparatorAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySeparatedSyntaxList.prototype.separatorAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySeparatedSyntaxList.prototype.collectTextElements = function (elements) { - }; - - EmptySeparatedSyntaxList.prototype.firstToken = function () { - return null; - }; - - EmptySeparatedSyntaxList.prototype.lastToken = function () { - return null; - }; - - EmptySeparatedSyntaxList.prototype.fullWidth = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.fullText = function () { - return ""; - }; - - EmptySeparatedSyntaxList.prototype.width = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.isTypeScriptSpecific = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.isIncrementallyUnusable = function () { - return false; - }; - - EmptySeparatedSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - throw TypeScript.Errors.invalidOperation(); - }; - - EmptySeparatedSyntaxList.prototype.insertChildrenInto = function (array, index) { - }; - - EmptySeparatedSyntaxList.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySeparatedSyntaxList.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySeparatedSyntaxList.prototype.leadingTriviaWidth = function () { - return 0; - }; - - EmptySeparatedSyntaxList.prototype.trailingTriviaWidth = function () { - return 0; - }; - return EmptySeparatedSyntaxList; - })(); - - Syntax.emptySeparatedList = new EmptySeparatedSyntaxList(); - - var SingletonSeparatedSyntaxList = (function () { - function SingletonSeparatedSyntaxList(item) { - this.item = item; - } - SingletonSeparatedSyntaxList.prototype.toJSON = function (key) { - return [this.item]; - }; - - SingletonSeparatedSyntaxList.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - SingletonSeparatedSyntaxList.prototype.isNode = function () { - return false; - }; - SingletonSeparatedSyntaxList.prototype.isToken = function () { - return false; - }; - SingletonSeparatedSyntaxList.prototype.isList = function () { - return false; - }; - SingletonSeparatedSyntaxList.prototype.isSeparatedList = function () { - return true; - }; - - SingletonSeparatedSyntaxList.prototype.childCount = function () { - return 1; - }; - SingletonSeparatedSyntaxList.prototype.nonSeparatorCount = function () { - return 1; - }; - SingletonSeparatedSyntaxList.prototype.separatorCount = function () { - return 0; - }; - - SingletonSeparatedSyntaxList.prototype.toArray = function () { - return [this.item]; - }; - SingletonSeparatedSyntaxList.prototype.toNonSeparatorArray = function () { - return [this.item]; - }; - - SingletonSeparatedSyntaxList.prototype.childAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSeparatedSyntaxList.prototype.nonSeparatorAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSeparatedSyntaxList.prototype.separatorAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - SingletonSeparatedSyntaxList.prototype.collectTextElements = function (elements) { - this.item.collectTextElements(elements); - }; - - SingletonSeparatedSyntaxList.prototype.firstToken = function () { - return this.item.firstToken(); - }; - - SingletonSeparatedSyntaxList.prototype.lastToken = function () { - return this.item.lastToken(); - }; - - SingletonSeparatedSyntaxList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - - SingletonSeparatedSyntaxList.prototype.width = function () { - return this.item.width(); - }; - - SingletonSeparatedSyntaxList.prototype.fullText = function () { - return this.item.fullText(); - }; - - SingletonSeparatedSyntaxList.prototype.leadingTrivia = function () { - return this.item.leadingTrivia(); - }; - - SingletonSeparatedSyntaxList.prototype.trailingTrivia = function () { - return this.item.trailingTrivia(); - }; - - SingletonSeparatedSyntaxList.prototype.leadingTriviaWidth = function () { - return this.item.leadingTriviaWidth(); - }; - - SingletonSeparatedSyntaxList.prototype.trailingTriviaWidth = function () { - return this.item.trailingTriviaWidth(); - }; - - SingletonSeparatedSyntaxList.prototype.isTypeScriptSpecific = function () { - return this.item.isTypeScriptSpecific(); - }; - - SingletonSeparatedSyntaxList.prototype.isIncrementallyUnusable = function () { - return this.item.isIncrementallyUnusable(); - }; - - SingletonSeparatedSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - return this.item.findTokenInternal(new TypeScript.PositionedSeparatedList(parent, this, fullStart), position, fullStart); - }; - - SingletonSeparatedSyntaxList.prototype.insertChildrenInto = function (array, index) { - array.splice(index, 0, this.item); - }; - return SingletonSeparatedSyntaxList; - })(); - - var NormalSeparatedSyntaxList = (function () { - function NormalSeparatedSyntaxList(elements) { - this._data = 0; - this.elements = elements; - } - NormalSeparatedSyntaxList.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - NormalSeparatedSyntaxList.prototype.isToken = function () { - return false; - }; - NormalSeparatedSyntaxList.prototype.isNode = function () { - return false; - }; - NormalSeparatedSyntaxList.prototype.isList = function () { - return false; - }; - NormalSeparatedSyntaxList.prototype.isSeparatedList = function () { - return true; - }; - NormalSeparatedSyntaxList.prototype.toJSON = function (key) { - return this.elements; - }; - - NormalSeparatedSyntaxList.prototype.childCount = function () { - return this.elements.length; - }; - NormalSeparatedSyntaxList.prototype.nonSeparatorCount = function () { - return TypeScript.IntegerUtilities.integerDivide(this.elements.length + 1, 2); - }; - NormalSeparatedSyntaxList.prototype.separatorCount = function () { - return TypeScript.IntegerUtilities.integerDivide(this.elements.length, 2); - }; - - NormalSeparatedSyntaxList.prototype.toArray = function () { - return this.elements.slice(0); - }; - - NormalSeparatedSyntaxList.prototype.toNonSeparatorArray = function () { - var result = []; - for (var i = 0, n = this.nonSeparatorCount(); i < n; i++) { - result.push(this.nonSeparatorAt(i)); - } - - return result; - }; - - NormalSeparatedSyntaxList.prototype.childAt = function (index) { - if (index < 0 || index >= this.elements.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.elements[index]; - }; - - NormalSeparatedSyntaxList.prototype.nonSeparatorAt = function (index) { - var value = index * 2; - if (value < 0 || value >= this.elements.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.elements[value]; - }; - - NormalSeparatedSyntaxList.prototype.separatorAt = function (index) { - var value = index * 2 + 1; - if (value < 0 || value >= this.elements.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.elements[value]; - }; - - NormalSeparatedSyntaxList.prototype.firstToken = function () { - var token; - for (var i = 0, n = this.elements.length; i < n; i++) { - if (i % 2 === 0) { - var nodeOrToken = this.elements[i]; - token = nodeOrToken.firstToken(); - if (token !== null) { - return token; - } - } else { - token = this.elements[i]; - if (token.width() > 0) { - return token; - } - } - } - - return null; - }; - - NormalSeparatedSyntaxList.prototype.lastToken = function () { - var token; - for (var i = this.elements.length - 1; i >= 0; i--) { - if (i % 2 === 0) { - var nodeOrToken = this.elements[i]; - token = nodeOrToken.lastToken(); - if (token !== null) { - return token; - } - } else { - token = this.elements[i]; - if (token.width() > 0) { - return token; - } - } - } - - return null; - }; - - NormalSeparatedSyntaxList.prototype.fullText = function () { - var elements = []; - this.collectTextElements(elements); - return elements.join(""); - }; - - NormalSeparatedSyntaxList.prototype.isTypeScriptSpecific = function () { - for (var i = 0, n = this.nonSeparatorCount(); i < n; i++) { - if (this.nonSeparatorAt(i).isTypeScriptSpecific()) { - return true; - } - } - - return false; - }; - - NormalSeparatedSyntaxList.prototype.isIncrementallyUnusable = function () { - return (this.data() & 2 /* NodeIncrementallyUnusableMask */) !== 0; - }; - - NormalSeparatedSyntaxList.prototype.fullWidth = function () { - return this.data() >>> 3 /* NodeFullWidthShift */; - }; - - NormalSeparatedSyntaxList.prototype.width = function () { - var fullWidth = this.fullWidth(); - return fullWidth - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - NormalSeparatedSyntaxList.prototype.leadingTrivia = function () { - return this.firstToken().leadingTrivia(); - }; - - NormalSeparatedSyntaxList.prototype.trailingTrivia = function () { - return this.lastToken().trailingTrivia(); - }; - - NormalSeparatedSyntaxList.prototype.leadingTriviaWidth = function () { - return this.firstToken().leadingTriviaWidth(); - }; - - NormalSeparatedSyntaxList.prototype.trailingTriviaWidth = function () { - return this.lastToken().trailingTriviaWidth(); - }; - - NormalSeparatedSyntaxList.prototype.computeData = function () { - var fullWidth = 0; - var isIncrementallyUnusable = false; - - for (var i = 0, n = this.elements.length; i < n; i++) { - var element = this.elements[i]; - - var childWidth = element.fullWidth(); - fullWidth += childWidth; - - isIncrementallyUnusable = isIncrementallyUnusable || element.isIncrementallyUnusable(); - } - - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - }; - - NormalSeparatedSyntaxList.prototype.data = function () { - if ((this._data & 1 /* NodeDataComputed */) === 0) { - this._data = this.computeData(); - } - - return this._data; - }; - - NormalSeparatedSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - parent = new TypeScript.PositionedSeparatedList(parent, this, fullStart); - for (var i = 0, n = this.elements.length; i < n; i++) { - var element = this.elements[i]; - - var childWidth = element.fullWidth(); - if (position < childWidth) { - return element.findTokenInternal(parent, position, fullStart); - } - - position -= childWidth; - fullStart += childWidth; - } - - throw TypeScript.Errors.invalidOperation(); - }; - - NormalSeparatedSyntaxList.prototype.collectTextElements = function (elements) { - for (var i = 0, n = this.elements.length; i < n; i++) { - var element = this.elements[i]; - element.collectTextElements(elements); - } - }; - - NormalSeparatedSyntaxList.prototype.insertChildrenInto = function (array, index) { - if (index === 0) { - array.unshift.apply(array, this.elements); - } else { - array.splice.apply(array, [index, 0].concat(this.elements)); - } - }; - return NormalSeparatedSyntaxList; - })(); - - function separatedList(nodes) { - return separatedListAndValidate(nodes, false); - } - Syntax.separatedList = separatedList; - - function separatedListAndValidate(nodes, validate) { - if (nodes === undefined || nodes === null || nodes.length === 0) { - return Syntax.emptySeparatedList; - } - - if (validate) { - for (var i = 0; i < nodes.length; i++) { - var item = nodes[i]; - - if (i % 2 === 1) { - } - } - } - - if (nodes.length === 1) { - return new SingletonSeparatedSyntaxList(nodes[0]); - } - - return new NormalSeparatedSyntaxList(nodes); - } - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SlidingWindow = (function () { - function SlidingWindow(source, window, defaultValue, sourceLength) { - if (typeof sourceLength === "undefined") { sourceLength = -1; } - this.source = source; - this.window = window; - this.defaultValue = defaultValue; - this.sourceLength = sourceLength; - this.windowCount = 0; - this.windowAbsoluteStartIndex = 0; - this.currentRelativeItemIndex = 0; - this._pinCount = 0; - this.firstPinnedAbsoluteIndex = -1; - } - SlidingWindow.prototype.windowAbsoluteEndIndex = function () { - return this.windowAbsoluteStartIndex + this.windowCount; - }; - - SlidingWindow.prototype.addMoreItemsToWindow = function (argument) { - if (this.sourceLength >= 0 && this.absoluteIndex() >= this.sourceLength) { - return false; - } - - if (this.windowCount >= this.window.length) { - this.tryShiftOrGrowWindow(); - } - - var spaceAvailable = this.window.length - this.windowCount; - var amountFetched = this.source.fetchMoreItems(argument, this.windowAbsoluteEndIndex(), this.window, this.windowCount, spaceAvailable); - - this.windowCount += amountFetched; - return amountFetched > 0; - }; - - SlidingWindow.prototype.tryShiftOrGrowWindow = function () { - var currentIndexIsPastWindowHalfwayPoint = this.currentRelativeItemIndex > (this.window.length >>> 1); - - var isAllowedToShift = this.firstPinnedAbsoluteIndex === -1 || this.firstPinnedAbsoluteIndex > this.windowAbsoluteStartIndex; - - if (currentIndexIsPastWindowHalfwayPoint && isAllowedToShift) { - var shiftStartIndex = this.firstPinnedAbsoluteIndex === -1 ? this.currentRelativeItemIndex : this.firstPinnedAbsoluteIndex - this.windowAbsoluteStartIndex; - - var shiftCount = this.windowCount - shiftStartIndex; - - if (shiftCount > 0) { - TypeScript.ArrayUtilities.copy(this.window, shiftStartIndex, this.window, 0, shiftCount); - } - - this.windowAbsoluteStartIndex += shiftStartIndex; - - this.windowCount -= shiftStartIndex; - - this.currentRelativeItemIndex -= shiftStartIndex; - } else { - TypeScript.ArrayUtilities.grow(this.window, this.window.length * 2, this.defaultValue); - } - }; - - SlidingWindow.prototype.absoluteIndex = function () { - return this.windowAbsoluteStartIndex + this.currentRelativeItemIndex; - }; - - SlidingWindow.prototype.isAtEndOfSource = function () { - return this.absoluteIndex() >= this.sourceLength; - }; - - SlidingWindow.prototype.getAndPinAbsoluteIndex = function () { - var absoluteIndex = this.absoluteIndex(); - var pinCount = this._pinCount++; - if (pinCount === 0) { - this.firstPinnedAbsoluteIndex = absoluteIndex; - } - - return absoluteIndex; - }; - - SlidingWindow.prototype.releaseAndUnpinAbsoluteIndex = function (absoluteIndex) { - this._pinCount--; - if (this._pinCount === 0) { - this.firstPinnedAbsoluteIndex = -1; - } - }; - - SlidingWindow.prototype.rewindToPinnedIndex = function (absoluteIndex) { - var relativeIndex = absoluteIndex - this.windowAbsoluteStartIndex; - - this.currentRelativeItemIndex = relativeIndex; - }; - - SlidingWindow.prototype.currentItem = function (argument) { - if (this.currentRelativeItemIndex >= this.windowCount) { - if (!this.addMoreItemsToWindow(argument)) { - return this.defaultValue; - } - } - - return this.window[this.currentRelativeItemIndex]; - }; - - SlidingWindow.prototype.peekItemN = function (n) { - while (this.currentRelativeItemIndex + n >= this.windowCount) { - if (!this.addMoreItemsToWindow(null)) { - return this.defaultValue; - } - } - - return this.window[this.currentRelativeItemIndex + n]; - }; - - SlidingWindow.prototype.moveToNextItem = function () { - this.currentRelativeItemIndex++; - }; - - SlidingWindow.prototype.disgardAllItemsFromCurrentIndexOnwards = function () { - this.windowCount = this.currentRelativeItemIndex; - }; - - SlidingWindow.prototype.setAbsoluteIndex = function (absoluteIndex) { - if (this.absoluteIndex() === absoluteIndex) { - return; - } - - if (this._pinCount > 0) { - } - - if (absoluteIndex >= this.windowAbsoluteStartIndex && absoluteIndex < this.windowAbsoluteEndIndex()) { - this.currentRelativeItemIndex = (absoluteIndex - this.windowAbsoluteStartIndex); - } else { - this.windowAbsoluteStartIndex = absoluteIndex; - - this.windowCount = 0; - - this.currentRelativeItemIndex = 0; - } - }; - - SlidingWindow.prototype.pinCount = function () { - return this._pinCount; - }; - return SlidingWindow; - })(); - TypeScript.SlidingWindow = SlidingWindow; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - function emptySourceUnit() { - return Syntax.normalModeFactory.sourceUnit(Syntax.emptyList, Syntax.token(10 /* EndOfFileToken */, { text: "" })); - } - Syntax.emptySourceUnit = emptySourceUnit; - - function getStandaloneExpression(positionedToken) { - var token = positionedToken.token(); - if (positionedToken !== null && positionedToken.kind() === 11 /* IdentifierName */) { - var parentPositionedNode = positionedToken.containingNode(); - var parentNode = parentPositionedNode.node(); - - if (parentNode.kind() === 121 /* QualifiedName */ && parentNode.right === token) { - return parentPositionedNode; - } else if (parentNode.kind() === 212 /* MemberAccessExpression */ && parentNode.name === token) { - return parentPositionedNode; - } - } - - return positionedToken; - } - Syntax.getStandaloneExpression = getStandaloneExpression; - - function isInModuleOrTypeContext(positionedToken) { - if (positionedToken !== null) { - var positionedNodeOrToken = Syntax.getStandaloneExpression(positionedToken); - var parent = positionedNodeOrToken.containingNode(); - - if (parent !== null) { - switch (parent.kind()) { - case 246 /* ModuleNameModuleReference */: - return true; - case 121 /* QualifiedName */: - return true; - default: - return isInTypeOnlyContext(positionedToken); - } - } - } - - return false; - } - Syntax.isInModuleOrTypeContext = isInModuleOrTypeContext; - - function isInTypeOnlyContext(positionedToken) { - var positionedNodeOrToken = Syntax.getStandaloneExpression(positionedToken); - var positionedParent = positionedNodeOrToken.containingNode(); - - var parent = positionedParent.node(); - var nodeOrToken = positionedNodeOrToken.nodeOrToken(); - - if (parent !== null) { - switch (parent.kind()) { - case 124 /* ArrayType */: - return parent.type === nodeOrToken; - case 220 /* CastExpression */: - return parent.type === nodeOrToken; - case 244 /* TypeAnnotation */: - case 230 /* ExtendsHeritageClause */: - case 231 /* ImplementsHeritageClause */: - case 228 /* TypeArgumentList */: - return true; - } - } - - return false; - } - Syntax.isInTypeOnlyContext = isInTypeOnlyContext; - - function childOffset(parent, child) { - var offset = 0; - for (var i = 0, n = parent.childCount(); i < n; i++) { - var current = parent.childAt(i); - if (current === child) { - return offset; - } - - if (current !== null) { - offset += current.fullWidth(); - } - } - - throw TypeScript.Errors.invalidOperation(); - } - Syntax.childOffset = childOffset; - - function childOffsetAt(parent, index) { - var offset = 0; - for (var i = 0; i < index; i++) { - var current = parent.childAt(i); - if (current !== null) { - offset += current.fullWidth(); - } - } - - return offset; - } - Syntax.childOffsetAt = childOffsetAt; - - function childIndex(parent, child) { - for (var i = 0, n = parent.childCount(); i < n; i++) { - var current = parent.childAt(i); - if (current === child) { - return i; - } - } - - throw TypeScript.Errors.invalidOperation(); - } - Syntax.childIndex = childIndex; - - function nodeStructuralEquals(node1, node2) { - if (node1 === null) { - return node2 === null; - } - - return node1.structuralEquals(node2); - } - Syntax.nodeStructuralEquals = nodeStructuralEquals; - - function nodeOrTokenStructuralEquals(node1, node2) { - if (node1 === node2) { - return true; - } - - if (node1 === null || node2 === null) { - return false; - } - - if (node1.isToken()) { - return node2.isToken() ? tokenStructuralEquals(node1, node2) : false; - } - - return node2.isNode() ? nodeStructuralEquals(node1, node2) : false; - } - Syntax.nodeOrTokenStructuralEquals = nodeOrTokenStructuralEquals; - - function tokenStructuralEquals(token1, token2) { - if (token1 === token2) { - return true; - } - - if (token1 === null || token2 === null) { - return false; - } - - return token1.kind() === token2.kind() && token1.width() === token2.width() && token1.fullWidth() === token2.fullWidth() && token1.text() === token2.text() && Syntax.triviaListStructuralEquals(token1.leadingTrivia(), token2.leadingTrivia()) && Syntax.triviaListStructuralEquals(token1.trailingTrivia(), token2.trailingTrivia()); - } - Syntax.tokenStructuralEquals = tokenStructuralEquals; - - function triviaListStructuralEquals(triviaList1, triviaList2) { - if (triviaList1.count() !== triviaList2.count()) { - return false; - } - - for (var i = 0, n = triviaList1.count(); i < n; i++) { - if (!Syntax.triviaStructuralEquals(triviaList1.syntaxTriviaAt(i), triviaList2.syntaxTriviaAt(i))) { - return false; - } - } - - return true; - } - Syntax.triviaListStructuralEquals = triviaListStructuralEquals; - - function triviaStructuralEquals(trivia1, trivia2) { - return trivia1.kind() === trivia2.kind() && trivia1.fullWidth() === trivia2.fullWidth() && trivia1.fullText() === trivia2.fullText(); - } - Syntax.triviaStructuralEquals = triviaStructuralEquals; - - function listStructuralEquals(list1, list2) { - if (list1.childCount() !== list2.childCount()) { - return false; - } - - for (var i = 0, n = list1.childCount(); i < n; i++) { - var child1 = list1.childAt(i); - var child2 = list2.childAt(i); - - if (!Syntax.nodeOrTokenStructuralEquals(child1, child2)) { - return false; - } - } - - return true; - } - Syntax.listStructuralEquals = listStructuralEquals; - - function separatedListStructuralEquals(list1, list2) { - if (list1.childCount() !== list2.childCount()) { - return false; - } - - for (var i = 0, n = list1.childCount(); i < n; i++) { - var element1 = list1.childAt(i); - var element2 = list2.childAt(i); - if (!Syntax.nodeOrTokenStructuralEquals(element1, element2)) { - return false; - } - } - - return true; - } - Syntax.separatedListStructuralEquals = separatedListStructuralEquals; - - function elementStructuralEquals(element1, element2) { - if (element1 === element2) { - return true; - } - - if (element1 === null || element2 === null) { - return false; - } - - if (element2.kind() !== element2.kind()) { - return false; - } - - if (element1.isToken()) { - return tokenStructuralEquals(element1, element2); - } else if (element1.isNode()) { - return nodeStructuralEquals(element1, element2); - } else if (element1.isList()) { - return listStructuralEquals(element1, element2); - } else if (element1.isSeparatedList()) { - return separatedListStructuralEquals(element1, element2); - } - - throw TypeScript.Errors.invalidOperation(); - } - Syntax.elementStructuralEquals = elementStructuralEquals; - - function identifierName(text, info) { - if (typeof info === "undefined") { info = null; } - return Syntax.identifier(text); - } - Syntax.identifierName = identifierName; - - function trueExpression() { - return Syntax.token(37 /* TrueKeyword */); - } - Syntax.trueExpression = trueExpression; - - function falseExpression() { - return Syntax.token(24 /* FalseKeyword */); - } - Syntax.falseExpression = falseExpression; - - function numericLiteralExpression(text) { - return Syntax.token(13 /* NumericLiteral */, { text: text }); - } - Syntax.numericLiteralExpression = numericLiteralExpression; - - function stringLiteralExpression(text) { - return Syntax.token(14 /* StringLiteral */, { text: text }); - } - Syntax.stringLiteralExpression = stringLiteralExpression; - - function isSuperInvocationExpression(node) { - return node.kind() === 213 /* InvocationExpression */ && node.expression.kind() === 50 /* SuperKeyword */; - } - Syntax.isSuperInvocationExpression = isSuperInvocationExpression; - - function isSuperInvocationExpressionStatement(node) { - return node.kind() === 149 /* ExpressionStatement */ && isSuperInvocationExpression(node.expression); - } - Syntax.isSuperInvocationExpressionStatement = isSuperInvocationExpressionStatement; - - function isSuperMemberAccessExpression(node) { - return node.kind() === 212 /* MemberAccessExpression */ && node.expression.kind() === 50 /* SuperKeyword */; - } - Syntax.isSuperMemberAccessExpression = isSuperMemberAccessExpression; - - function isSuperMemberAccessInvocationExpression(node) { - return node.kind() === 213 /* InvocationExpression */ && isSuperMemberAccessExpression(node.expression); - } - Syntax.isSuperMemberAccessInvocationExpression = isSuperMemberAccessInvocationExpression; - - function assignmentExpression(left, token, right) { - return Syntax.normalModeFactory.binaryExpression(174 /* AssignmentExpression */, left, token, right); - } - Syntax.assignmentExpression = assignmentExpression; - - function nodeHasSkippedOrMissingTokens(node) { - for (var i = 0; i < node.childCount(); i++) { - var child = node.childAt(i); - if (child !== null && child.isToken()) { - var token = child; - - if (token.hasSkippedToken() || (token.width() === 0 && token.kind() !== 10 /* EndOfFileToken */)) { - return true; - } - } - } - return false; - } - Syntax.nodeHasSkippedOrMissingTokens = nodeHasSkippedOrMissingTokens; - - function isUnterminatedStringLiteral(token) { - if (token && token.kind() === 14 /* StringLiteral */) { - var text = token.text(); - return text.length < 2 || text.charCodeAt(text.length - 1) !== text.charCodeAt(0); - } - - return false; - } - Syntax.isUnterminatedStringLiteral = isUnterminatedStringLiteral; - - function isUnterminatedMultilineCommentTrivia(trivia) { - if (trivia && trivia.kind() === 6 /* MultiLineCommentTrivia */) { - var text = trivia.fullText(); - return text.length < 4 || text.substring(text.length - 2) !== "*/"; - } - return false; - } - Syntax.isUnterminatedMultilineCommentTrivia = isUnterminatedMultilineCommentTrivia; - - function isEntirelyInsideCommentTrivia(trivia, fullStart, position) { - if (trivia && trivia.isComment() && position > fullStart) { - var end = fullStart + trivia.fullWidth(); - if (position < end) { - return true; - } else if (position === end) { - return trivia.kind() === 7 /* SingleLineCommentTrivia */ || isUnterminatedMultilineCommentTrivia(trivia); - } - } - - return false; - } - Syntax.isEntirelyInsideCommentTrivia = isEntirelyInsideCommentTrivia; - - function isEntirelyInsideComment(sourceUnit, position) { - var positionedToken = sourceUnit.findToken(position); - var fullStart = positionedToken.fullStart(); - var triviaList = null; - var lastTriviaBeforeToken = null; - - if (positionedToken.kind() === 10 /* EndOfFileToken */) { - if (positionedToken.token().hasLeadingTrivia()) { - triviaList = positionedToken.token().leadingTrivia(); - } else { - positionedToken = positionedToken.previousToken(); - if (positionedToken) { - if (positionedToken && positionedToken.token().hasTrailingTrivia()) { - triviaList = positionedToken.token().trailingTrivia(); - fullStart = positionedToken.end(); - } - } - } - } else { - if (position <= (fullStart + positionedToken.token().leadingTriviaWidth())) { - triviaList = positionedToken.token().leadingTrivia(); - } else if (position >= (fullStart + positionedToken.token().width())) { - triviaList = positionedToken.token().trailingTrivia(); - fullStart = positionedToken.end(); - } - } - - if (triviaList) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (position <= fullStart) { - break; - } else if (position <= fullStart + trivia.fullWidth() && trivia.isComment()) { - lastTriviaBeforeToken = trivia; - break; - } - - fullStart += trivia.fullWidth(); - } - } - - return lastTriviaBeforeToken && isEntirelyInsideCommentTrivia(lastTriviaBeforeToken, fullStart, position); - } - Syntax.isEntirelyInsideComment = isEntirelyInsideComment; - - function isEntirelyInStringOrRegularExpressionLiteral(sourceUnit, position) { - var positionedToken = sourceUnit.findToken(position); - - if (positionedToken) { - if (positionedToken.kind() === 10 /* EndOfFileToken */) { - positionedToken = positionedToken.previousToken(); - return positionedToken && positionedToken.token().trailingTriviaWidth() === 0 && isUnterminatedStringLiteral(positionedToken.token()); - } else if (position > positionedToken.start()) { - return (position < positionedToken.end() && (positionedToken.kind() === 14 /* StringLiteral */ || positionedToken.kind() === 12 /* RegularExpressionLiteral */)) || (position <= positionedToken.end() && isUnterminatedStringLiteral(positionedToken.token())); - } - } - - return false; - } - Syntax.isEntirelyInStringOrRegularExpressionLiteral = isEntirelyInStringOrRegularExpressionLiteral; - - function findSkippedTokenInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = null; - var fullStart; - - if (lookInLeadingTriviaList) { - triviaList = positionedToken.token().leadingTrivia(); - fullStart = positionedToken.fullStart(); - } else { - triviaList = positionedToken.token().trailingTrivia(); - fullStart = positionedToken.end(); - } - - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - var triviaWidth = trivia.fullWidth(); - - if (trivia.isSkippedToken() && position >= fullStart && position <= fullStart + triviaWidth) { - return new TypeScript.PositionedSkippedToken(positionedToken, trivia.skippedToken(), fullStart); - } - - fullStart += triviaWidth; - } - } - - return null; - } - - function findSkippedTokenOnLeftInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = null; - var fullEnd; - - if (lookInLeadingTriviaList) { - triviaList = positionedToken.token().leadingTrivia(); - fullEnd = positionedToken.fullStart() + triviaList.fullWidth(); - } else { - triviaList = positionedToken.token().trailingTrivia(); - fullEnd = positionedToken.fullEnd(); - } - - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = triviaList.count() - 1; i >= 0; i--) { - var trivia = triviaList.syntaxTriviaAt(i); - var triviaWidth = trivia.fullWidth(); - - if (trivia.isSkippedToken() && position >= fullEnd) { - return new TypeScript.PositionedSkippedToken(positionedToken, trivia.skippedToken(), fullEnd - triviaWidth); - } - - fullEnd -= triviaWidth; - } - } - - return null; - } - - function findSkippedTokenInLeadingTriviaList(positionedToken, position) { - return findSkippedTokenInTriviaList(positionedToken, position, true); - } - Syntax.findSkippedTokenInLeadingTriviaList = findSkippedTokenInLeadingTriviaList; - - function findSkippedTokenInTrailingTriviaList(positionedToken, position) { - return findSkippedTokenInTriviaList(positionedToken, position, false); - } - Syntax.findSkippedTokenInTrailingTriviaList = findSkippedTokenInTrailingTriviaList; - - function findSkippedTokenInPositionedToken(positionedToken, position) { - var positionInLeadingTriviaList = (position < positionedToken.start()); - return findSkippedTokenInTriviaList(positionedToken, position, positionInLeadingTriviaList); - } - Syntax.findSkippedTokenInPositionedToken = findSkippedTokenInPositionedToken; - - function findSkippedTokenOnLeft(positionedToken, position) { - var positionInLeadingTriviaList = (position < positionedToken.start()); - return findSkippedTokenOnLeftInTriviaList(positionedToken, position, positionInLeadingTriviaList); - } - Syntax.findSkippedTokenOnLeft = findSkippedTokenOnLeft; - - function getAncestorOfKind(positionedToken, kind) { - while (positionedToken && positionedToken.parent()) { - if (positionedToken.parent().kind() === kind) { - return positionedToken.parent(); - } - - positionedToken = positionedToken.parent(); - } - - return null; - } - Syntax.getAncestorOfKind = getAncestorOfKind; - - function hasAncestorOfKind(positionedToken, kind) { - return Syntax.getAncestorOfKind(positionedToken, kind) !== null; - } - Syntax.hasAncestorOfKind = hasAncestorOfKind; - - function isIntegerLiteral(expression) { - if (expression) { - switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - expression = expression.operand; - return expression.isToken() && TypeScript.IntegerUtilities.isInteger(expression.text()); - - case 13 /* NumericLiteral */: - var text = expression.text(); - return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); - } - } - - return false; - } - Syntax.isIntegerLiteral = isIntegerLiteral; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var NormalModeFactory = (function () { - function NormalModeFactory() { - } - NormalModeFactory.prototype.sourceUnit = function (moduleElements, endOfFileToken) { - return new TypeScript.SourceUnitSyntax(moduleElements, endOfFileToken, false); - }; - NormalModeFactory.prototype.externalModuleReference = function (requireKeyword, openParenToken, stringLiteral, closeParenToken) { - return new TypeScript.ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, false); - }; - NormalModeFactory.prototype.moduleNameModuleReference = function (moduleName) { - return new TypeScript.ModuleNameModuleReferenceSyntax(moduleName, false); - }; - NormalModeFactory.prototype.importDeclaration = function (modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - return new TypeScript.ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, false); - }; - NormalModeFactory.prototype.exportAssignment = function (exportKeyword, equalsToken, identifier, semicolonToken) { - return new TypeScript.ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, false); - }; - NormalModeFactory.prototype.classDeclaration = function (modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - return new TypeScript.ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, false); - }; - NormalModeFactory.prototype.interfaceDeclaration = function (modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - return new TypeScript.InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, false); - }; - NormalModeFactory.prototype.heritageClause = function (kind, extendsOrImplementsKeyword, typeNames) { - return new TypeScript.HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, false); - }; - NormalModeFactory.prototype.moduleDeclaration = function (modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - return new TypeScript.ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, false); - }; - NormalModeFactory.prototype.functionDeclaration = function (modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - return new TypeScript.FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, false); - }; - NormalModeFactory.prototype.variableStatement = function (modifiers, variableDeclaration, semicolonToken) { - return new TypeScript.VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, false); - }; - NormalModeFactory.prototype.variableDeclaration = function (varKeyword, variableDeclarators) { - return new TypeScript.VariableDeclarationSyntax(varKeyword, variableDeclarators, false); - }; - NormalModeFactory.prototype.variableDeclarator = function (propertyName, typeAnnotation, equalsValueClause) { - return new TypeScript.VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, false); - }; - NormalModeFactory.prototype.equalsValueClause = function (equalsToken, value) { - return new TypeScript.EqualsValueClauseSyntax(equalsToken, value, false); - }; - NormalModeFactory.prototype.prefixUnaryExpression = function (kind, operatorToken, operand) { - return new TypeScript.PrefixUnaryExpressionSyntax(kind, operatorToken, operand, false); - }; - NormalModeFactory.prototype.arrayLiteralExpression = function (openBracketToken, expressions, closeBracketToken) { - return new TypeScript.ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, false); - }; - NormalModeFactory.prototype.omittedExpression = function () { - return new TypeScript.OmittedExpressionSyntax(false); - }; - NormalModeFactory.prototype.parenthesizedExpression = function (openParenToken, expression, closeParenToken) { - return new TypeScript.ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, false); - }; - NormalModeFactory.prototype.simpleArrowFunctionExpression = function (identifier, equalsGreaterThanToken, block, expression) { - return new TypeScript.SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, false); - }; - NormalModeFactory.prototype.parenthesizedArrowFunctionExpression = function (callSignature, equalsGreaterThanToken, block, expression) { - return new TypeScript.ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, false); - }; - NormalModeFactory.prototype.qualifiedName = function (left, dotToken, right) { - return new TypeScript.QualifiedNameSyntax(left, dotToken, right, false); - }; - NormalModeFactory.prototype.typeArgumentList = function (lessThanToken, typeArguments, greaterThanToken) { - return new TypeScript.TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, false); - }; - NormalModeFactory.prototype.constructorType = function (newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, false); - }; - NormalModeFactory.prototype.functionType = function (typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, false); - }; - NormalModeFactory.prototype.objectType = function (openBraceToken, typeMembers, closeBraceToken) { - return new TypeScript.ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, false); - }; - NormalModeFactory.prototype.arrayType = function (type, openBracketToken, closeBracketToken) { - return new TypeScript.ArrayTypeSyntax(type, openBracketToken, closeBracketToken, false); - }; - NormalModeFactory.prototype.genericType = function (name, typeArgumentList) { - return new TypeScript.GenericTypeSyntax(name, typeArgumentList, false); - }; - NormalModeFactory.prototype.typeQuery = function (typeOfKeyword, name) { - return new TypeScript.TypeQuerySyntax(typeOfKeyword, name, false); - }; - NormalModeFactory.prototype.typeAnnotation = function (colonToken, type) { - return new TypeScript.TypeAnnotationSyntax(colonToken, type, false); - }; - NormalModeFactory.prototype.block = function (openBraceToken, statements, closeBraceToken) { - return new TypeScript.BlockSyntax(openBraceToken, statements, closeBraceToken, false); - }; - NormalModeFactory.prototype.parameter = function (dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - return new TypeScript.ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, false); - }; - NormalModeFactory.prototype.memberAccessExpression = function (expression, dotToken, name) { - return new TypeScript.MemberAccessExpressionSyntax(expression, dotToken, name, false); - }; - NormalModeFactory.prototype.postfixUnaryExpression = function (kind, operand, operatorToken) { - return new TypeScript.PostfixUnaryExpressionSyntax(kind, operand, operatorToken, false); - }; - NormalModeFactory.prototype.elementAccessExpression = function (expression, openBracketToken, argumentExpression, closeBracketToken) { - return new TypeScript.ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, false); - }; - NormalModeFactory.prototype.invocationExpression = function (expression, argumentList) { - return new TypeScript.InvocationExpressionSyntax(expression, argumentList, false); - }; - NormalModeFactory.prototype.argumentList = function (typeArgumentList, openParenToken, _arguments, closeParenToken) { - return new TypeScript.ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, false); - }; - NormalModeFactory.prototype.binaryExpression = function (kind, left, operatorToken, right) { - return new TypeScript.BinaryExpressionSyntax(kind, left, operatorToken, right, false); - }; - NormalModeFactory.prototype.conditionalExpression = function (condition, questionToken, whenTrue, colonToken, whenFalse) { - return new TypeScript.ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, false); - }; - NormalModeFactory.prototype.constructSignature = function (newKeyword, callSignature) { - return new TypeScript.ConstructSignatureSyntax(newKeyword, callSignature, false); - }; - NormalModeFactory.prototype.methodSignature = function (propertyName, questionToken, callSignature) { - return new TypeScript.MethodSignatureSyntax(propertyName, questionToken, callSignature, false); - }; - NormalModeFactory.prototype.indexSignature = function (openBracketToken, parameter, closeBracketToken, typeAnnotation) { - return new TypeScript.IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, false); - }; - NormalModeFactory.prototype.propertySignature = function (propertyName, questionToken, typeAnnotation) { - return new TypeScript.PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, false); - }; - NormalModeFactory.prototype.callSignature = function (typeParameterList, parameterList, typeAnnotation) { - return new TypeScript.CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, false); - }; - NormalModeFactory.prototype.parameterList = function (openParenToken, parameters, closeParenToken) { - return new TypeScript.ParameterListSyntax(openParenToken, parameters, closeParenToken, false); - }; - NormalModeFactory.prototype.typeParameterList = function (lessThanToken, typeParameters, greaterThanToken) { - return new TypeScript.TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, false); - }; - NormalModeFactory.prototype.typeParameter = function (identifier, constraint) { - return new TypeScript.TypeParameterSyntax(identifier, constraint, false); - }; - NormalModeFactory.prototype.constraint = function (extendsKeyword, type) { - return new TypeScript.ConstraintSyntax(extendsKeyword, type, false); - }; - NormalModeFactory.prototype.elseClause = function (elseKeyword, statement) { - return new TypeScript.ElseClauseSyntax(elseKeyword, statement, false); - }; - NormalModeFactory.prototype.ifStatement = function (ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - return new TypeScript.IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, false); - }; - NormalModeFactory.prototype.expressionStatement = function (expression, semicolonToken) { - return new TypeScript.ExpressionStatementSyntax(expression, semicolonToken, false); - }; - NormalModeFactory.prototype.constructorDeclaration = function (modifiers, constructorKeyword, callSignature, block, semicolonToken) { - return new TypeScript.ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, false); - }; - NormalModeFactory.prototype.memberFunctionDeclaration = function (modifiers, propertyName, callSignature, block, semicolonToken) { - return new TypeScript.MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, false); - }; - NormalModeFactory.prototype.getAccessor = function (modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block) { - return new TypeScript.GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, false); - }; - NormalModeFactory.prototype.setAccessor = function (modifiers, setKeyword, propertyName, parameterList, block) { - return new TypeScript.SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, false); - }; - NormalModeFactory.prototype.memberVariableDeclaration = function (modifiers, variableDeclarator, semicolonToken) { - return new TypeScript.MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, false); - }; - NormalModeFactory.prototype.indexMemberDeclaration = function (modifiers, indexSignature, semicolonToken) { - return new TypeScript.IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, false); - }; - NormalModeFactory.prototype.throwStatement = function (throwKeyword, expression, semicolonToken) { - return new TypeScript.ThrowStatementSyntax(throwKeyword, expression, semicolonToken, false); - }; - NormalModeFactory.prototype.returnStatement = function (returnKeyword, expression, semicolonToken) { - return new TypeScript.ReturnStatementSyntax(returnKeyword, expression, semicolonToken, false); - }; - NormalModeFactory.prototype.objectCreationExpression = function (newKeyword, expression, argumentList) { - return new TypeScript.ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, false); - }; - NormalModeFactory.prototype.switchStatement = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - return new TypeScript.SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, false); - }; - NormalModeFactory.prototype.caseSwitchClause = function (caseKeyword, expression, colonToken, statements) { - return new TypeScript.CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, false); - }; - NormalModeFactory.prototype.defaultSwitchClause = function (defaultKeyword, colonToken, statements) { - return new TypeScript.DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, false); - }; - NormalModeFactory.prototype.breakStatement = function (breakKeyword, identifier, semicolonToken) { - return new TypeScript.BreakStatementSyntax(breakKeyword, identifier, semicolonToken, false); - }; - NormalModeFactory.prototype.continueStatement = function (continueKeyword, identifier, semicolonToken) { - return new TypeScript.ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, false); - }; - NormalModeFactory.prototype.forStatement = function (forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - return new TypeScript.ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.forInStatement = function (forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - return new TypeScript.ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.whileStatement = function (whileKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.withStatement = function (withKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, false); - }; - NormalModeFactory.prototype.enumDeclaration = function (modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - return new TypeScript.EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, false); - }; - NormalModeFactory.prototype.enumElement = function (propertyName, equalsValueClause) { - return new TypeScript.EnumElementSyntax(propertyName, equalsValueClause, false); - }; - NormalModeFactory.prototype.castExpression = function (lessThanToken, type, greaterThanToken, expression) { - return new TypeScript.CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, false); - }; - NormalModeFactory.prototype.objectLiteralExpression = function (openBraceToken, propertyAssignments, closeBraceToken) { - return new TypeScript.ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, false); - }; - NormalModeFactory.prototype.simplePropertyAssignment = function (propertyName, colonToken, expression) { - return new TypeScript.SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, false); - }; - NormalModeFactory.prototype.functionPropertyAssignment = function (propertyName, callSignature, block) { - return new TypeScript.FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, false); - }; - NormalModeFactory.prototype.functionExpression = function (functionKeyword, identifier, callSignature, block) { - return new TypeScript.FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, false); - }; - NormalModeFactory.prototype.emptyStatement = function (semicolonToken) { - return new TypeScript.EmptyStatementSyntax(semicolonToken, false); - }; - NormalModeFactory.prototype.tryStatement = function (tryKeyword, block, catchClause, finallyClause) { - return new TypeScript.TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, false); - }; - NormalModeFactory.prototype.catchClause = function (catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - return new TypeScript.CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, false); - }; - NormalModeFactory.prototype.finallyClause = function (finallyKeyword, block) { - return new TypeScript.FinallyClauseSyntax(finallyKeyword, block, false); - }; - NormalModeFactory.prototype.labeledStatement = function (identifier, colonToken, statement) { - return new TypeScript.LabeledStatementSyntax(identifier, colonToken, statement, false); - }; - NormalModeFactory.prototype.doStatement = function (doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - return new TypeScript.DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, false); - }; - NormalModeFactory.prototype.typeOfExpression = function (typeOfKeyword, expression) { - return new TypeScript.TypeOfExpressionSyntax(typeOfKeyword, expression, false); - }; - NormalModeFactory.prototype.deleteExpression = function (deleteKeyword, expression) { - return new TypeScript.DeleteExpressionSyntax(deleteKeyword, expression, false); - }; - NormalModeFactory.prototype.voidExpression = function (voidKeyword, expression) { - return new TypeScript.VoidExpressionSyntax(voidKeyword, expression, false); - }; - NormalModeFactory.prototype.debuggerStatement = function (debuggerKeyword, semicolonToken) { - return new TypeScript.DebuggerStatementSyntax(debuggerKeyword, semicolonToken, false); - }; - return NormalModeFactory; - })(); - Syntax.NormalModeFactory = NormalModeFactory; - - var StrictModeFactory = (function () { - function StrictModeFactory() { - } - StrictModeFactory.prototype.sourceUnit = function (moduleElements, endOfFileToken) { - return new TypeScript.SourceUnitSyntax(moduleElements, endOfFileToken, true); - }; - StrictModeFactory.prototype.externalModuleReference = function (requireKeyword, openParenToken, stringLiteral, closeParenToken) { - return new TypeScript.ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, true); - }; - StrictModeFactory.prototype.moduleNameModuleReference = function (moduleName) { - return new TypeScript.ModuleNameModuleReferenceSyntax(moduleName, true); - }; - StrictModeFactory.prototype.importDeclaration = function (modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - return new TypeScript.ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, true); - }; - StrictModeFactory.prototype.exportAssignment = function (exportKeyword, equalsToken, identifier, semicolonToken) { - return new TypeScript.ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, true); - }; - StrictModeFactory.prototype.classDeclaration = function (modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - return new TypeScript.ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, true); - }; - StrictModeFactory.prototype.interfaceDeclaration = function (modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - return new TypeScript.InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, true); - }; - StrictModeFactory.prototype.heritageClause = function (kind, extendsOrImplementsKeyword, typeNames) { - return new TypeScript.HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, true); - }; - StrictModeFactory.prototype.moduleDeclaration = function (modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - return new TypeScript.ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, true); - }; - StrictModeFactory.prototype.functionDeclaration = function (modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - return new TypeScript.FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, true); - }; - StrictModeFactory.prototype.variableStatement = function (modifiers, variableDeclaration, semicolonToken) { - return new TypeScript.VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, true); - }; - StrictModeFactory.prototype.variableDeclaration = function (varKeyword, variableDeclarators) { - return new TypeScript.VariableDeclarationSyntax(varKeyword, variableDeclarators, true); - }; - StrictModeFactory.prototype.variableDeclarator = function (propertyName, typeAnnotation, equalsValueClause) { - return new TypeScript.VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, true); - }; - StrictModeFactory.prototype.equalsValueClause = function (equalsToken, value) { - return new TypeScript.EqualsValueClauseSyntax(equalsToken, value, true); - }; - StrictModeFactory.prototype.prefixUnaryExpression = function (kind, operatorToken, operand) { - return new TypeScript.PrefixUnaryExpressionSyntax(kind, operatorToken, operand, true); - }; - StrictModeFactory.prototype.arrayLiteralExpression = function (openBracketToken, expressions, closeBracketToken) { - return new TypeScript.ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, true); - }; - StrictModeFactory.prototype.omittedExpression = function () { - return new TypeScript.OmittedExpressionSyntax(true); - }; - StrictModeFactory.prototype.parenthesizedExpression = function (openParenToken, expression, closeParenToken) { - return new TypeScript.ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, true); - }; - StrictModeFactory.prototype.simpleArrowFunctionExpression = function (identifier, equalsGreaterThanToken, block, expression) { - return new TypeScript.SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, true); - }; - StrictModeFactory.prototype.parenthesizedArrowFunctionExpression = function (callSignature, equalsGreaterThanToken, block, expression) { - return new TypeScript.ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, true); - }; - StrictModeFactory.prototype.qualifiedName = function (left, dotToken, right) { - return new TypeScript.QualifiedNameSyntax(left, dotToken, right, true); - }; - StrictModeFactory.prototype.typeArgumentList = function (lessThanToken, typeArguments, greaterThanToken) { - return new TypeScript.TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, true); - }; - StrictModeFactory.prototype.constructorType = function (newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, true); - }; - StrictModeFactory.prototype.functionType = function (typeParameterList, parameterList, equalsGreaterThanToken, type) { - return new TypeScript.FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, true); - }; - StrictModeFactory.prototype.objectType = function (openBraceToken, typeMembers, closeBraceToken) { - return new TypeScript.ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, true); - }; - StrictModeFactory.prototype.arrayType = function (type, openBracketToken, closeBracketToken) { - return new TypeScript.ArrayTypeSyntax(type, openBracketToken, closeBracketToken, true); - }; - StrictModeFactory.prototype.genericType = function (name, typeArgumentList) { - return new TypeScript.GenericTypeSyntax(name, typeArgumentList, true); - }; - StrictModeFactory.prototype.typeQuery = function (typeOfKeyword, name) { - return new TypeScript.TypeQuerySyntax(typeOfKeyword, name, true); - }; - StrictModeFactory.prototype.typeAnnotation = function (colonToken, type) { - return new TypeScript.TypeAnnotationSyntax(colonToken, type, true); - }; - StrictModeFactory.prototype.block = function (openBraceToken, statements, closeBraceToken) { - return new TypeScript.BlockSyntax(openBraceToken, statements, closeBraceToken, true); - }; - StrictModeFactory.prototype.parameter = function (dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - return new TypeScript.ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, true); - }; - StrictModeFactory.prototype.memberAccessExpression = function (expression, dotToken, name) { - return new TypeScript.MemberAccessExpressionSyntax(expression, dotToken, name, true); - }; - StrictModeFactory.prototype.postfixUnaryExpression = function (kind, operand, operatorToken) { - return new TypeScript.PostfixUnaryExpressionSyntax(kind, operand, operatorToken, true); - }; - StrictModeFactory.prototype.elementAccessExpression = function (expression, openBracketToken, argumentExpression, closeBracketToken) { - return new TypeScript.ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, true); - }; - StrictModeFactory.prototype.invocationExpression = function (expression, argumentList) { - return new TypeScript.InvocationExpressionSyntax(expression, argumentList, true); - }; - StrictModeFactory.prototype.argumentList = function (typeArgumentList, openParenToken, _arguments, closeParenToken) { - return new TypeScript.ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, true); - }; - StrictModeFactory.prototype.binaryExpression = function (kind, left, operatorToken, right) { - return new TypeScript.BinaryExpressionSyntax(kind, left, operatorToken, right, true); - }; - StrictModeFactory.prototype.conditionalExpression = function (condition, questionToken, whenTrue, colonToken, whenFalse) { - return new TypeScript.ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, true); - }; - StrictModeFactory.prototype.constructSignature = function (newKeyword, callSignature) { - return new TypeScript.ConstructSignatureSyntax(newKeyword, callSignature, true); - }; - StrictModeFactory.prototype.methodSignature = function (propertyName, questionToken, callSignature) { - return new TypeScript.MethodSignatureSyntax(propertyName, questionToken, callSignature, true); - }; - StrictModeFactory.prototype.indexSignature = function (openBracketToken, parameter, closeBracketToken, typeAnnotation) { - return new TypeScript.IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, true); - }; - StrictModeFactory.prototype.propertySignature = function (propertyName, questionToken, typeAnnotation) { - return new TypeScript.PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, true); - }; - StrictModeFactory.prototype.callSignature = function (typeParameterList, parameterList, typeAnnotation) { - return new TypeScript.CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, true); - }; - StrictModeFactory.prototype.parameterList = function (openParenToken, parameters, closeParenToken) { - return new TypeScript.ParameterListSyntax(openParenToken, parameters, closeParenToken, true); - }; - StrictModeFactory.prototype.typeParameterList = function (lessThanToken, typeParameters, greaterThanToken) { - return new TypeScript.TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, true); - }; - StrictModeFactory.prototype.typeParameter = function (identifier, constraint) { - return new TypeScript.TypeParameterSyntax(identifier, constraint, true); - }; - StrictModeFactory.prototype.constraint = function (extendsKeyword, type) { - return new TypeScript.ConstraintSyntax(extendsKeyword, type, true); - }; - StrictModeFactory.prototype.elseClause = function (elseKeyword, statement) { - return new TypeScript.ElseClauseSyntax(elseKeyword, statement, true); - }; - StrictModeFactory.prototype.ifStatement = function (ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - return new TypeScript.IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, true); - }; - StrictModeFactory.prototype.expressionStatement = function (expression, semicolonToken) { - return new TypeScript.ExpressionStatementSyntax(expression, semicolonToken, true); - }; - StrictModeFactory.prototype.constructorDeclaration = function (modifiers, constructorKeyword, callSignature, block, semicolonToken) { - return new TypeScript.ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, true); - }; - StrictModeFactory.prototype.memberFunctionDeclaration = function (modifiers, propertyName, callSignature, block, semicolonToken) { - return new TypeScript.MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, true); - }; - StrictModeFactory.prototype.getAccessor = function (modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block) { - return new TypeScript.GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, true); - }; - StrictModeFactory.prototype.setAccessor = function (modifiers, setKeyword, propertyName, parameterList, block) { - return new TypeScript.SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, true); - }; - StrictModeFactory.prototype.memberVariableDeclaration = function (modifiers, variableDeclarator, semicolonToken) { - return new TypeScript.MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, true); - }; - StrictModeFactory.prototype.indexMemberDeclaration = function (modifiers, indexSignature, semicolonToken) { - return new TypeScript.IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, true); - }; - StrictModeFactory.prototype.throwStatement = function (throwKeyword, expression, semicolonToken) { - return new TypeScript.ThrowStatementSyntax(throwKeyword, expression, semicolonToken, true); - }; - StrictModeFactory.prototype.returnStatement = function (returnKeyword, expression, semicolonToken) { - return new TypeScript.ReturnStatementSyntax(returnKeyword, expression, semicolonToken, true); - }; - StrictModeFactory.prototype.objectCreationExpression = function (newKeyword, expression, argumentList) { - return new TypeScript.ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, true); - }; - StrictModeFactory.prototype.switchStatement = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - return new TypeScript.SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, true); - }; - StrictModeFactory.prototype.caseSwitchClause = function (caseKeyword, expression, colonToken, statements) { - return new TypeScript.CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, true); - }; - StrictModeFactory.prototype.defaultSwitchClause = function (defaultKeyword, colonToken, statements) { - return new TypeScript.DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, true); - }; - StrictModeFactory.prototype.breakStatement = function (breakKeyword, identifier, semicolonToken) { - return new TypeScript.BreakStatementSyntax(breakKeyword, identifier, semicolonToken, true); - }; - StrictModeFactory.prototype.continueStatement = function (continueKeyword, identifier, semicolonToken) { - return new TypeScript.ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, true); - }; - StrictModeFactory.prototype.forStatement = function (forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - return new TypeScript.ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.forInStatement = function (forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - return new TypeScript.ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.whileStatement = function (whileKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.withStatement = function (withKeyword, openParenToken, condition, closeParenToken, statement) { - return new TypeScript.WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, true); - }; - StrictModeFactory.prototype.enumDeclaration = function (modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - return new TypeScript.EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, true); - }; - StrictModeFactory.prototype.enumElement = function (propertyName, equalsValueClause) { - return new TypeScript.EnumElementSyntax(propertyName, equalsValueClause, true); - }; - StrictModeFactory.prototype.castExpression = function (lessThanToken, type, greaterThanToken, expression) { - return new TypeScript.CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, true); - }; - StrictModeFactory.prototype.objectLiteralExpression = function (openBraceToken, propertyAssignments, closeBraceToken) { - return new TypeScript.ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, true); - }; - StrictModeFactory.prototype.simplePropertyAssignment = function (propertyName, colonToken, expression) { - return new TypeScript.SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, true); - }; - StrictModeFactory.prototype.functionPropertyAssignment = function (propertyName, callSignature, block) { - return new TypeScript.FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, true); - }; - StrictModeFactory.prototype.functionExpression = function (functionKeyword, identifier, callSignature, block) { - return new TypeScript.FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, true); - }; - StrictModeFactory.prototype.emptyStatement = function (semicolonToken) { - return new TypeScript.EmptyStatementSyntax(semicolonToken, true); - }; - StrictModeFactory.prototype.tryStatement = function (tryKeyword, block, catchClause, finallyClause) { - return new TypeScript.TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, true); - }; - StrictModeFactory.prototype.catchClause = function (catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - return new TypeScript.CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, true); - }; - StrictModeFactory.prototype.finallyClause = function (finallyKeyword, block) { - return new TypeScript.FinallyClauseSyntax(finallyKeyword, block, true); - }; - StrictModeFactory.prototype.labeledStatement = function (identifier, colonToken, statement) { - return new TypeScript.LabeledStatementSyntax(identifier, colonToken, statement, true); - }; - StrictModeFactory.prototype.doStatement = function (doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - return new TypeScript.DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, true); - }; - StrictModeFactory.prototype.typeOfExpression = function (typeOfKeyword, expression) { - return new TypeScript.TypeOfExpressionSyntax(typeOfKeyword, expression, true); - }; - StrictModeFactory.prototype.deleteExpression = function (deleteKeyword, expression) { - return new TypeScript.DeleteExpressionSyntax(deleteKeyword, expression, true); - }; - StrictModeFactory.prototype.voidExpression = function (voidKeyword, expression) { - return new TypeScript.VoidExpressionSyntax(voidKeyword, expression, true); - }; - StrictModeFactory.prototype.debuggerStatement = function (debuggerKeyword, semicolonToken) { - return new TypeScript.DebuggerStatementSyntax(debuggerKeyword, semicolonToken, true); - }; - return StrictModeFactory; - })(); - Syntax.StrictModeFactory = StrictModeFactory; - - Syntax.normalModeFactory = new NormalModeFactory(); - Syntax.strictModeFactory = new StrictModeFactory(); - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxFacts) { - function isDirectivePrologueElement(node) { - if (node.kind() === 149 /* ExpressionStatement */) { - var expressionStatement = node; - var expression = expressionStatement.expression; - - if (expression.kind() === 14 /* StringLiteral */) { - return true; - } - } - - return false; - } - SyntaxFacts.isDirectivePrologueElement = isDirectivePrologueElement; - - function isUseStrictDirective(node) { - var expressionStatement = node; - var stringLiteral = expressionStatement.expression; - - var text = stringLiteral.text(); - return text === '"use strict"' || text === "'use strict'"; - } - SyntaxFacts.isUseStrictDirective = isUseStrictDirective; - - function isIdentifierNameOrAnyKeyword(token) { - var tokenKind = token.tokenKind; - return tokenKind === 11 /* IdentifierName */ || SyntaxFacts.isAnyKeyword(tokenKind); - } - SyntaxFacts.isIdentifierNameOrAnyKeyword = isIdentifierNameOrAnyKeyword; - })(TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); - var SyntaxFacts = TypeScript.SyntaxFacts; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var EmptySyntaxList = (function () { - function EmptySyntaxList() { - } - EmptySyntaxList.prototype.kind = function () { - return 1 /* List */; - }; - - EmptySyntaxList.prototype.isNode = function () { - return false; - }; - EmptySyntaxList.prototype.isToken = function () { - return false; - }; - EmptySyntaxList.prototype.isList = function () { - return true; - }; - EmptySyntaxList.prototype.isSeparatedList = function () { - return false; - }; - - EmptySyntaxList.prototype.toJSON = function (key) { - return []; - }; - - EmptySyntaxList.prototype.childCount = function () { - return 0; - }; - - EmptySyntaxList.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptySyntaxList.prototype.toArray = function () { - return []; - }; - - EmptySyntaxList.prototype.collectTextElements = function (elements) { - }; - - EmptySyntaxList.prototype.firstToken = function () { - return null; - }; - - EmptySyntaxList.prototype.lastToken = function () { - return null; - }; - - EmptySyntaxList.prototype.fullWidth = function () { - return 0; - }; - - EmptySyntaxList.prototype.width = function () { - return 0; - }; - - EmptySyntaxList.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySyntaxList.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - EmptySyntaxList.prototype.leadingTriviaWidth = function () { - return 0; - }; - - EmptySyntaxList.prototype.trailingTriviaWidth = function () { - return 0; - }; - - EmptySyntaxList.prototype.fullText = function () { - return ""; - }; - - EmptySyntaxList.prototype.isTypeScriptSpecific = function () { - return false; - }; - - EmptySyntaxList.prototype.isIncrementallyUnusable = function () { - return false; - }; - - EmptySyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - throw TypeScript.Errors.invalidOperation(); - }; - - EmptySyntaxList.prototype.insertChildrenInto = function (array, index) { - }; - return EmptySyntaxList; - })(); - Syntax.EmptySyntaxList = EmptySyntaxList; - - Syntax.emptyList = new EmptySyntaxList(); - - var SingletonSyntaxList = (function () { - function SingletonSyntaxList(item) { - this.item = item; - } - SingletonSyntaxList.prototype.kind = function () { - return 1 /* List */; - }; - - SingletonSyntaxList.prototype.isToken = function () { - return false; - }; - SingletonSyntaxList.prototype.isNode = function () { - return false; - }; - SingletonSyntaxList.prototype.isList = function () { - return true; - }; - SingletonSyntaxList.prototype.isSeparatedList = function () { - return false; - }; - - SingletonSyntaxList.prototype.toJSON = function (key) { - return [this.item]; - }; - - SingletonSyntaxList.prototype.childCount = function () { - return 1; - }; - - SingletonSyntaxList.prototype.childAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSyntaxList.prototype.toArray = function () { - return [this.item]; - }; - - SingletonSyntaxList.prototype.collectTextElements = function (elements) { - this.item.collectTextElements(elements); - }; - - SingletonSyntaxList.prototype.firstToken = function () { - return this.item.firstToken(); - }; - - SingletonSyntaxList.prototype.lastToken = function () { - return this.item.lastToken(); - }; - - SingletonSyntaxList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - - SingletonSyntaxList.prototype.width = function () { - return this.item.width(); - }; - - SingletonSyntaxList.prototype.leadingTrivia = function () { - return this.item.leadingTrivia(); - }; - - SingletonSyntaxList.prototype.trailingTrivia = function () { - return this.item.trailingTrivia(); - }; - - SingletonSyntaxList.prototype.leadingTriviaWidth = function () { - return this.item.leadingTriviaWidth(); - }; - - SingletonSyntaxList.prototype.trailingTriviaWidth = function () { - return this.item.trailingTriviaWidth(); - }; - - SingletonSyntaxList.prototype.fullText = function () { - return this.item.fullText(); - }; - - SingletonSyntaxList.prototype.isTypeScriptSpecific = function () { - return this.item.isTypeScriptSpecific(); - }; - - SingletonSyntaxList.prototype.isIncrementallyUnusable = function () { - return this.item.isIncrementallyUnusable(); - }; - - SingletonSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - return this.item.findTokenInternal(new TypeScript.PositionedList(parent, this, fullStart), position, fullStart); - }; - - SingletonSyntaxList.prototype.insertChildrenInto = function (array, index) { - array.splice(index, 0, this.item); - }; - return SingletonSyntaxList; - })(); - - var NormalSyntaxList = (function () { - function NormalSyntaxList(nodeOrTokens) { - this._data = 0; - this.nodeOrTokens = nodeOrTokens; - } - NormalSyntaxList.prototype.kind = function () { - return 1 /* List */; - }; - - NormalSyntaxList.prototype.isNode = function () { - return false; - }; - NormalSyntaxList.prototype.isToken = function () { - return false; - }; - NormalSyntaxList.prototype.isList = function () { - return true; - }; - NormalSyntaxList.prototype.isSeparatedList = function () { - return false; - }; - - NormalSyntaxList.prototype.toJSON = function (key) { - return this.nodeOrTokens; - }; - - NormalSyntaxList.prototype.childCount = function () { - return this.nodeOrTokens.length; - }; - - NormalSyntaxList.prototype.childAt = function (index) { - if (index < 0 || index >= this.nodeOrTokens.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.nodeOrTokens[index]; - }; - - NormalSyntaxList.prototype.toArray = function () { - return this.nodeOrTokens.slice(0); - }; - - NormalSyntaxList.prototype.collectTextElements = function (elements) { - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var element = this.nodeOrTokens[i]; - element.collectTextElements(elements); - } - }; - - NormalSyntaxList.prototype.firstToken = function () { - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var token = this.nodeOrTokens[i].firstToken(); - if (token !== null) { - return token; - } - } - - return null; - }; - - NormalSyntaxList.prototype.lastToken = function () { - for (var i = this.nodeOrTokens.length - 1; i >= 0; i--) { - var token = this.nodeOrTokens[i].lastToken(); - if (token !== null) { - return token; - } - } - - return null; - }; - - NormalSyntaxList.prototype.fullText = function () { - var elements = new Array(); - this.collectTextElements(elements); - return elements.join(""); - }; - - NormalSyntaxList.prototype.isTypeScriptSpecific = function () { - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - if (this.nodeOrTokens[i].isTypeScriptSpecific()) { - return true; - } - } - - return false; - }; - - NormalSyntaxList.prototype.isIncrementallyUnusable = function () { - return (this.data() & 2 /* NodeIncrementallyUnusableMask */) !== 0; - }; - - NormalSyntaxList.prototype.fullWidth = function () { - return this.data() >>> 3 /* NodeFullWidthShift */; - }; - - NormalSyntaxList.prototype.width = function () { - var fullWidth = this.fullWidth(); - return fullWidth - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - NormalSyntaxList.prototype.leadingTrivia = function () { - return this.firstToken().leadingTrivia(); - }; - - NormalSyntaxList.prototype.trailingTrivia = function () { - return this.lastToken().trailingTrivia(); - }; - - NormalSyntaxList.prototype.leadingTriviaWidth = function () { - return this.firstToken().leadingTriviaWidth(); - }; - - NormalSyntaxList.prototype.trailingTriviaWidth = function () { - return this.lastToken().trailingTriviaWidth(); - }; - - NormalSyntaxList.prototype.computeData = function () { - var fullWidth = 0; - var isIncrementallyUnusable = false; - - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var node = this.nodeOrTokens[i]; - fullWidth += node.fullWidth(); - isIncrementallyUnusable = isIncrementallyUnusable || node.isIncrementallyUnusable(); - } - - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - }; - - NormalSyntaxList.prototype.data = function () { - if ((this._data & 1 /* NodeDataComputed */) === 0) { - this._data = this.computeData(); - } - - return this._data; - }; - - NormalSyntaxList.prototype.findTokenInternal = function (parent, position, fullStart) { - parent = new TypeScript.PositionedList(parent, this, fullStart); - for (var i = 0, n = this.nodeOrTokens.length; i < n; i++) { - var nodeOrToken = this.nodeOrTokens[i]; - - var childWidth = nodeOrToken.fullWidth(); - if (position < childWidth) { - return nodeOrToken.findTokenInternal(parent, position, fullStart); - } - - position -= childWidth; - fullStart += childWidth; - } - - throw TypeScript.Errors.invalidOperation(); - }; - - NormalSyntaxList.prototype.insertChildrenInto = function (array, index) { - if (index === 0) { - array.unshift.apply(array, this.nodeOrTokens); - } else { - array.splice.apply(array, [index, 0].concat(this.nodeOrTokens)); - } - }; - return NormalSyntaxList; - })(); - - function list(nodes) { - if (nodes === undefined || nodes === null || nodes.length === 0) { - return Syntax.emptyList; - } - - if (nodes.length === 1) { - var item = nodes[0]; - return new SingletonSyntaxList(item); - } - - return new NormalSyntaxList(nodes); - } - Syntax.list = list; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxNode = (function () { - function SyntaxNode(parsedInStrictMode) { - this._data = parsedInStrictMode ? 4 /* NodeParsedInStrictModeMask */ : 0; - } - SyntaxNode.prototype.isNode = function () { - return true; - }; - SyntaxNode.prototype.isToken = function () { - return false; - }; - SyntaxNode.prototype.isList = function () { - return false; - }; - SyntaxNode.prototype.isSeparatedList = function () { - return false; - }; - - SyntaxNode.prototype.kind = function () { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.childCount = function () { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.childAt = function (slot) { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.firstToken = function () { - for (var i = 0, n = this.childCount(); i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - if (element.fullWidth() > 0 || element.kind() === 10 /* EndOfFileToken */) { - return element.firstToken(); - } - } - } - - return null; - }; - - SyntaxNode.prototype.lastToken = function () { - for (var i = this.childCount() - 1; i >= 0; i--) { - var element = this.childAt(i); - - if (element !== null) { - if (element.fullWidth() > 0 || element.kind() === 10 /* EndOfFileToken */) { - return element.lastToken(); - } - } - } - - return null; - }; - - SyntaxNode.prototype.insertChildrenInto = function (array, index) { - for (var i = this.childCount() - 1; i >= 0; i--) { - var element = this.childAt(i); - - if (element !== null) { - if (element.isNode() || element.isToken()) { - array.splice(index, 0, element); - } else if (element.isList()) { - element.insertChildrenInto(array, index); - } else if (element.isSeparatedList()) { - element.insertChildrenInto(array, index); - } else { - throw TypeScript.Errors.invalidOperation(); - } - } - } - }; - - SyntaxNode.prototype.leadingTrivia = function () { - var firstToken = this.firstToken(); - return firstToken ? firstToken.leadingTrivia() : TypeScript.Syntax.emptyTriviaList; - }; - - SyntaxNode.prototype.trailingTrivia = function () { - var lastToken = this.lastToken(); - return lastToken ? lastToken.trailingTrivia() : TypeScript.Syntax.emptyTriviaList; - }; - - SyntaxNode.prototype.toJSON = function (key) { - var result = { - kind: TypeScript.SyntaxKind[this.kind()], - fullWidth: this.fullWidth() - }; - - if (this.isIncrementallyUnusable()) { - result.isIncrementallyUnusable = true; - } - - if (this.parsedInStrictMode()) { - result.parsedInStrictMode = true; - } - - var thisAsIndexable = this; - for (var i = 0, n = this.childCount(); i < n; i++) { - var value = this.childAt(i); - - if (value) { - for (var name in this) { - if (value === thisAsIndexable[name]) { - result[name] = value; - break; - } - } - } - } - - return result; - }; - - SyntaxNode.prototype.accept = function (visitor) { - throw TypeScript.Errors.abstract(); - }; - - SyntaxNode.prototype.fullText = function () { - var elements = []; - this.collectTextElements(elements); - return elements.join(""); - }; - - SyntaxNode.prototype.collectTextElements = function (elements) { - for (var i = 0, n = this.childCount(); i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - element.collectTextElements(elements); - } - } - }; - - SyntaxNode.prototype.replaceToken = function (token1, token2) { - if (token1 === token2) { - return this; - } - - return this.accept(new TypeScript.SyntaxTokenReplacer(token1, token2)); - }; - - SyntaxNode.prototype.withLeadingTrivia = function (trivia) { - return this.replaceToken(this.firstToken(), this.firstToken().withLeadingTrivia(trivia)); - }; - - SyntaxNode.prototype.withTrailingTrivia = function (trivia) { - return this.replaceToken(this.lastToken(), this.lastToken().withTrailingTrivia(trivia)); - }; - - SyntaxNode.prototype.hasLeadingTrivia = function () { - return this.lastToken().hasLeadingTrivia(); - }; - - SyntaxNode.prototype.hasTrailingTrivia = function () { - return this.lastToken().hasTrailingTrivia(); - }; - - SyntaxNode.prototype.isTypeScriptSpecific = function () { - return false; - }; - - SyntaxNode.prototype.isIncrementallyUnusable = function () { - return (this.data() & 2 /* NodeIncrementallyUnusableMask */) !== 0; - }; - - SyntaxNode.prototype.parsedInStrictMode = function () { - return (this.data() & 4 /* NodeParsedInStrictModeMask */) !== 0; - }; - - SyntaxNode.prototype.fullWidth = function () { - return this.data() >>> 3 /* NodeFullWidthShift */; - }; - - SyntaxNode.prototype.computeData = function () { - var slotCount = this.childCount(); - - var fullWidth = 0; - var childWidth = 0; - - var isIncrementallyUnusable = ((this._data & 2 /* NodeIncrementallyUnusableMask */) !== 0) || slotCount === 0; - - for (var i = 0, n = slotCount; i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - childWidth = element.fullWidth(); - fullWidth += childWidth; - - if (!isIncrementallyUnusable) { - isIncrementallyUnusable = element.isIncrementallyUnusable(); - } - } - } - - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - }; - - SyntaxNode.prototype.data = function () { - if ((this._data & 1 /* NodeDataComputed */) === 0) { - this._data |= this.computeData(); - } - - return this._data; - }; - - SyntaxNode.prototype.findToken = function (position, includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var endOfFileToken = this.tryGetEndOfFileAt(position); - if (endOfFileToken !== null) { - return endOfFileToken; - } - - if (position < 0 || position >= this.fullWidth()) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - - var positionedToken = this.findTokenInternal(null, position, 0); - - if (includeSkippedTokens) { - return TypeScript.Syntax.findSkippedTokenInPositionedToken(positionedToken, position) || positionedToken; - } - - return positionedToken; - }; - - SyntaxNode.prototype.tryGetEndOfFileAt = function (position) { - if (this.kind() === 120 /* SourceUnit */ && position === this.fullWidth()) { - var sourceUnit = this; - return new TypeScript.PositionedToken(new TypeScript.PositionedNode(null, sourceUnit, 0), sourceUnit.endOfFileToken, sourceUnit.moduleElements.fullWidth()); - } - - return null; - }; - - SyntaxNode.prototype.findTokenInternal = function (parent, position, fullStart) { - parent = new TypeScript.PositionedNode(parent, this, fullStart); - for (var i = 0, n = this.childCount(); i < n; i++) { - var element = this.childAt(i); - - if (element !== null) { - var childWidth = element.fullWidth(); - - if (position < childWidth) { - return element.findTokenInternal(parent, position, fullStart); - } - - position -= childWidth; - fullStart += childWidth; - } - } - - throw TypeScript.Errors.invalidOperation(); - }; - - SyntaxNode.prototype.findTokenOnLeft = function (position, includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var positionedToken = this.findToken(position, false); - var start = positionedToken.start(); - - if (includeSkippedTokens) { - positionedToken = TypeScript.Syntax.findSkippedTokenOnLeft(positionedToken, position) || positionedToken; - } - - if (position > start) { - return positionedToken; - } - - if (positionedToken.fullStart() === 0) { - return null; - } - - return positionedToken.previousToken(includeSkippedTokens); - }; - - SyntaxNode.prototype.findCompleteTokenOnLeft = function (position, includeSkippedTokens) { - if (typeof includeSkippedTokens === "undefined") { includeSkippedTokens = false; } - var positionedToken = this.findToken(position, false); - - if (includeSkippedTokens) { - positionedToken = TypeScript.Syntax.findSkippedTokenOnLeft(positionedToken, position) || positionedToken; - } - - if (positionedToken.token().width() > 0 && position >= positionedToken.end()) { - return positionedToken; - } - - return positionedToken.previousToken(includeSkippedTokens); - }; - - SyntaxNode.prototype.isModuleElement = function () { - return false; - }; - - SyntaxNode.prototype.isClassElement = function () { - return false; - }; - - SyntaxNode.prototype.isTypeMember = function () { - return false; - }; - - SyntaxNode.prototype.isStatement = function () { - return false; - }; - - SyntaxNode.prototype.isExpression = function () { - return false; - }; - - SyntaxNode.prototype.isSwitchClause = function () { - return false; - }; - - SyntaxNode.prototype.structuralEquals = function (node) { - if (this === node) { - return true; - } - if (node === null) { - return false; - } - if (this.kind() !== node.kind()) { - return false; - } - - for (var i = 0, n = this.childCount(); i < n; i++) { - var element1 = this.childAt(i); - var element2 = node.childAt(i); - - if (!TypeScript.Syntax.elementStructuralEquals(element1, element2)) { - return false; - } - } - - return true; - }; - - SyntaxNode.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - SyntaxNode.prototype.leadingTriviaWidth = function () { - var firstToken = this.firstToken(); - return firstToken === null ? 0 : firstToken.leadingTriviaWidth(); - }; - - SyntaxNode.prototype.trailingTriviaWidth = function () { - var lastToken = this.lastToken(); - return lastToken === null ? 0 : lastToken.trailingTriviaWidth(); - }; - return SyntaxNode; - })(); - TypeScript.SyntaxNode = SyntaxNode; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SourceUnitSyntax = (function (_super) { - __extends(SourceUnitSyntax, _super); - function SourceUnitSyntax(moduleElements, endOfFileToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.moduleElements = moduleElements; - this.endOfFileToken = endOfFileToken; - } - SourceUnitSyntax.prototype.accept = function (visitor) { - return visitor.visitSourceUnit(this); - }; - - SourceUnitSyntax.prototype.kind = function () { - return 120 /* SourceUnit */; - }; - - SourceUnitSyntax.prototype.childCount = function () { - return 2; - }; - - SourceUnitSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.moduleElements; - case 1: - return this.endOfFileToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SourceUnitSyntax.prototype.update = function (moduleElements, endOfFileToken) { - if (this.moduleElements === moduleElements && this.endOfFileToken === endOfFileToken) { - return this; - } - - return new SourceUnitSyntax(moduleElements, endOfFileToken, this.parsedInStrictMode()); - }; - - SourceUnitSyntax.create = function (endOfFileToken) { - return new SourceUnitSyntax(TypeScript.Syntax.emptyList, endOfFileToken, false); - }; - - SourceUnitSyntax.create1 = function (endOfFileToken) { - return new SourceUnitSyntax(TypeScript.Syntax.emptyList, endOfFileToken, false); - }; - - SourceUnitSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SourceUnitSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SourceUnitSyntax.prototype.withModuleElements = function (moduleElements) { - return this.update(moduleElements, this.endOfFileToken); - }; - - SourceUnitSyntax.prototype.withModuleElement = function (moduleElement) { - return this.withModuleElements(TypeScript.Syntax.list([moduleElement])); - }; - - SourceUnitSyntax.prototype.withEndOfFileToken = function (endOfFileToken) { - return this.update(this.moduleElements, endOfFileToken); - }; - - SourceUnitSyntax.prototype.isTypeScriptSpecific = function () { - if (this.moduleElements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return SourceUnitSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SourceUnitSyntax = SourceUnitSyntax; - - var ExternalModuleReferenceSyntax = (function (_super) { - __extends(ExternalModuleReferenceSyntax, _super); - function ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.requireKeyword = requireKeyword; - this.openParenToken = openParenToken; - this.stringLiteral = stringLiteral; - this.closeParenToken = closeParenToken; - } - ExternalModuleReferenceSyntax.prototype.accept = function (visitor) { - return visitor.visitExternalModuleReference(this); - }; - - ExternalModuleReferenceSyntax.prototype.kind = function () { - return 245 /* ExternalModuleReference */; - }; - - ExternalModuleReferenceSyntax.prototype.childCount = function () { - return 4; - }; - - ExternalModuleReferenceSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.requireKeyword; - case 1: - return this.openParenToken; - case 2: - return this.stringLiteral; - case 3: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ExternalModuleReferenceSyntax.prototype.isModuleReference = function () { - return true; - }; - - ExternalModuleReferenceSyntax.prototype.update = function (requireKeyword, openParenToken, stringLiteral, closeParenToken) { - if (this.requireKeyword === requireKeyword && this.openParenToken === openParenToken && this.stringLiteral === stringLiteral && this.closeParenToken === closeParenToken) { - return this; - } - - return new ExternalModuleReferenceSyntax(requireKeyword, openParenToken, stringLiteral, closeParenToken, this.parsedInStrictMode()); - }; - - ExternalModuleReferenceSyntax.create1 = function (stringLiteral) { - return new ExternalModuleReferenceSyntax(TypeScript.Syntax.token(66 /* RequireKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), stringLiteral, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ExternalModuleReferenceSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ExternalModuleReferenceSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ExternalModuleReferenceSyntax.prototype.withRequireKeyword = function (requireKeyword) { - return this.update(requireKeyword, this.openParenToken, this.stringLiteral, this.closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.requireKeyword, openParenToken, this.stringLiteral, this.closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.withStringLiteral = function (stringLiteral) { - return this.update(this.requireKeyword, this.openParenToken, stringLiteral, this.closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.requireKeyword, this.openParenToken, this.stringLiteral, closeParenToken); - }; - - ExternalModuleReferenceSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ExternalModuleReferenceSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ExternalModuleReferenceSyntax = ExternalModuleReferenceSyntax; - - var ModuleNameModuleReferenceSyntax = (function (_super) { - __extends(ModuleNameModuleReferenceSyntax, _super); - function ModuleNameModuleReferenceSyntax(moduleName, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.moduleName = moduleName; - } - ModuleNameModuleReferenceSyntax.prototype.accept = function (visitor) { - return visitor.visitModuleNameModuleReference(this); - }; - - ModuleNameModuleReferenceSyntax.prototype.kind = function () { - return 246 /* ModuleNameModuleReference */; - }; - - ModuleNameModuleReferenceSyntax.prototype.childCount = function () { - return 1; - }; - - ModuleNameModuleReferenceSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.moduleName; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ModuleNameModuleReferenceSyntax.prototype.isModuleReference = function () { - return true; - }; - - ModuleNameModuleReferenceSyntax.prototype.update = function (moduleName) { - if (this.moduleName === moduleName) { - return this; - } - - return new ModuleNameModuleReferenceSyntax(moduleName, this.parsedInStrictMode()); - }; - - ModuleNameModuleReferenceSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ModuleNameModuleReferenceSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ModuleNameModuleReferenceSyntax.prototype.withModuleName = function (moduleName) { - return this.update(moduleName); - }; - - ModuleNameModuleReferenceSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ModuleNameModuleReferenceSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ModuleNameModuleReferenceSyntax = ModuleNameModuleReferenceSyntax; - - var ImportDeclarationSyntax = (function (_super) { - __extends(ImportDeclarationSyntax, _super); - function ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.importKeyword = importKeyword; - this.identifier = identifier; - this.equalsToken = equalsToken; - this.moduleReference = moduleReference; - this.semicolonToken = semicolonToken; - } - ImportDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitImportDeclaration(this); - }; - - ImportDeclarationSyntax.prototype.kind = function () { - return 133 /* ImportDeclaration */; - }; - - ImportDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - ImportDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.importKeyword; - case 2: - return this.identifier; - case 3: - return this.equalsToken; - case 4: - return this.moduleReference; - case 5: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ImportDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - ImportDeclarationSyntax.prototype.update = function (modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - if (this.modifiers === modifiers && this.importKeyword === importKeyword && this.identifier === identifier && this.equalsToken === equalsToken && this.moduleReference === moduleReference && this.semicolonToken === semicolonToken) { - return this; - } - - return new ImportDeclarationSyntax(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, this.parsedInStrictMode()); - }; - - ImportDeclarationSyntax.create = function (importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - return new ImportDeclarationSyntax(TypeScript.Syntax.emptyList, importKeyword, identifier, equalsToken, moduleReference, semicolonToken, false); - }; - - ImportDeclarationSyntax.create1 = function (identifier, moduleReference) { - return new ImportDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(49 /* ImportKeyword */), identifier, TypeScript.Syntax.token(107 /* EqualsToken */), moduleReference, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ImportDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ImportDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ImportDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.importKeyword, this.identifier, this.equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ImportDeclarationSyntax.prototype.withImportKeyword = function (importKeyword) { - return this.update(this.modifiers, importKeyword, this.identifier, this.equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.importKeyword, identifier, this.equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withEqualsToken = function (equalsToken) { - return this.update(this.modifiers, this.importKeyword, this.identifier, equalsToken, this.moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withModuleReference = function (moduleReference) { - return this.update(this.modifiers, this.importKeyword, this.identifier, this.equalsToken, moduleReference, this.semicolonToken); - }; - - ImportDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.importKeyword, this.identifier, this.equalsToken, this.moduleReference, semicolonToken); - }; - - ImportDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ImportDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ImportDeclarationSyntax = ImportDeclarationSyntax; - - var ExportAssignmentSyntax = (function (_super) { - __extends(ExportAssignmentSyntax, _super); - function ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.exportKeyword = exportKeyword; - this.equalsToken = equalsToken; - this.identifier = identifier; - this.semicolonToken = semicolonToken; - } - ExportAssignmentSyntax.prototype.accept = function (visitor) { - return visitor.visitExportAssignment(this); - }; - - ExportAssignmentSyntax.prototype.kind = function () { - return 134 /* ExportAssignment */; - }; - - ExportAssignmentSyntax.prototype.childCount = function () { - return 4; - }; - - ExportAssignmentSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.exportKeyword; - case 1: - return this.equalsToken; - case 2: - return this.identifier; - case 3: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ExportAssignmentSyntax.prototype.isModuleElement = function () { - return true; - }; - - ExportAssignmentSyntax.prototype.update = function (exportKeyword, equalsToken, identifier, semicolonToken) { - if (this.exportKeyword === exportKeyword && this.equalsToken === equalsToken && this.identifier === identifier && this.semicolonToken === semicolonToken) { - return this; - } - - return new ExportAssignmentSyntax(exportKeyword, equalsToken, identifier, semicolonToken, this.parsedInStrictMode()); - }; - - ExportAssignmentSyntax.create1 = function (identifier) { - return new ExportAssignmentSyntax(TypeScript.Syntax.token(47 /* ExportKeyword */), TypeScript.Syntax.token(107 /* EqualsToken */), identifier, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ExportAssignmentSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ExportAssignmentSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ExportAssignmentSyntax.prototype.withExportKeyword = function (exportKeyword) { - return this.update(exportKeyword, this.equalsToken, this.identifier, this.semicolonToken); - }; - - ExportAssignmentSyntax.prototype.withEqualsToken = function (equalsToken) { - return this.update(this.exportKeyword, equalsToken, this.identifier, this.semicolonToken); - }; - - ExportAssignmentSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.exportKeyword, this.equalsToken, identifier, this.semicolonToken); - }; - - ExportAssignmentSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.exportKeyword, this.equalsToken, this.identifier, semicolonToken); - }; - - ExportAssignmentSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ExportAssignmentSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ExportAssignmentSyntax = ExportAssignmentSyntax; - - var ClassDeclarationSyntax = (function (_super) { - __extends(ClassDeclarationSyntax, _super); - function ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.classKeyword = classKeyword; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.openBraceToken = openBraceToken; - this.classElements = classElements; - this.closeBraceToken = closeBraceToken; - } - ClassDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitClassDeclaration(this); - }; - - ClassDeclarationSyntax.prototype.kind = function () { - return 131 /* ClassDeclaration */; - }; - - ClassDeclarationSyntax.prototype.childCount = function () { - return 8; - }; - - ClassDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.classKeyword; - case 2: - return this.identifier; - case 3: - return this.typeParameterList; - case 4: - return this.heritageClauses; - case 5: - return this.openBraceToken; - case 6: - return this.classElements; - case 7: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ClassDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - ClassDeclarationSyntax.prototype.update = function (modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - if (this.modifiers === modifiers && this.classKeyword === classKeyword && this.identifier === identifier && this.typeParameterList === typeParameterList && this.heritageClauses === heritageClauses && this.openBraceToken === openBraceToken && this.classElements === classElements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ClassDeclarationSyntax(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken, this.parsedInStrictMode()); - }; - - ClassDeclarationSyntax.create = function (classKeyword, identifier, openBraceToken, closeBraceToken) { - return new ClassDeclarationSyntax(TypeScript.Syntax.emptyList, classKeyword, identifier, null, TypeScript.Syntax.emptyList, openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - ClassDeclarationSyntax.create1 = function (identifier) { - return new ClassDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(44 /* ClassKeyword */), identifier, null, TypeScript.Syntax.emptyList, TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ClassDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ClassDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ClassDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ClassDeclarationSyntax.prototype.withClassKeyword = function (classKeyword) { - return this.update(this.modifiers, classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.classKeyword, identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(this.modifiers, this.classKeyword, this.identifier, typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withHeritageClauses = function (heritageClauses) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, heritageClauses, this.openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withHeritageClause = function (heritageClause) { - return this.withHeritageClauses(TypeScript.Syntax.list([heritageClause])); - }; - - ClassDeclarationSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, openBraceToken, this.classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withClassElements = function (classElements) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, classElements, this.closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.withClassElement = function (classElement) { - return this.withClassElements(TypeScript.Syntax.list([classElement])); - }; - - ClassDeclarationSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.modifiers, this.classKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.openBraceToken, this.classElements, closeBraceToken); - }; - - ClassDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ClassDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ClassDeclarationSyntax = ClassDeclarationSyntax; - - var InterfaceDeclarationSyntax = (function (_super) { - __extends(InterfaceDeclarationSyntax, _super); - function InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.interfaceKeyword = interfaceKeyword; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.body = body; - } - InterfaceDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitInterfaceDeclaration(this); - }; - - InterfaceDeclarationSyntax.prototype.kind = function () { - return 128 /* InterfaceDeclaration */; - }; - - InterfaceDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - InterfaceDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.interfaceKeyword; - case 2: - return this.identifier; - case 3: - return this.typeParameterList; - case 4: - return this.heritageClauses; - case 5: - return this.body; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - InterfaceDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - InterfaceDeclarationSyntax.prototype.update = function (modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - if (this.modifiers === modifiers && this.interfaceKeyword === interfaceKeyword && this.identifier === identifier && this.typeParameterList === typeParameterList && this.heritageClauses === heritageClauses && this.body === body) { - return this; - } - - return new InterfaceDeclarationSyntax(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body, this.parsedInStrictMode()); - }; - - InterfaceDeclarationSyntax.create = function (interfaceKeyword, identifier, body) { - return new InterfaceDeclarationSyntax(TypeScript.Syntax.emptyList, interfaceKeyword, identifier, null, TypeScript.Syntax.emptyList, body, false); - }; - - InterfaceDeclarationSyntax.create1 = function (identifier) { - return new InterfaceDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(52 /* InterfaceKeyword */), identifier, null, TypeScript.Syntax.emptyList, ObjectTypeSyntax.create1(), false); - }; - - InterfaceDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - InterfaceDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - InterfaceDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.interfaceKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - InterfaceDeclarationSyntax.prototype.withInterfaceKeyword = function (interfaceKeyword) { - return this.update(this.modifiers, interfaceKeyword, this.identifier, this.typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.interfaceKeyword, identifier, this.typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(this.modifiers, this.interfaceKeyword, this.identifier, typeParameterList, this.heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withHeritageClauses = function (heritageClauses) { - return this.update(this.modifiers, this.interfaceKeyword, this.identifier, this.typeParameterList, heritageClauses, this.body); - }; - - InterfaceDeclarationSyntax.prototype.withHeritageClause = function (heritageClause) { - return this.withHeritageClauses(TypeScript.Syntax.list([heritageClause])); - }; - - InterfaceDeclarationSyntax.prototype.withBody = function (body) { - return this.update(this.modifiers, this.interfaceKeyword, this.identifier, this.typeParameterList, this.heritageClauses, body); - }; - - InterfaceDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return InterfaceDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.InterfaceDeclarationSyntax = InterfaceDeclarationSyntax; - - var HeritageClauseSyntax = (function (_super) { - __extends(HeritageClauseSyntax, _super); - function HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.extendsOrImplementsKeyword = extendsOrImplementsKeyword; - this.typeNames = typeNames; - - this._kind = kind; - } - HeritageClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitHeritageClause(this); - }; - - HeritageClauseSyntax.prototype.childCount = function () { - return 2; - }; - - HeritageClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.extendsOrImplementsKeyword; - case 1: - return this.typeNames; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - HeritageClauseSyntax.prototype.kind = function () { - return this._kind; - }; - - HeritageClauseSyntax.prototype.update = function (kind, extendsOrImplementsKeyword, typeNames) { - if (this._kind === kind && this.extendsOrImplementsKeyword === extendsOrImplementsKeyword && this.typeNames === typeNames) { - return this; - } - - return new HeritageClauseSyntax(kind, extendsOrImplementsKeyword, typeNames, this.parsedInStrictMode()); - }; - - HeritageClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - HeritageClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - HeritageClauseSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.extendsOrImplementsKeyword, this.typeNames); - }; - - HeritageClauseSyntax.prototype.withExtendsOrImplementsKeyword = function (extendsOrImplementsKeyword) { - return this.update(this._kind, extendsOrImplementsKeyword, this.typeNames); - }; - - HeritageClauseSyntax.prototype.withTypeNames = function (typeNames) { - return this.update(this._kind, this.extendsOrImplementsKeyword, typeNames); - }; - - HeritageClauseSyntax.prototype.withTypeName = function (typeName) { - return this.withTypeNames(TypeScript.Syntax.separatedList([typeName])); - }; - - HeritageClauseSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return HeritageClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.HeritageClauseSyntax = HeritageClauseSyntax; - - var ModuleDeclarationSyntax = (function (_super) { - __extends(ModuleDeclarationSyntax, _super); - function ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.moduleKeyword = moduleKeyword; - this.name = name; - this.stringLiteral = stringLiteral; - this.openBraceToken = openBraceToken; - this.moduleElements = moduleElements; - this.closeBraceToken = closeBraceToken; - } - ModuleDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitModuleDeclaration(this); - }; - - ModuleDeclarationSyntax.prototype.kind = function () { - return 130 /* ModuleDeclaration */; - }; - - ModuleDeclarationSyntax.prototype.childCount = function () { - return 7; - }; - - ModuleDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.moduleKeyword; - case 2: - return this.name; - case 3: - return this.stringLiteral; - case 4: - return this.openBraceToken; - case 5: - return this.moduleElements; - case 6: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ModuleDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - ModuleDeclarationSyntax.prototype.update = function (modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - if (this.modifiers === modifiers && this.moduleKeyword === moduleKeyword && this.name === name && this.stringLiteral === stringLiteral && this.openBraceToken === openBraceToken && this.moduleElements === moduleElements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ModuleDeclarationSyntax(modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken, this.parsedInStrictMode()); - }; - - ModuleDeclarationSyntax.create = function (moduleKeyword, openBraceToken, closeBraceToken) { - return new ModuleDeclarationSyntax(TypeScript.Syntax.emptyList, moduleKeyword, null, null, openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - ModuleDeclarationSyntax.create1 = function () { - return new ModuleDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(65 /* ModuleKeyword */), null, null, TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ModuleDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ModuleDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ModuleDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ModuleDeclarationSyntax.prototype.withModuleKeyword = function (moduleKeyword) { - return this.update(this.modifiers, moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withName = function (name) { - return this.update(this.modifiers, this.moduleKeyword, name, this.stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withStringLiteral = function (stringLiteral) { - return this.update(this.modifiers, this.moduleKeyword, this.name, stringLiteral, this.openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.modifiers, this.moduleKeyword, this.name, this.stringLiteral, openBraceToken, this.moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withModuleElements = function (moduleElements) { - return this.update(this.modifiers, this.moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, moduleElements, this.closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.withModuleElement = function (moduleElement) { - return this.withModuleElements(TypeScript.Syntax.list([moduleElement])); - }; - - ModuleDeclarationSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.modifiers, this.moduleKeyword, this.name, this.stringLiteral, this.openBraceToken, this.moduleElements, closeBraceToken); - }; - - ModuleDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ModuleDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ModuleDeclarationSyntax = ModuleDeclarationSyntax; - - var FunctionDeclarationSyntax = (function (_super) { - __extends(FunctionDeclarationSyntax, _super); - function FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.functionKeyword = functionKeyword; - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - this.semicolonToken = semicolonToken; - } - FunctionDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionDeclaration(this); - }; - - FunctionDeclarationSyntax.prototype.kind = function () { - return 129 /* FunctionDeclaration */; - }; - - FunctionDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - FunctionDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.functionKeyword; - case 2: - return this.identifier; - case 3: - return this.callSignature; - case 4: - return this.block; - case 5: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionDeclarationSyntax.prototype.isStatement = function () { - return true; - }; - - FunctionDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - FunctionDeclarationSyntax.prototype.update = function (modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - if (this.modifiers === modifiers && this.functionKeyword === functionKeyword && this.identifier === identifier && this.callSignature === callSignature && this.block === block && this.semicolonToken === semicolonToken) { - return this; - } - - return new FunctionDeclarationSyntax(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken, this.parsedInStrictMode()); - }; - - FunctionDeclarationSyntax.create = function (functionKeyword, identifier, callSignature) { - return new FunctionDeclarationSyntax(TypeScript.Syntax.emptyList, functionKeyword, identifier, callSignature, null, null, false); - }; - - FunctionDeclarationSyntax.create1 = function (identifier) { - return new FunctionDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(27 /* FunctionKeyword */), identifier, CallSignatureSyntax.create1(), null, null, false); - }; - - FunctionDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.functionKeyword, this.identifier, this.callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - FunctionDeclarationSyntax.prototype.withFunctionKeyword = function (functionKeyword) { - return this.update(this.modifiers, functionKeyword, this.identifier, this.callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.functionKeyword, identifier, this.callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.modifiers, this.functionKeyword, this.identifier, callSignature, this.block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.functionKeyword, this.identifier, this.callSignature, block, this.semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.functionKeyword, this.identifier, this.callSignature, this.block, semicolonToken); - }; - - FunctionDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - if (this.modifiers.childCount() > 0) { - return true; - } - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - if (this.block !== null && this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FunctionDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionDeclarationSyntax = FunctionDeclarationSyntax; - - var VariableStatementSyntax = (function (_super) { - __extends(VariableStatementSyntax, _super); - function VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.variableDeclaration = variableDeclaration; - this.semicolonToken = semicolonToken; - } - VariableStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitVariableStatement(this); - }; - - VariableStatementSyntax.prototype.kind = function () { - return 148 /* VariableStatement */; - }; - - VariableStatementSyntax.prototype.childCount = function () { - return 3; - }; - - VariableStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.variableDeclaration; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VariableStatementSyntax.prototype.isStatement = function () { - return true; - }; - - VariableStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - VariableStatementSyntax.prototype.update = function (modifiers, variableDeclaration, semicolonToken) { - if (this.modifiers === modifiers && this.variableDeclaration === variableDeclaration && this.semicolonToken === semicolonToken) { - return this; - } - - return new VariableStatementSyntax(modifiers, variableDeclaration, semicolonToken, this.parsedInStrictMode()); - }; - - VariableStatementSyntax.create = function (variableDeclaration, semicolonToken) { - return new VariableStatementSyntax(TypeScript.Syntax.emptyList, variableDeclaration, semicolonToken, false); - }; - - VariableStatementSyntax.create1 = function (variableDeclaration) { - return new VariableStatementSyntax(TypeScript.Syntax.emptyList, variableDeclaration, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - VariableStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VariableStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VariableStatementSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.variableDeclaration, this.semicolonToken); - }; - - VariableStatementSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - VariableStatementSyntax.prototype.withVariableDeclaration = function (variableDeclaration) { - return this.update(this.modifiers, variableDeclaration, this.semicolonToken); - }; - - VariableStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.variableDeclaration, semicolonToken); - }; - - VariableStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.modifiers.childCount() > 0) { - return true; - } - if (this.variableDeclaration.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VariableStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VariableStatementSyntax = VariableStatementSyntax; - - var VariableDeclarationSyntax = (function (_super) { - __extends(VariableDeclarationSyntax, _super); - function VariableDeclarationSyntax(varKeyword, variableDeclarators, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.varKeyword = varKeyword; - this.variableDeclarators = variableDeclarators; - } - VariableDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitVariableDeclaration(this); - }; - - VariableDeclarationSyntax.prototype.kind = function () { - return 224 /* VariableDeclaration */; - }; - - VariableDeclarationSyntax.prototype.childCount = function () { - return 2; - }; - - VariableDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.varKeyword; - case 1: - return this.variableDeclarators; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VariableDeclarationSyntax.prototype.update = function (varKeyword, variableDeclarators) { - if (this.varKeyword === varKeyword && this.variableDeclarators === variableDeclarators) { - return this; - } - - return new VariableDeclarationSyntax(varKeyword, variableDeclarators, this.parsedInStrictMode()); - }; - - VariableDeclarationSyntax.create1 = function (variableDeclarators) { - return new VariableDeclarationSyntax(TypeScript.Syntax.token(40 /* VarKeyword */), variableDeclarators, false); - }; - - VariableDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VariableDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VariableDeclarationSyntax.prototype.withVarKeyword = function (varKeyword) { - return this.update(varKeyword, this.variableDeclarators); - }; - - VariableDeclarationSyntax.prototype.withVariableDeclarators = function (variableDeclarators) { - return this.update(this.varKeyword, variableDeclarators); - }; - - VariableDeclarationSyntax.prototype.withVariableDeclarator = function (variableDeclarator) { - return this.withVariableDeclarators(TypeScript.Syntax.separatedList([variableDeclarator])); - }; - - VariableDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - if (this.variableDeclarators.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VariableDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VariableDeclarationSyntax = VariableDeclarationSyntax; - - var VariableDeclaratorSyntax = (function (_super) { - __extends(VariableDeclaratorSyntax, _super); - function VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - } - VariableDeclaratorSyntax.prototype.accept = function (visitor) { - return visitor.visitVariableDeclarator(this); - }; - - VariableDeclaratorSyntax.prototype.kind = function () { - return 225 /* VariableDeclarator */; - }; - - VariableDeclaratorSyntax.prototype.childCount = function () { - return 3; - }; - - VariableDeclaratorSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.typeAnnotation; - case 2: - return this.equalsValueClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VariableDeclaratorSyntax.prototype.update = function (propertyName, typeAnnotation, equalsValueClause) { - if (this.propertyName === propertyName && this.typeAnnotation === typeAnnotation && this.equalsValueClause === equalsValueClause) { - return this; - } - - return new VariableDeclaratorSyntax(propertyName, typeAnnotation, equalsValueClause, this.parsedInStrictMode()); - }; - - VariableDeclaratorSyntax.create = function (propertyName) { - return new VariableDeclaratorSyntax(propertyName, null, null, false); - }; - - VariableDeclaratorSyntax.create1 = function (propertyName) { - return new VariableDeclaratorSyntax(propertyName, null, null, false); - }; - - VariableDeclaratorSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VariableDeclaratorSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VariableDeclaratorSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.typeAnnotation, this.equalsValueClause); - }; - - VariableDeclaratorSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.propertyName, typeAnnotation, this.equalsValueClause); - }; - - VariableDeclaratorSyntax.prototype.withEqualsValueClause = function (equalsValueClause) { - return this.update(this.propertyName, this.typeAnnotation, equalsValueClause); - }; - - VariableDeclaratorSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeAnnotation !== null) { - return true; - } - if (this.equalsValueClause !== null && this.equalsValueClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VariableDeclaratorSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VariableDeclaratorSyntax = VariableDeclaratorSyntax; - - var EqualsValueClauseSyntax = (function (_super) { - __extends(EqualsValueClauseSyntax, _super); - function EqualsValueClauseSyntax(equalsToken, value, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.equalsToken = equalsToken; - this.value = value; - } - EqualsValueClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitEqualsValueClause(this); - }; - - EqualsValueClauseSyntax.prototype.kind = function () { - return 232 /* EqualsValueClause */; - }; - - EqualsValueClauseSyntax.prototype.childCount = function () { - return 2; - }; - - EqualsValueClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.equalsToken; - case 1: - return this.value; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EqualsValueClauseSyntax.prototype.update = function (equalsToken, value) { - if (this.equalsToken === equalsToken && this.value === value) { - return this; - } - - return new EqualsValueClauseSyntax(equalsToken, value, this.parsedInStrictMode()); - }; - - EqualsValueClauseSyntax.create1 = function (value) { - return new EqualsValueClauseSyntax(TypeScript.Syntax.token(107 /* EqualsToken */), value, false); - }; - - EqualsValueClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EqualsValueClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EqualsValueClauseSyntax.prototype.withEqualsToken = function (equalsToken) { - return this.update(equalsToken, this.value); - }; - - EqualsValueClauseSyntax.prototype.withValue = function (value) { - return this.update(this.equalsToken, value); - }; - - EqualsValueClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.value.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return EqualsValueClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EqualsValueClauseSyntax = EqualsValueClauseSyntax; - - var PrefixUnaryExpressionSyntax = (function (_super) { - __extends(PrefixUnaryExpressionSyntax, _super); - function PrefixUnaryExpressionSyntax(kind, operatorToken, operand, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.operatorToken = operatorToken; - this.operand = operand; - - this._kind = kind; - } - PrefixUnaryExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitPrefixUnaryExpression(this); - }; - - PrefixUnaryExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - PrefixUnaryExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.operatorToken; - case 1: - return this.operand; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - PrefixUnaryExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - PrefixUnaryExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - PrefixUnaryExpressionSyntax.prototype.kind = function () { - return this._kind; - }; - - PrefixUnaryExpressionSyntax.prototype.update = function (kind, operatorToken, operand) { - if (this._kind === kind && this.operatorToken === operatorToken && this.operand === operand) { - return this; - } - - return new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.parsedInStrictMode()); - }; - - PrefixUnaryExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - PrefixUnaryExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - PrefixUnaryExpressionSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.operatorToken, this.operand); - }; - - PrefixUnaryExpressionSyntax.prototype.withOperatorToken = function (operatorToken) { - return this.update(this._kind, operatorToken, this.operand); - }; - - PrefixUnaryExpressionSyntax.prototype.withOperand = function (operand) { - return this.update(this._kind, this.operatorToken, operand); - }; - - PrefixUnaryExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.operand.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return PrefixUnaryExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.PrefixUnaryExpressionSyntax = PrefixUnaryExpressionSyntax; - - var ArrayLiteralExpressionSyntax = (function (_super) { - __extends(ArrayLiteralExpressionSyntax, _super); - function ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBracketToken = openBracketToken; - this.expressions = expressions; - this.closeBracketToken = closeBracketToken; - } - ArrayLiteralExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitArrayLiteralExpression(this); - }; - - ArrayLiteralExpressionSyntax.prototype.kind = function () { - return 214 /* ArrayLiteralExpression */; - }; - - ArrayLiteralExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ArrayLiteralExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBracketToken; - case 1: - return this.expressions; - case 2: - return this.closeBracketToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ArrayLiteralExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ArrayLiteralExpressionSyntax.prototype.update = function (openBracketToken, expressions, closeBracketToken) { - if (this.openBracketToken === openBracketToken && this.expressions === expressions && this.closeBracketToken === closeBracketToken) { - return this; - } - - return new ArrayLiteralExpressionSyntax(openBracketToken, expressions, closeBracketToken, this.parsedInStrictMode()); - }; - - ArrayLiteralExpressionSyntax.create = function (openBracketToken, closeBracketToken) { - return new ArrayLiteralExpressionSyntax(openBracketToken, TypeScript.Syntax.emptySeparatedList, closeBracketToken, false); - }; - - ArrayLiteralExpressionSyntax.create1 = function () { - return new ArrayLiteralExpressionSyntax(TypeScript.Syntax.token(74 /* OpenBracketToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(75 /* CloseBracketToken */), false); - }; - - ArrayLiteralExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ArrayLiteralExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ArrayLiteralExpressionSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(openBracketToken, this.expressions, this.closeBracketToken); - }; - - ArrayLiteralExpressionSyntax.prototype.withExpressions = function (expressions) { - return this.update(this.openBracketToken, expressions, this.closeBracketToken); - }; - - ArrayLiteralExpressionSyntax.prototype.withExpression = function (expression) { - return this.withExpressions(TypeScript.Syntax.separatedList([expression])); - }; - - ArrayLiteralExpressionSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.openBracketToken, this.expressions, closeBracketToken); - }; - - ArrayLiteralExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expressions.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ArrayLiteralExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ArrayLiteralExpressionSyntax = ArrayLiteralExpressionSyntax; - - var OmittedExpressionSyntax = (function (_super) { - __extends(OmittedExpressionSyntax, _super); - function OmittedExpressionSyntax(parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - } - OmittedExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitOmittedExpression(this); - }; - - OmittedExpressionSyntax.prototype.kind = function () { - return 223 /* OmittedExpression */; - }; - - OmittedExpressionSyntax.prototype.childCount = function () { - return 0; - }; - - OmittedExpressionSyntax.prototype.childAt = function (slot) { - throw TypeScript.Errors.invalidOperation(); - }; - - OmittedExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - OmittedExpressionSyntax.prototype.update = function () { - return this; - }; - - OmittedExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - OmittedExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - OmittedExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return OmittedExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.OmittedExpressionSyntax = OmittedExpressionSyntax; - - var ParenthesizedExpressionSyntax = (function (_super) { - __extends(ParenthesizedExpressionSyntax, _super); - function ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openParenToken = openParenToken; - this.expression = expression; - this.closeParenToken = closeParenToken; - } - ParenthesizedExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitParenthesizedExpression(this); - }; - - ParenthesizedExpressionSyntax.prototype.kind = function () { - return 217 /* ParenthesizedExpression */; - }; - - ParenthesizedExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ParenthesizedExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openParenToken; - case 1: - return this.expression; - case 2: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParenthesizedExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ParenthesizedExpressionSyntax.prototype.update = function (openParenToken, expression, closeParenToken) { - if (this.openParenToken === openParenToken && this.expression === expression && this.closeParenToken === closeParenToken) { - return this; - } - - return new ParenthesizedExpressionSyntax(openParenToken, expression, closeParenToken, this.parsedInStrictMode()); - }; - - ParenthesizedExpressionSyntax.create1 = function (expression) { - return new ParenthesizedExpressionSyntax(TypeScript.Syntax.token(72 /* OpenParenToken */), expression, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ParenthesizedExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParenthesizedExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParenthesizedExpressionSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(openParenToken, this.expression, this.closeParenToken); - }; - - ParenthesizedExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.openParenToken, expression, this.closeParenToken); - }; - - ParenthesizedExpressionSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.openParenToken, this.expression, closeParenToken); - }; - - ParenthesizedExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ParenthesizedExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParenthesizedExpressionSyntax = ParenthesizedExpressionSyntax; - - var SimpleArrowFunctionExpressionSyntax = (function (_super) { - __extends(SimpleArrowFunctionExpressionSyntax, _super); - function SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.identifier = identifier; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.block = block; - this.expression = expression; - } - SimpleArrowFunctionExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitSimpleArrowFunctionExpression(this); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.kind = function () { - return 219 /* SimpleArrowFunctionExpression */; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.identifier; - case 1: - return this.equalsGreaterThanToken; - case 2: - return this.block; - case 3: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isArrowFunctionExpression = function () { - return true; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - SimpleArrowFunctionExpressionSyntax.prototype.update = function (identifier, equalsGreaterThanToken, block, expression) { - if (this.identifier === identifier && this.equalsGreaterThanToken === equalsGreaterThanToken && this.block === block && this.expression === expression) { - return this; - } - - return new SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, block, expression, this.parsedInStrictMode()); - }; - - SimpleArrowFunctionExpressionSyntax.create = function (identifier, equalsGreaterThanToken) { - return new SimpleArrowFunctionExpressionSyntax(identifier, equalsGreaterThanToken, null, null, false); - }; - - SimpleArrowFunctionExpressionSyntax.create1 = function (identifier) { - return new SimpleArrowFunctionExpressionSyntax(identifier, TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), null, null, false); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withIdentifier = function (identifier) { - return this.update(identifier, this.equalsGreaterThanToken, this.block, this.expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.identifier, equalsGreaterThanToken, this.block, this.expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withBlock = function (block) { - return this.update(this.identifier, this.equalsGreaterThanToken, block, this.expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.identifier, this.equalsGreaterThanToken, this.block, expression); - }; - - SimpleArrowFunctionExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return SimpleArrowFunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SimpleArrowFunctionExpressionSyntax = SimpleArrowFunctionExpressionSyntax; - - var ParenthesizedArrowFunctionExpressionSyntax = (function (_super) { - __extends(ParenthesizedArrowFunctionExpressionSyntax, _super); - function ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.callSignature = callSignature; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.block = block; - this.expression = expression; - } - ParenthesizedArrowFunctionExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitParenthesizedArrowFunctionExpression(this); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.kind = function () { - return 218 /* ParenthesizedArrowFunctionExpression */; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.callSignature; - case 1: - return this.equalsGreaterThanToken; - case 2: - return this.block; - case 3: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isArrowFunctionExpression = function () { - return true; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.update = function (callSignature, equalsGreaterThanToken, block, expression) { - if (this.callSignature === callSignature && this.equalsGreaterThanToken === equalsGreaterThanToken && this.block === block && this.expression === expression) { - return this; - } - - return new ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, block, expression, this.parsedInStrictMode()); - }; - - ParenthesizedArrowFunctionExpressionSyntax.create = function (callSignature, equalsGreaterThanToken) { - return new ParenthesizedArrowFunctionExpressionSyntax(callSignature, equalsGreaterThanToken, null, null, false); - }; - - ParenthesizedArrowFunctionExpressionSyntax.create1 = function () { - return new ParenthesizedArrowFunctionExpressionSyntax(CallSignatureSyntax.create1(), TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), null, null, false); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(callSignature, this.equalsGreaterThanToken, this.block, this.expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.callSignature, equalsGreaterThanToken, this.block, this.expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withBlock = function (block) { - return this.update(this.callSignature, this.equalsGreaterThanToken, block, this.expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.callSignature, this.equalsGreaterThanToken, this.block, expression); - }; - - ParenthesizedArrowFunctionExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ParenthesizedArrowFunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParenthesizedArrowFunctionExpressionSyntax = ParenthesizedArrowFunctionExpressionSyntax; - - var QualifiedNameSyntax = (function (_super) { - __extends(QualifiedNameSyntax, _super); - function QualifiedNameSyntax(left, dotToken, right, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.left = left; - this.dotToken = dotToken; - this.right = right; - } - QualifiedNameSyntax.prototype.accept = function (visitor) { - return visitor.visitQualifiedName(this); - }; - - QualifiedNameSyntax.prototype.kind = function () { - return 121 /* QualifiedName */; - }; - - QualifiedNameSyntax.prototype.childCount = function () { - return 3; - }; - - QualifiedNameSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.left; - case 1: - return this.dotToken; - case 2: - return this.right; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - QualifiedNameSyntax.prototype.isName = function () { - return true; - }; - - QualifiedNameSyntax.prototype.isType = function () { - return true; - }; - - QualifiedNameSyntax.prototype.update = function (left, dotToken, right) { - if (this.left === left && this.dotToken === dotToken && this.right === right) { - return this; - } - - return new QualifiedNameSyntax(left, dotToken, right, this.parsedInStrictMode()); - }; - - QualifiedNameSyntax.create1 = function (left, right) { - return new QualifiedNameSyntax(left, TypeScript.Syntax.token(76 /* DotToken */), right, false); - }; - - QualifiedNameSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - QualifiedNameSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - QualifiedNameSyntax.prototype.withLeft = function (left) { - return this.update(left, this.dotToken, this.right); - }; - - QualifiedNameSyntax.prototype.withDotToken = function (dotToken) { - return this.update(this.left, dotToken, this.right); - }; - - QualifiedNameSyntax.prototype.withRight = function (right) { - return this.update(this.left, this.dotToken, right); - }; - - QualifiedNameSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return QualifiedNameSyntax; - })(TypeScript.SyntaxNode); - TypeScript.QualifiedNameSyntax = QualifiedNameSyntax; - - var TypeArgumentListSyntax = (function (_super) { - __extends(TypeArgumentListSyntax, _super); - function TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.lessThanToken = lessThanToken; - this.typeArguments = typeArguments; - this.greaterThanToken = greaterThanToken; - } - TypeArgumentListSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeArgumentList(this); - }; - - TypeArgumentListSyntax.prototype.kind = function () { - return 228 /* TypeArgumentList */; - }; - - TypeArgumentListSyntax.prototype.childCount = function () { - return 3; - }; - - TypeArgumentListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.lessThanToken; - case 1: - return this.typeArguments; - case 2: - return this.greaterThanToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeArgumentListSyntax.prototype.update = function (lessThanToken, typeArguments, greaterThanToken) { - if (this.lessThanToken === lessThanToken && this.typeArguments === typeArguments && this.greaterThanToken === greaterThanToken) { - return this; - } - - return new TypeArgumentListSyntax(lessThanToken, typeArguments, greaterThanToken, this.parsedInStrictMode()); - }; - - TypeArgumentListSyntax.create = function (lessThanToken, greaterThanToken) { - return new TypeArgumentListSyntax(lessThanToken, TypeScript.Syntax.emptySeparatedList, greaterThanToken, false); - }; - - TypeArgumentListSyntax.create1 = function () { - return new TypeArgumentListSyntax(TypeScript.Syntax.token(80 /* LessThanToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(81 /* GreaterThanToken */), false); - }; - - TypeArgumentListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeArgumentListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeArgumentListSyntax.prototype.withLessThanToken = function (lessThanToken) { - return this.update(lessThanToken, this.typeArguments, this.greaterThanToken); - }; - - TypeArgumentListSyntax.prototype.withTypeArguments = function (typeArguments) { - return this.update(this.lessThanToken, typeArguments, this.greaterThanToken); - }; - - TypeArgumentListSyntax.prototype.withTypeArgument = function (typeArgument) { - return this.withTypeArguments(TypeScript.Syntax.separatedList([typeArgument])); - }; - - TypeArgumentListSyntax.prototype.withGreaterThanToken = function (greaterThanToken) { - return this.update(this.lessThanToken, this.typeArguments, greaterThanToken); - }; - - TypeArgumentListSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeArgumentListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeArgumentListSyntax = TypeArgumentListSyntax; - - var ConstructorTypeSyntax = (function (_super) { - __extends(ConstructorTypeSyntax, _super); - function ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.newKeyword = newKeyword; - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.type = type; - } - ConstructorTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitConstructorType(this); - }; - - ConstructorTypeSyntax.prototype.kind = function () { - return 125 /* ConstructorType */; - }; - - ConstructorTypeSyntax.prototype.childCount = function () { - return 5; - }; - - ConstructorTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.newKeyword; - case 1: - return this.typeParameterList; - case 2: - return this.parameterList; - case 3: - return this.equalsGreaterThanToken; - case 4: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstructorTypeSyntax.prototype.isType = function () { - return true; - }; - - ConstructorTypeSyntax.prototype.update = function (newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - if (this.newKeyword === newKeyword && this.typeParameterList === typeParameterList && this.parameterList === parameterList && this.equalsGreaterThanToken === equalsGreaterThanToken && this.type === type) { - return this; - } - - return new ConstructorTypeSyntax(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type, this.parsedInStrictMode()); - }; - - ConstructorTypeSyntax.create = function (newKeyword, parameterList, equalsGreaterThanToken, type) { - return new ConstructorTypeSyntax(newKeyword, null, parameterList, equalsGreaterThanToken, type, false); - }; - - ConstructorTypeSyntax.create1 = function (type) { - return new ConstructorTypeSyntax(TypeScript.Syntax.token(31 /* NewKeyword */), null, ParameterListSyntax.create1(), TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), type, false); - }; - - ConstructorTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstructorTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstructorTypeSyntax.prototype.withNewKeyword = function (newKeyword) { - return this.update(newKeyword, this.typeParameterList, this.parameterList, this.equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(this.newKeyword, typeParameterList, this.parameterList, this.equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.newKeyword, this.typeParameterList, parameterList, this.equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.newKeyword, this.typeParameterList, this.parameterList, equalsGreaterThanToken, this.type); - }; - - ConstructorTypeSyntax.prototype.withType = function (type) { - return this.update(this.newKeyword, this.typeParameterList, this.parameterList, this.equalsGreaterThanToken, type); - }; - - ConstructorTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstructorTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstructorTypeSyntax = ConstructorTypeSyntax; - - var FunctionTypeSyntax = (function (_super) { - __extends(FunctionTypeSyntax, _super); - function FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.type = type; - } - FunctionTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionType(this); - }; - - FunctionTypeSyntax.prototype.kind = function () { - return 123 /* FunctionType */; - }; - - FunctionTypeSyntax.prototype.childCount = function () { - return 4; - }; - - FunctionTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeParameterList; - case 1: - return this.parameterList; - case 2: - return this.equalsGreaterThanToken; - case 3: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionTypeSyntax.prototype.isType = function () { - return true; - }; - - FunctionTypeSyntax.prototype.update = function (typeParameterList, parameterList, equalsGreaterThanToken, type) { - if (this.typeParameterList === typeParameterList && this.parameterList === parameterList && this.equalsGreaterThanToken === equalsGreaterThanToken && this.type === type) { - return this; - } - - return new FunctionTypeSyntax(typeParameterList, parameterList, equalsGreaterThanToken, type, this.parsedInStrictMode()); - }; - - FunctionTypeSyntax.create = function (parameterList, equalsGreaterThanToken, type) { - return new FunctionTypeSyntax(null, parameterList, equalsGreaterThanToken, type, false); - }; - - FunctionTypeSyntax.create1 = function (type) { - return new FunctionTypeSyntax(null, ParameterListSyntax.create1(), TypeScript.Syntax.token(85 /* EqualsGreaterThanToken */), type, false); - }; - - FunctionTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionTypeSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(typeParameterList, this.parameterList, this.equalsGreaterThanToken, this.type); - }; - - FunctionTypeSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.typeParameterList, parameterList, this.equalsGreaterThanToken, this.type); - }; - - FunctionTypeSyntax.prototype.withEqualsGreaterThanToken = function (equalsGreaterThanToken) { - return this.update(this.typeParameterList, this.parameterList, equalsGreaterThanToken, this.type); - }; - - FunctionTypeSyntax.prototype.withType = function (type) { - return this.update(this.typeParameterList, this.parameterList, this.equalsGreaterThanToken, type); - }; - - FunctionTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return FunctionTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionTypeSyntax = FunctionTypeSyntax; - - var ObjectTypeSyntax = (function (_super) { - __extends(ObjectTypeSyntax, _super); - function ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBraceToken = openBraceToken; - this.typeMembers = typeMembers; - this.closeBraceToken = closeBraceToken; - } - ObjectTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitObjectType(this); - }; - - ObjectTypeSyntax.prototype.kind = function () { - return 122 /* ObjectType */; - }; - - ObjectTypeSyntax.prototype.childCount = function () { - return 3; - }; - - ObjectTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBraceToken; - case 1: - return this.typeMembers; - case 2: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ObjectTypeSyntax.prototype.isType = function () { - return true; - }; - - ObjectTypeSyntax.prototype.update = function (openBraceToken, typeMembers, closeBraceToken) { - if (this.openBraceToken === openBraceToken && this.typeMembers === typeMembers && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ObjectTypeSyntax(openBraceToken, typeMembers, closeBraceToken, this.parsedInStrictMode()); - }; - - ObjectTypeSyntax.create = function (openBraceToken, closeBraceToken) { - return new ObjectTypeSyntax(openBraceToken, TypeScript.Syntax.emptySeparatedList, closeBraceToken, false); - }; - - ObjectTypeSyntax.create1 = function () { - return new ObjectTypeSyntax(TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ObjectTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ObjectTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ObjectTypeSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(openBraceToken, this.typeMembers, this.closeBraceToken); - }; - - ObjectTypeSyntax.prototype.withTypeMembers = function (typeMembers) { - return this.update(this.openBraceToken, typeMembers, this.closeBraceToken); - }; - - ObjectTypeSyntax.prototype.withTypeMember = function (typeMember) { - return this.withTypeMembers(TypeScript.Syntax.separatedList([typeMember])); - }; - - ObjectTypeSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.openBraceToken, this.typeMembers, closeBraceToken); - }; - - ObjectTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ObjectTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ObjectTypeSyntax = ObjectTypeSyntax; - - var ArrayTypeSyntax = (function (_super) { - __extends(ArrayTypeSyntax, _super); - function ArrayTypeSyntax(type, openBracketToken, closeBracketToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.type = type; - this.openBracketToken = openBracketToken; - this.closeBracketToken = closeBracketToken; - } - ArrayTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitArrayType(this); - }; - - ArrayTypeSyntax.prototype.kind = function () { - return 124 /* ArrayType */; - }; - - ArrayTypeSyntax.prototype.childCount = function () { - return 3; - }; - - ArrayTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.type; - case 1: - return this.openBracketToken; - case 2: - return this.closeBracketToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ArrayTypeSyntax.prototype.isType = function () { - return true; - }; - - ArrayTypeSyntax.prototype.update = function (type, openBracketToken, closeBracketToken) { - if (this.type === type && this.openBracketToken === openBracketToken && this.closeBracketToken === closeBracketToken) { - return this; - } - - return new ArrayTypeSyntax(type, openBracketToken, closeBracketToken, this.parsedInStrictMode()); - }; - - ArrayTypeSyntax.create1 = function (type) { - return new ArrayTypeSyntax(type, TypeScript.Syntax.token(74 /* OpenBracketToken */), TypeScript.Syntax.token(75 /* CloseBracketToken */), false); - }; - - ArrayTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ArrayTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ArrayTypeSyntax.prototype.withType = function (type) { - return this.update(type, this.openBracketToken, this.closeBracketToken); - }; - - ArrayTypeSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(this.type, openBracketToken, this.closeBracketToken); - }; - - ArrayTypeSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.type, this.openBracketToken, closeBracketToken); - }; - - ArrayTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ArrayTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ArrayTypeSyntax = ArrayTypeSyntax; - - var GenericTypeSyntax = (function (_super) { - __extends(GenericTypeSyntax, _super); - function GenericTypeSyntax(name, typeArgumentList, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.name = name; - this.typeArgumentList = typeArgumentList; - } - GenericTypeSyntax.prototype.accept = function (visitor) { - return visitor.visitGenericType(this); - }; - - GenericTypeSyntax.prototype.kind = function () { - return 126 /* GenericType */; - }; - - GenericTypeSyntax.prototype.childCount = function () { - return 2; - }; - - GenericTypeSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.name; - case 1: - return this.typeArgumentList; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - GenericTypeSyntax.prototype.isType = function () { - return true; - }; - - GenericTypeSyntax.prototype.update = function (name, typeArgumentList) { - if (this.name === name && this.typeArgumentList === typeArgumentList) { - return this; - } - - return new GenericTypeSyntax(name, typeArgumentList, this.parsedInStrictMode()); - }; - - GenericTypeSyntax.create1 = function (name) { - return new GenericTypeSyntax(name, TypeArgumentListSyntax.create1(), false); - }; - - GenericTypeSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - GenericTypeSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - GenericTypeSyntax.prototype.withName = function (name) { - return this.update(name, this.typeArgumentList); - }; - - GenericTypeSyntax.prototype.withTypeArgumentList = function (typeArgumentList) { - return this.update(this.name, typeArgumentList); - }; - - GenericTypeSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return GenericTypeSyntax; - })(TypeScript.SyntaxNode); - TypeScript.GenericTypeSyntax = GenericTypeSyntax; - - var TypeQuerySyntax = (function (_super) { - __extends(TypeQuerySyntax, _super); - function TypeQuerySyntax(typeOfKeyword, name, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeOfKeyword = typeOfKeyword; - this.name = name; - } - TypeQuerySyntax.prototype.accept = function (visitor) { - return visitor.visitTypeQuery(this); - }; - - TypeQuerySyntax.prototype.kind = function () { - return 127 /* TypeQuery */; - }; - - TypeQuerySyntax.prototype.childCount = function () { - return 2; - }; - - TypeQuerySyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeOfKeyword; - case 1: - return this.name; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeQuerySyntax.prototype.isType = function () { - return true; - }; - - TypeQuerySyntax.prototype.update = function (typeOfKeyword, name) { - if (this.typeOfKeyword === typeOfKeyword && this.name === name) { - return this; - } - - return new TypeQuerySyntax(typeOfKeyword, name, this.parsedInStrictMode()); - }; - - TypeQuerySyntax.create1 = function (name) { - return new TypeQuerySyntax(TypeScript.Syntax.token(39 /* TypeOfKeyword */), name, false); - }; - - TypeQuerySyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeQuerySyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeQuerySyntax.prototype.withTypeOfKeyword = function (typeOfKeyword) { - return this.update(typeOfKeyword, this.name); - }; - - TypeQuerySyntax.prototype.withName = function (name) { - return this.update(this.typeOfKeyword, name); - }; - - TypeQuerySyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeQuerySyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeQuerySyntax = TypeQuerySyntax; - - var TypeAnnotationSyntax = (function (_super) { - __extends(TypeAnnotationSyntax, _super); - function TypeAnnotationSyntax(colonToken, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.colonToken = colonToken; - this.type = type; - } - TypeAnnotationSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeAnnotation(this); - }; - - TypeAnnotationSyntax.prototype.kind = function () { - return 244 /* TypeAnnotation */; - }; - - TypeAnnotationSyntax.prototype.childCount = function () { - return 2; - }; - - TypeAnnotationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.colonToken; - case 1: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeAnnotationSyntax.prototype.update = function (colonToken, type) { - if (this.colonToken === colonToken && this.type === type) { - return this; - } - - return new TypeAnnotationSyntax(colonToken, type, this.parsedInStrictMode()); - }; - - TypeAnnotationSyntax.create1 = function (type) { - return new TypeAnnotationSyntax(TypeScript.Syntax.token(106 /* ColonToken */), type, false); - }; - - TypeAnnotationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeAnnotationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeAnnotationSyntax.prototype.withColonToken = function (colonToken) { - return this.update(colonToken, this.type); - }; - - TypeAnnotationSyntax.prototype.withType = function (type) { - return this.update(this.colonToken, type); - }; - - TypeAnnotationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeAnnotationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeAnnotationSyntax = TypeAnnotationSyntax; - - var BlockSyntax = (function (_super) { - __extends(BlockSyntax, _super); - function BlockSyntax(openBraceToken, statements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBraceToken = openBraceToken; - this.statements = statements; - this.closeBraceToken = closeBraceToken; - } - BlockSyntax.prototype.accept = function (visitor) { - return visitor.visitBlock(this); - }; - - BlockSyntax.prototype.kind = function () { - return 146 /* Block */; - }; - - BlockSyntax.prototype.childCount = function () { - return 3; - }; - - BlockSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBraceToken; - case 1: - return this.statements; - case 2: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - BlockSyntax.prototype.isStatement = function () { - return true; - }; - - BlockSyntax.prototype.isModuleElement = function () { - return true; - }; - - BlockSyntax.prototype.update = function (openBraceToken, statements, closeBraceToken) { - if (this.openBraceToken === openBraceToken && this.statements === statements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new BlockSyntax(openBraceToken, statements, closeBraceToken, this.parsedInStrictMode()); - }; - - BlockSyntax.create = function (openBraceToken, closeBraceToken) { - return new BlockSyntax(openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - BlockSyntax.create1 = function () { - return new BlockSyntax(TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - BlockSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - BlockSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - BlockSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(openBraceToken, this.statements, this.closeBraceToken); - }; - - BlockSyntax.prototype.withStatements = function (statements) { - return this.update(this.openBraceToken, statements, this.closeBraceToken); - }; - - BlockSyntax.prototype.withStatement = function (statement) { - return this.withStatements(TypeScript.Syntax.list([statement])); - }; - - BlockSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.openBraceToken, this.statements, closeBraceToken); - }; - - BlockSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return BlockSyntax; - })(TypeScript.SyntaxNode); - TypeScript.BlockSyntax = BlockSyntax; - - var ParameterSyntax = (function (_super) { - __extends(ParameterSyntax, _super); - function ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.dotDotDotToken = dotDotDotToken; - this.modifiers = modifiers; - this.identifier = identifier; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - } - ParameterSyntax.prototype.accept = function (visitor) { - return visitor.visitParameter(this); - }; - - ParameterSyntax.prototype.kind = function () { - return 242 /* Parameter */; - }; - - ParameterSyntax.prototype.childCount = function () { - return 6; - }; - - ParameterSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.dotDotDotToken; - case 1: - return this.modifiers; - case 2: - return this.identifier; - case 3: - return this.questionToken; - case 4: - return this.typeAnnotation; - case 5: - return this.equalsValueClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParameterSyntax.prototype.update = function (dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - if (this.dotDotDotToken === dotDotDotToken && this.modifiers === modifiers && this.identifier === identifier && this.questionToken === questionToken && this.typeAnnotation === typeAnnotation && this.equalsValueClause === equalsValueClause) { - return this; - } - - return new ParameterSyntax(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause, this.parsedInStrictMode()); - }; - - ParameterSyntax.create = function (identifier) { - return new ParameterSyntax(null, TypeScript.Syntax.emptyList, identifier, null, null, null, false); - }; - - ParameterSyntax.create1 = function (identifier) { - return new ParameterSyntax(null, TypeScript.Syntax.emptyList, identifier, null, null, null, false); - }; - - ParameterSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParameterSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParameterSyntax.prototype.withDotDotDotToken = function (dotDotDotToken) { - return this.update(dotDotDotToken, this.modifiers, this.identifier, this.questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withModifiers = function (modifiers) { - return this.update(this.dotDotDotToken, modifiers, this.identifier, this.questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ParameterSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.dotDotDotToken, this.modifiers, identifier, this.questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.dotDotDotToken, this.modifiers, this.identifier, questionToken, this.typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.dotDotDotToken, this.modifiers, this.identifier, this.questionToken, typeAnnotation, this.equalsValueClause); - }; - - ParameterSyntax.prototype.withEqualsValueClause = function (equalsValueClause) { - return this.update(this.dotDotDotToken, this.modifiers, this.identifier, this.questionToken, this.typeAnnotation, equalsValueClause); - }; - - ParameterSyntax.prototype.isTypeScriptSpecific = function () { - if (this.dotDotDotToken !== null) { - return true; - } - if (this.modifiers.isTypeScriptSpecific()) { - return true; - } - if (this.questionToken !== null) { - return true; - } - if (this.typeAnnotation !== null) { - return true; - } - if (this.equalsValueClause !== null) { - return true; - } - return false; - }; - return ParameterSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParameterSyntax = ParameterSyntax; - - var MemberAccessExpressionSyntax = (function (_super) { - __extends(MemberAccessExpressionSyntax, _super); - function MemberAccessExpressionSyntax(expression, dotToken, name, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.dotToken = dotToken; - this.name = name; - } - MemberAccessExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitMemberAccessExpression(this); - }; - - MemberAccessExpressionSyntax.prototype.kind = function () { - return 212 /* MemberAccessExpression */; - }; - - MemberAccessExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - MemberAccessExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.dotToken; - case 2: - return this.name; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MemberAccessExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - MemberAccessExpressionSyntax.prototype.update = function (expression, dotToken, name) { - if (this.expression === expression && this.dotToken === dotToken && this.name === name) { - return this; - } - - return new MemberAccessExpressionSyntax(expression, dotToken, name, this.parsedInStrictMode()); - }; - - MemberAccessExpressionSyntax.create1 = function (expression, name) { - return new MemberAccessExpressionSyntax(expression, TypeScript.Syntax.token(76 /* DotToken */), name, false); - }; - - MemberAccessExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MemberAccessExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MemberAccessExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.dotToken, this.name); - }; - - MemberAccessExpressionSyntax.prototype.withDotToken = function (dotToken) { - return this.update(this.expression, dotToken, this.name); - }; - - MemberAccessExpressionSyntax.prototype.withName = function (name) { - return this.update(this.expression, this.dotToken, name); - }; - - MemberAccessExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return MemberAccessExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MemberAccessExpressionSyntax = MemberAccessExpressionSyntax; - - var PostfixUnaryExpressionSyntax = (function (_super) { - __extends(PostfixUnaryExpressionSyntax, _super); - function PostfixUnaryExpressionSyntax(kind, operand, operatorToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.operand = operand; - this.operatorToken = operatorToken; - - this._kind = kind; - } - PostfixUnaryExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitPostfixUnaryExpression(this); - }; - - PostfixUnaryExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - PostfixUnaryExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.operand; - case 1: - return this.operatorToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - PostfixUnaryExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - PostfixUnaryExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - PostfixUnaryExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - PostfixUnaryExpressionSyntax.prototype.kind = function () { - return this._kind; - }; - - PostfixUnaryExpressionSyntax.prototype.update = function (kind, operand, operatorToken) { - if (this._kind === kind && this.operand === operand && this.operatorToken === operatorToken) { - return this; - } - - return new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.parsedInStrictMode()); - }; - - PostfixUnaryExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - PostfixUnaryExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - PostfixUnaryExpressionSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.operand, this.operatorToken); - }; - - PostfixUnaryExpressionSyntax.prototype.withOperand = function (operand) { - return this.update(this._kind, operand, this.operatorToken); - }; - - PostfixUnaryExpressionSyntax.prototype.withOperatorToken = function (operatorToken) { - return this.update(this._kind, this.operand, operatorToken); - }; - - PostfixUnaryExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.operand.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return PostfixUnaryExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.PostfixUnaryExpressionSyntax = PostfixUnaryExpressionSyntax; - - var ElementAccessExpressionSyntax = (function (_super) { - __extends(ElementAccessExpressionSyntax, _super); - function ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.openBracketToken = openBracketToken; - this.argumentExpression = argumentExpression; - this.closeBracketToken = closeBracketToken; - } - ElementAccessExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitElementAccessExpression(this); - }; - - ElementAccessExpressionSyntax.prototype.kind = function () { - return 221 /* ElementAccessExpression */; - }; - - ElementAccessExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - ElementAccessExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.openBracketToken; - case 2: - return this.argumentExpression; - case 3: - return this.closeBracketToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ElementAccessExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ElementAccessExpressionSyntax.prototype.update = function (expression, openBracketToken, argumentExpression, closeBracketToken) { - if (this.expression === expression && this.openBracketToken === openBracketToken && this.argumentExpression === argumentExpression && this.closeBracketToken === closeBracketToken) { - return this; - } - - return new ElementAccessExpressionSyntax(expression, openBracketToken, argumentExpression, closeBracketToken, this.parsedInStrictMode()); - }; - - ElementAccessExpressionSyntax.create1 = function (expression, argumentExpression) { - return new ElementAccessExpressionSyntax(expression, TypeScript.Syntax.token(74 /* OpenBracketToken */), argumentExpression, TypeScript.Syntax.token(75 /* CloseBracketToken */), false); - }; - - ElementAccessExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ElementAccessExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ElementAccessExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.openBracketToken, this.argumentExpression, this.closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(this.expression, openBracketToken, this.argumentExpression, this.closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.withArgumentExpression = function (argumentExpression) { - return this.update(this.expression, this.openBracketToken, argumentExpression, this.closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.expression, this.openBracketToken, this.argumentExpression, closeBracketToken); - }; - - ElementAccessExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.argumentExpression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ElementAccessExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ElementAccessExpressionSyntax = ElementAccessExpressionSyntax; - - var InvocationExpressionSyntax = (function (_super) { - __extends(InvocationExpressionSyntax, _super); - function InvocationExpressionSyntax(expression, argumentList, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.argumentList = argumentList; - } - InvocationExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitInvocationExpression(this); - }; - - InvocationExpressionSyntax.prototype.kind = function () { - return 213 /* InvocationExpression */; - }; - - InvocationExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - InvocationExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.argumentList; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - InvocationExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - InvocationExpressionSyntax.prototype.update = function (expression, argumentList) { - if (this.expression === expression && this.argumentList === argumentList) { - return this; - } - - return new InvocationExpressionSyntax(expression, argumentList, this.parsedInStrictMode()); - }; - - InvocationExpressionSyntax.create1 = function (expression) { - return new InvocationExpressionSyntax(expression, ArgumentListSyntax.create1(), false); - }; - - InvocationExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - InvocationExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - InvocationExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.argumentList); - }; - - InvocationExpressionSyntax.prototype.withArgumentList = function (argumentList) { - return this.update(this.expression, argumentList); - }; - - InvocationExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.argumentList.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return InvocationExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.InvocationExpressionSyntax = InvocationExpressionSyntax; - - var ArgumentListSyntax = (function (_super) { - __extends(ArgumentListSyntax, _super); - function ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeArgumentList = typeArgumentList; - this.openParenToken = openParenToken; - this.closeParenToken = closeParenToken; - - this.arguments = _arguments; - } - ArgumentListSyntax.prototype.accept = function (visitor) { - return visitor.visitArgumentList(this); - }; - - ArgumentListSyntax.prototype.kind = function () { - return 226 /* ArgumentList */; - }; - - ArgumentListSyntax.prototype.childCount = function () { - return 4; - }; - - ArgumentListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeArgumentList; - case 1: - return this.openParenToken; - case 2: - return this.arguments; - case 3: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ArgumentListSyntax.prototype.update = function (typeArgumentList, openParenToken, _arguments, closeParenToken) { - if (this.typeArgumentList === typeArgumentList && this.openParenToken === openParenToken && this.arguments === _arguments && this.closeParenToken === closeParenToken) { - return this; - } - - return new ArgumentListSyntax(typeArgumentList, openParenToken, _arguments, closeParenToken, this.parsedInStrictMode()); - }; - - ArgumentListSyntax.create = function (openParenToken, closeParenToken) { - return new ArgumentListSyntax(null, openParenToken, TypeScript.Syntax.emptySeparatedList, closeParenToken, false); - }; - - ArgumentListSyntax.create1 = function () { - return new ArgumentListSyntax(null, TypeScript.Syntax.token(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ArgumentListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ArgumentListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ArgumentListSyntax.prototype.withTypeArgumentList = function (typeArgumentList) { - return this.update(typeArgumentList, this.openParenToken, this.arguments, this.closeParenToken); - }; - - ArgumentListSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.typeArgumentList, openParenToken, this.arguments, this.closeParenToken); - }; - - ArgumentListSyntax.prototype.withArguments = function (_arguments) { - return this.update(this.typeArgumentList, this.openParenToken, _arguments, this.closeParenToken); - }; - - ArgumentListSyntax.prototype.withArgument = function (_argument) { - return this.withArguments(TypeScript.Syntax.separatedList([_argument])); - }; - - ArgumentListSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.typeArgumentList, this.openParenToken, this.arguments, closeParenToken); - }; - - ArgumentListSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeArgumentList !== null && this.typeArgumentList.isTypeScriptSpecific()) { - return true; - } - if (this.arguments.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ArgumentListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ArgumentListSyntax = ArgumentListSyntax; - - var BinaryExpressionSyntax = (function (_super) { - __extends(BinaryExpressionSyntax, _super); - function BinaryExpressionSyntax(kind, left, operatorToken, right, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.left = left; - this.operatorToken = operatorToken; - this.right = right; - - this._kind = kind; - } - BinaryExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitBinaryExpression(this); - }; - - BinaryExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - BinaryExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.left; - case 1: - return this.operatorToken; - case 2: - return this.right; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - BinaryExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - BinaryExpressionSyntax.prototype.kind = function () { - return this._kind; - }; - - BinaryExpressionSyntax.prototype.update = function (kind, left, operatorToken, right) { - if (this._kind === kind && this.left === left && this.operatorToken === operatorToken && this.right === right) { - return this; - } - - return new BinaryExpressionSyntax(kind, left, operatorToken, right, this.parsedInStrictMode()); - }; - - BinaryExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - BinaryExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - BinaryExpressionSyntax.prototype.withKind = function (kind) { - return this.update(kind, this.left, this.operatorToken, this.right); - }; - - BinaryExpressionSyntax.prototype.withLeft = function (left) { - return this.update(this._kind, left, this.operatorToken, this.right); - }; - - BinaryExpressionSyntax.prototype.withOperatorToken = function (operatorToken) { - return this.update(this._kind, this.left, operatorToken, this.right); - }; - - BinaryExpressionSyntax.prototype.withRight = function (right) { - return this.update(this._kind, this.left, this.operatorToken, right); - }; - - BinaryExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.left.isTypeScriptSpecific()) { - return true; - } - if (this.right.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return BinaryExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.BinaryExpressionSyntax = BinaryExpressionSyntax; - - var ConditionalExpressionSyntax = (function (_super) { - __extends(ConditionalExpressionSyntax, _super); - function ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.condition = condition; - this.questionToken = questionToken; - this.whenTrue = whenTrue; - this.colonToken = colonToken; - this.whenFalse = whenFalse; - } - ConditionalExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitConditionalExpression(this); - }; - - ConditionalExpressionSyntax.prototype.kind = function () { - return 186 /* ConditionalExpression */; - }; - - ConditionalExpressionSyntax.prototype.childCount = function () { - return 5; - }; - - ConditionalExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.condition; - case 1: - return this.questionToken; - case 2: - return this.whenTrue; - case 3: - return this.colonToken; - case 4: - return this.whenFalse; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConditionalExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ConditionalExpressionSyntax.prototype.update = function (condition, questionToken, whenTrue, colonToken, whenFalse) { - if (this.condition === condition && this.questionToken === questionToken && this.whenTrue === whenTrue && this.colonToken === colonToken && this.whenFalse === whenFalse) { - return this; - } - - return new ConditionalExpressionSyntax(condition, questionToken, whenTrue, colonToken, whenFalse, this.parsedInStrictMode()); - }; - - ConditionalExpressionSyntax.create1 = function (condition, whenTrue, whenFalse) { - return new ConditionalExpressionSyntax(condition, TypeScript.Syntax.token(105 /* QuestionToken */), whenTrue, TypeScript.Syntax.token(106 /* ColonToken */), whenFalse, false); - }; - - ConditionalExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConditionalExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConditionalExpressionSyntax.prototype.withCondition = function (condition) { - return this.update(condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.condition, questionToken, this.whenTrue, this.colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withWhenTrue = function (whenTrue) { - return this.update(this.condition, this.questionToken, whenTrue, this.colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.condition, this.questionToken, this.whenTrue, colonToken, this.whenFalse); - }; - - ConditionalExpressionSyntax.prototype.withWhenFalse = function (whenFalse) { - return this.update(this.condition, this.questionToken, this.whenTrue, this.colonToken, whenFalse); - }; - - ConditionalExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.whenTrue.isTypeScriptSpecific()) { - return true; - } - if (this.whenFalse.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ConditionalExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConditionalExpressionSyntax = ConditionalExpressionSyntax; - - var ConstructSignatureSyntax = (function (_super) { - __extends(ConstructSignatureSyntax, _super); - function ConstructSignatureSyntax(newKeyword, callSignature, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.newKeyword = newKeyword; - this.callSignature = callSignature; - } - ConstructSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitConstructSignature(this); - }; - - ConstructSignatureSyntax.prototype.kind = function () { - return 143 /* ConstructSignature */; - }; - - ConstructSignatureSyntax.prototype.childCount = function () { - return 2; - }; - - ConstructSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.newKeyword; - case 1: - return this.callSignature; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstructSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - ConstructSignatureSyntax.prototype.update = function (newKeyword, callSignature) { - if (this.newKeyword === newKeyword && this.callSignature === callSignature) { - return this; - } - - return new ConstructSignatureSyntax(newKeyword, callSignature, this.parsedInStrictMode()); - }; - - ConstructSignatureSyntax.create1 = function () { - return new ConstructSignatureSyntax(TypeScript.Syntax.token(31 /* NewKeyword */), CallSignatureSyntax.create1(), false); - }; - - ConstructSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstructSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstructSignatureSyntax.prototype.withNewKeyword = function (newKeyword) { - return this.update(newKeyword, this.callSignature); - }; - - ConstructSignatureSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.newKeyword, callSignature); - }; - - ConstructSignatureSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstructSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstructSignatureSyntax = ConstructSignatureSyntax; - - var MethodSignatureSyntax = (function (_super) { - __extends(MethodSignatureSyntax, _super); - function MethodSignatureSyntax(propertyName, questionToken, callSignature, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.callSignature = callSignature; - } - MethodSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitMethodSignature(this); - }; - - MethodSignatureSyntax.prototype.kind = function () { - return 145 /* MethodSignature */; - }; - - MethodSignatureSyntax.prototype.childCount = function () { - return 3; - }; - - MethodSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.questionToken; - case 2: - return this.callSignature; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MethodSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - MethodSignatureSyntax.prototype.update = function (propertyName, questionToken, callSignature) { - if (this.propertyName === propertyName && this.questionToken === questionToken && this.callSignature === callSignature) { - return this; - } - - return new MethodSignatureSyntax(propertyName, questionToken, callSignature, this.parsedInStrictMode()); - }; - - MethodSignatureSyntax.create = function (propertyName, callSignature) { - return new MethodSignatureSyntax(propertyName, null, callSignature, false); - }; - - MethodSignatureSyntax.create1 = function (propertyName) { - return new MethodSignatureSyntax(propertyName, null, CallSignatureSyntax.create1(), false); - }; - - MethodSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MethodSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MethodSignatureSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.questionToken, this.callSignature); - }; - - MethodSignatureSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.propertyName, questionToken, this.callSignature); - }; - - MethodSignatureSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.propertyName, this.questionToken, callSignature); - }; - - MethodSignatureSyntax.prototype.isTypeScriptSpecific = function () { - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return MethodSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MethodSignatureSyntax = MethodSignatureSyntax; - - var IndexSignatureSyntax = (function (_super) { - __extends(IndexSignatureSyntax, _super); - function IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBracketToken = openBracketToken; - this.parameter = parameter; - this.closeBracketToken = closeBracketToken; - this.typeAnnotation = typeAnnotation; - } - IndexSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitIndexSignature(this); - }; - - IndexSignatureSyntax.prototype.kind = function () { - return 144 /* IndexSignature */; - }; - - IndexSignatureSyntax.prototype.childCount = function () { - return 4; - }; - - IndexSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBracketToken; - case 1: - return this.parameter; - case 2: - return this.closeBracketToken; - case 3: - return this.typeAnnotation; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - IndexSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - IndexSignatureSyntax.prototype.update = function (openBracketToken, parameter, closeBracketToken, typeAnnotation) { - if (this.openBracketToken === openBracketToken && this.parameter === parameter && this.closeBracketToken === closeBracketToken && this.typeAnnotation === typeAnnotation) { - return this; - } - - return new IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, typeAnnotation, this.parsedInStrictMode()); - }; - - IndexSignatureSyntax.create = function (openBracketToken, parameter, closeBracketToken) { - return new IndexSignatureSyntax(openBracketToken, parameter, closeBracketToken, null, false); - }; - - IndexSignatureSyntax.create1 = function (parameter) { - return new IndexSignatureSyntax(TypeScript.Syntax.token(74 /* OpenBracketToken */), parameter, TypeScript.Syntax.token(75 /* CloseBracketToken */), null, false); - }; - - IndexSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - IndexSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - IndexSignatureSyntax.prototype.withOpenBracketToken = function (openBracketToken) { - return this.update(openBracketToken, this.parameter, this.closeBracketToken, this.typeAnnotation); - }; - - IndexSignatureSyntax.prototype.withParameter = function (parameter) { - return this.update(this.openBracketToken, parameter, this.closeBracketToken, this.typeAnnotation); - }; - - IndexSignatureSyntax.prototype.withCloseBracketToken = function (closeBracketToken) { - return this.update(this.openBracketToken, this.parameter, closeBracketToken, this.typeAnnotation); - }; - - IndexSignatureSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.openBracketToken, this.parameter, this.closeBracketToken, typeAnnotation); - }; - - IndexSignatureSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return IndexSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.IndexSignatureSyntax = IndexSignatureSyntax; - - var PropertySignatureSyntax = (function (_super) { - __extends(PropertySignatureSyntax, _super); - function PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - } - PropertySignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitPropertySignature(this); - }; - - PropertySignatureSyntax.prototype.kind = function () { - return 141 /* PropertySignature */; - }; - - PropertySignatureSyntax.prototype.childCount = function () { - return 3; - }; - - PropertySignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.questionToken; - case 2: - return this.typeAnnotation; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - PropertySignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - PropertySignatureSyntax.prototype.update = function (propertyName, questionToken, typeAnnotation) { - if (this.propertyName === propertyName && this.questionToken === questionToken && this.typeAnnotation === typeAnnotation) { - return this; - } - - return new PropertySignatureSyntax(propertyName, questionToken, typeAnnotation, this.parsedInStrictMode()); - }; - - PropertySignatureSyntax.create = function (propertyName) { - return new PropertySignatureSyntax(propertyName, null, null, false); - }; - - PropertySignatureSyntax.create1 = function (propertyName) { - return new PropertySignatureSyntax(propertyName, null, null, false); - }; - - PropertySignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - PropertySignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - PropertySignatureSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.questionToken, this.typeAnnotation); - }; - - PropertySignatureSyntax.prototype.withQuestionToken = function (questionToken) { - return this.update(this.propertyName, questionToken, this.typeAnnotation); - }; - - PropertySignatureSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.propertyName, this.questionToken, typeAnnotation); - }; - - PropertySignatureSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return PropertySignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.PropertySignatureSyntax = PropertySignatureSyntax; - - var CallSignatureSyntax = (function (_super) { - __extends(CallSignatureSyntax, _super); - function CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - } - CallSignatureSyntax.prototype.accept = function (visitor) { - return visitor.visitCallSignature(this); - }; - - CallSignatureSyntax.prototype.kind = function () { - return 142 /* CallSignature */; - }; - - CallSignatureSyntax.prototype.childCount = function () { - return 3; - }; - - CallSignatureSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeParameterList; - case 1: - return this.parameterList; - case 2: - return this.typeAnnotation; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CallSignatureSyntax.prototype.isTypeMember = function () { - return true; - }; - - CallSignatureSyntax.prototype.update = function (typeParameterList, parameterList, typeAnnotation) { - if (this.typeParameterList === typeParameterList && this.parameterList === parameterList && this.typeAnnotation === typeAnnotation) { - return this; - } - - return new CallSignatureSyntax(typeParameterList, parameterList, typeAnnotation, this.parsedInStrictMode()); - }; - - CallSignatureSyntax.create = function (parameterList) { - return new CallSignatureSyntax(null, parameterList, null, false); - }; - - CallSignatureSyntax.create1 = function () { - return new CallSignatureSyntax(null, ParameterListSyntax.create1(), null, false); - }; - - CallSignatureSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CallSignatureSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CallSignatureSyntax.prototype.withTypeParameterList = function (typeParameterList) { - return this.update(typeParameterList, this.parameterList, this.typeAnnotation); - }; - - CallSignatureSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.typeParameterList, parameterList, this.typeAnnotation); - }; - - CallSignatureSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.typeParameterList, this.parameterList, typeAnnotation); - }; - - CallSignatureSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeParameterList !== null) { - return true; - } - if (this.parameterList.isTypeScriptSpecific()) { - return true; - } - if (this.typeAnnotation !== null) { - return true; - } - return false; - }; - return CallSignatureSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CallSignatureSyntax = CallSignatureSyntax; - - var ParameterListSyntax = (function (_super) { - __extends(ParameterListSyntax, _super); - function ParameterListSyntax(openParenToken, parameters, closeParenToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openParenToken = openParenToken; - this.parameters = parameters; - this.closeParenToken = closeParenToken; - } - ParameterListSyntax.prototype.accept = function (visitor) { - return visitor.visitParameterList(this); - }; - - ParameterListSyntax.prototype.kind = function () { - return 227 /* ParameterList */; - }; - - ParameterListSyntax.prototype.childCount = function () { - return 3; - }; - - ParameterListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openParenToken; - case 1: - return this.parameters; - case 2: - return this.closeParenToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParameterListSyntax.prototype.update = function (openParenToken, parameters, closeParenToken) { - if (this.openParenToken === openParenToken && this.parameters === parameters && this.closeParenToken === closeParenToken) { - return this; - } - - return new ParameterListSyntax(openParenToken, parameters, closeParenToken, this.parsedInStrictMode()); - }; - - ParameterListSyntax.create = function (openParenToken, closeParenToken) { - return new ParameterListSyntax(openParenToken, TypeScript.Syntax.emptySeparatedList, closeParenToken, false); - }; - - ParameterListSyntax.create1 = function () { - return new ParameterListSyntax(TypeScript.Syntax.token(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(73 /* CloseParenToken */), false); - }; - - ParameterListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ParameterListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ParameterListSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(openParenToken, this.parameters, this.closeParenToken); - }; - - ParameterListSyntax.prototype.withParameters = function (parameters) { - return this.update(this.openParenToken, parameters, this.closeParenToken); - }; - - ParameterListSyntax.prototype.withParameter = function (parameter) { - return this.withParameters(TypeScript.Syntax.separatedList([parameter])); - }; - - ParameterListSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.openParenToken, this.parameters, closeParenToken); - }; - - ParameterListSyntax.prototype.isTypeScriptSpecific = function () { - if (this.parameters.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ParameterListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ParameterListSyntax = ParameterListSyntax; - - var TypeParameterListSyntax = (function (_super) { - __extends(TypeParameterListSyntax, _super); - function TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.lessThanToken = lessThanToken; - this.typeParameters = typeParameters; - this.greaterThanToken = greaterThanToken; - } - TypeParameterListSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeParameterList(this); - }; - - TypeParameterListSyntax.prototype.kind = function () { - return 229 /* TypeParameterList */; - }; - - TypeParameterListSyntax.prototype.childCount = function () { - return 3; - }; - - TypeParameterListSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.lessThanToken; - case 1: - return this.typeParameters; - case 2: - return this.greaterThanToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeParameterListSyntax.prototype.update = function (lessThanToken, typeParameters, greaterThanToken) { - if (this.lessThanToken === lessThanToken && this.typeParameters === typeParameters && this.greaterThanToken === greaterThanToken) { - return this; - } - - return new TypeParameterListSyntax(lessThanToken, typeParameters, greaterThanToken, this.parsedInStrictMode()); - }; - - TypeParameterListSyntax.create = function (lessThanToken, greaterThanToken) { - return new TypeParameterListSyntax(lessThanToken, TypeScript.Syntax.emptySeparatedList, greaterThanToken, false); - }; - - TypeParameterListSyntax.create1 = function () { - return new TypeParameterListSyntax(TypeScript.Syntax.token(80 /* LessThanToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(81 /* GreaterThanToken */), false); - }; - - TypeParameterListSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeParameterListSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeParameterListSyntax.prototype.withLessThanToken = function (lessThanToken) { - return this.update(lessThanToken, this.typeParameters, this.greaterThanToken); - }; - - TypeParameterListSyntax.prototype.withTypeParameters = function (typeParameters) { - return this.update(this.lessThanToken, typeParameters, this.greaterThanToken); - }; - - TypeParameterListSyntax.prototype.withTypeParameter = function (typeParameter) { - return this.withTypeParameters(TypeScript.Syntax.separatedList([typeParameter])); - }; - - TypeParameterListSyntax.prototype.withGreaterThanToken = function (greaterThanToken) { - return this.update(this.lessThanToken, this.typeParameters, greaterThanToken); - }; - - TypeParameterListSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeParameterListSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeParameterListSyntax = TypeParameterListSyntax; - - var TypeParameterSyntax = (function (_super) { - __extends(TypeParameterSyntax, _super); - function TypeParameterSyntax(identifier, constraint, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.identifier = identifier; - this.constraint = constraint; - } - TypeParameterSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeParameter(this); - }; - - TypeParameterSyntax.prototype.kind = function () { - return 238 /* TypeParameter */; - }; - - TypeParameterSyntax.prototype.childCount = function () { - return 2; - }; - - TypeParameterSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.identifier; - case 1: - return this.constraint; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeParameterSyntax.prototype.update = function (identifier, constraint) { - if (this.identifier === identifier && this.constraint === constraint) { - return this; - } - - return new TypeParameterSyntax(identifier, constraint, this.parsedInStrictMode()); - }; - - TypeParameterSyntax.create = function (identifier) { - return new TypeParameterSyntax(identifier, null, false); - }; - - TypeParameterSyntax.create1 = function (identifier) { - return new TypeParameterSyntax(identifier, null, false); - }; - - TypeParameterSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeParameterSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeParameterSyntax.prototype.withIdentifier = function (identifier) { - return this.update(identifier, this.constraint); - }; - - TypeParameterSyntax.prototype.withConstraint = function (constraint) { - return this.update(this.identifier, constraint); - }; - - TypeParameterSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return TypeParameterSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeParameterSyntax = TypeParameterSyntax; - - var ConstraintSyntax = (function (_super) { - __extends(ConstraintSyntax, _super); - function ConstraintSyntax(extendsKeyword, type, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.extendsKeyword = extendsKeyword; - this.type = type; - } - ConstraintSyntax.prototype.accept = function (visitor) { - return visitor.visitConstraint(this); - }; - - ConstraintSyntax.prototype.kind = function () { - return 239 /* Constraint */; - }; - - ConstraintSyntax.prototype.childCount = function () { - return 2; - }; - - ConstraintSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.extendsKeyword; - case 1: - return this.type; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstraintSyntax.prototype.update = function (extendsKeyword, type) { - if (this.extendsKeyword === extendsKeyword && this.type === type) { - return this; - } - - return new ConstraintSyntax(extendsKeyword, type, this.parsedInStrictMode()); - }; - - ConstraintSyntax.create1 = function (type) { - return new ConstraintSyntax(TypeScript.Syntax.token(48 /* ExtendsKeyword */), type, false); - }; - - ConstraintSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstraintSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstraintSyntax.prototype.withExtendsKeyword = function (extendsKeyword) { - return this.update(extendsKeyword, this.type); - }; - - ConstraintSyntax.prototype.withType = function (type) { - return this.update(this.extendsKeyword, type); - }; - - ConstraintSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstraintSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstraintSyntax = ConstraintSyntax; - - var ElseClauseSyntax = (function (_super) { - __extends(ElseClauseSyntax, _super); - function ElseClauseSyntax(elseKeyword, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.elseKeyword = elseKeyword; - this.statement = statement; - } - ElseClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitElseClause(this); - }; - - ElseClauseSyntax.prototype.kind = function () { - return 235 /* ElseClause */; - }; - - ElseClauseSyntax.prototype.childCount = function () { - return 2; - }; - - ElseClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.elseKeyword; - case 1: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ElseClauseSyntax.prototype.update = function (elseKeyword, statement) { - if (this.elseKeyword === elseKeyword && this.statement === statement) { - return this; - } - - return new ElseClauseSyntax(elseKeyword, statement, this.parsedInStrictMode()); - }; - - ElseClauseSyntax.create1 = function (statement) { - return new ElseClauseSyntax(TypeScript.Syntax.token(23 /* ElseKeyword */), statement, false); - }; - - ElseClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ElseClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ElseClauseSyntax.prototype.withElseKeyword = function (elseKeyword) { - return this.update(elseKeyword, this.statement); - }; - - ElseClauseSyntax.prototype.withStatement = function (statement) { - return this.update(this.elseKeyword, statement); - }; - - ElseClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ElseClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ElseClauseSyntax = ElseClauseSyntax; - - var IfStatementSyntax = (function (_super) { - __extends(IfStatementSyntax, _super); - function IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.ifKeyword = ifKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.statement = statement; - this.elseClause = elseClause; - } - IfStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitIfStatement(this); - }; - - IfStatementSyntax.prototype.kind = function () { - return 147 /* IfStatement */; - }; - - IfStatementSyntax.prototype.childCount = function () { - return 6; - }; - - IfStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.ifKeyword; - case 1: - return this.openParenToken; - case 2: - return this.condition; - case 3: - return this.closeParenToken; - case 4: - return this.statement; - case 5: - return this.elseClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - IfStatementSyntax.prototype.isStatement = function () { - return true; - }; - - IfStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - IfStatementSyntax.prototype.update = function (ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - if (this.ifKeyword === ifKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.statement === statement && this.elseClause === elseClause) { - return this; - } - - return new IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause, this.parsedInStrictMode()); - }; - - IfStatementSyntax.create = function (ifKeyword, openParenToken, condition, closeParenToken, statement) { - return new IfStatementSyntax(ifKeyword, openParenToken, condition, closeParenToken, statement, null, false); - }; - - IfStatementSyntax.create1 = function (condition, statement) { - return new IfStatementSyntax(TypeScript.Syntax.token(28 /* IfKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, null, false); - }; - - IfStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - IfStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - IfStatementSyntax.prototype.withIfKeyword = function (ifKeyword) { - return this.update(ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.ifKeyword, openParenToken, this.condition, this.closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.ifKeyword, this.openParenToken, condition, this.closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.ifKeyword, this.openParenToken, this.condition, closeParenToken, this.statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, statement, this.elseClause); - }; - - IfStatementSyntax.prototype.withElseClause = function (elseClause) { - return this.update(this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, elseClause); - }; - - IfStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - if (this.elseClause !== null && this.elseClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return IfStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.IfStatementSyntax = IfStatementSyntax; - - var ExpressionStatementSyntax = (function (_super) { - __extends(ExpressionStatementSyntax, _super); - function ExpressionStatementSyntax(expression, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.expression = expression; - this.semicolonToken = semicolonToken; - } - ExpressionStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitExpressionStatement(this); - }; - - ExpressionStatementSyntax.prototype.kind = function () { - return 149 /* ExpressionStatement */; - }; - - ExpressionStatementSyntax.prototype.childCount = function () { - return 2; - }; - - ExpressionStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.expression; - case 1: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ExpressionStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ExpressionStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ExpressionStatementSyntax.prototype.update = function (expression, semicolonToken) { - if (this.expression === expression && this.semicolonToken === semicolonToken) { - return this; - } - - return new ExpressionStatementSyntax(expression, semicolonToken, this.parsedInStrictMode()); - }; - - ExpressionStatementSyntax.create1 = function (expression) { - return new ExpressionStatementSyntax(expression, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ExpressionStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ExpressionStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ExpressionStatementSyntax.prototype.withExpression = function (expression) { - return this.update(expression, this.semicolonToken); - }; - - ExpressionStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.expression, semicolonToken); - }; - - ExpressionStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ExpressionStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ExpressionStatementSyntax = ExpressionStatementSyntax; - - var ConstructorDeclarationSyntax = (function (_super) { - __extends(ConstructorDeclarationSyntax, _super); - function ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.constructorKeyword = constructorKeyword; - this.callSignature = callSignature; - this.block = block; - this.semicolonToken = semicolonToken; - } - ConstructorDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitConstructorDeclaration(this); - }; - - ConstructorDeclarationSyntax.prototype.kind = function () { - return 137 /* ConstructorDeclaration */; - }; - - ConstructorDeclarationSyntax.prototype.childCount = function () { - return 5; - }; - - ConstructorDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.constructorKeyword; - case 2: - return this.callSignature; - case 3: - return this.block; - case 4: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ConstructorDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - ConstructorDeclarationSyntax.prototype.update = function (modifiers, constructorKeyword, callSignature, block, semicolonToken) { - if (this.modifiers === modifiers && this.constructorKeyword === constructorKeyword && this.callSignature === callSignature && this.block === block && this.semicolonToken === semicolonToken) { - return this; - } - - return new ConstructorDeclarationSyntax(modifiers, constructorKeyword, callSignature, block, semicolonToken, this.parsedInStrictMode()); - }; - - ConstructorDeclarationSyntax.create = function (constructorKeyword, callSignature) { - return new ConstructorDeclarationSyntax(TypeScript.Syntax.emptyList, constructorKeyword, callSignature, null, null, false); - }; - - ConstructorDeclarationSyntax.create1 = function () { - return new ConstructorDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(62 /* ConstructorKeyword */), CallSignatureSyntax.create1(), null, null, false); - }; - - ConstructorDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ConstructorDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ConstructorDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.constructorKeyword, this.callSignature, this.block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - ConstructorDeclarationSyntax.prototype.withConstructorKeyword = function (constructorKeyword) { - return this.update(this.modifiers, constructorKeyword, this.callSignature, this.block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.modifiers, this.constructorKeyword, callSignature, this.block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.constructorKeyword, this.callSignature, block, this.semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.constructorKeyword, this.callSignature, this.block, semicolonToken); - }; - - ConstructorDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return ConstructorDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ConstructorDeclarationSyntax = ConstructorDeclarationSyntax; - - var MemberFunctionDeclarationSyntax = (function (_super) { - __extends(MemberFunctionDeclarationSyntax, _super); - function MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - this.semicolonToken = semicolonToken; - } - MemberFunctionDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitMemberFunctionDeclaration(this); - }; - - MemberFunctionDeclarationSyntax.prototype.kind = function () { - return 135 /* MemberFunctionDeclaration */; - }; - - MemberFunctionDeclarationSyntax.prototype.childCount = function () { - return 5; - }; - - MemberFunctionDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.propertyName; - case 2: - return this.callSignature; - case 3: - return this.block; - case 4: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MemberFunctionDeclarationSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - MemberFunctionDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - MemberFunctionDeclarationSyntax.prototype.update = function (modifiers, propertyName, callSignature, block, semicolonToken) { - if (this.modifiers === modifiers && this.propertyName === propertyName && this.callSignature === callSignature && this.block === block && this.semicolonToken === semicolonToken) { - return this; - } - - return new MemberFunctionDeclarationSyntax(modifiers, propertyName, callSignature, block, semicolonToken, this.parsedInStrictMode()); - }; - - MemberFunctionDeclarationSyntax.create = function (propertyName, callSignature) { - return new MemberFunctionDeclarationSyntax(TypeScript.Syntax.emptyList, propertyName, callSignature, null, null, false); - }; - - MemberFunctionDeclarationSyntax.create1 = function (propertyName) { - return new MemberFunctionDeclarationSyntax(TypeScript.Syntax.emptyList, propertyName, CallSignatureSyntax.create1(), null, null, false); - }; - - MemberFunctionDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MemberFunctionDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MemberFunctionDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.propertyName, this.callSignature, this.block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - MemberFunctionDeclarationSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(this.modifiers, propertyName, this.callSignature, this.block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.modifiers, this.propertyName, callSignature, this.block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.propertyName, this.callSignature, block, this.semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.propertyName, this.callSignature, this.block, semicolonToken); - }; - - MemberFunctionDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return MemberFunctionDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MemberFunctionDeclarationSyntax = MemberFunctionDeclarationSyntax; - - var GetAccessorSyntax = (function (_super) { - __extends(GetAccessorSyntax, _super); - function GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.getKeyword = getKeyword; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - this.block = block; - } - GetAccessorSyntax.prototype.accept = function (visitor) { - return visitor.visitGetAccessor(this); - }; - - GetAccessorSyntax.prototype.kind = function () { - return 139 /* GetAccessor */; - }; - - GetAccessorSyntax.prototype.childCount = function () { - return 6; - }; - - GetAccessorSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.getKeyword; - case 2: - return this.propertyName; - case 3: - return this.parameterList; - case 4: - return this.typeAnnotation; - case 5: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - GetAccessorSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - GetAccessorSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - GetAccessorSyntax.prototype.isClassElement = function () { - return true; - }; - - GetAccessorSyntax.prototype.update = function (modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block) { - if (this.modifiers === modifiers && this.getKeyword === getKeyword && this.propertyName === propertyName && this.parameterList === parameterList && this.typeAnnotation === typeAnnotation && this.block === block) { - return this; - } - - return new GetAccessorSyntax(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block, this.parsedInStrictMode()); - }; - - GetAccessorSyntax.create = function (getKeyword, propertyName, parameterList, block) { - return new GetAccessorSyntax(TypeScript.Syntax.emptyList, getKeyword, propertyName, parameterList, null, block, false); - }; - - GetAccessorSyntax.create1 = function (propertyName) { - return new GetAccessorSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(64 /* GetKeyword */), propertyName, ParameterListSyntax.create1(), null, BlockSyntax.create1(), false); - }; - - GetAccessorSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - GetAccessorSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - GetAccessorSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.getKeyword, this.propertyName, this.parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - GetAccessorSyntax.prototype.withGetKeyword = function (getKeyword) { - return this.update(this.modifiers, getKeyword, this.propertyName, this.parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(this.modifiers, this.getKeyword, propertyName, this.parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.modifiers, this.getKeyword, this.propertyName, parameterList, this.typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.modifiers, this.getKeyword, this.propertyName, this.parameterList, typeAnnotation, this.block); - }; - - GetAccessorSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.getKeyword, this.propertyName, this.parameterList, this.typeAnnotation, block); - }; - - GetAccessorSyntax.prototype.isTypeScriptSpecific = function () { - if (this.modifiers.childCount() > 0) { - return true; - } - if (this.parameterList.isTypeScriptSpecific()) { - return true; - } - if (this.typeAnnotation !== null) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return GetAccessorSyntax; - })(TypeScript.SyntaxNode); - TypeScript.GetAccessorSyntax = GetAccessorSyntax; - - var SetAccessorSyntax = (function (_super) { - __extends(SetAccessorSyntax, _super); - function SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.setKeyword = setKeyword; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.block = block; - } - SetAccessorSyntax.prototype.accept = function (visitor) { - return visitor.visitSetAccessor(this); - }; - - SetAccessorSyntax.prototype.kind = function () { - return 140 /* SetAccessor */; - }; - - SetAccessorSyntax.prototype.childCount = function () { - return 5; - }; - - SetAccessorSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.setKeyword; - case 2: - return this.propertyName; - case 3: - return this.parameterList; - case 4: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SetAccessorSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - SetAccessorSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - SetAccessorSyntax.prototype.isClassElement = function () { - return true; - }; - - SetAccessorSyntax.prototype.update = function (modifiers, setKeyword, propertyName, parameterList, block) { - if (this.modifiers === modifiers && this.setKeyword === setKeyword && this.propertyName === propertyName && this.parameterList === parameterList && this.block === block) { - return this; - } - - return new SetAccessorSyntax(modifiers, setKeyword, propertyName, parameterList, block, this.parsedInStrictMode()); - }; - - SetAccessorSyntax.create = function (setKeyword, propertyName, parameterList, block) { - return new SetAccessorSyntax(TypeScript.Syntax.emptyList, setKeyword, propertyName, parameterList, block, false); - }; - - SetAccessorSyntax.create1 = function (propertyName) { - return new SetAccessorSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(68 /* SetKeyword */), propertyName, ParameterListSyntax.create1(), BlockSyntax.create1(), false); - }; - - SetAccessorSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SetAccessorSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SetAccessorSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.setKeyword, this.propertyName, this.parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - SetAccessorSyntax.prototype.withSetKeyword = function (setKeyword) { - return this.update(this.modifiers, setKeyword, this.propertyName, this.parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(this.modifiers, this.setKeyword, propertyName, this.parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withParameterList = function (parameterList) { - return this.update(this.modifiers, this.setKeyword, this.propertyName, parameterList, this.block); - }; - - SetAccessorSyntax.prototype.withBlock = function (block) { - return this.update(this.modifiers, this.setKeyword, this.propertyName, this.parameterList, block); - }; - - SetAccessorSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return SetAccessorSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SetAccessorSyntax = SetAccessorSyntax; - - var MemberVariableDeclarationSyntax = (function (_super) { - __extends(MemberVariableDeclarationSyntax, _super); - function MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.variableDeclarator = variableDeclarator; - this.semicolonToken = semicolonToken; - } - MemberVariableDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitMemberVariableDeclaration(this); - }; - - MemberVariableDeclarationSyntax.prototype.kind = function () { - return 136 /* MemberVariableDeclaration */; - }; - - MemberVariableDeclarationSyntax.prototype.childCount = function () { - return 3; - }; - - MemberVariableDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.variableDeclarator; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - MemberVariableDeclarationSyntax.prototype.isMemberDeclaration = function () { - return true; - }; - - MemberVariableDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - MemberVariableDeclarationSyntax.prototype.update = function (modifiers, variableDeclarator, semicolonToken) { - if (this.modifiers === modifiers && this.variableDeclarator === variableDeclarator && this.semicolonToken === semicolonToken) { - return this; - } - - return new MemberVariableDeclarationSyntax(modifiers, variableDeclarator, semicolonToken, this.parsedInStrictMode()); - }; - - MemberVariableDeclarationSyntax.create = function (variableDeclarator, semicolonToken) { - return new MemberVariableDeclarationSyntax(TypeScript.Syntax.emptyList, variableDeclarator, semicolonToken, false); - }; - - MemberVariableDeclarationSyntax.create1 = function (variableDeclarator) { - return new MemberVariableDeclarationSyntax(TypeScript.Syntax.emptyList, variableDeclarator, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - MemberVariableDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - MemberVariableDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - MemberVariableDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.variableDeclarator, this.semicolonToken); - }; - - MemberVariableDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - MemberVariableDeclarationSyntax.prototype.withVariableDeclarator = function (variableDeclarator) { - return this.update(this.modifiers, variableDeclarator, this.semicolonToken); - }; - - MemberVariableDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.variableDeclarator, semicolonToken); - }; - - MemberVariableDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return MemberVariableDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.MemberVariableDeclarationSyntax = MemberVariableDeclarationSyntax; - - var IndexMemberDeclarationSyntax = (function (_super) { - __extends(IndexMemberDeclarationSyntax, _super); - function IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.indexSignature = indexSignature; - this.semicolonToken = semicolonToken; - } - IndexMemberDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitIndexMemberDeclaration(this); - }; - - IndexMemberDeclarationSyntax.prototype.kind = function () { - return 138 /* IndexMemberDeclaration */; - }; - - IndexMemberDeclarationSyntax.prototype.childCount = function () { - return 3; - }; - - IndexMemberDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.indexSignature; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - IndexMemberDeclarationSyntax.prototype.isClassElement = function () { - return true; - }; - - IndexMemberDeclarationSyntax.prototype.update = function (modifiers, indexSignature, semicolonToken) { - if (this.modifiers === modifiers && this.indexSignature === indexSignature && this.semicolonToken === semicolonToken) { - return this; - } - - return new IndexMemberDeclarationSyntax(modifiers, indexSignature, semicolonToken, this.parsedInStrictMode()); - }; - - IndexMemberDeclarationSyntax.create = function (indexSignature, semicolonToken) { - return new IndexMemberDeclarationSyntax(TypeScript.Syntax.emptyList, indexSignature, semicolonToken, false); - }; - - IndexMemberDeclarationSyntax.create1 = function (indexSignature) { - return new IndexMemberDeclarationSyntax(TypeScript.Syntax.emptyList, indexSignature, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - IndexMemberDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - IndexMemberDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - IndexMemberDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.indexSignature, this.semicolonToken); - }; - - IndexMemberDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - IndexMemberDeclarationSyntax.prototype.withIndexSignature = function (indexSignature) { - return this.update(this.modifiers, indexSignature, this.semicolonToken); - }; - - IndexMemberDeclarationSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.modifiers, this.indexSignature, semicolonToken); - }; - - IndexMemberDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return IndexMemberDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.IndexMemberDeclarationSyntax = IndexMemberDeclarationSyntax; - - var ThrowStatementSyntax = (function (_super) { - __extends(ThrowStatementSyntax, _super); - function ThrowStatementSyntax(throwKeyword, expression, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.throwKeyword = throwKeyword; - this.expression = expression; - this.semicolonToken = semicolonToken; - } - ThrowStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitThrowStatement(this); - }; - - ThrowStatementSyntax.prototype.kind = function () { - return 157 /* ThrowStatement */; - }; - - ThrowStatementSyntax.prototype.childCount = function () { - return 3; - }; - - ThrowStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.throwKeyword; - case 1: - return this.expression; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ThrowStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ThrowStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ThrowStatementSyntax.prototype.update = function (throwKeyword, expression, semicolonToken) { - if (this.throwKeyword === throwKeyword && this.expression === expression && this.semicolonToken === semicolonToken) { - return this; - } - - return new ThrowStatementSyntax(throwKeyword, expression, semicolonToken, this.parsedInStrictMode()); - }; - - ThrowStatementSyntax.create1 = function (expression) { - return new ThrowStatementSyntax(TypeScript.Syntax.token(36 /* ThrowKeyword */), expression, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ThrowStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ThrowStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ThrowStatementSyntax.prototype.withThrowKeyword = function (throwKeyword) { - return this.update(throwKeyword, this.expression, this.semicolonToken); - }; - - ThrowStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.throwKeyword, expression, this.semicolonToken); - }; - - ThrowStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.throwKeyword, this.expression, semicolonToken); - }; - - ThrowStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ThrowStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ThrowStatementSyntax = ThrowStatementSyntax; - - var ReturnStatementSyntax = (function (_super) { - __extends(ReturnStatementSyntax, _super); - function ReturnStatementSyntax(returnKeyword, expression, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.returnKeyword = returnKeyword; - this.expression = expression; - this.semicolonToken = semicolonToken; - } - ReturnStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitReturnStatement(this); - }; - - ReturnStatementSyntax.prototype.kind = function () { - return 150 /* ReturnStatement */; - }; - - ReturnStatementSyntax.prototype.childCount = function () { - return 3; - }; - - ReturnStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.returnKeyword; - case 1: - return this.expression; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ReturnStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ReturnStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ReturnStatementSyntax.prototype.update = function (returnKeyword, expression, semicolonToken) { - if (this.returnKeyword === returnKeyword && this.expression === expression && this.semicolonToken === semicolonToken) { - return this; - } - - return new ReturnStatementSyntax(returnKeyword, expression, semicolonToken, this.parsedInStrictMode()); - }; - - ReturnStatementSyntax.create = function (returnKeyword, semicolonToken) { - return new ReturnStatementSyntax(returnKeyword, null, semicolonToken, false); - }; - - ReturnStatementSyntax.create1 = function () { - return new ReturnStatementSyntax(TypeScript.Syntax.token(33 /* ReturnKeyword */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ReturnStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ReturnStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ReturnStatementSyntax.prototype.withReturnKeyword = function (returnKeyword) { - return this.update(returnKeyword, this.expression, this.semicolonToken); - }; - - ReturnStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.returnKeyword, expression, this.semicolonToken); - }; - - ReturnStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.returnKeyword, this.expression, semicolonToken); - }; - - ReturnStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression !== null && this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ReturnStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ReturnStatementSyntax = ReturnStatementSyntax; - - var ObjectCreationExpressionSyntax = (function (_super) { - __extends(ObjectCreationExpressionSyntax, _super); - function ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.newKeyword = newKeyword; - this.expression = expression; - this.argumentList = argumentList; - } - ObjectCreationExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitObjectCreationExpression(this); - }; - - ObjectCreationExpressionSyntax.prototype.kind = function () { - return 216 /* ObjectCreationExpression */; - }; - - ObjectCreationExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ObjectCreationExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.newKeyword; - case 1: - return this.expression; - case 2: - return this.argumentList; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ObjectCreationExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ObjectCreationExpressionSyntax.prototype.update = function (newKeyword, expression, argumentList) { - if (this.newKeyword === newKeyword && this.expression === expression && this.argumentList === argumentList) { - return this; - } - - return new ObjectCreationExpressionSyntax(newKeyword, expression, argumentList, this.parsedInStrictMode()); - }; - - ObjectCreationExpressionSyntax.create = function (newKeyword, expression) { - return new ObjectCreationExpressionSyntax(newKeyword, expression, null, false); - }; - - ObjectCreationExpressionSyntax.create1 = function (expression) { - return new ObjectCreationExpressionSyntax(TypeScript.Syntax.token(31 /* NewKeyword */), expression, null, false); - }; - - ObjectCreationExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ObjectCreationExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ObjectCreationExpressionSyntax.prototype.withNewKeyword = function (newKeyword) { - return this.update(newKeyword, this.expression, this.argumentList); - }; - - ObjectCreationExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.newKeyword, expression, this.argumentList); - }; - - ObjectCreationExpressionSyntax.prototype.withArgumentList = function (argumentList) { - return this.update(this.newKeyword, this.expression, argumentList); - }; - - ObjectCreationExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.argumentList !== null && this.argumentList.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ObjectCreationExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ObjectCreationExpressionSyntax = ObjectCreationExpressionSyntax; - - var SwitchStatementSyntax = (function (_super) { - __extends(SwitchStatementSyntax, _super); - function SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.switchKeyword = switchKeyword; - this.openParenToken = openParenToken; - this.expression = expression; - this.closeParenToken = closeParenToken; - this.openBraceToken = openBraceToken; - this.switchClauses = switchClauses; - this.closeBraceToken = closeBraceToken; - } - SwitchStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitSwitchStatement(this); - }; - - SwitchStatementSyntax.prototype.kind = function () { - return 151 /* SwitchStatement */; - }; - - SwitchStatementSyntax.prototype.childCount = function () { - return 7; - }; - - SwitchStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.switchKeyword; - case 1: - return this.openParenToken; - case 2: - return this.expression; - case 3: - return this.closeParenToken; - case 4: - return this.openBraceToken; - case 5: - return this.switchClauses; - case 6: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SwitchStatementSyntax.prototype.isStatement = function () { - return true; - }; - - SwitchStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - SwitchStatementSyntax.prototype.update = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - if (this.switchKeyword === switchKeyword && this.openParenToken === openParenToken && this.expression === expression && this.closeParenToken === closeParenToken && this.openBraceToken === openBraceToken && this.switchClauses === switchClauses && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken, this.parsedInStrictMode()); - }; - - SwitchStatementSyntax.create = function (switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, closeBraceToken) { - return new SwitchStatementSyntax(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, TypeScript.Syntax.emptyList, closeBraceToken, false); - }; - - SwitchStatementSyntax.create1 = function (expression) { - return new SwitchStatementSyntax(TypeScript.Syntax.token(34 /* SwitchKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), expression, TypeScript.Syntax.token(73 /* CloseParenToken */), TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptyList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - SwitchStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SwitchStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SwitchStatementSyntax.prototype.withSwitchKeyword = function (switchKeyword) { - return this.update(switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.switchKeyword, openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.switchKeyword, this.openParenToken, expression, this.closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, closeParenToken, this.openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, openBraceToken, this.switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withSwitchClauses = function (switchClauses) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, switchClauses, this.closeBraceToken); - }; - - SwitchStatementSyntax.prototype.withSwitchClause = function (switchClause) { - return this.withSwitchClauses(TypeScript.Syntax.list([switchClause])); - }; - - SwitchStatementSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.switchClauses, closeBraceToken); - }; - - SwitchStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.switchClauses.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return SwitchStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SwitchStatementSyntax = SwitchStatementSyntax; - - var CaseSwitchClauseSyntax = (function (_super) { - __extends(CaseSwitchClauseSyntax, _super); - function CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.caseKeyword = caseKeyword; - this.expression = expression; - this.colonToken = colonToken; - this.statements = statements; - } - CaseSwitchClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitCaseSwitchClause(this); - }; - - CaseSwitchClauseSyntax.prototype.kind = function () { - return 233 /* CaseSwitchClause */; - }; - - CaseSwitchClauseSyntax.prototype.childCount = function () { - return 4; - }; - - CaseSwitchClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.caseKeyword; - case 1: - return this.expression; - case 2: - return this.colonToken; - case 3: - return this.statements; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CaseSwitchClauseSyntax.prototype.isSwitchClause = function () { - return true; - }; - - CaseSwitchClauseSyntax.prototype.update = function (caseKeyword, expression, colonToken, statements) { - if (this.caseKeyword === caseKeyword && this.expression === expression && this.colonToken === colonToken && this.statements === statements) { - return this; - } - - return new CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, statements, this.parsedInStrictMode()); - }; - - CaseSwitchClauseSyntax.create = function (caseKeyword, expression, colonToken) { - return new CaseSwitchClauseSyntax(caseKeyword, expression, colonToken, TypeScript.Syntax.emptyList, false); - }; - - CaseSwitchClauseSyntax.create1 = function (expression) { - return new CaseSwitchClauseSyntax(TypeScript.Syntax.token(16 /* CaseKeyword */), expression, TypeScript.Syntax.token(106 /* ColonToken */), TypeScript.Syntax.emptyList, false); - }; - - CaseSwitchClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CaseSwitchClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CaseSwitchClauseSyntax.prototype.withCaseKeyword = function (caseKeyword) { - return this.update(caseKeyword, this.expression, this.colonToken, this.statements); - }; - - CaseSwitchClauseSyntax.prototype.withExpression = function (expression) { - return this.update(this.caseKeyword, expression, this.colonToken, this.statements); - }; - - CaseSwitchClauseSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.caseKeyword, this.expression, colonToken, this.statements); - }; - - CaseSwitchClauseSyntax.prototype.withStatements = function (statements) { - return this.update(this.caseKeyword, this.expression, this.colonToken, statements); - }; - - CaseSwitchClauseSyntax.prototype.withStatement = function (statement) { - return this.withStatements(TypeScript.Syntax.list([statement])); - }; - - CaseSwitchClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.statements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return CaseSwitchClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CaseSwitchClauseSyntax = CaseSwitchClauseSyntax; - - var DefaultSwitchClauseSyntax = (function (_super) { - __extends(DefaultSwitchClauseSyntax, _super); - function DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.defaultKeyword = defaultKeyword; - this.colonToken = colonToken; - this.statements = statements; - } - DefaultSwitchClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitDefaultSwitchClause(this); - }; - - DefaultSwitchClauseSyntax.prototype.kind = function () { - return 234 /* DefaultSwitchClause */; - }; - - DefaultSwitchClauseSyntax.prototype.childCount = function () { - return 3; - }; - - DefaultSwitchClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.defaultKeyword; - case 1: - return this.colonToken; - case 2: - return this.statements; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DefaultSwitchClauseSyntax.prototype.isSwitchClause = function () { - return true; - }; - - DefaultSwitchClauseSyntax.prototype.update = function (defaultKeyword, colonToken, statements) { - if (this.defaultKeyword === defaultKeyword && this.colonToken === colonToken && this.statements === statements) { - return this; - } - - return new DefaultSwitchClauseSyntax(defaultKeyword, colonToken, statements, this.parsedInStrictMode()); - }; - - DefaultSwitchClauseSyntax.create = function (defaultKeyword, colonToken) { - return new DefaultSwitchClauseSyntax(defaultKeyword, colonToken, TypeScript.Syntax.emptyList, false); - }; - - DefaultSwitchClauseSyntax.create1 = function () { - return new DefaultSwitchClauseSyntax(TypeScript.Syntax.token(20 /* DefaultKeyword */), TypeScript.Syntax.token(106 /* ColonToken */), TypeScript.Syntax.emptyList, false); - }; - - DefaultSwitchClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DefaultSwitchClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DefaultSwitchClauseSyntax.prototype.withDefaultKeyword = function (defaultKeyword) { - return this.update(defaultKeyword, this.colonToken, this.statements); - }; - - DefaultSwitchClauseSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.defaultKeyword, colonToken, this.statements); - }; - - DefaultSwitchClauseSyntax.prototype.withStatements = function (statements) { - return this.update(this.defaultKeyword, this.colonToken, statements); - }; - - DefaultSwitchClauseSyntax.prototype.withStatement = function (statement) { - return this.withStatements(TypeScript.Syntax.list([statement])); - }; - - DefaultSwitchClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statements.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return DefaultSwitchClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DefaultSwitchClauseSyntax = DefaultSwitchClauseSyntax; - - var BreakStatementSyntax = (function (_super) { - __extends(BreakStatementSyntax, _super); - function BreakStatementSyntax(breakKeyword, identifier, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.breakKeyword = breakKeyword; - this.identifier = identifier; - this.semicolonToken = semicolonToken; - } - BreakStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitBreakStatement(this); - }; - - BreakStatementSyntax.prototype.kind = function () { - return 152 /* BreakStatement */; - }; - - BreakStatementSyntax.prototype.childCount = function () { - return 3; - }; - - BreakStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.breakKeyword; - case 1: - return this.identifier; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - BreakStatementSyntax.prototype.isStatement = function () { - return true; - }; - - BreakStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - BreakStatementSyntax.prototype.update = function (breakKeyword, identifier, semicolonToken) { - if (this.breakKeyword === breakKeyword && this.identifier === identifier && this.semicolonToken === semicolonToken) { - return this; - } - - return new BreakStatementSyntax(breakKeyword, identifier, semicolonToken, this.parsedInStrictMode()); - }; - - BreakStatementSyntax.create = function (breakKeyword, semicolonToken) { - return new BreakStatementSyntax(breakKeyword, null, semicolonToken, false); - }; - - BreakStatementSyntax.create1 = function () { - return new BreakStatementSyntax(TypeScript.Syntax.token(15 /* BreakKeyword */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - BreakStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - BreakStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - BreakStatementSyntax.prototype.withBreakKeyword = function (breakKeyword) { - return this.update(breakKeyword, this.identifier, this.semicolonToken); - }; - - BreakStatementSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.breakKeyword, identifier, this.semicolonToken); - }; - - BreakStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.breakKeyword, this.identifier, semicolonToken); - }; - - BreakStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return BreakStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.BreakStatementSyntax = BreakStatementSyntax; - - var ContinueStatementSyntax = (function (_super) { - __extends(ContinueStatementSyntax, _super); - function ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.continueKeyword = continueKeyword; - this.identifier = identifier; - this.semicolonToken = semicolonToken; - } - ContinueStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitContinueStatement(this); - }; - - ContinueStatementSyntax.prototype.kind = function () { - return 153 /* ContinueStatement */; - }; - - ContinueStatementSyntax.prototype.childCount = function () { - return 3; - }; - - ContinueStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.continueKeyword; - case 1: - return this.identifier; - case 2: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ContinueStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ContinueStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ContinueStatementSyntax.prototype.update = function (continueKeyword, identifier, semicolonToken) { - if (this.continueKeyword === continueKeyword && this.identifier === identifier && this.semicolonToken === semicolonToken) { - return this; - } - - return new ContinueStatementSyntax(continueKeyword, identifier, semicolonToken, this.parsedInStrictMode()); - }; - - ContinueStatementSyntax.create = function (continueKeyword, semicolonToken) { - return new ContinueStatementSyntax(continueKeyword, null, semicolonToken, false); - }; - - ContinueStatementSyntax.create1 = function () { - return new ContinueStatementSyntax(TypeScript.Syntax.token(18 /* ContinueKeyword */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - ContinueStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ContinueStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ContinueStatementSyntax.prototype.withContinueKeyword = function (continueKeyword) { - return this.update(continueKeyword, this.identifier, this.semicolonToken); - }; - - ContinueStatementSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.continueKeyword, identifier, this.semicolonToken); - }; - - ContinueStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.continueKeyword, this.identifier, semicolonToken); - }; - - ContinueStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return ContinueStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ContinueStatementSyntax = ContinueStatementSyntax; - - var ForStatementSyntax = (function (_super) { - __extends(ForStatementSyntax, _super); - function ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.forKeyword = forKeyword; - this.openParenToken = openParenToken; - this.variableDeclaration = variableDeclaration; - this.initializer = initializer; - this.firstSemicolonToken = firstSemicolonToken; - this.condition = condition; - this.secondSemicolonToken = secondSemicolonToken; - this.incrementor = incrementor; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - ForStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitForStatement(this); - }; - - ForStatementSyntax.prototype.kind = function () { - return 154 /* ForStatement */; - }; - - ForStatementSyntax.prototype.childCount = function () { - return 10; - }; - - ForStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.forKeyword; - case 1: - return this.openParenToken; - case 2: - return this.variableDeclaration; - case 3: - return this.initializer; - case 4: - return this.firstSemicolonToken; - case 5: - return this.condition; - case 6: - return this.secondSemicolonToken; - case 7: - return this.incrementor; - case 8: - return this.closeParenToken; - case 9: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ForStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - ForStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ForStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ForStatementSyntax.prototype.update = function (forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - if (this.forKeyword === forKeyword && this.openParenToken === openParenToken && this.variableDeclaration === variableDeclaration && this.initializer === initializer && this.firstSemicolonToken === firstSemicolonToken && this.condition === condition && this.secondSemicolonToken === secondSemicolonToken && this.incrementor === incrementor && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new ForStatementSyntax(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement, this.parsedInStrictMode()); - }; - - ForStatementSyntax.create = function (forKeyword, openParenToken, firstSemicolonToken, secondSemicolonToken, closeParenToken, statement) { - return new ForStatementSyntax(forKeyword, openParenToken, null, null, firstSemicolonToken, null, secondSemicolonToken, null, closeParenToken, statement, false); - }; - - ForStatementSyntax.create1 = function (statement) { - return new ForStatementSyntax(TypeScript.Syntax.token(26 /* ForKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), null, null, TypeScript.Syntax.token(78 /* SemicolonToken */), null, TypeScript.Syntax.token(78 /* SemicolonToken */), null, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - ForStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ForStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ForStatementSyntax.prototype.withForKeyword = function (forKeyword) { - return this.update(forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.forKeyword, openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withVariableDeclaration = function (variableDeclaration) { - return this.update(this.forKeyword, this.openParenToken, variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withInitializer = function (initializer) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withFirstSemicolonToken = function (firstSemicolonToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withSecondSemicolonToken = function (secondSemicolonToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, secondSemicolonToken, this.incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withIncrementor = function (incrementor) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, incrementor, this.closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, closeParenToken, this.statement); - }; - - ForStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.initializer, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementor, this.closeParenToken, statement); - }; - - ForStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.variableDeclaration !== null && this.variableDeclaration.isTypeScriptSpecific()) { - return true; - } - if (this.initializer !== null && this.initializer.isTypeScriptSpecific()) { - return true; - } - if (this.condition !== null && this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.incrementor !== null && this.incrementor.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ForStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ForStatementSyntax = ForStatementSyntax; - - var ForInStatementSyntax = (function (_super) { - __extends(ForInStatementSyntax, _super); - function ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.forKeyword = forKeyword; - this.openParenToken = openParenToken; - this.variableDeclaration = variableDeclaration; - this.left = left; - this.inKeyword = inKeyword; - this.expression = expression; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - ForInStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitForInStatement(this); - }; - - ForInStatementSyntax.prototype.kind = function () { - return 155 /* ForInStatement */; - }; - - ForInStatementSyntax.prototype.childCount = function () { - return 8; - }; - - ForInStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.forKeyword; - case 1: - return this.openParenToken; - case 2: - return this.variableDeclaration; - case 3: - return this.left; - case 4: - return this.inKeyword; - case 5: - return this.expression; - case 6: - return this.closeParenToken; - case 7: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ForInStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - ForInStatementSyntax.prototype.isStatement = function () { - return true; - }; - - ForInStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - ForInStatementSyntax.prototype.update = function (forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - if (this.forKeyword === forKeyword && this.openParenToken === openParenToken && this.variableDeclaration === variableDeclaration && this.left === left && this.inKeyword === inKeyword && this.expression === expression && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new ForInStatementSyntax(forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement, this.parsedInStrictMode()); - }; - - ForInStatementSyntax.create = function (forKeyword, openParenToken, inKeyword, expression, closeParenToken, statement) { - return new ForInStatementSyntax(forKeyword, openParenToken, null, null, inKeyword, expression, closeParenToken, statement, false); - }; - - ForInStatementSyntax.create1 = function (expression, statement) { - return new ForInStatementSyntax(TypeScript.Syntax.token(26 /* ForKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), null, null, TypeScript.Syntax.token(29 /* InKeyword */), expression, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - ForInStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ForInStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ForInStatementSyntax.prototype.withForKeyword = function (forKeyword) { - return this.update(forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.forKeyword, openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withVariableDeclaration = function (variableDeclaration) { - return this.update(this.forKeyword, this.openParenToken, variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withLeft = function (left) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, left, this.inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withInKeyword = function (inKeyword) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, inKeyword, this.expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withExpression = function (expression) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, expression, this.closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, closeParenToken, this.statement); - }; - - ForInStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.forKeyword, this.openParenToken, this.variableDeclaration, this.left, this.inKeyword, this.expression, this.closeParenToken, statement); - }; - - ForInStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.variableDeclaration !== null && this.variableDeclaration.isTypeScriptSpecific()) { - return true; - } - if (this.left !== null && this.left.isTypeScriptSpecific()) { - return true; - } - if (this.expression.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ForInStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ForInStatementSyntax = ForInStatementSyntax; - - var WhileStatementSyntax = (function (_super) { - __extends(WhileStatementSyntax, _super); - function WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.whileKeyword = whileKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - WhileStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitWhileStatement(this); - }; - - WhileStatementSyntax.prototype.kind = function () { - return 158 /* WhileStatement */; - }; - - WhileStatementSyntax.prototype.childCount = function () { - return 5; - }; - - WhileStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.whileKeyword; - case 1: - return this.openParenToken; - case 2: - return this.condition; - case 3: - return this.closeParenToken; - case 4: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - WhileStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - WhileStatementSyntax.prototype.isStatement = function () { - return true; - }; - - WhileStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - WhileStatementSyntax.prototype.update = function (whileKeyword, openParenToken, condition, closeParenToken, statement) { - if (this.whileKeyword === whileKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new WhileStatementSyntax(whileKeyword, openParenToken, condition, closeParenToken, statement, this.parsedInStrictMode()); - }; - - WhileStatementSyntax.create1 = function (condition, statement) { - return new WhileStatementSyntax(TypeScript.Syntax.token(42 /* WhileKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - WhileStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - WhileStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - WhileStatementSyntax.prototype.withWhileKeyword = function (whileKeyword) { - return this.update(whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.whileKeyword, openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.whileKeyword, this.openParenToken, condition, this.closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.whileKeyword, this.openParenToken, this.condition, closeParenToken, this.statement); - }; - - WhileStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, statement); - }; - - WhileStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return WhileStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.WhileStatementSyntax = WhileStatementSyntax; - - var WithStatementSyntax = (function (_super) { - __extends(WithStatementSyntax, _super); - function WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.withKeyword = withKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.statement = statement; - } - WithStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitWithStatement(this); - }; - - WithStatementSyntax.prototype.kind = function () { - return 163 /* WithStatement */; - }; - - WithStatementSyntax.prototype.childCount = function () { - return 5; - }; - - WithStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.withKeyword; - case 1: - return this.openParenToken; - case 2: - return this.condition; - case 3: - return this.closeParenToken; - case 4: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - WithStatementSyntax.prototype.isStatement = function () { - return true; - }; - - WithStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - WithStatementSyntax.prototype.update = function (withKeyword, openParenToken, condition, closeParenToken, statement) { - if (this.withKeyword === withKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.statement === statement) { - return this; - } - - return new WithStatementSyntax(withKeyword, openParenToken, condition, closeParenToken, statement, this.parsedInStrictMode()); - }; - - WithStatementSyntax.create1 = function (condition, statement) { - return new WithStatementSyntax(TypeScript.Syntax.token(43 /* WithKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), statement, false); - }; - - WithStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - WithStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - WithStatementSyntax.prototype.withWithKeyword = function (withKeyword) { - return this.update(withKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.withKeyword, openParenToken, this.condition, this.closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.withKeyword, this.openParenToken, condition, this.closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.withKeyword, this.openParenToken, this.condition, closeParenToken, this.statement); - }; - - WithStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.withKeyword, this.openParenToken, this.condition, this.closeParenToken, statement); - }; - - WithStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.condition.isTypeScriptSpecific()) { - return true; - } - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return WithStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.WithStatementSyntax = WithStatementSyntax; - - var EnumDeclarationSyntax = (function (_super) { - __extends(EnumDeclarationSyntax, _super); - function EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.modifiers = modifiers; - this.enumKeyword = enumKeyword; - this.identifier = identifier; - this.openBraceToken = openBraceToken; - this.enumElements = enumElements; - this.closeBraceToken = closeBraceToken; - } - EnumDeclarationSyntax.prototype.accept = function (visitor) { - return visitor.visitEnumDeclaration(this); - }; - - EnumDeclarationSyntax.prototype.kind = function () { - return 132 /* EnumDeclaration */; - }; - - EnumDeclarationSyntax.prototype.childCount = function () { - return 6; - }; - - EnumDeclarationSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.modifiers; - case 1: - return this.enumKeyword; - case 2: - return this.identifier; - case 3: - return this.openBraceToken; - case 4: - return this.enumElements; - case 5: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EnumDeclarationSyntax.prototype.isModuleElement = function () { - return true; - }; - - EnumDeclarationSyntax.prototype.update = function (modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - if (this.modifiers === modifiers && this.enumKeyword === enumKeyword && this.identifier === identifier && this.openBraceToken === openBraceToken && this.enumElements === enumElements && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new EnumDeclarationSyntax(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken, this.parsedInStrictMode()); - }; - - EnumDeclarationSyntax.create = function (enumKeyword, identifier, openBraceToken, closeBraceToken) { - return new EnumDeclarationSyntax(TypeScript.Syntax.emptyList, enumKeyword, identifier, openBraceToken, TypeScript.Syntax.emptySeparatedList, closeBraceToken, false); - }; - - EnumDeclarationSyntax.create1 = function (identifier) { - return new EnumDeclarationSyntax(TypeScript.Syntax.emptyList, TypeScript.Syntax.token(46 /* EnumKeyword */), identifier, TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - EnumDeclarationSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EnumDeclarationSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EnumDeclarationSyntax.prototype.withModifiers = function (modifiers) { - return this.update(modifiers, this.enumKeyword, this.identifier, this.openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withModifier = function (modifier) { - return this.withModifiers(TypeScript.Syntax.list([modifier])); - }; - - EnumDeclarationSyntax.prototype.withEnumKeyword = function (enumKeyword) { - return this.update(this.modifiers, enumKeyword, this.identifier, this.openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.modifiers, this.enumKeyword, identifier, this.openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(this.modifiers, this.enumKeyword, this.identifier, openBraceToken, this.enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withEnumElements = function (enumElements) { - return this.update(this.modifiers, this.enumKeyword, this.identifier, this.openBraceToken, enumElements, this.closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.withEnumElement = function (enumElement) { - return this.withEnumElements(TypeScript.Syntax.separatedList([enumElement])); - }; - - EnumDeclarationSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.modifiers, this.enumKeyword, this.identifier, this.openBraceToken, this.enumElements, closeBraceToken); - }; - - EnumDeclarationSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return EnumDeclarationSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EnumDeclarationSyntax = EnumDeclarationSyntax; - - var EnumElementSyntax = (function (_super) { - __extends(EnumElementSyntax, _super); - function EnumElementSyntax(propertyName, equalsValueClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.equalsValueClause = equalsValueClause; - } - EnumElementSyntax.prototype.accept = function (visitor) { - return visitor.visitEnumElement(this); - }; - - EnumElementSyntax.prototype.kind = function () { - return 243 /* EnumElement */; - }; - - EnumElementSyntax.prototype.childCount = function () { - return 2; - }; - - EnumElementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.equalsValueClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EnumElementSyntax.prototype.update = function (propertyName, equalsValueClause) { - if (this.propertyName === propertyName && this.equalsValueClause === equalsValueClause) { - return this; - } - - return new EnumElementSyntax(propertyName, equalsValueClause, this.parsedInStrictMode()); - }; - - EnumElementSyntax.create = function (propertyName) { - return new EnumElementSyntax(propertyName, null, false); - }; - - EnumElementSyntax.create1 = function (propertyName) { - return new EnumElementSyntax(propertyName, null, false); - }; - - EnumElementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EnumElementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EnumElementSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.equalsValueClause); - }; - - EnumElementSyntax.prototype.withEqualsValueClause = function (equalsValueClause) { - return this.update(this.propertyName, equalsValueClause); - }; - - EnumElementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.equalsValueClause !== null && this.equalsValueClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return EnumElementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EnumElementSyntax = EnumElementSyntax; - - var CastExpressionSyntax = (function (_super) { - __extends(CastExpressionSyntax, _super); - function CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.lessThanToken = lessThanToken; - this.type = type; - this.greaterThanToken = greaterThanToken; - this.expression = expression; - } - CastExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitCastExpression(this); - }; - - CastExpressionSyntax.prototype.kind = function () { - return 220 /* CastExpression */; - }; - - CastExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - CastExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.lessThanToken; - case 1: - return this.type; - case 2: - return this.greaterThanToken; - case 3: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CastExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - CastExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - CastExpressionSyntax.prototype.update = function (lessThanToken, type, greaterThanToken, expression) { - if (this.lessThanToken === lessThanToken && this.type === type && this.greaterThanToken === greaterThanToken && this.expression === expression) { - return this; - } - - return new CastExpressionSyntax(lessThanToken, type, greaterThanToken, expression, this.parsedInStrictMode()); - }; - - CastExpressionSyntax.create1 = function (type, expression) { - return new CastExpressionSyntax(TypeScript.Syntax.token(80 /* LessThanToken */), type, TypeScript.Syntax.token(81 /* GreaterThanToken */), expression, false); - }; - - CastExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CastExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CastExpressionSyntax.prototype.withLessThanToken = function (lessThanToken) { - return this.update(lessThanToken, this.type, this.greaterThanToken, this.expression); - }; - - CastExpressionSyntax.prototype.withType = function (type) { - return this.update(this.lessThanToken, type, this.greaterThanToken, this.expression); - }; - - CastExpressionSyntax.prototype.withGreaterThanToken = function (greaterThanToken) { - return this.update(this.lessThanToken, this.type, greaterThanToken, this.expression); - }; - - CastExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.lessThanToken, this.type, this.greaterThanToken, expression); - }; - - CastExpressionSyntax.prototype.isTypeScriptSpecific = function () { - return true; - }; - return CastExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CastExpressionSyntax = CastExpressionSyntax; - - var ObjectLiteralExpressionSyntax = (function (_super) { - __extends(ObjectLiteralExpressionSyntax, _super); - function ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.openBraceToken = openBraceToken; - this.propertyAssignments = propertyAssignments; - this.closeBraceToken = closeBraceToken; - } - ObjectLiteralExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitObjectLiteralExpression(this); - }; - - ObjectLiteralExpressionSyntax.prototype.kind = function () { - return 215 /* ObjectLiteralExpression */; - }; - - ObjectLiteralExpressionSyntax.prototype.childCount = function () { - return 3; - }; - - ObjectLiteralExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.openBraceToken; - case 1: - return this.propertyAssignments; - case 2: - return this.closeBraceToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ObjectLiteralExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - ObjectLiteralExpressionSyntax.prototype.update = function (openBraceToken, propertyAssignments, closeBraceToken) { - if (this.openBraceToken === openBraceToken && this.propertyAssignments === propertyAssignments && this.closeBraceToken === closeBraceToken) { - return this; - } - - return new ObjectLiteralExpressionSyntax(openBraceToken, propertyAssignments, closeBraceToken, this.parsedInStrictMode()); - }; - - ObjectLiteralExpressionSyntax.create = function (openBraceToken, closeBraceToken) { - return new ObjectLiteralExpressionSyntax(openBraceToken, TypeScript.Syntax.emptySeparatedList, closeBraceToken, false); - }; - - ObjectLiteralExpressionSyntax.create1 = function () { - return new ObjectLiteralExpressionSyntax(TypeScript.Syntax.token(70 /* OpenBraceToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.token(71 /* CloseBraceToken */), false); - }; - - ObjectLiteralExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - ObjectLiteralExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - ObjectLiteralExpressionSyntax.prototype.withOpenBraceToken = function (openBraceToken) { - return this.update(openBraceToken, this.propertyAssignments, this.closeBraceToken); - }; - - ObjectLiteralExpressionSyntax.prototype.withPropertyAssignments = function (propertyAssignments) { - return this.update(this.openBraceToken, propertyAssignments, this.closeBraceToken); - }; - - ObjectLiteralExpressionSyntax.prototype.withPropertyAssignment = function (propertyAssignment) { - return this.withPropertyAssignments(TypeScript.Syntax.separatedList([propertyAssignment])); - }; - - ObjectLiteralExpressionSyntax.prototype.withCloseBraceToken = function (closeBraceToken) { - return this.update(this.openBraceToken, this.propertyAssignments, closeBraceToken); - }; - - ObjectLiteralExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.propertyAssignments.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return ObjectLiteralExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.ObjectLiteralExpressionSyntax = ObjectLiteralExpressionSyntax; - - var SimplePropertyAssignmentSyntax = (function (_super) { - __extends(SimplePropertyAssignmentSyntax, _super); - function SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.colonToken = colonToken; - this.expression = expression; - } - SimplePropertyAssignmentSyntax.prototype.accept = function (visitor) { - return visitor.visitSimplePropertyAssignment(this); - }; - - SimplePropertyAssignmentSyntax.prototype.kind = function () { - return 240 /* SimplePropertyAssignment */; - }; - - SimplePropertyAssignmentSyntax.prototype.childCount = function () { - return 3; - }; - - SimplePropertyAssignmentSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.colonToken; - case 2: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SimplePropertyAssignmentSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - SimplePropertyAssignmentSyntax.prototype.update = function (propertyName, colonToken, expression) { - if (this.propertyName === propertyName && this.colonToken === colonToken && this.expression === expression) { - return this; - } - - return new SimplePropertyAssignmentSyntax(propertyName, colonToken, expression, this.parsedInStrictMode()); - }; - - SimplePropertyAssignmentSyntax.create1 = function (propertyName, expression) { - return new SimplePropertyAssignmentSyntax(propertyName, TypeScript.Syntax.token(106 /* ColonToken */), expression, false); - }; - - SimplePropertyAssignmentSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - SimplePropertyAssignmentSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - SimplePropertyAssignmentSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.colonToken, this.expression); - }; - - SimplePropertyAssignmentSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.propertyName, colonToken, this.expression); - }; - - SimplePropertyAssignmentSyntax.prototype.withExpression = function (expression) { - return this.update(this.propertyName, this.colonToken, expression); - }; - - SimplePropertyAssignmentSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return SimplePropertyAssignmentSyntax; - })(TypeScript.SyntaxNode); - TypeScript.SimplePropertyAssignmentSyntax = SimplePropertyAssignmentSyntax; - - var FunctionPropertyAssignmentSyntax = (function (_super) { - __extends(FunctionPropertyAssignmentSyntax, _super); - function FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - } - FunctionPropertyAssignmentSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionPropertyAssignment(this); - }; - - FunctionPropertyAssignmentSyntax.prototype.kind = function () { - return 241 /* FunctionPropertyAssignment */; - }; - - FunctionPropertyAssignmentSyntax.prototype.childCount = function () { - return 3; - }; - - FunctionPropertyAssignmentSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.propertyName; - case 1: - return this.callSignature; - case 2: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionPropertyAssignmentSyntax.prototype.isPropertyAssignment = function () { - return true; - }; - - FunctionPropertyAssignmentSyntax.prototype.update = function (propertyName, callSignature, block) { - if (this.propertyName === propertyName && this.callSignature === callSignature && this.block === block) { - return this; - } - - return new FunctionPropertyAssignmentSyntax(propertyName, callSignature, block, this.parsedInStrictMode()); - }; - - FunctionPropertyAssignmentSyntax.create1 = function (propertyName) { - return new FunctionPropertyAssignmentSyntax(propertyName, CallSignatureSyntax.create1(), BlockSyntax.create1(), false); - }; - - FunctionPropertyAssignmentSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionPropertyAssignmentSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionPropertyAssignmentSyntax.prototype.withPropertyName = function (propertyName) { - return this.update(propertyName, this.callSignature, this.block); - }; - - FunctionPropertyAssignmentSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.propertyName, callSignature, this.block); - }; - - FunctionPropertyAssignmentSyntax.prototype.withBlock = function (block) { - return this.update(this.propertyName, this.callSignature, block); - }; - - FunctionPropertyAssignmentSyntax.prototype.isTypeScriptSpecific = function () { - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FunctionPropertyAssignmentSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionPropertyAssignmentSyntax = FunctionPropertyAssignmentSyntax; - - var FunctionExpressionSyntax = (function (_super) { - __extends(FunctionExpressionSyntax, _super); - function FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.functionKeyword = functionKeyword; - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - } - FunctionExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitFunctionExpression(this); - }; - - FunctionExpressionSyntax.prototype.kind = function () { - return 222 /* FunctionExpression */; - }; - - FunctionExpressionSyntax.prototype.childCount = function () { - return 4; - }; - - FunctionExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.functionKeyword; - case 1: - return this.identifier; - case 2: - return this.callSignature; - case 3: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FunctionExpressionSyntax.prototype.isPrimaryExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isMemberExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isPostfixExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - FunctionExpressionSyntax.prototype.update = function (functionKeyword, identifier, callSignature, block) { - if (this.functionKeyword === functionKeyword && this.identifier === identifier && this.callSignature === callSignature && this.block === block) { - return this; - } - - return new FunctionExpressionSyntax(functionKeyword, identifier, callSignature, block, this.parsedInStrictMode()); - }; - - FunctionExpressionSyntax.create = function (functionKeyword, callSignature, block) { - return new FunctionExpressionSyntax(functionKeyword, null, callSignature, block, false); - }; - - FunctionExpressionSyntax.create1 = function () { - return new FunctionExpressionSyntax(TypeScript.Syntax.token(27 /* FunctionKeyword */), null, CallSignatureSyntax.create1(), BlockSyntax.create1(), false); - }; - - FunctionExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FunctionExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FunctionExpressionSyntax.prototype.withFunctionKeyword = function (functionKeyword) { - return this.update(functionKeyword, this.identifier, this.callSignature, this.block); - }; - - FunctionExpressionSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.functionKeyword, identifier, this.callSignature, this.block); - }; - - FunctionExpressionSyntax.prototype.withCallSignature = function (callSignature) { - return this.update(this.functionKeyword, this.identifier, callSignature, this.block); - }; - - FunctionExpressionSyntax.prototype.withBlock = function (block) { - return this.update(this.functionKeyword, this.identifier, this.callSignature, block); - }; - - FunctionExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.callSignature.isTypeScriptSpecific()) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FunctionExpressionSyntax = FunctionExpressionSyntax; - - var EmptyStatementSyntax = (function (_super) { - __extends(EmptyStatementSyntax, _super); - function EmptyStatementSyntax(semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.semicolonToken = semicolonToken; - } - EmptyStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitEmptyStatement(this); - }; - - EmptyStatementSyntax.prototype.kind = function () { - return 156 /* EmptyStatement */; - }; - - EmptyStatementSyntax.prototype.childCount = function () { - return 1; - }; - - EmptyStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - EmptyStatementSyntax.prototype.isStatement = function () { - return true; - }; - - EmptyStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - EmptyStatementSyntax.prototype.update = function (semicolonToken) { - if (this.semicolonToken === semicolonToken) { - return this; - } - - return new EmptyStatementSyntax(semicolonToken, this.parsedInStrictMode()); - }; - - EmptyStatementSyntax.create1 = function () { - return new EmptyStatementSyntax(TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - EmptyStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - EmptyStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - EmptyStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(semicolonToken); - }; - - EmptyStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return EmptyStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.EmptyStatementSyntax = EmptyStatementSyntax; - - var TryStatementSyntax = (function (_super) { - __extends(TryStatementSyntax, _super); - function TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.tryKeyword = tryKeyword; - this.block = block; - this.catchClause = catchClause; - this.finallyClause = finallyClause; - } - TryStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitTryStatement(this); - }; - - TryStatementSyntax.prototype.kind = function () { - return 159 /* TryStatement */; - }; - - TryStatementSyntax.prototype.childCount = function () { - return 4; - }; - - TryStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.tryKeyword; - case 1: - return this.block; - case 2: - return this.catchClause; - case 3: - return this.finallyClause; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TryStatementSyntax.prototype.isStatement = function () { - return true; - }; - - TryStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - TryStatementSyntax.prototype.update = function (tryKeyword, block, catchClause, finallyClause) { - if (this.tryKeyword === tryKeyword && this.block === block && this.catchClause === catchClause && this.finallyClause === finallyClause) { - return this; - } - - return new TryStatementSyntax(tryKeyword, block, catchClause, finallyClause, this.parsedInStrictMode()); - }; - - TryStatementSyntax.create = function (tryKeyword, block) { - return new TryStatementSyntax(tryKeyword, block, null, null, false); - }; - - TryStatementSyntax.create1 = function () { - return new TryStatementSyntax(TypeScript.Syntax.token(38 /* TryKeyword */), BlockSyntax.create1(), null, null, false); - }; - - TryStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TryStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TryStatementSyntax.prototype.withTryKeyword = function (tryKeyword) { - return this.update(tryKeyword, this.block, this.catchClause, this.finallyClause); - }; - - TryStatementSyntax.prototype.withBlock = function (block) { - return this.update(this.tryKeyword, block, this.catchClause, this.finallyClause); - }; - - TryStatementSyntax.prototype.withCatchClause = function (catchClause) { - return this.update(this.tryKeyword, this.block, catchClause, this.finallyClause); - }; - - TryStatementSyntax.prototype.withFinallyClause = function (finallyClause) { - return this.update(this.tryKeyword, this.block, this.catchClause, finallyClause); - }; - - TryStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.block.isTypeScriptSpecific()) { - return true; - } - if (this.catchClause !== null && this.catchClause.isTypeScriptSpecific()) { - return true; - } - if (this.finallyClause !== null && this.finallyClause.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return TryStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TryStatementSyntax = TryStatementSyntax; - - var CatchClauseSyntax = (function (_super) { - __extends(CatchClauseSyntax, _super); - function CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.catchKeyword = catchKeyword; - this.openParenToken = openParenToken; - this.identifier = identifier; - this.typeAnnotation = typeAnnotation; - this.closeParenToken = closeParenToken; - this.block = block; - } - CatchClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitCatchClause(this); - }; - - CatchClauseSyntax.prototype.kind = function () { - return 236 /* CatchClause */; - }; - - CatchClauseSyntax.prototype.childCount = function () { - return 6; - }; - - CatchClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.catchKeyword; - case 1: - return this.openParenToken; - case 2: - return this.identifier; - case 3: - return this.typeAnnotation; - case 4: - return this.closeParenToken; - case 5: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - CatchClauseSyntax.prototype.update = function (catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - if (this.catchKeyword === catchKeyword && this.openParenToken === openParenToken && this.identifier === identifier && this.typeAnnotation === typeAnnotation && this.closeParenToken === closeParenToken && this.block === block) { - return this; - } - - return new CatchClauseSyntax(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block, this.parsedInStrictMode()); - }; - - CatchClauseSyntax.create = function (catchKeyword, openParenToken, identifier, closeParenToken, block) { - return new CatchClauseSyntax(catchKeyword, openParenToken, identifier, null, closeParenToken, block, false); - }; - - CatchClauseSyntax.create1 = function (identifier) { - return new CatchClauseSyntax(TypeScript.Syntax.token(17 /* CatchKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), identifier, null, TypeScript.Syntax.token(73 /* CloseParenToken */), BlockSyntax.create1(), false); - }; - - CatchClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - CatchClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - CatchClauseSyntax.prototype.withCatchKeyword = function (catchKeyword) { - return this.update(catchKeyword, this.openParenToken, this.identifier, this.typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.catchKeyword, openParenToken, this.identifier, this.typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withIdentifier = function (identifier) { - return this.update(this.catchKeyword, this.openParenToken, identifier, this.typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withTypeAnnotation = function (typeAnnotation) { - return this.update(this.catchKeyword, this.openParenToken, this.identifier, typeAnnotation, this.closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.catchKeyword, this.openParenToken, this.identifier, this.typeAnnotation, closeParenToken, this.block); - }; - - CatchClauseSyntax.prototype.withBlock = function (block) { - return this.update(this.catchKeyword, this.openParenToken, this.identifier, this.typeAnnotation, this.closeParenToken, block); - }; - - CatchClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.typeAnnotation !== null && this.typeAnnotation.isTypeScriptSpecific()) { - return true; - } - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return CatchClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.CatchClauseSyntax = CatchClauseSyntax; - - var FinallyClauseSyntax = (function (_super) { - __extends(FinallyClauseSyntax, _super); - function FinallyClauseSyntax(finallyKeyword, block, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.finallyKeyword = finallyKeyword; - this.block = block; - } - FinallyClauseSyntax.prototype.accept = function (visitor) { - return visitor.visitFinallyClause(this); - }; - - FinallyClauseSyntax.prototype.kind = function () { - return 237 /* FinallyClause */; - }; - - FinallyClauseSyntax.prototype.childCount = function () { - return 2; - }; - - FinallyClauseSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.finallyKeyword; - case 1: - return this.block; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - FinallyClauseSyntax.prototype.update = function (finallyKeyword, block) { - if (this.finallyKeyword === finallyKeyword && this.block === block) { - return this; - } - - return new FinallyClauseSyntax(finallyKeyword, block, this.parsedInStrictMode()); - }; - - FinallyClauseSyntax.create1 = function () { - return new FinallyClauseSyntax(TypeScript.Syntax.token(25 /* FinallyKeyword */), BlockSyntax.create1(), false); - }; - - FinallyClauseSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - FinallyClauseSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - FinallyClauseSyntax.prototype.withFinallyKeyword = function (finallyKeyword) { - return this.update(finallyKeyword, this.block); - }; - - FinallyClauseSyntax.prototype.withBlock = function (block) { - return this.update(this.finallyKeyword, block); - }; - - FinallyClauseSyntax.prototype.isTypeScriptSpecific = function () { - if (this.block.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return FinallyClauseSyntax; - })(TypeScript.SyntaxNode); - TypeScript.FinallyClauseSyntax = FinallyClauseSyntax; - - var LabeledStatementSyntax = (function (_super) { - __extends(LabeledStatementSyntax, _super); - function LabeledStatementSyntax(identifier, colonToken, statement, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.identifier = identifier; - this.colonToken = colonToken; - this.statement = statement; - } - LabeledStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitLabeledStatement(this); - }; - - LabeledStatementSyntax.prototype.kind = function () { - return 160 /* LabeledStatement */; - }; - - LabeledStatementSyntax.prototype.childCount = function () { - return 3; - }; - - LabeledStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.identifier; - case 1: - return this.colonToken; - case 2: - return this.statement; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - LabeledStatementSyntax.prototype.isStatement = function () { - return true; - }; - - LabeledStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - LabeledStatementSyntax.prototype.update = function (identifier, colonToken, statement) { - if (this.identifier === identifier && this.colonToken === colonToken && this.statement === statement) { - return this; - } - - return new LabeledStatementSyntax(identifier, colonToken, statement, this.parsedInStrictMode()); - }; - - LabeledStatementSyntax.create1 = function (identifier, statement) { - return new LabeledStatementSyntax(identifier, TypeScript.Syntax.token(106 /* ColonToken */), statement, false); - }; - - LabeledStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - LabeledStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - LabeledStatementSyntax.prototype.withIdentifier = function (identifier) { - return this.update(identifier, this.colonToken, this.statement); - }; - - LabeledStatementSyntax.prototype.withColonToken = function (colonToken) { - return this.update(this.identifier, colonToken, this.statement); - }; - - LabeledStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.identifier, this.colonToken, statement); - }; - - LabeledStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statement.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return LabeledStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.LabeledStatementSyntax = LabeledStatementSyntax; - - var DoStatementSyntax = (function (_super) { - __extends(DoStatementSyntax, _super); - function DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.doKeyword = doKeyword; - this.statement = statement; - this.whileKeyword = whileKeyword; - this.openParenToken = openParenToken; - this.condition = condition; - this.closeParenToken = closeParenToken; - this.semicolonToken = semicolonToken; - } - DoStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitDoStatement(this); - }; - - DoStatementSyntax.prototype.kind = function () { - return 161 /* DoStatement */; - }; - - DoStatementSyntax.prototype.childCount = function () { - return 7; - }; - - DoStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.doKeyword; - case 1: - return this.statement; - case 2: - return this.whileKeyword; - case 3: - return this.openParenToken; - case 4: - return this.condition; - case 5: - return this.closeParenToken; - case 6: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DoStatementSyntax.prototype.isIterationStatement = function () { - return true; - }; - - DoStatementSyntax.prototype.isStatement = function () { - return true; - }; - - DoStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - DoStatementSyntax.prototype.update = function (doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - if (this.doKeyword === doKeyword && this.statement === statement && this.whileKeyword === whileKeyword && this.openParenToken === openParenToken && this.condition === condition && this.closeParenToken === closeParenToken && this.semicolonToken === semicolonToken) { - return this; - } - - return new DoStatementSyntax(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.parsedInStrictMode()); - }; - - DoStatementSyntax.create1 = function (statement, condition) { - return new DoStatementSyntax(TypeScript.Syntax.token(22 /* DoKeyword */), statement, TypeScript.Syntax.token(42 /* WhileKeyword */), TypeScript.Syntax.token(72 /* OpenParenToken */), condition, TypeScript.Syntax.token(73 /* CloseParenToken */), TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - DoStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DoStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DoStatementSyntax.prototype.withDoKeyword = function (doKeyword) { - return this.update(doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withStatement = function (statement) { - return this.update(this.doKeyword, statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withWhileKeyword = function (whileKeyword) { - return this.update(this.doKeyword, this.statement, whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withOpenParenToken = function (openParenToken) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, openParenToken, this.condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withCondition = function (condition) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, condition, this.closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withCloseParenToken = function (closeParenToken) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, closeParenToken, this.semicolonToken); - }; - - DoStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, semicolonToken); - }; - - DoStatementSyntax.prototype.isTypeScriptSpecific = function () { - if (this.statement.isTypeScriptSpecific()) { - return true; - } - if (this.condition.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return DoStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DoStatementSyntax = DoStatementSyntax; - - var TypeOfExpressionSyntax = (function (_super) { - __extends(TypeOfExpressionSyntax, _super); - function TypeOfExpressionSyntax(typeOfKeyword, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.typeOfKeyword = typeOfKeyword; - this.expression = expression; - } - TypeOfExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitTypeOfExpression(this); - }; - - TypeOfExpressionSyntax.prototype.kind = function () { - return 171 /* TypeOfExpression */; - }; - - TypeOfExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - TypeOfExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.typeOfKeyword; - case 1: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - TypeOfExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - TypeOfExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - TypeOfExpressionSyntax.prototype.update = function (typeOfKeyword, expression) { - if (this.typeOfKeyword === typeOfKeyword && this.expression === expression) { - return this; - } - - return new TypeOfExpressionSyntax(typeOfKeyword, expression, this.parsedInStrictMode()); - }; - - TypeOfExpressionSyntax.create1 = function (expression) { - return new TypeOfExpressionSyntax(TypeScript.Syntax.token(39 /* TypeOfKeyword */), expression, false); - }; - - TypeOfExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - TypeOfExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - TypeOfExpressionSyntax.prototype.withTypeOfKeyword = function (typeOfKeyword) { - return this.update(typeOfKeyword, this.expression); - }; - - TypeOfExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.typeOfKeyword, expression); - }; - - TypeOfExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return TypeOfExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.TypeOfExpressionSyntax = TypeOfExpressionSyntax; - - var DeleteExpressionSyntax = (function (_super) { - __extends(DeleteExpressionSyntax, _super); - function DeleteExpressionSyntax(deleteKeyword, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.deleteKeyword = deleteKeyword; - this.expression = expression; - } - DeleteExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitDeleteExpression(this); - }; - - DeleteExpressionSyntax.prototype.kind = function () { - return 170 /* DeleteExpression */; - }; - - DeleteExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - DeleteExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.deleteKeyword; - case 1: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DeleteExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - DeleteExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - DeleteExpressionSyntax.prototype.update = function (deleteKeyword, expression) { - if (this.deleteKeyword === deleteKeyword && this.expression === expression) { - return this; - } - - return new DeleteExpressionSyntax(deleteKeyword, expression, this.parsedInStrictMode()); - }; - - DeleteExpressionSyntax.create1 = function (expression) { - return new DeleteExpressionSyntax(TypeScript.Syntax.token(21 /* DeleteKeyword */), expression, false); - }; - - DeleteExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DeleteExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DeleteExpressionSyntax.prototype.withDeleteKeyword = function (deleteKeyword) { - return this.update(deleteKeyword, this.expression); - }; - - DeleteExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.deleteKeyword, expression); - }; - - DeleteExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return DeleteExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DeleteExpressionSyntax = DeleteExpressionSyntax; - - var VoidExpressionSyntax = (function (_super) { - __extends(VoidExpressionSyntax, _super); - function VoidExpressionSyntax(voidKeyword, expression, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.voidKeyword = voidKeyword; - this.expression = expression; - } - VoidExpressionSyntax.prototype.accept = function (visitor) { - return visitor.visitVoidExpression(this); - }; - - VoidExpressionSyntax.prototype.kind = function () { - return 172 /* VoidExpression */; - }; - - VoidExpressionSyntax.prototype.childCount = function () { - return 2; - }; - - VoidExpressionSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.voidKeyword; - case 1: - return this.expression; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - VoidExpressionSyntax.prototype.isUnaryExpression = function () { - return true; - }; - - VoidExpressionSyntax.prototype.isExpression = function () { - return true; - }; - - VoidExpressionSyntax.prototype.update = function (voidKeyword, expression) { - if (this.voidKeyword === voidKeyword && this.expression === expression) { - return this; - } - - return new VoidExpressionSyntax(voidKeyword, expression, this.parsedInStrictMode()); - }; - - VoidExpressionSyntax.create1 = function (expression) { - return new VoidExpressionSyntax(TypeScript.Syntax.token(41 /* VoidKeyword */), expression, false); - }; - - VoidExpressionSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - VoidExpressionSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - VoidExpressionSyntax.prototype.withVoidKeyword = function (voidKeyword) { - return this.update(voidKeyword, this.expression); - }; - - VoidExpressionSyntax.prototype.withExpression = function (expression) { - return this.update(this.voidKeyword, expression); - }; - - VoidExpressionSyntax.prototype.isTypeScriptSpecific = function () { - if (this.expression.isTypeScriptSpecific()) { - return true; - } - return false; - }; - return VoidExpressionSyntax; - })(TypeScript.SyntaxNode); - TypeScript.VoidExpressionSyntax = VoidExpressionSyntax; - - var DebuggerStatementSyntax = (function (_super) { - __extends(DebuggerStatementSyntax, _super); - function DebuggerStatementSyntax(debuggerKeyword, semicolonToken, parsedInStrictMode) { - _super.call(this, parsedInStrictMode); - this.debuggerKeyword = debuggerKeyword; - this.semicolonToken = semicolonToken; - } - DebuggerStatementSyntax.prototype.accept = function (visitor) { - return visitor.visitDebuggerStatement(this); - }; - - DebuggerStatementSyntax.prototype.kind = function () { - return 162 /* DebuggerStatement */; - }; - - DebuggerStatementSyntax.prototype.childCount = function () { - return 2; - }; - - DebuggerStatementSyntax.prototype.childAt = function (slot) { - switch (slot) { - case 0: - return this.debuggerKeyword; - case 1: - return this.semicolonToken; - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - DebuggerStatementSyntax.prototype.isStatement = function () { - return true; - }; - - DebuggerStatementSyntax.prototype.isModuleElement = function () { - return true; - }; - - DebuggerStatementSyntax.prototype.update = function (debuggerKeyword, semicolonToken) { - if (this.debuggerKeyword === debuggerKeyword && this.semicolonToken === semicolonToken) { - return this; - } - - return new DebuggerStatementSyntax(debuggerKeyword, semicolonToken, this.parsedInStrictMode()); - }; - - DebuggerStatementSyntax.create1 = function () { - return new DebuggerStatementSyntax(TypeScript.Syntax.token(19 /* DebuggerKeyword */), TypeScript.Syntax.token(78 /* SemicolonToken */), false); - }; - - DebuggerStatementSyntax.prototype.withLeadingTrivia = function (trivia) { - return _super.prototype.withLeadingTrivia.call(this, trivia); - }; - - DebuggerStatementSyntax.prototype.withTrailingTrivia = function (trivia) { - return _super.prototype.withTrailingTrivia.call(this, trivia); - }; - - DebuggerStatementSyntax.prototype.withDebuggerKeyword = function (debuggerKeyword) { - return this.update(debuggerKeyword, this.semicolonToken); - }; - - DebuggerStatementSyntax.prototype.withSemicolonToken = function (semicolonToken) { - return this.update(this.debuggerKeyword, semicolonToken); - }; - - DebuggerStatementSyntax.prototype.isTypeScriptSpecific = function () { - return false; - }; - return DebuggerStatementSyntax; - })(TypeScript.SyntaxNode); - TypeScript.DebuggerStatementSyntax = DebuggerStatementSyntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxRewriter = (function () { - function SyntaxRewriter() { - } - SyntaxRewriter.prototype.visitToken = function (token) { - return token; - }; - - SyntaxRewriter.prototype.visitNode = function (node) { - return node.accept(this); - }; - - SyntaxRewriter.prototype.visitNodeOrToken = function (node) { - return node.isToken() ? this.visitToken(node) : this.visitNode(node); - }; - - SyntaxRewriter.prototype.visitList = function (list) { - var newItems = null; - - for (var i = 0, n = list.childCount(); i < n; i++) { - var item = list.childAt(i); - var newItem = this.visitNodeOrToken(item); - - if (item !== newItem && newItems === null) { - newItems = []; - for (var j = 0; j < i; j++) { - newItems.push(list.childAt(j)); - } - } - - if (newItems) { - newItems.push(newItem); - } - } - - return newItems === null ? list : TypeScript.Syntax.list(newItems); - }; - - SyntaxRewriter.prototype.visitSeparatedList = function (list) { - var newItems = null; - - for (var i = 0, n = list.childCount(); i < n; i++) { - var item = list.childAt(i); - var newItem = item.isToken() ? this.visitToken(item) : this.visitNode(item); - - if (item !== newItem && newItems === null) { - newItems = []; - for (var j = 0; j < i; j++) { - newItems.push(list.childAt(j)); - } - } - - if (newItems) { - newItems.push(newItem); - } - } - - return newItems === null ? list : TypeScript.Syntax.separatedList(newItems); - }; - - SyntaxRewriter.prototype.visitSourceUnit = function (node) { - return node.update(this.visitList(node.moduleElements), this.visitToken(node.endOfFileToken)); - }; - - SyntaxRewriter.prototype.visitExternalModuleReference = function (node) { - return node.update(this.visitToken(node.requireKeyword), this.visitToken(node.openParenToken), this.visitToken(node.stringLiteral), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitModuleNameModuleReference = function (node) { - return node.update(this.visitNodeOrToken(node.moduleName)); - }; - - SyntaxRewriter.prototype.visitImportDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.importKeyword), this.visitToken(node.identifier), this.visitToken(node.equalsToken), this.visitNodeOrToken(node.moduleReference), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitExportAssignment = function (node) { - return node.update(this.visitToken(node.exportKeyword), this.visitToken(node.equalsToken), this.visitToken(node.identifier), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitClassDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.classKeyword), this.visitToken(node.identifier), node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitList(node.heritageClauses), this.visitToken(node.openBraceToken), this.visitList(node.classElements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitInterfaceDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.interfaceKeyword), this.visitToken(node.identifier), node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitList(node.heritageClauses), this.visitNode(node.body)); - }; - - SyntaxRewriter.prototype.visitHeritageClause = function (node) { - return node.update(node.kind(), this.visitToken(node.extendsOrImplementsKeyword), this.visitSeparatedList(node.typeNames)); - }; - - SyntaxRewriter.prototype.visitModuleDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.moduleKeyword), node.name === null ? null : this.visitNodeOrToken(node.name), node.stringLiteral === null ? null : this.visitToken(node.stringLiteral), this.visitToken(node.openBraceToken), this.visitList(node.moduleElements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitFunctionDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.functionKeyword), this.visitToken(node.identifier), this.visitNode(node.callSignature), node.block === null ? null : this.visitNode(node.block), node.semicolonToken === null ? null : this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitVariableStatement = function (node) { - return node.update(this.visitList(node.modifiers), this.visitNode(node.variableDeclaration), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitVariableDeclaration = function (node) { - return node.update(this.visitToken(node.varKeyword), this.visitSeparatedList(node.variableDeclarators)); - }; - - SyntaxRewriter.prototype.visitVariableDeclarator = function (node) { - return node.update(this.visitToken(node.propertyName), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), node.equalsValueClause === null ? null : this.visitNode(node.equalsValueClause)); - }; - - SyntaxRewriter.prototype.visitEqualsValueClause = function (node) { - return node.update(this.visitToken(node.equalsToken), this.visitNodeOrToken(node.value)); - }; - - SyntaxRewriter.prototype.visitPrefixUnaryExpression = function (node) { - return node.update(node.kind(), this.visitToken(node.operatorToken), this.visitNodeOrToken(node.operand)); - }; - - SyntaxRewriter.prototype.visitArrayLiteralExpression = function (node) { - return node.update(this.visitToken(node.openBracketToken), this.visitSeparatedList(node.expressions), this.visitToken(node.closeBracketToken)); - }; - - SyntaxRewriter.prototype.visitOmittedExpression = function (node) { - return node; - }; - - SyntaxRewriter.prototype.visitParenthesizedExpression = function (node) { - return node.update(this.visitToken(node.openParenToken), this.visitNodeOrToken(node.expression), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitSimpleArrowFunctionExpression = function (node) { - return node.update(this.visitToken(node.identifier), this.visitToken(node.equalsGreaterThanToken), node.block === null ? null : this.visitNode(node.block), node.expression === null ? null : this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - return node.update(this.visitNode(node.callSignature), this.visitToken(node.equalsGreaterThanToken), node.block === null ? null : this.visitNode(node.block), node.expression === null ? null : this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitQualifiedName = function (node) { - return node.update(this.visitNodeOrToken(node.left), this.visitToken(node.dotToken), this.visitToken(node.right)); - }; - - SyntaxRewriter.prototype.visitTypeArgumentList = function (node) { - return node.update(this.visitToken(node.lessThanToken), this.visitSeparatedList(node.typeArguments), this.visitToken(node.greaterThanToken)); - }; - - SyntaxRewriter.prototype.visitConstructorType = function (node) { - return node.update(this.visitToken(node.newKeyword), node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitNode(node.parameterList), this.visitToken(node.equalsGreaterThanToken), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitFunctionType = function (node) { - return node.update(node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitNode(node.parameterList), this.visitToken(node.equalsGreaterThanToken), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitObjectType = function (node) { - return node.update(this.visitToken(node.openBraceToken), this.visitSeparatedList(node.typeMembers), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitArrayType = function (node) { - return node.update(this.visitNodeOrToken(node.type), this.visitToken(node.openBracketToken), this.visitToken(node.closeBracketToken)); - }; - - SyntaxRewriter.prototype.visitGenericType = function (node) { - return node.update(this.visitNodeOrToken(node.name), this.visitNode(node.typeArgumentList)); - }; - - SyntaxRewriter.prototype.visitTypeQuery = function (node) { - return node.update(this.visitToken(node.typeOfKeyword), this.visitNodeOrToken(node.name)); - }; - - SyntaxRewriter.prototype.visitTypeAnnotation = function (node) { - return node.update(this.visitToken(node.colonToken), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitBlock = function (node) { - return node.update(this.visitToken(node.openBraceToken), this.visitList(node.statements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitParameter = function (node) { - return node.update(node.dotDotDotToken === null ? null : this.visitToken(node.dotDotDotToken), this.visitList(node.modifiers), this.visitToken(node.identifier), node.questionToken === null ? null : this.visitToken(node.questionToken), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), node.equalsValueClause === null ? null : this.visitNode(node.equalsValueClause)); - }; - - SyntaxRewriter.prototype.visitMemberAccessExpression = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitToken(node.dotToken), this.visitToken(node.name)); - }; - - SyntaxRewriter.prototype.visitPostfixUnaryExpression = function (node) { - return node.update(node.kind(), this.visitNodeOrToken(node.operand), this.visitToken(node.operatorToken)); - }; - - SyntaxRewriter.prototype.visitElementAccessExpression = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitToken(node.openBracketToken), this.visitNodeOrToken(node.argumentExpression), this.visitToken(node.closeBracketToken)); - }; - - SyntaxRewriter.prototype.visitInvocationExpression = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitNode(node.argumentList)); - }; - - SyntaxRewriter.prototype.visitArgumentList = function (node) { - return node.update(node.typeArgumentList === null ? null : this.visitNode(node.typeArgumentList), this.visitToken(node.openParenToken), this.visitSeparatedList(node.arguments), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitBinaryExpression = function (node) { - return node.update(node.kind(), this.visitNodeOrToken(node.left), this.visitToken(node.operatorToken), this.visitNodeOrToken(node.right)); - }; - - SyntaxRewriter.prototype.visitConditionalExpression = function (node) { - return node.update(this.visitNodeOrToken(node.condition), this.visitToken(node.questionToken), this.visitNodeOrToken(node.whenTrue), this.visitToken(node.colonToken), this.visitNodeOrToken(node.whenFalse)); - }; - - SyntaxRewriter.prototype.visitConstructSignature = function (node) { - return node.update(this.visitToken(node.newKeyword), this.visitNode(node.callSignature)); - }; - - SyntaxRewriter.prototype.visitMethodSignature = function (node) { - return node.update(this.visitToken(node.propertyName), node.questionToken === null ? null : this.visitToken(node.questionToken), this.visitNode(node.callSignature)); - }; - - SyntaxRewriter.prototype.visitIndexSignature = function (node) { - return node.update(this.visitToken(node.openBracketToken), this.visitNode(node.parameter), this.visitToken(node.closeBracketToken), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation)); - }; - - SyntaxRewriter.prototype.visitPropertySignature = function (node) { - return node.update(this.visitToken(node.propertyName), node.questionToken === null ? null : this.visitToken(node.questionToken), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation)); - }; - - SyntaxRewriter.prototype.visitCallSignature = function (node) { - return node.update(node.typeParameterList === null ? null : this.visitNode(node.typeParameterList), this.visitNode(node.parameterList), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation)); - }; - - SyntaxRewriter.prototype.visitParameterList = function (node) { - return node.update(this.visitToken(node.openParenToken), this.visitSeparatedList(node.parameters), this.visitToken(node.closeParenToken)); - }; - - SyntaxRewriter.prototype.visitTypeParameterList = function (node) { - return node.update(this.visitToken(node.lessThanToken), this.visitSeparatedList(node.typeParameters), this.visitToken(node.greaterThanToken)); - }; - - SyntaxRewriter.prototype.visitTypeParameter = function (node) { - return node.update(this.visitToken(node.identifier), node.constraint === null ? null : this.visitNode(node.constraint)); - }; - - SyntaxRewriter.prototype.visitConstraint = function (node) { - return node.update(this.visitToken(node.extendsKeyword), this.visitNodeOrToken(node.type)); - }; - - SyntaxRewriter.prototype.visitElseClause = function (node) { - return node.update(this.visitToken(node.elseKeyword), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitIfStatement = function (node) { - return node.update(this.visitToken(node.ifKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement), node.elseClause === null ? null : this.visitNode(node.elseClause)); - }; - - SyntaxRewriter.prototype.visitExpressionStatement = function (node) { - return node.update(this.visitNodeOrToken(node.expression), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitConstructorDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.constructorKeyword), this.visitNode(node.callSignature), node.block === null ? null : this.visitNode(node.block), node.semicolonToken === null ? null : this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitMemberFunctionDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.propertyName), this.visitNode(node.callSignature), node.block === null ? null : this.visitNode(node.block), node.semicolonToken === null ? null : this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitGetAccessor = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.getKeyword), this.visitToken(node.propertyName), this.visitNode(node.parameterList), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitSetAccessor = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.setKeyword), this.visitToken(node.propertyName), this.visitNode(node.parameterList), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitMemberVariableDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitNode(node.variableDeclarator), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitIndexMemberDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitNode(node.indexSignature), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitThrowStatement = function (node) { - return node.update(this.visitToken(node.throwKeyword), this.visitNodeOrToken(node.expression), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitReturnStatement = function (node) { - return node.update(this.visitToken(node.returnKeyword), node.expression === null ? null : this.visitNodeOrToken(node.expression), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitObjectCreationExpression = function (node) { - return node.update(this.visitToken(node.newKeyword), this.visitNodeOrToken(node.expression), node.argumentList === null ? null : this.visitNode(node.argumentList)); - }; - - SyntaxRewriter.prototype.visitSwitchStatement = function (node) { - return node.update(this.visitToken(node.switchKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.expression), this.visitToken(node.closeParenToken), this.visitToken(node.openBraceToken), this.visitList(node.switchClauses), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitCaseSwitchClause = function (node) { - return node.update(this.visitToken(node.caseKeyword), this.visitNodeOrToken(node.expression), this.visitToken(node.colonToken), this.visitList(node.statements)); - }; - - SyntaxRewriter.prototype.visitDefaultSwitchClause = function (node) { - return node.update(this.visitToken(node.defaultKeyword), this.visitToken(node.colonToken), this.visitList(node.statements)); - }; - - SyntaxRewriter.prototype.visitBreakStatement = function (node) { - return node.update(this.visitToken(node.breakKeyword), node.identifier === null ? null : this.visitToken(node.identifier), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitContinueStatement = function (node) { - return node.update(this.visitToken(node.continueKeyword), node.identifier === null ? null : this.visitToken(node.identifier), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitForStatement = function (node) { - return node.update(this.visitToken(node.forKeyword), this.visitToken(node.openParenToken), node.variableDeclaration === null ? null : this.visitNode(node.variableDeclaration), node.initializer === null ? null : this.visitNodeOrToken(node.initializer), this.visitToken(node.firstSemicolonToken), node.condition === null ? null : this.visitNodeOrToken(node.condition), this.visitToken(node.secondSemicolonToken), node.incrementor === null ? null : this.visitNodeOrToken(node.incrementor), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitForInStatement = function (node) { - return node.update(this.visitToken(node.forKeyword), this.visitToken(node.openParenToken), node.variableDeclaration === null ? null : this.visitNode(node.variableDeclaration), node.left === null ? null : this.visitNodeOrToken(node.left), this.visitToken(node.inKeyword), this.visitNodeOrToken(node.expression), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitWhileStatement = function (node) { - return node.update(this.visitToken(node.whileKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitWithStatement = function (node) { - return node.update(this.visitToken(node.withKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitEnumDeclaration = function (node) { - return node.update(this.visitList(node.modifiers), this.visitToken(node.enumKeyword), this.visitToken(node.identifier), this.visitToken(node.openBraceToken), this.visitSeparatedList(node.enumElements), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitEnumElement = function (node) { - return node.update(this.visitToken(node.propertyName), node.equalsValueClause === null ? null : this.visitNode(node.equalsValueClause)); - }; - - SyntaxRewriter.prototype.visitCastExpression = function (node) { - return node.update(this.visitToken(node.lessThanToken), this.visitNodeOrToken(node.type), this.visitToken(node.greaterThanToken), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitObjectLiteralExpression = function (node) { - return node.update(this.visitToken(node.openBraceToken), this.visitSeparatedList(node.propertyAssignments), this.visitToken(node.closeBraceToken)); - }; - - SyntaxRewriter.prototype.visitSimplePropertyAssignment = function (node) { - return node.update(this.visitToken(node.propertyName), this.visitToken(node.colonToken), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitFunctionPropertyAssignment = function (node) { - return node.update(this.visitToken(node.propertyName), this.visitNode(node.callSignature), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitFunctionExpression = function (node) { - return node.update(this.visitToken(node.functionKeyword), node.identifier === null ? null : this.visitToken(node.identifier), this.visitNode(node.callSignature), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitEmptyStatement = function (node) { - return node.update(this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitTryStatement = function (node) { - return node.update(this.visitToken(node.tryKeyword), this.visitNode(node.block), node.catchClause === null ? null : this.visitNode(node.catchClause), node.finallyClause === null ? null : this.visitNode(node.finallyClause)); - }; - - SyntaxRewriter.prototype.visitCatchClause = function (node) { - return node.update(this.visitToken(node.catchKeyword), this.visitToken(node.openParenToken), this.visitToken(node.identifier), node.typeAnnotation === null ? null : this.visitNode(node.typeAnnotation), this.visitToken(node.closeParenToken), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitFinallyClause = function (node) { - return node.update(this.visitToken(node.finallyKeyword), this.visitNode(node.block)); - }; - - SyntaxRewriter.prototype.visitLabeledStatement = function (node) { - return node.update(this.visitToken(node.identifier), this.visitToken(node.colonToken), this.visitNodeOrToken(node.statement)); - }; - - SyntaxRewriter.prototype.visitDoStatement = function (node) { - return node.update(this.visitToken(node.doKeyword), this.visitNodeOrToken(node.statement), this.visitToken(node.whileKeyword), this.visitToken(node.openParenToken), this.visitNodeOrToken(node.condition), this.visitToken(node.closeParenToken), this.visitToken(node.semicolonToken)); - }; - - SyntaxRewriter.prototype.visitTypeOfExpression = function (node) { - return node.update(this.visitToken(node.typeOfKeyword), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitDeleteExpression = function (node) { - return node.update(this.visitToken(node.deleteKeyword), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitVoidExpression = function (node) { - return node.update(this.visitToken(node.voidKeyword), this.visitNodeOrToken(node.expression)); - }; - - SyntaxRewriter.prototype.visitDebuggerStatement = function (node) { - return node.update(this.visitToken(node.debuggerKeyword), this.visitToken(node.semicolonToken)); - }; - return SyntaxRewriter; - })(); - TypeScript.SyntaxRewriter = SyntaxRewriter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxDedenter = (function (_super) { - __extends(SyntaxDedenter, _super); - function SyntaxDedenter(dedentFirstToken, dedentationAmount, minimumIndent, options) { - _super.call(this); - this.dedentationAmount = dedentationAmount; - this.minimumIndent = minimumIndent; - this.options = options; - this.lastTriviaWasNewLine = dedentFirstToken; - } - SyntaxDedenter.prototype.abort = function () { - this.lastTriviaWasNewLine = false; - this.dedentationAmount = 0; - }; - - SyntaxDedenter.prototype.isAborted = function () { - return this.dedentationAmount === 0; - }; - - SyntaxDedenter.prototype.visitToken = function (token) { - if (token.width() === 0) { - return token; - } - - var result = token; - if (this.lastTriviaWasNewLine) { - result = token.withLeadingTrivia(this.dedentTriviaList(token.leadingTrivia())); - } - - if (this.isAborted()) { - return token; - } - - this.lastTriviaWasNewLine = token.hasTrailingNewLine(); - return result; - }; - - SyntaxDedenter.prototype.dedentTriviaList = function (triviaList) { - var result = []; - var dedentNextWhitespace = true; - - for (var i = 0, n = triviaList.count(); i < n && !this.isAborted(); i++) { - var trivia = triviaList.syntaxTriviaAt(i); - - var dedentThisTrivia = dedentNextWhitespace; - dedentNextWhitespace = false; - - if (dedentThisTrivia) { - if (trivia.kind() === 4 /* WhitespaceTrivia */) { - var hasFollowingNewLine = (i < triviaList.count() - 1) && triviaList.syntaxTriviaAt(i + 1).kind() === 5 /* NewLineTrivia */; - result.push(this.dedentWhitespace(trivia, hasFollowingNewLine)); - continue; - } else if (trivia.kind() !== 5 /* NewLineTrivia */) { - this.abort(); - break; - } - } - - if (trivia.kind() === 6 /* MultiLineCommentTrivia */) { - result.push(this.dedentMultiLineComment(trivia)); - continue; - } - - result.push(trivia); - if (trivia.kind() === 5 /* NewLineTrivia */) { - dedentNextWhitespace = true; - } - } - - if (dedentNextWhitespace) { - this.abort(); - } - - if (this.isAborted()) { - return triviaList; - } - - return TypeScript.Syntax.triviaList(result); - }; - - SyntaxDedenter.prototype.dedentSegment = function (segment, hasFollowingNewLineTrivia) { - var firstNonWhitespacePosition = TypeScript.Indentation.firstNonWhitespacePosition(segment); - - if (firstNonWhitespacePosition === segment.length) { - if (hasFollowingNewLineTrivia) { - return ""; - } - } else if (TypeScript.CharacterInfo.isLineTerminator(segment.charCodeAt(firstNonWhitespacePosition))) { - return segment.substring(firstNonWhitespacePosition); - } - - var firstNonWhitespaceColumn = TypeScript.Indentation.columnForPositionInString(segment, firstNonWhitespacePosition, this.options); - - var newFirstNonWhitespaceColumn = TypeScript.MathPrototype.min(firstNonWhitespaceColumn, TypeScript.MathPrototype.max(firstNonWhitespaceColumn - this.dedentationAmount, this.minimumIndent)); - - if (newFirstNonWhitespaceColumn === firstNonWhitespaceColumn) { - this.abort(); - return segment; - } - - this.dedentationAmount = firstNonWhitespaceColumn - newFirstNonWhitespaceColumn; - TypeScript.Debug.assert(this.dedentationAmount >= 0); - - var indentationString = TypeScript.Indentation.indentationString(newFirstNonWhitespaceColumn, this.options); - - return indentationString + segment.substring(firstNonWhitespacePosition); - }; - - SyntaxDedenter.prototype.dedentWhitespace = function (trivia, hasFollowingNewLineTrivia) { - var newIndentation = this.dedentSegment(trivia.fullText(), hasFollowingNewLineTrivia); - return TypeScript.Syntax.whitespace(newIndentation); - }; - - SyntaxDedenter.prototype.dedentMultiLineComment = function (trivia) { - var segments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - if (segments.length === 1) { - return trivia; - } - - for (var i = 1; i < segments.length; i++) { - var segment = segments[i]; - segments[i] = this.dedentSegment(segment, false); - } - - var result = segments.join(""); - - return TypeScript.Syntax.multiLineComment(result); - }; - - SyntaxDedenter.dedentNode = function (node, dedentFirstToken, dedentAmount, minimumIndent, options) { - var dedenter = new SyntaxDedenter(dedentFirstToken, dedentAmount, minimumIndent, options); - var result = node.accept(dedenter); - - if (dedenter.isAborted()) { - return node; - } - - return result; - }; - return SyntaxDedenter; - })(TypeScript.SyntaxRewriter); - TypeScript.SyntaxDedenter = SyntaxDedenter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxIndenter = (function (_super) { - __extends(SyntaxIndenter, _super); - function SyntaxIndenter(indentFirstToken, indentationAmount, options) { - _super.call(this); - this.indentationAmount = indentationAmount; - this.options = options; - this.lastTriviaWasNewLine = indentFirstToken; - this.indentationTrivia = TypeScript.Indentation.indentationTrivia(this.indentationAmount, this.options); - } - SyntaxIndenter.prototype.visitToken = function (token) { - if (token.width() === 0) { - return token; - } - - var result = token; - if (this.lastTriviaWasNewLine) { - result = token.withLeadingTrivia(this.indentTriviaList(token.leadingTrivia())); - } - - this.lastTriviaWasNewLine = token.hasTrailingNewLine(); - return result; - }; - - SyntaxIndenter.prototype.indentTriviaList = function (triviaList) { - var result = []; - - var indentNextTrivia = true; - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - - var indentThisTrivia = indentNextTrivia; - indentNextTrivia = false; - - switch (trivia.kind()) { - case 6 /* MultiLineCommentTrivia */: - this.indentMultiLineComment(trivia, indentThisTrivia, result); - continue; - - case 7 /* SingleLineCommentTrivia */: - case 8 /* SkippedTokenTrivia */: - this.indentSingleLineOrSkippedText(trivia, indentThisTrivia, result); - continue; - - case 4 /* WhitespaceTrivia */: - this.indentWhitespace(trivia, indentThisTrivia, result); - continue; - - case 5 /* NewLineTrivia */: - result.push(trivia); - indentNextTrivia = true; - continue; - - default: - throw TypeScript.Errors.invalidOperation(); - } - } - - if (indentNextTrivia) { - result.push(this.indentationTrivia); - } - - return TypeScript.Syntax.triviaList(result); - }; - - SyntaxIndenter.prototype.indentSegment = function (segment) { - var firstNonWhitespacePosition = TypeScript.Indentation.firstNonWhitespacePosition(segment); - - if (firstNonWhitespacePosition < segment.length && TypeScript.CharacterInfo.isLineTerminator(segment.charCodeAt(firstNonWhitespacePosition))) { - return segment; - } - - var firstNonWhitespaceColumn = TypeScript.Indentation.columnForPositionInString(segment, firstNonWhitespacePosition, this.options); - - var newFirstNonWhitespaceColumn = firstNonWhitespaceColumn + this.indentationAmount; - - var indentationString = TypeScript.Indentation.indentationString(newFirstNonWhitespaceColumn, this.options); - - return indentationString + segment.substring(firstNonWhitespacePosition); - }; - - SyntaxIndenter.prototype.indentWhitespace = function (trivia, indentThisTrivia, result) { - if (!indentThisTrivia) { - result.push(trivia); - return; - } - - var newIndentation = this.indentSegment(trivia.fullText()); - result.push(TypeScript.Syntax.whitespace(newIndentation)); - }; - - SyntaxIndenter.prototype.indentSingleLineOrSkippedText = function (trivia, indentThisTrivia, result) { - if (indentThisTrivia) { - result.push(this.indentationTrivia); - } - - result.push(trivia); - }; - - SyntaxIndenter.prototype.indentMultiLineComment = function (trivia, indentThisTrivia, result) { - if (indentThisTrivia) { - result.push(this.indentationTrivia); - } - - var segments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - - for (var i = 1; i < segments.length; i++) { - segments[i] = this.indentSegment(segments[i]); - } - - var newText = segments.join(""); - result.push(TypeScript.Syntax.multiLineComment(newText)); - }; - - SyntaxIndenter.indentNode = function (node, indentFirstToken, indentAmount, options) { - var indenter = new SyntaxIndenter(indentFirstToken, indentAmount, options); - return node.accept(indenter); - }; - - SyntaxIndenter.indentNodes = function (nodes, indentFirstToken, indentAmount, options) { - var indenter = new SyntaxIndenter(indentFirstToken, indentAmount, options); - var result = TypeScript.ArrayUtilities.select(nodes, function (n) { - return n.accept(indenter); - }); - - return result; - }; - return SyntaxIndenter; - })(TypeScript.SyntaxRewriter); - TypeScript.SyntaxIndenter = SyntaxIndenter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var VariableWidthTokenWithNoTrivia = (function () { - function VariableWidthTokenWithNoTrivia(fullText, kind) { - this._fullText = fullText; - this.tokenKind = kind; - } - VariableWidthTokenWithNoTrivia.prototype.clone = function () { - return new VariableWidthTokenWithNoTrivia(this._fullText, this.tokenKind); - }; - - VariableWidthTokenWithNoTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithNoTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithNoTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithNoTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithNoTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithNoTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithNoTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithNoTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithNoTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithNoTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithNoTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithNoTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasLeadingComment = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithNoTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithNoTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasTrailingComment = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithNoTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithNoTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithNoTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithNoTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithNoTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithNoTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithNoTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithNoTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithNoTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithNoTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithNoTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithNoTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithNoTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithNoTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithNoTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithNoTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithNoTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithNoTrivia; - })(); - Syntax.VariableWidthTokenWithNoTrivia = VariableWidthTokenWithNoTrivia; - - var VariableWidthTokenWithLeadingTrivia = (function () { - function VariableWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - } - VariableWidthTokenWithLeadingTrivia.prototype.clone = function () { - return new VariableWidthTokenWithLeadingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithLeadingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithLeadingTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithLeadingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingComment = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithLeadingTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithLeadingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithLeadingTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithLeadingTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithLeadingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithLeadingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithLeadingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithLeadingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithLeadingTrivia; - })(); - Syntax.VariableWidthTokenWithLeadingTrivia = VariableWidthTokenWithLeadingTrivia; - - var VariableWidthTokenWithTrailingTrivia = (function () { - function VariableWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._trailingTriviaInfo = trailingTriviaInfo; - } - VariableWidthTokenWithTrailingTrivia.prototype.clone = function () { - return new VariableWidthTokenWithTrailingTrivia(this._fullText, this.tokenKind, this._trailingTriviaInfo); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithTrailingTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingComment = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - VariableWidthTokenWithTrailingTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - VariableWidthTokenWithTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - VariableWidthTokenWithTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithTrailingTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithTrailingTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithTrailingTrivia; - })(); - Syntax.VariableWidthTokenWithTrailingTrivia = VariableWidthTokenWithTrailingTrivia; - - var VariableWidthTokenWithLeadingAndTrailingTrivia = (function () { - function VariableWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - this._trailingTriviaInfo = trailingTriviaInfo; - } - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.clone = function () { - return new VariableWidthTokenWithLeadingAndTrailingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo, this._trailingTriviaInfo); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isNode = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isToken = function () { - return true; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isList = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.childCount = function () { - return 0; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.width = function () { - return this.fullWidth() - this.leadingTriviaWidth() - this.trailingTriviaWidth(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.text = function () { - return this.fullText().substr(this.leadingTriviaWidth(), this.width()); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.value = function () { - if (this._value === undefined) { - this._value = Syntax.value(this); - } - - return this._value; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.valueText = function () { - if (this._valueText === undefined) { - this._valueText = Syntax.valueText(this); - } - - return this._valueText; - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.firstToken = function () { - return this; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.lastToken = function () { - return this; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - VariableWidthTokenWithLeadingAndTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return VariableWidthTokenWithLeadingAndTrailingTrivia; - })(); - Syntax.VariableWidthTokenWithLeadingAndTrailingTrivia = VariableWidthTokenWithLeadingAndTrailingTrivia; - - var FixedWidthTokenWithNoTrivia = (function () { - function FixedWidthTokenWithNoTrivia(kind) { - this.tokenKind = kind; - } - FixedWidthTokenWithNoTrivia.prototype.clone = function () { - return new FixedWidthTokenWithNoTrivia(this.tokenKind); - }; - - FixedWidthTokenWithNoTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithNoTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithNoTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithNoTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithNoTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithNoTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithNoTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithNoTrivia.prototype.fullText = function () { - return this.text(); - }; - - FixedWidthTokenWithNoTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithNoTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingComment = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithNoTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingComment = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithNoTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithNoTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithNoTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithNoTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithNoTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithNoTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithNoTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithNoTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithNoTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithNoTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithNoTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithNoTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithNoTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithNoTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithNoTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithNoTrivia; - })(); - Syntax.FixedWidthTokenWithNoTrivia = FixedWidthTokenWithNoTrivia; - - var FixedWidthTokenWithLeadingTrivia = (function () { - function FixedWidthTokenWithLeadingTrivia(fullText, kind, leadingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - } - FixedWidthTokenWithLeadingTrivia.prototype.clone = function () { - return new FixedWidthTokenWithLeadingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithLeadingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithLeadingTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithLeadingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingComment = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingNewLine = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithLeadingTrivia.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithLeadingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithLeadingTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithLeadingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithLeadingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithLeadingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithLeadingTrivia; - })(); - Syntax.FixedWidthTokenWithLeadingTrivia = FixedWidthTokenWithLeadingTrivia; - - var FixedWidthTokenWithTrailingTrivia = (function () { - function FixedWidthTokenWithTrailingTrivia(fullText, kind, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._trailingTriviaInfo = trailingTriviaInfo; - } - FixedWidthTokenWithTrailingTrivia.prototype.clone = function () { - return new FixedWidthTokenWithTrailingTrivia(this._fullText, this.tokenKind, this._trailingTriviaInfo); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithTrailingTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingComment = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingNewLine = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithTrailingTrivia.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - FixedWidthTokenWithTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - FixedWidthTokenWithTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithTrailingTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithTrailingTrivia; - })(); - Syntax.FixedWidthTokenWithTrailingTrivia = FixedWidthTokenWithTrailingTrivia; - - var FixedWidthTokenWithLeadingAndTrailingTrivia = (function () { - function FixedWidthTokenWithLeadingAndTrailingTrivia(fullText, kind, leadingTriviaInfo, trailingTriviaInfo) { - this._fullText = fullText; - this.tokenKind = kind; - this._leadingTriviaInfo = leadingTriviaInfo; - this._trailingTriviaInfo = trailingTriviaInfo; - } - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.clone = function () { - return new FixedWidthTokenWithLeadingAndTrailingTrivia(this._fullText, this.tokenKind, this._leadingTriviaInfo, this._trailingTriviaInfo); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isNode = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isToken = function () { - return true; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isList = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isSeparatedList = function () { - return false; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.kind = function () { - return this.tokenKind; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange('index'); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.width = function () { - return this.text().length; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.text = function () { - return TypeScript.SyntaxFacts.getText(this.tokenKind); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.fullText = function () { - return this._fullText; - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.value = function () { - return Syntax.value(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.valueText = function () { - return Syntax.valueText(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingTrivia = function () { - return true; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingComment = function () { - return hasTriviaComment(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingNewLine = function () { - return hasTriviaNewLine(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasLeadingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTriviaWidth = function () { - return getTriviaWidth(this._leadingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.leadingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), 0, getTriviaWidth(this._leadingTriviaInfo), false); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingTrivia = function () { - return true; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingComment = function () { - return hasTriviaComment(this._trailingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingNewLine = function () { - return hasTriviaNewLine(this._trailingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasTrailingSkippedText = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTriviaWidth = function () { - return getTriviaWidth(this._trailingTriviaInfo); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.trailingTrivia = function () { - return TypeScript.Scanner.scanTrivia(TypeScript.SimpleText.fromString(this._fullText), this.leadingTriviaWidth() + this.width(), getTriviaWidth(this._trailingTriviaInfo), true); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.toJSON = function (key) { - return Syntax.tokenToJSON(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.firstToken = function () { - return this; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.lastToken = function () { - return this; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isTypeScriptSpecific = function () { - return false; - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isIncrementallyUnusable = function () { - return this.fullWidth() === 0 || TypeScript.SyntaxFacts.isAnyDivideOrRegularExpressionToken(this.tokenKind); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.realize = function () { - return Syntax.realizeToken(this); - }; - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.collectTextElements = function (elements) { - collectTokenTextElements(this, elements); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isExpression = function () { - return Syntax.isExpression(this); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - FixedWidthTokenWithLeadingAndTrailingTrivia.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return FixedWidthTokenWithLeadingAndTrailingTrivia; - })(); - Syntax.FixedWidthTokenWithLeadingAndTrailingTrivia = FixedWidthTokenWithLeadingAndTrailingTrivia; - - function collectTokenTextElements(token, elements) { - token.leadingTrivia().collectTextElements(elements); - elements.push(token.text()); - token.trailingTrivia().collectTextElements(elements); - } - - function getTriviaWidth(value) { - return value >>> 2 /* TriviaFullWidthShift */; - } - - function hasTriviaComment(value) { - return (value & 2 /* TriviaCommentMask */) !== 0; - } - - function hasTriviaNewLine(value) { - return (value & 1 /* TriviaNewLineMask */) !== 0; - } - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - function isExpression(token) { - switch (token.tokenKind) { - case 11 /* IdentifierName */: - case 12 /* RegularExpressionLiteral */: - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 50 /* SuperKeyword */: - return true; - } - - return false; - } - Syntax.isExpression = isExpression; - - function realizeToken(token) { - return new RealizedToken(token.tokenKind, token.leadingTrivia(), token.text(), token.value(), token.valueText(), token.trailingTrivia()); - } - Syntax.realizeToken = realizeToken; - - function convertToIdentifierName(token) { - TypeScript.Debug.assert(TypeScript.SyntaxFacts.isAnyKeyword(token.tokenKind)); - return new RealizedToken(11 /* IdentifierName */, token.leadingTrivia(), token.text(), token.text(), token.text(), token.trailingTrivia()); - } - Syntax.convertToIdentifierName = convertToIdentifierName; - - function tokenToJSON(token) { - var result = {}; - - for (var name in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind[name] === token.kind()) { - result.kind = name; - break; - } - } - - result.width = token.width(); - if (token.fullWidth() !== token.width()) { - result.fullWidth = token.fullWidth(); - } - - result.text = token.text(); - - var value = token.value(); - if (value !== null) { - result.value = value; - result.valueText = token.valueText(); - } - - if (token.hasLeadingTrivia()) { - result.hasLeadingTrivia = true; - } - - if (token.hasLeadingComment()) { - result.hasLeadingComment = true; - } - - if (token.hasLeadingNewLine()) { - result.hasLeadingNewLine = true; - } - - if (token.hasLeadingSkippedText()) { - result.hasLeadingSkippedText = true; - } - - if (token.hasTrailingTrivia()) { - result.hasTrailingTrivia = true; - } - - if (token.hasTrailingComment()) { - result.hasTrailingComment = true; - } - - if (token.hasTrailingNewLine()) { - result.hasTrailingNewLine = true; - } - - if (token.hasTrailingSkippedText()) { - result.hasTrailingSkippedText = true; - } - - var trivia = token.leadingTrivia(); - if (trivia.count() > 0) { - result.leadingTrivia = trivia; - } - - trivia = token.trailingTrivia(); - if (trivia.count() > 0) { - result.trailingTrivia = trivia; - } - - return result; - } - Syntax.tokenToJSON = tokenToJSON; - - function value(token) { - return value1(token.tokenKind, token.text()); - } - Syntax.value = value; - - function hexValue(text, start, length) { - var intChar = 0; - for (var i = 0; i < length; i++) { - var ch2 = text.charCodeAt(start + i); - if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { - break; - } - - intChar = (intChar << 4) + TypeScript.CharacterInfo.hexValue(ch2); - } - - return intChar; - } - - var characterArray = []; - - function convertEscapes(text) { - characterArray.length = 0; - var result = ""; - - for (var i = 0, n = text.length; i < n; i++) { - var ch = text.charCodeAt(i); - - if (ch === 92 /* backslash */) { - i++; - if (i < n) { - ch = text.charCodeAt(i); - switch (ch) { - case 48 /* _0 */: - characterArray.push(0 /* nullCharacter */); - continue; - - case 98 /* b */: - characterArray.push(8 /* backspace */); - continue; - - case 102 /* f */: - characterArray.push(12 /* formFeed */); - continue; - - case 110 /* n */: - characterArray.push(10 /* lineFeed */); - continue; - - case 114 /* r */: - characterArray.push(13 /* carriageReturn */); - continue; - - case 116 /* t */: - characterArray.push(9 /* tab */); - continue; - - case 118 /* v */: - characterArray.push(11 /* verticalTab */); - continue; - - case 120 /* x */: - characterArray.push(hexValue(text, i + 1, 2)); - i += 2; - continue; - - case 117 /* u */: - characterArray.push(hexValue(text, i + 1, 4)); - i += 4; - continue; - - case 13 /* carriageReturn */: - var nextIndex = i + 1; - if (nextIndex < text.length && text.charCodeAt(nextIndex) === 10 /* lineFeed */) { - i++; - } - continue; - - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - continue; - - default: - } - } - } - - characterArray.push(ch); - - if (i && !(i % 1024)) { - result = result.concat(String.fromCharCode.apply(null, characterArray)); - characterArray.length = 0; - } - } - - if (characterArray.length) { - result = result.concat(String.fromCharCode.apply(null, characterArray)); - } - - return result; - } - - function massageEscapes(text) { - return text.indexOf("\\") >= 0 ? convertEscapes(text) : text; - } - Syntax.massageEscapes = massageEscapes; - - function value1(kind, text) { - if (kind === 11 /* IdentifierName */) { - return massageEscapes(text); - } - - switch (kind) { - case 37 /* TrueKeyword */: - return true; - case 24 /* FalseKeyword */: - return false; - case 32 /* NullKeyword */: - return null; - } - - if (TypeScript.SyntaxFacts.isAnyKeyword(kind) || TypeScript.SyntaxFacts.isAnyPunctuation(kind)) { - return TypeScript.SyntaxFacts.getText(kind); - } - - if (kind === 13 /* NumericLiteral */) { - return TypeScript.IntegerUtilities.isHexInteger(text) ? parseInt(text, 16) : parseFloat(text); - } else if (kind === 14 /* StringLiteral */) { - if (text.length > 1 && text.charCodeAt(text.length - 1) === text.charCodeAt(0)) { - return massageEscapes(text.substr(1, text.length - 2)); - } else { - return massageEscapes(text.substr(1)); - } - } else if (kind === 12 /* RegularExpressionLiteral */) { - return regularExpressionValue(text); - } else if (kind === 10 /* EndOfFileToken */ || kind === 9 /* ErrorToken */) { - return null; - } else { - throw TypeScript.Errors.invalidOperation(); - } - } - - function regularExpressionValue(text) { - try { - var lastSlash = text.lastIndexOf("/"); - var body = text.substring(1, lastSlash); - var flags = text.substring(lastSlash + 1); - return new RegExp(body, flags); - } catch (e) { - return null; - } - } - - function valueText1(kind, text) { - var value = value1(kind, text); - return value === null ? "" : value.toString(); - } - - function valueText(token) { - var value = token.value(); - return value === null ? "" : value.toString(); - } - Syntax.valueText = valueText; - - var EmptyToken = (function () { - function EmptyToken(kind) { - this.tokenKind = kind; - } - EmptyToken.prototype.clone = function () { - return new EmptyToken(this.tokenKind); - }; - - EmptyToken.prototype.kind = function () { - return this.tokenKind; - }; - - EmptyToken.prototype.isToken = function () { - return true; - }; - EmptyToken.prototype.isNode = function () { - return false; - }; - EmptyToken.prototype.isList = function () { - return false; - }; - EmptyToken.prototype.isSeparatedList = function () { - return false; - }; - - EmptyToken.prototype.childCount = function () { - return 0; - }; - - EmptyToken.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - EmptyToken.prototype.toJSON = function (key) { - return tokenToJSON(this); - }; - EmptyToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - - EmptyToken.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - EmptyToken.prototype.firstToken = function () { - return this; - }; - EmptyToken.prototype.lastToken = function () { - return this; - }; - EmptyToken.prototype.isTypeScriptSpecific = function () { - return false; - }; - - EmptyToken.prototype.isIncrementallyUnusable = function () { - return true; - }; - - EmptyToken.prototype.fullWidth = function () { - return 0; - }; - EmptyToken.prototype.width = function () { - return 0; - }; - EmptyToken.prototype.text = function () { - return ""; - }; - EmptyToken.prototype.fullText = function () { - return ""; - }; - EmptyToken.prototype.value = function () { - return null; - }; - EmptyToken.prototype.valueText = function () { - return ""; - }; - - EmptyToken.prototype.hasLeadingTrivia = function () { - return false; - }; - EmptyToken.prototype.hasLeadingComment = function () { - return false; - }; - EmptyToken.prototype.hasLeadingNewLine = function () { - return false; - }; - EmptyToken.prototype.hasLeadingSkippedText = function () { - return false; - }; - EmptyToken.prototype.leadingTriviaWidth = function () { - return 0; - }; - EmptyToken.prototype.hasTrailingTrivia = function () { - return false; - }; - EmptyToken.prototype.hasTrailingComment = function () { - return false; - }; - EmptyToken.prototype.hasTrailingNewLine = function () { - return false; - }; - EmptyToken.prototype.hasTrailingSkippedText = function () { - return false; - }; - EmptyToken.prototype.hasSkippedToken = function () { - return false; - }; - - EmptyToken.prototype.trailingTriviaWidth = function () { - return 0; - }; - EmptyToken.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - EmptyToken.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - EmptyToken.prototype.realize = function () { - return realizeToken(this); - }; - EmptyToken.prototype.collectTextElements = function (elements) { - }; - - EmptyToken.prototype.withLeadingTrivia = function (leadingTrivia) { - return this.realize().withLeadingTrivia(leadingTrivia); - }; - - EmptyToken.prototype.withTrailingTrivia = function (trailingTrivia) { - return this.realize().withTrailingTrivia(trailingTrivia); - }; - - EmptyToken.prototype.isExpression = function () { - return isExpression(this); - }; - - EmptyToken.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - EmptyToken.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - EmptyToken.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - EmptyToken.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return EmptyToken; - })(); - - function emptyToken(kind) { - return new EmptyToken(kind); - } - Syntax.emptyToken = emptyToken; - - var RealizedToken = (function () { - function RealizedToken(tokenKind, leadingTrivia, text, value, valueText, trailingTrivia) { - this.tokenKind = tokenKind; - this._leadingTrivia = leadingTrivia; - this._text = text; - this._value = value; - this._valueText = valueText; - this._trailingTrivia = trailingTrivia; - } - RealizedToken.prototype.clone = function () { - return new RealizedToken(this.tokenKind, this._leadingTrivia, this._text, this._value, this._valueText, this._trailingTrivia); - }; - - RealizedToken.prototype.kind = function () { - return this.tokenKind; - }; - RealizedToken.prototype.toJSON = function (key) { - return tokenToJSON(this); - }; - RealizedToken.prototype.firstToken = function () { - return this; - }; - RealizedToken.prototype.lastToken = function () { - return this; - }; - RealizedToken.prototype.isTypeScriptSpecific = function () { - return false; - }; - - RealizedToken.prototype.isIncrementallyUnusable = function () { - return true; - }; - - RealizedToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - - RealizedToken.prototype.childCount = function () { - return 0; - }; - - RealizedToken.prototype.childAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - - RealizedToken.prototype.isToken = function () { - return true; - }; - RealizedToken.prototype.isNode = function () { - return false; - }; - RealizedToken.prototype.isList = function () { - return false; - }; - RealizedToken.prototype.isSeparatedList = function () { - return false; - }; - RealizedToken.prototype.isTrivia = function () { - return false; - }; - RealizedToken.prototype.isTriviaList = function () { - return false; - }; - - RealizedToken.prototype.fullWidth = function () { - return this._leadingTrivia.fullWidth() + this.width() + this._trailingTrivia.fullWidth(); - }; - RealizedToken.prototype.width = function () { - return this.text().length; - }; - - RealizedToken.prototype.text = function () { - return this._text; - }; - RealizedToken.prototype.fullText = function () { - return this._leadingTrivia.fullText() + this.text() + this._trailingTrivia.fullText(); - }; - - RealizedToken.prototype.value = function () { - return this._value; - }; - RealizedToken.prototype.valueText = function () { - return this._valueText; - }; - - RealizedToken.prototype.hasLeadingTrivia = function () { - return this._leadingTrivia.count() > 0; - }; - RealizedToken.prototype.hasLeadingComment = function () { - return this._leadingTrivia.hasComment(); - }; - RealizedToken.prototype.hasLeadingNewLine = function () { - return this._leadingTrivia.hasNewLine(); - }; - RealizedToken.prototype.hasLeadingSkippedText = function () { - return this._leadingTrivia.hasSkippedToken(); - }; - RealizedToken.prototype.leadingTriviaWidth = function () { - return this._leadingTrivia.fullWidth(); - }; - - RealizedToken.prototype.hasTrailingTrivia = function () { - return this._trailingTrivia.count() > 0; - }; - RealizedToken.prototype.hasTrailingComment = function () { - return this._trailingTrivia.hasComment(); - }; - RealizedToken.prototype.hasTrailingNewLine = function () { - return this._trailingTrivia.hasNewLine(); - }; - RealizedToken.prototype.hasTrailingSkippedText = function () { - return this._trailingTrivia.hasSkippedToken(); - }; - RealizedToken.prototype.trailingTriviaWidth = function () { - return this._trailingTrivia.fullWidth(); - }; - - RealizedToken.prototype.hasSkippedToken = function () { - return this.hasLeadingSkippedText() || this.hasTrailingSkippedText(); - }; - - RealizedToken.prototype.leadingTrivia = function () { - return this._leadingTrivia; - }; - RealizedToken.prototype.trailingTrivia = function () { - return this._trailingTrivia; - }; - - RealizedToken.prototype.findTokenInternal = function (parent, position, fullStart) { - return new TypeScript.PositionedToken(parent, this, fullStart); - }; - - RealizedToken.prototype.collectTextElements = function (elements) { - this.leadingTrivia().collectTextElements(elements); - elements.push(this.text()); - this.trailingTrivia().collectTextElements(elements); - }; - - RealizedToken.prototype.withLeadingTrivia = function (leadingTrivia) { - return new RealizedToken(this.tokenKind, leadingTrivia, this._text, this._value, this._valueText, this._trailingTrivia); - }; - - RealizedToken.prototype.withTrailingTrivia = function (trailingTrivia) { - return new RealizedToken(this.tokenKind, this._leadingTrivia, this._text, this._value, this._valueText, trailingTrivia); - }; - - RealizedToken.prototype.isExpression = function () { - return isExpression(this); - }; - - RealizedToken.prototype.isPrimaryExpression = function () { - return this.isExpression(); - }; - - RealizedToken.prototype.isMemberExpression = function () { - return this.isExpression(); - }; - - RealizedToken.prototype.isPostfixExpression = function () { - return this.isExpression(); - }; - - RealizedToken.prototype.isUnaryExpression = function () { - return this.isExpression(); - }; - return RealizedToken; - })(); - - function token(kind, info) { - if (typeof info === "undefined") { info = null; } - var text = (info !== null && info.text !== undefined) ? info.text : TypeScript.SyntaxFacts.getText(kind); - - return new RealizedToken(kind, Syntax.triviaList(info === null ? null : info.leadingTrivia), text, value1(kind, text), valueText1(kind, text), Syntax.triviaList(info === null ? null : info.trailingTrivia)); - } - Syntax.token = token; - - function identifier(text, info) { - if (typeof info === "undefined") { info = null; } - info = info || {}; - info.text = text; - return token(11 /* IdentifierName */, info); - } - Syntax.identifier = identifier; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxTokenReplacer = (function (_super) { - __extends(SyntaxTokenReplacer, _super); - function SyntaxTokenReplacer(token1, token2) { - _super.call(this); - this.token1 = token1; - this.token2 = token2; - } - SyntaxTokenReplacer.prototype.visitToken = function (token) { - if (token === this.token1) { - var result = this.token2; - this.token1 = null; - this.token2 = null; - - return result; - } - - return token; - }; - - SyntaxTokenReplacer.prototype.visitNode = function (node) { - if (this.token1 === null) { - return node; - } - - return _super.prototype.visitNode.call(this, node); - }; - - SyntaxTokenReplacer.prototype.visitList = function (list) { - if (this.token1 === null) { - return list; - } - - return _super.prototype.visitList.call(this, list); - }; - - SyntaxTokenReplacer.prototype.visitSeparatedList = function (list) { - if (this.token1 === null) { - return list; - } - - return _super.prototype.visitSeparatedList.call(this, list); - }; - return SyntaxTokenReplacer; - })(TypeScript.SyntaxRewriter); - TypeScript.SyntaxTokenReplacer = SyntaxTokenReplacer; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - var AbstractTrivia = (function () { - function AbstractTrivia(_kind) { - this._kind = _kind; - } - AbstractTrivia.prototype.fullWidth = function () { - throw TypeScript.Errors.abstract(); - }; - - AbstractTrivia.prototype.fullText = function () { - throw TypeScript.Errors.abstract(); - }; - - AbstractTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.abstract(); - }; - - AbstractTrivia.prototype.toJSON = function (key) { - var result = {}; - - for (var name in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind[name] === this._kind) { - result.kind = name; - break; - } - } - - if (this.isSkippedToken()) { - result.skippedToken = this.skippedToken(); - } else { - result.text = this.fullText(); - } - return result; - }; - - AbstractTrivia.prototype.kind = function () { - return this._kind; - }; - - AbstractTrivia.prototype.isWhitespace = function () { - return this.kind() === 4 /* WhitespaceTrivia */; - }; - - AbstractTrivia.prototype.isComment = function () { - return this.kind() === 7 /* SingleLineCommentTrivia */ || this.kind() === 6 /* MultiLineCommentTrivia */; - }; - - AbstractTrivia.prototype.isNewLine = function () { - return this.kind() === 5 /* NewLineTrivia */; - }; - - AbstractTrivia.prototype.isSkippedToken = function () { - return this.kind() === 8 /* SkippedTokenTrivia */; - }; - - AbstractTrivia.prototype.collectTextElements = function (elements) { - elements.push(this.fullText()); - }; - return AbstractTrivia; - })(); - - var NormalTrivia = (function (_super) { - __extends(NormalTrivia, _super); - function NormalTrivia(kind, _text) { - _super.call(this, kind); - this._text = _text; - } - NormalTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - - NormalTrivia.prototype.fullText = function () { - return this._text; - }; - - NormalTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.invalidOperation(); - }; - return NormalTrivia; - })(AbstractTrivia); - - var SkippedTokenTrivia = (function (_super) { - __extends(SkippedTokenTrivia, _super); - function SkippedTokenTrivia(_skippedToken) { - _super.call(this, 8 /* SkippedTokenTrivia */); - this._skippedToken = _skippedToken; - } - SkippedTokenTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - - SkippedTokenTrivia.prototype.fullText = function () { - return this.skippedToken().fullText(); - }; - - SkippedTokenTrivia.prototype.skippedToken = function () { - return this._skippedToken; - }; - return SkippedTokenTrivia; - })(AbstractTrivia); - - var DeferredTrivia = (function (_super) { - __extends(DeferredTrivia, _super); - function DeferredTrivia(kind, _text, _fullStart, _fullWidth) { - _super.call(this, kind); - this._text = _text; - this._fullStart = _fullStart; - this._fullWidth = _fullWidth; - this._fullText = null; - } - DeferredTrivia.prototype.fullWidth = function () { - return this._fullWidth; - }; - - DeferredTrivia.prototype.fullText = function () { - if (!this._fullText) { - this._fullText = this._text.substr(this._fullStart, this._fullWidth, false); - this._text = null; - } - - return this._fullText; - }; - - DeferredTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.invalidOperation(); - }; - return DeferredTrivia; - })(AbstractTrivia); - - function deferredTrivia(kind, text, fullStart, fullWidth) { - return new DeferredTrivia(kind, text, fullStart, fullWidth); - } - Syntax.deferredTrivia = deferredTrivia; - - function trivia(kind, text) { - return new NormalTrivia(kind, text); - } - Syntax.trivia = trivia; - - function skippedTokenTrivia(token) { - TypeScript.Debug.assert(!token.hasLeadingTrivia()); - TypeScript.Debug.assert(!token.hasTrailingTrivia()); - TypeScript.Debug.assert(token.fullWidth() > 0); - return new SkippedTokenTrivia(token); - } - Syntax.skippedTokenTrivia = skippedTokenTrivia; - - function spaces(count) { - return trivia(4 /* WhitespaceTrivia */, TypeScript.StringUtilities.repeat(" ", count)); - } - Syntax.spaces = spaces; - - function whitespace(text) { - return trivia(4 /* WhitespaceTrivia */, text); - } - Syntax.whitespace = whitespace; - - function multiLineComment(text) { - return trivia(6 /* MultiLineCommentTrivia */, text); - } - Syntax.multiLineComment = multiLineComment; - - function singleLineComment(text) { - return trivia(7 /* SingleLineCommentTrivia */, text); - } - Syntax.singleLineComment = singleLineComment; - - Syntax.spaceTrivia = spaces(1); - Syntax.lineFeedTrivia = trivia(5 /* NewLineTrivia */, "\n"); - Syntax.carriageReturnTrivia = trivia(5 /* NewLineTrivia */, "\r"); - Syntax.carriageReturnLineFeedTrivia = trivia(5 /* NewLineTrivia */, "\r\n"); - - function splitMultiLineCommentTriviaIntoMultipleLines(trivia) { - var result = []; - - var triviaText = trivia.fullText(); - var currentIndex = 0; - - for (var i = 0; i < triviaText.length; i++) { - var ch = triviaText.charCodeAt(i); - - var isCarriageReturnLineFeed = false; - switch (ch) { - case 13 /* carriageReturn */: - if (i < triviaText.length - 1 && triviaText.charCodeAt(i + 1) === 10 /* lineFeed */) { - i++; - } - - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - result.push(triviaText.substring(currentIndex, i + 1)); - - currentIndex = i + 1; - continue; - } - } - - result.push(triviaText.substring(currentIndex)); - return result; - } - Syntax.splitMultiLineCommentTriviaIntoMultipleLines = splitMultiLineCommentTriviaIntoMultipleLines; - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (Syntax) { - Syntax.emptyTriviaList = { - kind: function () { - return 3 /* TriviaList */; - }, - count: function () { - return 0; - }, - syntaxTriviaAt: function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }, - last: function () { - throw TypeScript.Errors.argumentOutOfRange("index"); - }, - fullWidth: function () { - return 0; - }, - fullText: function () { - return ""; - }, - hasComment: function () { - return false; - }, - hasNewLine: function () { - return false; - }, - hasSkippedToken: function () { - return false; - }, - toJSON: function (key) { - return []; - }, - collectTextElements: function (elements) { - }, - toArray: function () { - return []; - }, - concat: function (trivia) { - return trivia; - } - }; - - function concatTrivia(list1, list2) { - if (list1.count() === 0) { - return list2; - } - - if (list2.count() === 0) { - return list1; - } - - var trivia = list1.toArray(); - trivia.push.apply(trivia, list2.toArray()); - - return triviaList(trivia); - } - - function isComment(trivia) { - return trivia.kind() === 6 /* MultiLineCommentTrivia */ || trivia.kind() === 7 /* SingleLineCommentTrivia */; - } - - var SingletonSyntaxTriviaList = (function () { - function SingletonSyntaxTriviaList(item) { - this.item = item; - } - SingletonSyntaxTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; - - SingletonSyntaxTriviaList.prototype.count = function () { - return 1; - }; - - SingletonSyntaxTriviaList.prototype.syntaxTriviaAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.item; - }; - - SingletonSyntaxTriviaList.prototype.last = function () { - return this.item; - }; - - SingletonSyntaxTriviaList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - - SingletonSyntaxTriviaList.prototype.fullText = function () { - return this.item.fullText(); - }; - - SingletonSyntaxTriviaList.prototype.hasComment = function () { - return isComment(this.item); - }; - - SingletonSyntaxTriviaList.prototype.hasNewLine = function () { - return this.item.kind() === 5 /* NewLineTrivia */; - }; - - SingletonSyntaxTriviaList.prototype.hasSkippedToken = function () { - return this.item.kind() === 8 /* SkippedTokenTrivia */; - }; - - SingletonSyntaxTriviaList.prototype.toJSON = function (key) { - return [this.item]; - }; - - SingletonSyntaxTriviaList.prototype.collectTextElements = function (elements) { - this.item.collectTextElements(elements); - }; - - SingletonSyntaxTriviaList.prototype.toArray = function () { - return [this.item]; - }; - - SingletonSyntaxTriviaList.prototype.concat = function (trivia) { - return concatTrivia(this, trivia); - }; - return SingletonSyntaxTriviaList; - })(); - - var NormalSyntaxTriviaList = (function () { - function NormalSyntaxTriviaList(trivia) { - this.trivia = trivia; - } - NormalSyntaxTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; - - NormalSyntaxTriviaList.prototype.count = function () { - return this.trivia.length; - }; - - NormalSyntaxTriviaList.prototype.syntaxTriviaAt = function (index) { - if (index < 0 || index >= this.trivia.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - - return this.trivia[index]; - }; - - NormalSyntaxTriviaList.prototype.last = function () { - return this.trivia[this.trivia.length - 1]; - }; - - NormalSyntaxTriviaList.prototype.fullWidth = function () { - return TypeScript.ArrayUtilities.sum(this.trivia, function (t) { - return t.fullWidth(); - }); - }; - - NormalSyntaxTriviaList.prototype.fullText = function () { - var result = ""; - - for (var i = 0, n = this.trivia.length; i < n; i++) { - result += this.trivia[i].fullText(); - } - - return result; - }; - - NormalSyntaxTriviaList.prototype.hasComment = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (isComment(this.trivia[i])) { - return true; - } - } - - return false; - }; - - NormalSyntaxTriviaList.prototype.hasNewLine = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 5 /* NewLineTrivia */) { - return true; - } - } - - return false; - }; - - NormalSyntaxTriviaList.prototype.hasSkippedToken = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 8 /* SkippedTokenTrivia */) { - return true; - } - } - - return false; - }; - - NormalSyntaxTriviaList.prototype.toJSON = function (key) { - return this.trivia; - }; - - NormalSyntaxTriviaList.prototype.collectTextElements = function (elements) { - for (var i = 0; i < this.trivia.length; i++) { - this.trivia[i].collectTextElements(elements); - } - }; - - NormalSyntaxTriviaList.prototype.toArray = function () { - return this.trivia.slice(0); - }; - - NormalSyntaxTriviaList.prototype.concat = function (trivia) { - return concatTrivia(this, trivia); - }; - return NormalSyntaxTriviaList; - })(); - - function triviaList(trivia) { - if (trivia === undefined || trivia === null || trivia.length === 0) { - return Syntax.emptyTriviaList; - } - - if (trivia.length === 1) { - return new SingletonSyntaxTriviaList(trivia[0]); - } - - return new NormalSyntaxTriviaList(trivia); - } - Syntax.triviaList = triviaList; - - Syntax.spaceTriviaList = triviaList([Syntax.spaceTrivia]); - })(TypeScript.Syntax || (TypeScript.Syntax = {})); - var Syntax = TypeScript.Syntax; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxUtilities = (function () { - function SyntaxUtilities() { - } - SyntaxUtilities.isAngleBracket = function (positionedElement) { - var element = positionedElement.element(); - var parent = positionedElement.parentElement(); - if (parent !== null && (element.kind() === 80 /* LessThanToken */ || element.kind() === 81 /* GreaterThanToken */)) { - switch (parent.kind()) { - case 228 /* TypeArgumentList */: - case 229 /* TypeParameterList */: - case 220 /* CastExpression */: - return true; - } - } - - return false; - }; - - SyntaxUtilities.getToken = function (list, kind) { - for (var i = 0, n = list.childCount(); i < n; i++) { - var token = list.childAt(i); - if (token.tokenKind === kind) { - return token; - } - } - - return null; - }; - - SyntaxUtilities.containsToken = function (list, kind) { - return SyntaxUtilities.getToken(list, kind) !== null; - }; - - SyntaxUtilities.hasExportKeyword = function (moduleElement) { - return SyntaxUtilities.getExportKeyword(moduleElement) !== null; - }; - - SyntaxUtilities.getExportKeyword = function (moduleElement) { - switch (moduleElement.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 132 /* EnumDeclaration */: - case 128 /* InterfaceDeclaration */: - case 133 /* ImportDeclaration */: - return SyntaxUtilities.getToken(moduleElement.modifiers, 47 /* ExportKeyword */); - default: - return null; - } - }; - - SyntaxUtilities.isAmbientDeclarationSyntax = function (positionNode) { - if (!positionNode) { - return false; - } - - var node = positionNode.node(); - switch (node.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 132 /* EnumDeclaration */: - if (SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { - return true; - } - - case 133 /* ImportDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 136 /* MemberVariableDeclaration */: - if (node.isClassElement() || node.isModuleElement()) { - return SyntaxUtilities.isAmbientDeclarationSyntax(positionNode.containingNode()); - } - - case 243 /* EnumElement */: - return SyntaxUtilities.isAmbientDeclarationSyntax(positionNode.containingNode().containingNode()); - - default: - return SyntaxUtilities.isAmbientDeclarationSyntax(positionNode.containingNode()); - } - }; - return SyntaxUtilities; - })(); - TypeScript.SyntaxUtilities = SyntaxUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxVisitor = (function () { - function SyntaxVisitor() { - } - SyntaxVisitor.prototype.defaultVisit = function (node) { - return null; - }; - - SyntaxVisitor.prototype.visitToken = function (token) { - return this.defaultVisit(token); - }; - - SyntaxVisitor.prototype.visitSourceUnit = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitExternalModuleReference = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitModuleNameModuleReference = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitImportDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitExportAssignment = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitClassDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitInterfaceDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitHeritageClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitModuleDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVariableStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVariableDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVariableDeclarator = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEqualsValueClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitPrefixUnaryExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitArrayLiteralExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitOmittedExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParenthesizedExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSimpleArrowFunctionExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitQualifiedName = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeArgumentList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstructorType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitObjectType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitArrayType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitGenericType = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeQuery = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeAnnotation = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitBlock = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParameter = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMemberAccessExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitPostfixUnaryExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitElementAccessExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitInvocationExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitArgumentList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitBinaryExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConditionalExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstructSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMethodSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitIndexSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitPropertySignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCallSignature = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitParameterList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeParameterList = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeParameter = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstraint = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitElseClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitIfStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitExpressionStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitConstructorDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMemberFunctionDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitGetAccessor = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSetAccessor = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitMemberVariableDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitIndexMemberDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitThrowStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitReturnStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitObjectCreationExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSwitchStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCaseSwitchClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDefaultSwitchClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitBreakStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitContinueStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitForStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitForInStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitWhileStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitWithStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEnumDeclaration = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEnumElement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCastExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitObjectLiteralExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitSimplePropertyAssignment = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionPropertyAssignment = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFunctionExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitEmptyStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTryStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitCatchClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitFinallyClause = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitLabeledStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDoStatement = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitTypeOfExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDeleteExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitVoidExpression = function (node) { - return this.defaultVisit(node); - }; - - SyntaxVisitor.prototype.visitDebuggerStatement = function (node) { - return this.defaultVisit(node); - }; - return SyntaxVisitor; - })(); - TypeScript.SyntaxVisitor = SyntaxVisitor; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxWalker = (function () { - function SyntaxWalker() { - } - SyntaxWalker.prototype.visitToken = function (token) { - }; - - SyntaxWalker.prototype.visitNode = function (node) { - node.accept(this); - }; - - SyntaxWalker.prototype.visitNodeOrToken = function (nodeOrToken) { - if (nodeOrToken.isToken()) { - this.visitToken(nodeOrToken); - } else { - this.visitNode(nodeOrToken); - } - }; - - SyntaxWalker.prototype.visitOptionalToken = function (token) { - if (token === null) { - return; - } - - this.visitToken(token); - }; - - SyntaxWalker.prototype.visitOptionalNode = function (node) { - if (node === null) { - return; - } - - this.visitNode(node); - }; - - SyntaxWalker.prototype.visitOptionalNodeOrToken = function (nodeOrToken) { - if (nodeOrToken === null) { - return; - } - - this.visitNodeOrToken(nodeOrToken); - }; - - SyntaxWalker.prototype.visitList = function (list) { - for (var i = 0, n = list.childCount(); i < n; i++) { - this.visitNodeOrToken(list.childAt(i)); - } - }; - - SyntaxWalker.prototype.visitSeparatedList = function (list) { - for (var i = 0, n = list.childCount(); i < n; i++) { - var item = list.childAt(i); - this.visitNodeOrToken(item); - } - }; - - SyntaxWalker.prototype.visitSourceUnit = function (node) { - this.visitList(node.moduleElements); - this.visitToken(node.endOfFileToken); - }; - - SyntaxWalker.prototype.visitExternalModuleReference = function (node) { - this.visitToken(node.requireKeyword); - this.visitToken(node.openParenToken); - this.visitToken(node.stringLiteral); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitModuleNameModuleReference = function (node) { - this.visitNodeOrToken(node.moduleName); - }; - - SyntaxWalker.prototype.visitImportDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.importKeyword); - this.visitToken(node.identifier); - this.visitToken(node.equalsToken); - this.visitNodeOrToken(node.moduleReference); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitExportAssignment = function (node) { - this.visitToken(node.exportKeyword); - this.visitToken(node.equalsToken); - this.visitToken(node.identifier); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitClassDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.classKeyword); - this.visitToken(node.identifier); - this.visitOptionalNode(node.typeParameterList); - this.visitList(node.heritageClauses); - this.visitToken(node.openBraceToken); - this.visitList(node.classElements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.interfaceKeyword); - this.visitToken(node.identifier); - this.visitOptionalNode(node.typeParameterList); - this.visitList(node.heritageClauses); - this.visitNode(node.body); - }; - - SyntaxWalker.prototype.visitHeritageClause = function (node) { - this.visitToken(node.extendsOrImplementsKeyword); - this.visitSeparatedList(node.typeNames); - }; - - SyntaxWalker.prototype.visitModuleDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.moduleKeyword); - this.visitOptionalNodeOrToken(node.name); - this.visitOptionalToken(node.stringLiteral); - this.visitToken(node.openBraceToken); - this.visitList(node.moduleElements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitFunctionDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.functionKeyword); - this.visitToken(node.identifier); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); - this.visitOptionalToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitVariableStatement = function (node) { - this.visitList(node.modifiers); - this.visitNode(node.variableDeclaration); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitVariableDeclaration = function (node) { - this.visitToken(node.varKeyword); - this.visitSeparatedList(node.variableDeclarators); - }; - - SyntaxWalker.prototype.visitVariableDeclarator = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalNode(node.typeAnnotation); - this.visitOptionalNode(node.equalsValueClause); - }; - - SyntaxWalker.prototype.visitEqualsValueClause = function (node) { - this.visitToken(node.equalsToken); - this.visitNodeOrToken(node.value); - }; - - SyntaxWalker.prototype.visitPrefixUnaryExpression = function (node) { - this.visitToken(node.operatorToken); - this.visitNodeOrToken(node.operand); - }; - - SyntaxWalker.prototype.visitArrayLiteralExpression = function (node) { - this.visitToken(node.openBracketToken); - this.visitSeparatedList(node.expressions); - this.visitToken(node.closeBracketToken); - }; - - SyntaxWalker.prototype.visitOmittedExpression = function (node) { - }; - - SyntaxWalker.prototype.visitParenthesizedExpression = function (node) { - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.expression); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitSimpleArrowFunctionExpression = function (node) { - this.visitToken(node.identifier); - this.visitToken(node.equalsGreaterThanToken); - this.visitOptionalNode(node.block); - this.visitOptionalNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - this.visitNode(node.callSignature); - this.visitToken(node.equalsGreaterThanToken); - this.visitOptionalNode(node.block); - this.visitOptionalNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitQualifiedName = function (node) { - this.visitNodeOrToken(node.left); - this.visitToken(node.dotToken); - this.visitToken(node.right); - }; - - SyntaxWalker.prototype.visitTypeArgumentList = function (node) { - this.visitToken(node.lessThanToken); - this.visitSeparatedList(node.typeArguments); - this.visitToken(node.greaterThanToken); - }; - - SyntaxWalker.prototype.visitConstructorType = function (node) { - this.visitToken(node.newKeyword); - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitToken(node.equalsGreaterThanToken); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitFunctionType = function (node) { - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitToken(node.equalsGreaterThanToken); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitObjectType = function (node) { - this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.typeMembers); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitArrayType = function (node) { - this.visitNodeOrToken(node.type); - this.visitToken(node.openBracketToken); - this.visitToken(node.closeBracketToken); - }; - - SyntaxWalker.prototype.visitGenericType = function (node) { - this.visitNodeOrToken(node.name); - this.visitNode(node.typeArgumentList); - }; - - SyntaxWalker.prototype.visitTypeQuery = function (node) { - this.visitToken(node.typeOfKeyword); - this.visitNodeOrToken(node.name); - }; - - SyntaxWalker.prototype.visitTypeAnnotation = function (node) { - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitBlock = function (node) { - this.visitToken(node.openBraceToken); - this.visitList(node.statements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitParameter = function (node) { - this.visitOptionalToken(node.dotDotDotToken); - this.visitList(node.modifiers); - this.visitToken(node.identifier); - this.visitOptionalToken(node.questionToken); - this.visitOptionalNode(node.typeAnnotation); - this.visitOptionalNode(node.equalsValueClause); - }; - - SyntaxWalker.prototype.visitMemberAccessExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitToken(node.dotToken); - this.visitToken(node.name); - }; - - SyntaxWalker.prototype.visitPostfixUnaryExpression = function (node) { - this.visitNodeOrToken(node.operand); - this.visitToken(node.operatorToken); - }; - - SyntaxWalker.prototype.visitElementAccessExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitToken(node.openBracketToken); - this.visitNodeOrToken(node.argumentExpression); - this.visitToken(node.closeBracketToken); - }; - - SyntaxWalker.prototype.visitInvocationExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitNode(node.argumentList); - }; - - SyntaxWalker.prototype.visitArgumentList = function (node) { - this.visitOptionalNode(node.typeArgumentList); - this.visitToken(node.openParenToken); - this.visitSeparatedList(node.arguments); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitBinaryExpression = function (node) { - this.visitNodeOrToken(node.left); - this.visitToken(node.operatorToken); - this.visitNodeOrToken(node.right); - }; - - SyntaxWalker.prototype.visitConditionalExpression = function (node) { - this.visitNodeOrToken(node.condition); - this.visitToken(node.questionToken); - this.visitNodeOrToken(node.whenTrue); - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.whenFalse); - }; - - SyntaxWalker.prototype.visitConstructSignature = function (node) { - this.visitToken(node.newKeyword); - this.visitNode(node.callSignature); - }; - - SyntaxWalker.prototype.visitMethodSignature = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalToken(node.questionToken); - this.visitNode(node.callSignature); - }; - - SyntaxWalker.prototype.visitIndexSignature = function (node) { - this.visitToken(node.openBracketToken); - this.visitNode(node.parameter); - this.visitToken(node.closeBracketToken); - this.visitOptionalNode(node.typeAnnotation); - }; - - SyntaxWalker.prototype.visitPropertySignature = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalToken(node.questionToken); - this.visitOptionalNode(node.typeAnnotation); - }; - - SyntaxWalker.prototype.visitCallSignature = function (node) { - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitOptionalNode(node.typeAnnotation); - }; - - SyntaxWalker.prototype.visitParameterList = function (node) { - this.visitToken(node.openParenToken); - this.visitSeparatedList(node.parameters); - this.visitToken(node.closeParenToken); - }; - - SyntaxWalker.prototype.visitTypeParameterList = function (node) { - this.visitToken(node.lessThanToken); - this.visitSeparatedList(node.typeParameters); - this.visitToken(node.greaterThanToken); - }; - - SyntaxWalker.prototype.visitTypeParameter = function (node) { - this.visitToken(node.identifier); - this.visitOptionalNode(node.constraint); - }; - - SyntaxWalker.prototype.visitConstraint = function (node) { - this.visitToken(node.extendsKeyword); - this.visitNodeOrToken(node.type); - }; - - SyntaxWalker.prototype.visitElseClause = function (node) { - this.visitToken(node.elseKeyword); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitIfStatement = function (node) { - this.visitToken(node.ifKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - this.visitOptionalNode(node.elseClause); - }; - - SyntaxWalker.prototype.visitExpressionStatement = function (node) { - this.visitNodeOrToken(node.expression); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitConstructorDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.constructorKeyword); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); - this.visitOptionalToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitMemberFunctionDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); - this.visitOptionalToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitGetAccessor = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.getKeyword); - this.visitToken(node.propertyName); - this.visitNode(node.parameterList); - this.visitOptionalNode(node.typeAnnotation); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitSetAccessor = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.setKeyword); - this.visitToken(node.propertyName); - this.visitNode(node.parameterList); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitMemberVariableDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitNode(node.variableDeclarator); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitIndexMemberDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitNode(node.indexSignature); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitThrowStatement = function (node) { - this.visitToken(node.throwKeyword); - this.visitNodeOrToken(node.expression); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitReturnStatement = function (node) { - this.visitToken(node.returnKeyword); - this.visitOptionalNodeOrToken(node.expression); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitObjectCreationExpression = function (node) { - this.visitToken(node.newKeyword); - this.visitNodeOrToken(node.expression); - this.visitOptionalNode(node.argumentList); - }; - - SyntaxWalker.prototype.visitSwitchStatement = function (node) { - this.visitToken(node.switchKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.expression); - this.visitToken(node.closeParenToken); - this.visitToken(node.openBraceToken); - this.visitList(node.switchClauses); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitCaseSwitchClause = function (node) { - this.visitToken(node.caseKeyword); - this.visitNodeOrToken(node.expression); - this.visitToken(node.colonToken); - this.visitList(node.statements); - }; - - SyntaxWalker.prototype.visitDefaultSwitchClause = function (node) { - this.visitToken(node.defaultKeyword); - this.visitToken(node.colonToken); - this.visitList(node.statements); - }; - - SyntaxWalker.prototype.visitBreakStatement = function (node) { - this.visitToken(node.breakKeyword); - this.visitOptionalToken(node.identifier); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitContinueStatement = function (node) { - this.visitToken(node.continueKeyword); - this.visitOptionalToken(node.identifier); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitForStatement = function (node) { - this.visitToken(node.forKeyword); - this.visitToken(node.openParenToken); - this.visitOptionalNode(node.variableDeclaration); - this.visitOptionalNodeOrToken(node.initializer); - this.visitToken(node.firstSemicolonToken); - this.visitOptionalNodeOrToken(node.condition); - this.visitToken(node.secondSemicolonToken); - this.visitOptionalNodeOrToken(node.incrementor); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitForInStatement = function (node) { - this.visitToken(node.forKeyword); - this.visitToken(node.openParenToken); - this.visitOptionalNode(node.variableDeclaration); - this.visitOptionalNodeOrToken(node.left); - this.visitToken(node.inKeyword); - this.visitNodeOrToken(node.expression); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitWhileStatement = function (node) { - this.visitToken(node.whileKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitWithStatement = function (node) { - this.visitToken(node.withKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitEnumDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.enumKeyword); - this.visitToken(node.identifier); - this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.enumElements); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitEnumElement = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalNode(node.equalsValueClause); - }; - - SyntaxWalker.prototype.visitCastExpression = function (node) { - this.visitToken(node.lessThanToken); - this.visitNodeOrToken(node.type); - this.visitToken(node.greaterThanToken); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitObjectLiteralExpression = function (node) { - this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.propertyAssignments); - this.visitToken(node.closeBraceToken); - }; - - SyntaxWalker.prototype.visitSimplePropertyAssignment = function (node) { - this.visitToken(node.propertyName); - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitFunctionPropertyAssignment = function (node) { - this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitFunctionExpression = function (node) { - this.visitToken(node.functionKeyword); - this.visitOptionalToken(node.identifier); - this.visitNode(node.callSignature); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitEmptyStatement = function (node) { - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitTryStatement = function (node) { - this.visitToken(node.tryKeyword); - this.visitNode(node.block); - this.visitOptionalNode(node.catchClause); - this.visitOptionalNode(node.finallyClause); - }; - - SyntaxWalker.prototype.visitCatchClause = function (node) { - this.visitToken(node.catchKeyword); - this.visitToken(node.openParenToken); - this.visitToken(node.identifier); - this.visitOptionalNode(node.typeAnnotation); - this.visitToken(node.closeParenToken); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitFinallyClause = function (node) { - this.visitToken(node.finallyKeyword); - this.visitNode(node.block); - }; - - SyntaxWalker.prototype.visitLabeledStatement = function (node) { - this.visitToken(node.identifier); - this.visitToken(node.colonToken); - this.visitNodeOrToken(node.statement); - }; - - SyntaxWalker.prototype.visitDoStatement = function (node) { - this.visitToken(node.doKeyword); - this.visitNodeOrToken(node.statement); - this.visitToken(node.whileKeyword); - this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); - this.visitToken(node.closeParenToken); - this.visitToken(node.semicolonToken); - }; - - SyntaxWalker.prototype.visitTypeOfExpression = function (node) { - this.visitToken(node.typeOfKeyword); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitDeleteExpression = function (node) { - this.visitToken(node.deleteKeyword); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitVoidExpression = function (node) { - this.visitToken(node.voidKeyword); - this.visitNodeOrToken(node.expression); - }; - - SyntaxWalker.prototype.visitDebuggerStatement = function (node) { - this.visitToken(node.debuggerKeyword); - this.visitToken(node.semicolonToken); - }; - return SyntaxWalker; - })(); - TypeScript.SyntaxWalker = SyntaxWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var PositionTrackingWalker = (function (_super) { - __extends(PositionTrackingWalker, _super); - function PositionTrackingWalker() { - _super.apply(this, arguments); - this._position = 0; - } - PositionTrackingWalker.prototype.visitToken = function (token) { - this._position += token.fullWidth(); - }; - - PositionTrackingWalker.prototype.position = function () { - return this._position; - }; - - PositionTrackingWalker.prototype.skip = function (element) { - this._position += element.fullWidth(); - }; - return PositionTrackingWalker; - })(TypeScript.SyntaxWalker); - TypeScript.PositionTrackingWalker = PositionTrackingWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxInformationMap = (function (_super) { - __extends(SyntaxInformationMap, _super); - function SyntaxInformationMap(trackParents, trackPreviousToken) { - _super.call(this); - this.trackParents = trackParents; - this.trackPreviousToken = trackPreviousToken; - this.tokenToInformation = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - this.elementToPosition = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - this._previousToken = null; - this._previousTokenInformation = null; - this._currentPosition = 0; - this._elementToParent = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - this._parentStack = []; - this._parentStack.push(null); - } - SyntaxInformationMap.create = function (node, trackParents, trackPreviousToken) { - var map = new SyntaxInformationMap(trackParents, trackPreviousToken); - map.visitNode(node); - return map; - }; - - SyntaxInformationMap.prototype.visitNode = function (node) { - this.trackParents && this._elementToParent.add(node, TypeScript.ArrayUtilities.last(this._parentStack)); - this.elementToPosition.add(node, this._currentPosition); - - this.trackParents && this._parentStack.push(node); - _super.prototype.visitNode.call(this, node); - this.trackParents && this._parentStack.pop(); - }; - - SyntaxInformationMap.prototype.visitToken = function (token) { - this.trackParents && this._elementToParent.add(token, TypeScript.ArrayUtilities.last(this._parentStack)); - - if (this.trackPreviousToken) { - var tokenInformation = { - previousToken: this._previousToken, - nextToken: null - }; - - if (this._previousTokenInformation !== null) { - this._previousTokenInformation.nextToken = token; - } - - this._previousToken = token; - this._previousTokenInformation = tokenInformation; - - this.tokenToInformation.add(token, tokenInformation); - } - - this.elementToPosition.add(token, this._currentPosition); - this._currentPosition += token.fullWidth(); - }; - - SyntaxInformationMap.prototype.parent = function (element) { - return this._elementToParent.get(element); - }; - - SyntaxInformationMap.prototype.fullStart = function (element) { - return this.elementToPosition.get(element); - }; - - SyntaxInformationMap.prototype.start = function (element) { - return this.fullStart(element) + element.leadingTriviaWidth(); - }; - - SyntaxInformationMap.prototype.end = function (element) { - return this.start(element) + element.width(); - }; - - SyntaxInformationMap.prototype.previousToken = function (token) { - return this.tokenInformation(token).previousToken; - }; - - SyntaxInformationMap.prototype.tokenInformation = function (token) { - return this.tokenToInformation.get(token); - }; - - SyntaxInformationMap.prototype.firstTokenInLineContainingToken = function (token) { - var current = token; - while (true) { - var information = this.tokenInformation(current); - if (this.isFirstTokenInLineWorker(information)) { - break; - } - - current = information.previousToken; - } - - return current; - }; - - SyntaxInformationMap.prototype.isFirstTokenInLine = function (token) { - var information = this.tokenInformation(token); - return this.isFirstTokenInLineWorker(information); - }; - - SyntaxInformationMap.prototype.isFirstTokenInLineWorker = function (information) { - return information.previousToken === null || information.previousToken.hasTrailingNewLine(); - }; - return SyntaxInformationMap; - })(TypeScript.SyntaxWalker); - TypeScript.SyntaxInformationMap = SyntaxInformationMap; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxNodeInvariantsChecker = (function (_super) { - __extends(SyntaxNodeInvariantsChecker, _super); - function SyntaxNodeInvariantsChecker() { - _super.apply(this, arguments); - this.tokenTable = TypeScript.Collections.createHashTable(TypeScript.Collections.DefaultHashTableCapacity, TypeScript.Collections.identityHashCode); - } - SyntaxNodeInvariantsChecker.checkInvariants = function (node) { - node.accept(new SyntaxNodeInvariantsChecker()); - }; - - SyntaxNodeInvariantsChecker.prototype.visitToken = function (token) { - this.tokenTable.add(token, token); - }; - return SyntaxNodeInvariantsChecker; - })(TypeScript.SyntaxWalker); - TypeScript.SyntaxNodeInvariantsChecker = SyntaxNodeInvariantsChecker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var DepthLimitedWalker = (function (_super) { - __extends(DepthLimitedWalker, _super); - function DepthLimitedWalker(maximumDepth) { - _super.call(this); - this._depth = 0; - this._maximumDepth = 0; - this._maximumDepth = maximumDepth; - } - DepthLimitedWalker.prototype.visitNode = function (node) { - if (this._depth < this._maximumDepth) { - this._depth++; - _super.prototype.visitNode.call(this, node); - this._depth--; - } else { - this.skip(node); - } - }; - return DepthLimitedWalker; - })(TypeScript.PositionTrackingWalker); - TypeScript.DepthLimitedWalker = DepthLimitedWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (Parser) { - - - var ExpressionPrecedence; - (function (ExpressionPrecedence) { - ExpressionPrecedence[ExpressionPrecedence["CommaExpressionPrecedence"] = 1] = "CommaExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["AssignmentExpressionPrecedence"] = 2] = "AssignmentExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["ConditionalExpressionPrecedence"] = 3] = "ConditionalExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["ArrowFunctionPrecedence"] = 4] = "ArrowFunctionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["LogicalOrExpressionPrecedence"] = 5] = "LogicalOrExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["LogicalAndExpressionPrecedence"] = 6] = "LogicalAndExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["BitwiseOrExpressionPrecedence"] = 7] = "BitwiseOrExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["BitwiseExclusiveOrExpressionPrecedence"] = 8] = "BitwiseExclusiveOrExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["BitwiseAndExpressionPrecedence"] = 9] = "BitwiseAndExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["EqualityExpressionPrecedence"] = 10] = "EqualityExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["RelationalExpressionPrecedence"] = 11] = "RelationalExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["ShiftExpressionPrecdence"] = 12] = "ShiftExpressionPrecdence"; - ExpressionPrecedence[ExpressionPrecedence["AdditiveExpressionPrecedence"] = 13] = "AdditiveExpressionPrecedence"; - ExpressionPrecedence[ExpressionPrecedence["MultiplicativeExpressionPrecedence"] = 14] = "MultiplicativeExpressionPrecedence"; - - ExpressionPrecedence[ExpressionPrecedence["UnaryExpressionPrecedence"] = 15] = "UnaryExpressionPrecedence"; - })(ExpressionPrecedence || (ExpressionPrecedence = {})); - - var ListParsingState; - (function (ListParsingState) { - ListParsingState[ListParsingState["SourceUnit_ModuleElements"] = 1 << 0] = "SourceUnit_ModuleElements"; - ListParsingState[ListParsingState["ClassDeclaration_ClassElements"] = 1 << 1] = "ClassDeclaration_ClassElements"; - ListParsingState[ListParsingState["ModuleDeclaration_ModuleElements"] = 1 << 2] = "ModuleDeclaration_ModuleElements"; - ListParsingState[ListParsingState["SwitchStatement_SwitchClauses"] = 1 << 3] = "SwitchStatement_SwitchClauses"; - ListParsingState[ListParsingState["SwitchClause_Statements"] = 1 << 4] = "SwitchClause_Statements"; - ListParsingState[ListParsingState["Block_Statements"] = 1 << 5] = "Block_Statements"; - ListParsingState[ListParsingState["TryBlock_Statements"] = 1 << 6] = "TryBlock_Statements"; - ListParsingState[ListParsingState["CatchBlock_Statements"] = 1 << 7] = "CatchBlock_Statements"; - ListParsingState[ListParsingState["EnumDeclaration_EnumElements"] = 1 << 8] = "EnumDeclaration_EnumElements"; - ListParsingState[ListParsingState["ObjectType_TypeMembers"] = 1 << 9] = "ObjectType_TypeMembers"; - ListParsingState[ListParsingState["ClassOrInterfaceDeclaration_HeritageClauses"] = 1 << 10] = "ClassOrInterfaceDeclaration_HeritageClauses"; - ListParsingState[ListParsingState["HeritageClause_TypeNameList"] = 1 << 11] = "HeritageClause_TypeNameList"; - ListParsingState[ListParsingState["VariableDeclaration_VariableDeclarators_AllowIn"] = 1 << 12] = "VariableDeclaration_VariableDeclarators_AllowIn"; - ListParsingState[ListParsingState["VariableDeclaration_VariableDeclarators_DisallowIn"] = 1 << 13] = "VariableDeclaration_VariableDeclarators_DisallowIn"; - ListParsingState[ListParsingState["ArgumentList_AssignmentExpressions"] = 1 << 14] = "ArgumentList_AssignmentExpressions"; - ListParsingState[ListParsingState["ObjectLiteralExpression_PropertyAssignments"] = 1 << 15] = "ObjectLiteralExpression_PropertyAssignments"; - ListParsingState[ListParsingState["ArrayLiteralExpression_AssignmentExpressions"] = 1 << 16] = "ArrayLiteralExpression_AssignmentExpressions"; - ListParsingState[ListParsingState["ParameterList_Parameters"] = 1 << 17] = "ParameterList_Parameters"; - ListParsingState[ListParsingState["TypeArgumentList_Types"] = 1 << 18] = "TypeArgumentList_Types"; - ListParsingState[ListParsingState["TypeParameterList_TypeParameters"] = 1 << 19] = "TypeParameterList_TypeParameters"; - - ListParsingState[ListParsingState["FirstListParsingState"] = ListParsingState.SourceUnit_ModuleElements] = "FirstListParsingState"; - ListParsingState[ListParsingState["LastListParsingState"] = ListParsingState.TypeParameterList_TypeParameters] = "LastListParsingState"; - })(ListParsingState || (ListParsingState = {})); - - var SyntaxCursor = (function () { - function SyntaxCursor(sourceUnit) { - this._elements = []; - this._index = 0; - this._pinCount = 0; - sourceUnit.insertChildrenInto(this._elements, 0); - } - SyntaxCursor.prototype.isFinished = function () { - return this._index === this._elements.length; - }; - - SyntaxCursor.prototype.currentElement = function () { - if (this.isFinished()) { - return null; - } - - return this._elements[this._index]; - }; - - SyntaxCursor.prototype.currentNode = function () { - var element = this.currentElement(); - return element !== null && element.isNode() ? element : null; - }; - - SyntaxCursor.prototype.moveToFirstChild = function () { - if (this.isFinished()) { - return; - } - - var element = this._elements[this._index]; - if (element.isToken()) { - return; - } - - var node = element; - - this._elements.splice(this._index, 1); - - node.insertChildrenInto(this._elements, this._index); - }; - - SyntaxCursor.prototype.moveToNextSibling = function () { - if (this.isFinished()) { - return; - } - - if (this._pinCount > 0) { - this._index++; - return; - } - - this._elements.shift(); - }; - - SyntaxCursor.prototype.getAndPinCursorIndex = function () { - this._pinCount++; - return this._index; - }; - - SyntaxCursor.prototype.releaseAndUnpinCursorIndex = function (index) { - this._pinCount--; - if (this._pinCount === 0) { - } - }; - - SyntaxCursor.prototype.rewindToPinnedCursorIndex = function (index) { - this._index = index; - }; - - SyntaxCursor.prototype.pinCount = function () { - return this._pinCount; - }; - - SyntaxCursor.prototype.moveToFirstToken = function () { - var element; - - while (!this.isFinished()) { - element = this.currentElement(); - if (element.isNode()) { - this.moveToFirstChild(); - continue; - } - - return; - } - }; - - SyntaxCursor.prototype.currentToken = function () { - this.moveToFirstToken(); - if (this.isFinished()) { - return null; - } - - var element = this.currentElement(); - - return element; - }; - - SyntaxCursor.prototype.peekToken = function (n) { - this.moveToFirstToken(); - var pin = this.getAndPinCursorIndex(); - - for (var i = 0; i < n; i++) { - this.moveToNextSibling(); - this.moveToFirstToken(); - } - - var result = this.currentToken(); - this.rewindToPinnedCursorIndex(pin); - this.releaseAndUnpinCursorIndex(pin); - - return result; - }; - return SyntaxCursor; - })(); - - - - var NormalParserSource = (function () { - function NormalParserSource(fileName, text, languageVersion) { - this._previousToken = null; - this._absolutePosition = 0; - this._tokenDiagnostics = []; - this.rewindPointPool = []; - this.rewindPointPoolCount = 0; - this.slidingWindow = new TypeScript.SlidingWindow(this, TypeScript.ArrayUtilities.createArray(32, null), null); - this.scanner = new TypeScript.Scanner(fileName, text, languageVersion); - } - NormalParserSource.prototype.currentNode = function () { - return null; - }; - - NormalParserSource.prototype.moveToNextNode = function () { - throw TypeScript.Errors.invalidOperation(); - }; - - NormalParserSource.prototype.absolutePosition = function () { - return this._absolutePosition; - }; - - NormalParserSource.prototype.previousToken = function () { - return this._previousToken; - }; - - NormalParserSource.prototype.tokenDiagnostics = function () { - return this._tokenDiagnostics; - }; - - NormalParserSource.prototype.getOrCreateRewindPoint = function () { - if (this.rewindPointPoolCount === 0) { - return {}; - } - - this.rewindPointPoolCount--; - var result = this.rewindPointPool[this.rewindPointPoolCount]; - this.rewindPointPool[this.rewindPointPoolCount] = null; - return result; - }; - - NormalParserSource.prototype.getRewindPoint = function () { - var slidingWindowIndex = this.slidingWindow.getAndPinAbsoluteIndex(); - - var rewindPoint = this.getOrCreateRewindPoint(); - - rewindPoint.slidingWindowIndex = slidingWindowIndex; - rewindPoint.previousToken = this._previousToken; - rewindPoint.absolutePosition = this._absolutePosition; - - rewindPoint.pinCount = this.slidingWindow.pinCount(); - - return rewindPoint; - }; - - NormalParserSource.prototype.isPinned = function () { - return this.slidingWindow.pinCount() > 0; - }; - - NormalParserSource.prototype.rewind = function (rewindPoint) { - this.slidingWindow.rewindToPinnedIndex(rewindPoint.slidingWindowIndex); - - this._previousToken = rewindPoint.previousToken; - this._absolutePosition = rewindPoint.absolutePosition; - }; - - NormalParserSource.prototype.releaseRewindPoint = function (rewindPoint) { - this.slidingWindow.releaseAndUnpinAbsoluteIndex(rewindPoint.absoluteIndex); - - this.rewindPointPool[this.rewindPointPoolCount] = rewindPoint; - this.rewindPointPoolCount++; - }; - - NormalParserSource.prototype.fetchMoreItems = function (allowRegularExpression, sourceIndex, window, destinationIndex, spaceAvailable) { - window[destinationIndex] = this.scanner.scan(this._tokenDiagnostics, allowRegularExpression); - return 1; - }; - - NormalParserSource.prototype.peekToken = function (n) { - return this.slidingWindow.peekItemN(n); - }; - - NormalParserSource.prototype.moveToNextToken = function () { - var currentToken = this.currentToken(); - this._absolutePosition += currentToken.fullWidth(); - this._previousToken = currentToken; - - this.slidingWindow.moveToNextItem(); - }; - - NormalParserSource.prototype.currentToken = function () { - return this.slidingWindow.currentItem(false); - }; - - NormalParserSource.prototype.removeDiagnosticsOnOrAfterPosition = function (position) { - var tokenDiagnosticsLength = this._tokenDiagnostics.length; - while (tokenDiagnosticsLength > 0) { - var diagnostic = this._tokenDiagnostics[tokenDiagnosticsLength - 1]; - if (diagnostic.start() >= position) { - tokenDiagnosticsLength--; - } else { - break; - } - } - - this._tokenDiagnostics.length = tokenDiagnosticsLength; - }; - - NormalParserSource.prototype.resetToPosition = function (absolutePosition, previousToken) { - this._absolutePosition = absolutePosition; - this._previousToken = previousToken; - - this.removeDiagnosticsOnOrAfterPosition(absolutePosition); - - this.slidingWindow.disgardAllItemsFromCurrentIndexOnwards(); - - this.scanner.setAbsoluteIndex(absolutePosition); - }; - - NormalParserSource.prototype.currentTokenAllowingRegularExpression = function () { - this.resetToPosition(this._absolutePosition, this._previousToken); - - var token = this.slidingWindow.currentItem(true); - - return token; - }; - return NormalParserSource; - })(); - - var IncrementalParserSource = (function () { - function IncrementalParserSource(oldSyntaxTree, textChangeRange, newText) { - this._changeDelta = 0; - var oldSourceUnit = oldSyntaxTree.sourceUnit(); - this._oldSourceUnitCursor = new SyntaxCursor(oldSourceUnit); - - this._changeRange = IncrementalParserSource.extendToAffectedRange(textChangeRange, oldSourceUnit); - - if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { - TypeScript.Debug.assert((oldSourceUnit.fullWidth() - this._changeRange.span().length() + this._changeRange.newLength()) === newText.length()); - } - - this._normalParserSource = new NormalParserSource(oldSyntaxTree.fileName(), newText, oldSyntaxTree.parseOptions().languageVersion()); - } - IncrementalParserSource.extendToAffectedRange = function (changeRange, sourceUnit) { - var maxLookahead = 1; - - var start = changeRange.span().start(); - - for (var i = 0; start > 0 && i <= maxLookahead; i++) { - var token = sourceUnit.findToken(start); - - var position = token.fullStart(); - - start = TypeScript.MathPrototype.max(0, position - 1); - } - - var finalSpan = TypeScript.TextSpan.fromBounds(start, changeRange.span().end()); - var finalLength = changeRange.newLength() + (changeRange.span().start() - start); - - return new TypeScript.TextChangeRange(finalSpan, finalLength); - }; - - IncrementalParserSource.prototype.absolutePosition = function () { - return this._normalParserSource.absolutePosition(); - }; - - IncrementalParserSource.prototype.previousToken = function () { - return this._normalParserSource.previousToken(); - }; - - IncrementalParserSource.prototype.tokenDiagnostics = function () { - return this._normalParserSource.tokenDiagnostics(); - }; - - IncrementalParserSource.prototype.getRewindPoint = function () { - var rewindPoint = this._normalParserSource.getRewindPoint(); - var oldSourceUnitCursorIndex = this._oldSourceUnitCursor.getAndPinCursorIndex(); - - rewindPoint.changeDelta = this._changeDelta; - rewindPoint.changeRange = this._changeRange; - rewindPoint.oldSourceUnitCursorIndex = oldSourceUnitCursorIndex; - - return rewindPoint; - }; - - IncrementalParserSource.prototype.rewind = function (rewindPoint) { - this._changeRange = rewindPoint.changeRange; - this._changeDelta = rewindPoint.changeDelta; - this._oldSourceUnitCursor.rewindToPinnedCursorIndex(rewindPoint.oldSourceUnitCursorIndex); - - this._normalParserSource.rewind(rewindPoint); - }; - - IncrementalParserSource.prototype.releaseRewindPoint = function (rewindPoint) { - this._oldSourceUnitCursor.releaseAndUnpinCursorIndex(rewindPoint.oldSourceUnitCursorIndex); - this._normalParserSource.releaseRewindPoint(rewindPoint); - }; - - IncrementalParserSource.prototype.canReadFromOldSourceUnit = function () { - if (this._normalParserSource.isPinned()) { - return false; - } - - if (this._changeRange !== null && this._changeRange.newSpan().intersectsWithPosition(this.absolutePosition())) { - return false; - } - - this.syncCursorToNewTextIfBehind(); - - return this._changeDelta === 0 && !this._oldSourceUnitCursor.isFinished(); - }; - - IncrementalParserSource.prototype.currentNode = function () { - if (this.canReadFromOldSourceUnit()) { - return this.tryGetNodeFromOldSourceUnit(); - } - - return null; - }; - - IncrementalParserSource.prototype.currentToken = function () { - if (this.canReadFromOldSourceUnit()) { - var token = this.tryGetTokenFromOldSourceUnit(); - if (token !== null) { - return token; - } - } - - return this._normalParserSource.currentToken(); - }; - - IncrementalParserSource.prototype.currentTokenAllowingRegularExpression = function () { - return this._normalParserSource.currentTokenAllowingRegularExpression(); - }; - - IncrementalParserSource.prototype.syncCursorToNewTextIfBehind = function () { - while (true) { - if (this._oldSourceUnitCursor.isFinished()) { - break; - } - - if (this._changeDelta >= 0) { - break; - } - - var currentElement = this._oldSourceUnitCursor.currentElement(); - - if (currentElement.isNode() && (currentElement.fullWidth() > Math.abs(this._changeDelta))) { - this._oldSourceUnitCursor.moveToFirstChild(); - } else { - this._oldSourceUnitCursor.moveToNextSibling(); - - this._changeDelta += currentElement.fullWidth(); - } - } - }; - - IncrementalParserSource.prototype.intersectsWithChangeRangeSpanInOriginalText = function (start, length) { - return this._changeRange !== null && this._changeRange.span().intersectsWith(start, length); - }; - - IncrementalParserSource.prototype.tryGetNodeFromOldSourceUnit = function () { - while (true) { - var node = this._oldSourceUnitCursor.currentNode(); - if (node === null) { - return null; - } - - if (!this.intersectsWithChangeRangeSpanInOriginalText(this.absolutePosition(), node.fullWidth())) { - if (!node.isIncrementallyUnusable()) { - return node; - } - } - - this._oldSourceUnitCursor.moveToFirstChild(); - } - }; - - IncrementalParserSource.prototype.canReuseTokenFromOldSourceUnit = function (position, token) { - if (token !== null) { - if (!this.intersectsWithChangeRangeSpanInOriginalText(position, token.fullWidth())) { - if (!token.isIncrementallyUnusable()) { - return true; - } - } - } - - return false; - }; - - IncrementalParserSource.prototype.tryGetTokenFromOldSourceUnit = function () { - var token = this._oldSourceUnitCursor.currentToken(); - - return this.canReuseTokenFromOldSourceUnit(this.absolutePosition(), token) ? token : null; - }; - - IncrementalParserSource.prototype.peekToken = function (n) { - if (this.canReadFromOldSourceUnit()) { - var token = this.tryPeekTokenFromOldSourceUnit(n); - if (token !== null) { - return token; - } - } - - return this._normalParserSource.peekToken(n); - }; - - IncrementalParserSource.prototype.tryPeekTokenFromOldSourceUnit = function (n) { - var currentPosition = this.absolutePosition(); - for (var i = 0; i < n; i++) { - var interimToken = this._oldSourceUnitCursor.peekToken(i); - if (!this.canReuseTokenFromOldSourceUnit(currentPosition, interimToken)) { - return null; - } - - currentPosition += interimToken.fullWidth(); - } - - var token = this._oldSourceUnitCursor.peekToken(n); - return this.canReuseTokenFromOldSourceUnit(currentPosition, token) ? token : null; - }; - - IncrementalParserSource.prototype.moveToNextNode = function () { - var currentElement = this._oldSourceUnitCursor.currentElement(); - var currentNode = this._oldSourceUnitCursor.currentNode(); - - this._oldSourceUnitCursor.moveToNextSibling(); - - var absolutePosition = this.absolutePosition() + currentNode.fullWidth(); - var previousToken = currentNode.lastToken(); - this._normalParserSource.resetToPosition(absolutePosition, previousToken); - - if (this._changeRange !== null) { - } - }; - - IncrementalParserSource.prototype.moveToNextToken = function () { - var currentToken = this.currentToken(); - - if (this._oldSourceUnitCursor.currentToken() === currentToken) { - this._oldSourceUnitCursor.moveToNextSibling(); - - var absolutePosition = this.absolutePosition() + currentToken.fullWidth(); - var previousToken = currentToken; - this._normalParserSource.resetToPosition(absolutePosition, previousToken); - - if (this._changeRange !== null) { - } - } else { - this._changeDelta -= currentToken.fullWidth(); - - this._normalParserSource.moveToNextToken(); - - if (this._changeRange !== null) { - var changeRangeSpanInNewText = this._changeRange.newSpan(); - if (this.absolutePosition() >= changeRangeSpanInNewText.end()) { - this._changeDelta += this._changeRange.newLength() - this._changeRange.span().length(); - this._changeRange = null; - } - } - } - }; - return IncrementalParserSource; - })(); - - var ParserImpl = (function () { - function ParserImpl(fileName, lineMap, source, parseOptions, newText_forDebuggingPurposesOnly) { - this.newText_forDebuggingPurposesOnly = newText_forDebuggingPurposesOnly; - this.listParsingState = 0; - this.isInStrictMode = false; - this.diagnostics = []; - this.factory = TypeScript.Syntax.normalModeFactory; - this.mergeTokensStorage = []; - this.arrayPool = []; - this.fileName = fileName; - this.lineMap = lineMap; - this.source = source; - this.parseOptions = parseOptions; - } - ParserImpl.prototype.getRewindPoint = function () { - var rewindPoint = this.source.getRewindPoint(); - - rewindPoint.diagnosticsCount = this.diagnostics.length; - - rewindPoint.isInStrictMode = this.isInStrictMode; - rewindPoint.listParsingState = this.listParsingState; - - return rewindPoint; - }; - - ParserImpl.prototype.rewind = function (rewindPoint) { - this.source.rewind(rewindPoint); - - this.diagnostics.length = rewindPoint.diagnosticsCount; - }; - - ParserImpl.prototype.releaseRewindPoint = function (rewindPoint) { - this.source.releaseRewindPoint(rewindPoint); - }; - - ParserImpl.prototype.currentTokenStart = function () { - return this.source.absolutePosition() + this.currentToken().leadingTriviaWidth(); - }; - - ParserImpl.prototype.previousTokenStart = function () { - if (this.previousToken() === null) { - return 0; - } - - return this.source.absolutePosition() - this.previousToken().fullWidth() + this.previousToken().leadingTriviaWidth(); - }; - - ParserImpl.prototype.previousTokenEnd = function () { - if (this.previousToken() === null) { - return 0; - } - - return this.previousTokenStart() + this.previousToken().width(); - }; - - ParserImpl.prototype.currentNode = function () { - var node = this.source.currentNode(); - - if (node === null || node.parsedInStrictMode() !== this.isInStrictMode) { - return null; - } - - return node; - }; - - ParserImpl.prototype.currentToken = function () { - return this.source.currentToken(); - }; - - ParserImpl.prototype.currentTokenAllowingRegularExpression = function () { - return this.source.currentTokenAllowingRegularExpression(); - }; - - ParserImpl.prototype.peekToken = function (n) { - return this.source.peekToken(n); - }; - - ParserImpl.prototype.eatAnyToken = function () { - var token = this.currentToken(); - this.moveToNextToken(); - return token; - }; - - ParserImpl.prototype.moveToNextToken = function () { - this.source.moveToNextToken(); - }; - - ParserImpl.prototype.previousToken = function () { - return this.source.previousToken(); - }; - - ParserImpl.prototype.eatNode = function () { - var node = this.source.currentNode(); - this.source.moveToNextNode(); - return node; - }; - - ParserImpl.prototype.eatToken = function (kind) { - var token = this.currentToken(); - if (token.tokenKind === kind) { - this.moveToNextToken(); - return token; - } - - return this.createMissingToken(kind, token); - }; - - ParserImpl.prototype.tryEatToken = function (kind) { - if (this.currentToken().tokenKind === kind) { - return this.eatToken(kind); - } - - return null; - }; - - ParserImpl.prototype.eatKeyword = function (kind) { - var token = this.currentToken(); - if (token.tokenKind === kind) { - this.moveToNextToken(); - return token; - } - - return this.createMissingToken(kind, token); - }; - - ParserImpl.prototype.isIdentifier = function (token) { - var tokenKind = token.tokenKind; - - if (tokenKind === 11 /* IdentifierName */) { - return true; - } - - if (tokenKind >= 51 /* FirstFutureReservedStrictKeyword */) { - if (tokenKind <= 59 /* LastFutureReservedStrictKeyword */) { - return !this.isInStrictMode; - } - - return tokenKind <= 69 /* LastTypeScriptKeyword */; - } - - return false; - }; - - ParserImpl.prototype.eatIdentifierNameToken = function () { - var token = this.currentToken(); - - if (token.tokenKind === 11 /* IdentifierName */) { - this.moveToNextToken(); - return token; - } - - if (TypeScript.SyntaxFacts.isAnyKeyword(token.tokenKind)) { - this.moveToNextToken(); - return TypeScript.Syntax.convertToIdentifierName(token); - } - - return this.createMissingToken(11 /* IdentifierName */, token); - }; - - ParserImpl.prototype.eatIdentifierToken = function () { - var token = this.currentToken(); - if (this.isIdentifier(token)) { - this.moveToNextToken(); - - if (token.tokenKind === 11 /* IdentifierName */) { - return token; - } - - return TypeScript.Syntax.convertToIdentifierName(token); - } - - return this.createMissingToken(11 /* IdentifierName */, token); - }; - - ParserImpl.prototype.canEatAutomaticSemicolon = function (allowWithoutNewLine) { - var token = this.currentToken(); - - if (token.tokenKind === 10 /* EndOfFileToken */) { - return true; - } - - if (token.tokenKind === 71 /* CloseBraceToken */) { - return true; - } - - if (allowWithoutNewLine) { - return true; - } - - if (this.previousToken() !== null && this.previousToken().hasTrailingNewLine()) { - return true; - } - - return false; - }; - - ParserImpl.prototype.canEatExplicitOrAutomaticSemicolon = function (allowWithoutNewline) { - var token = this.currentToken(); - - if (token.tokenKind === 78 /* SemicolonToken */) { - return true; - } - - return this.canEatAutomaticSemicolon(allowWithoutNewline); - }; - - ParserImpl.prototype.eatExplicitOrAutomaticSemicolon = function (allowWithoutNewline) { - var token = this.currentToken(); - - if (token.tokenKind === 78 /* SemicolonToken */) { - return this.eatToken(78 /* SemicolonToken */); - } - - if (this.canEatAutomaticSemicolon(allowWithoutNewline)) { - var semicolonToken = TypeScript.Syntax.emptyToken(78 /* SemicolonToken */); - - if (!this.parseOptions.allowAutomaticSemicolonInsertion()) { - this.addDiagnostic(new TypeScript.Diagnostic(this.fileName, this.lineMap, this.previousTokenEnd(), 0, TypeScript.DiagnosticCode.Automatic_semicolon_insertion_not_allowed, null)); - } - - return semicolonToken; - } - - return this.eatToken(78 /* SemicolonToken */); - }; - - ParserImpl.prototype.isKeyword = function (kind) { - if (kind >= 15 /* FirstKeyword */) { - if (kind <= 50 /* LastFutureReservedKeyword */) { - return true; - } - - if (this.isInStrictMode) { - return kind <= 59 /* LastFutureReservedStrictKeyword */; - } - } - - return false; - }; - - ParserImpl.prototype.createMissingToken = function (expectedKind, actual) { - var diagnostic = this.getExpectedTokenDiagnostic(expectedKind, actual); - this.addDiagnostic(diagnostic); - - return TypeScript.Syntax.emptyToken(expectedKind); - }; - - ParserImpl.prototype.getExpectedTokenDiagnostic = function (expectedKind, actual) { - var token = this.currentToken(); - - if (TypeScript.SyntaxFacts.isAnyKeyword(expectedKind) || TypeScript.SyntaxFacts.isAnyPunctuation(expectedKind)) { - return new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode._0_expected, [TypeScript.SyntaxFacts.getText(expectedKind)]); - } else { - if (actual !== null && TypeScript.SyntaxFacts.isAnyKeyword(actual.tokenKind)) { - return new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode.Identifier_expected_0_is_a_keyword, [TypeScript.SyntaxFacts.getText(actual.tokenKind)]); - } else { - return new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode.Identifier_expected, null); - } - } - }; - - ParserImpl.getPrecedence = function (expressionKind) { - switch (expressionKind) { - case 173 /* CommaExpression */: - return 1 /* CommaExpressionPrecedence */; - - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - return 2 /* AssignmentExpressionPrecedence */; - - case 186 /* ConditionalExpression */: - return 3 /* ConditionalExpressionPrecedence */; - - case 187 /* LogicalOrExpression */: - return 5 /* LogicalOrExpressionPrecedence */; - - case 188 /* LogicalAndExpression */: - return 6 /* LogicalAndExpressionPrecedence */; - - case 189 /* BitwiseOrExpression */: - return 7 /* BitwiseOrExpressionPrecedence */; - - case 190 /* BitwiseExclusiveOrExpression */: - return 8 /* BitwiseExclusiveOrExpressionPrecedence */; - - case 191 /* BitwiseAndExpression */: - return 9 /* BitwiseAndExpressionPrecedence */; - - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - return 10 /* EqualityExpressionPrecedence */; - - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - return 11 /* RelationalExpressionPrecedence */; - - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - return 12 /* ShiftExpressionPrecdence */; - - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: - return 13 /* AdditiveExpressionPrecedence */; - - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - return 14 /* MultiplicativeExpressionPrecedence */; - - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - case 166 /* BitwiseNotExpression */: - case 167 /* LogicalNotExpression */: - case 170 /* DeleteExpression */: - case 171 /* TypeOfExpression */: - case 172 /* VoidExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - return 15 /* UnaryExpressionPrecedence */; - } - - throw TypeScript.Errors.invalidOperation(); - }; - - ParserImpl.prototype.addSkippedTokenAfterNodeOrToken = function (nodeOrToken, skippedToken) { - if (nodeOrToken.isToken()) { - return this.addSkippedTokenAfterToken(nodeOrToken, skippedToken); - } else if (nodeOrToken.isNode()) { - return this.addSkippedTokenAfterNode(nodeOrToken, skippedToken); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.addSkippedTokenAfterNode = function (node, skippedToken) { - var oldToken = node.lastToken(); - var newToken = this.addSkippedTokenAfterToken(oldToken, skippedToken); - - return node.replaceToken(oldToken, newToken); - }; - - ParserImpl.prototype.addSkippedTokensBeforeNode = function (node, skippedTokens) { - if (skippedTokens.length > 0) { - var oldToken = node.firstToken(); - var newToken = this.addSkippedTokensBeforeToken(oldToken, skippedTokens); - - return node.replaceToken(oldToken, newToken); - } - - return node; - }; - - ParserImpl.prototype.addSkippedTokensBeforeToken = function (token, skippedTokens) { - var leadingTrivia = []; - for (var i = 0, n = skippedTokens.length; i < n; i++) { - this.addSkippedTokenToTriviaArray(leadingTrivia, skippedTokens[i]); - } - - this.addTriviaTo(token.leadingTrivia(), leadingTrivia); - - this.returnArray(skippedTokens); - return token.withLeadingTrivia(TypeScript.Syntax.triviaList(leadingTrivia)); - }; - - ParserImpl.prototype.addSkippedTokensAfterToken = function (token, skippedTokens) { - if (skippedTokens.length === 0) { - this.returnArray(skippedTokens); - return token; - } - - var trailingTrivia = token.trailingTrivia().toArray(); - - for (var i = 0, n = skippedTokens.length; i < n; i++) { - this.addSkippedTokenToTriviaArray(trailingTrivia, skippedTokens[i]); - } - - this.returnArray(skippedTokens); - return token.withTrailingTrivia(TypeScript.Syntax.triviaList(trailingTrivia)); - }; - - ParserImpl.prototype.addSkippedTokenAfterToken = function (token, skippedToken) { - var trailingTrivia = token.trailingTrivia().toArray(); - this.addSkippedTokenToTriviaArray(trailingTrivia, skippedToken); - - return token.withTrailingTrivia(TypeScript.Syntax.triviaList(trailingTrivia)); - }; - - ParserImpl.prototype.addSkippedTokenToTriviaArray = function (array, skippedToken) { - this.addTriviaTo(skippedToken.leadingTrivia(), array); - - var trimmedToken = skippedToken.withLeadingTrivia(TypeScript.Syntax.emptyTriviaList).withTrailingTrivia(TypeScript.Syntax.emptyTriviaList); - array.push(TypeScript.Syntax.skippedTokenTrivia(trimmedToken)); - - this.addTriviaTo(skippedToken.trailingTrivia(), array); - }; - - ParserImpl.prototype.addTriviaTo = function (list, array) { - for (var i = 0, n = list.count(); i < n; i++) { - array.push(list.syntaxTriviaAt(i)); - } - }; - - ParserImpl.prototype.parseSyntaxTree = function (isDeclaration) { - var sourceUnit = this.parseSourceUnit(); - - var allDiagnostics = this.source.tokenDiagnostics().concat(this.diagnostics); - allDiagnostics.sort(function (a, b) { - return a.start() - b.start(); - }); - - return new TypeScript.SyntaxTree(sourceUnit, isDeclaration, allDiagnostics, this.fileName, this.lineMap, this.parseOptions); - }; - - ParserImpl.prototype.setStrictMode = function (isInStrictMode) { - this.isInStrictMode = isInStrictMode; - this.factory = isInStrictMode ? TypeScript.Syntax.strictModeFactory : TypeScript.Syntax.normalModeFactory; - }; - - ParserImpl.prototype.parseSourceUnit = function () { - var savedIsInStrictMode = this.isInStrictMode; - - var result = this.parseSyntaxList(1 /* SourceUnit_ModuleElements */, ParserImpl.updateStrictModeState); - var moduleElements = result.list; - - this.setStrictMode(savedIsInStrictMode); - - var sourceUnit = this.factory.sourceUnit(moduleElements, this.currentToken()); - sourceUnit = this.addSkippedTokensBeforeNode(sourceUnit, result.skippedTokens); - - if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { - TypeScript.Debug.assert(sourceUnit.fullWidth() === this.newText_forDebuggingPurposesOnly.length()); - - if (TypeScript.Debug.shouldAssert(3 /* VeryAggressive */)) { - TypeScript.Debug.assert(sourceUnit.fullText() === this.newText_forDebuggingPurposesOnly.substr(0, this.newText_forDebuggingPurposesOnly.length(), false)); - } - } - - return sourceUnit; - }; - - ParserImpl.updateStrictModeState = function (parser, items) { - if (!parser.isInStrictMode) { - for (var i = 0; i < items.length; i++) { - var item = items[i]; - if (!TypeScript.SyntaxFacts.isDirectivePrologueElement(item)) { - return; - } - } - - parser.setStrictMode(TypeScript.SyntaxFacts.isUseStrictDirective(items[items.length - 1])); - } - }; - - ParserImpl.prototype.isModuleElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isModuleElement()) { - return true; - } - - var modifierCount = this.modifierCount(); - return this.isImportDeclaration(modifierCount) || this.isExportAssignment() || this.isModuleDeclaration(modifierCount) || this.isInterfaceDeclaration(modifierCount) || this.isClassDeclaration(modifierCount) || this.isEnumDeclaration(modifierCount) || this.isStatement(inErrorRecovery); - }; - - ParserImpl.prototype.parseModuleElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isModuleElement()) { - return this.eatNode(); - } - - var modifierCount = this.modifierCount(); - if (this.isImportDeclaration(modifierCount)) { - return this.parseImportDeclaration(); - } else if (this.isExportAssignment()) { - return this.parseExportAssignment(); - } else if (this.isModuleDeclaration(modifierCount)) { - return this.parseModuleDeclaration(); - } else if (this.isInterfaceDeclaration(modifierCount)) { - return this.parseInterfaceDeclaration(); - } else if (this.isClassDeclaration(modifierCount)) { - return this.parseClassDeclaration(); - } else if (this.isEnumDeclaration(modifierCount)) { - return this.parseEnumDeclaration(); - } else if (this.isStatement(inErrorRecovery)) { - return this.parseStatement(inErrorRecovery); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isImportDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 49 /* ImportKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 49 /* ImportKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseImportDeclaration = function () { - var modifiers = this.parseModifiers(); - var importKeyword = this.eatKeyword(49 /* ImportKeyword */); - var identifier = this.eatIdentifierToken(); - var equalsToken = this.eatToken(107 /* EqualsToken */); - var moduleReference = this.parseModuleReference(); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.importDeclaration(modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken); - }; - - ParserImpl.prototype.isExportAssignment = function () { - return this.currentToken().tokenKind === 47 /* ExportKeyword */ && this.peekToken(1).tokenKind === 107 /* EqualsToken */; - }; - - ParserImpl.prototype.parseExportAssignment = function () { - var exportKeyword = this.eatKeyword(47 /* ExportKeyword */); - var equalsToken = this.eatToken(107 /* EqualsToken */); - var identifier = this.eatIdentifierToken(); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.exportAssignment(exportKeyword, equalsToken, identifier, semicolonToken); - }; - - ParserImpl.prototype.parseModuleReference = function () { - if (this.isExternalModuleReference()) { - return this.parseExternalModuleReference(); - } else { - return this.parseModuleNameModuleReference(); - } - }; - - ParserImpl.prototype.isExternalModuleReference = function () { - var token0 = this.currentToken(); - if (token0.tokenKind === 66 /* RequireKeyword */) { - return this.peekToken(1).tokenKind === 72 /* OpenParenToken */; - } - - return false; - }; - - ParserImpl.prototype.parseExternalModuleReference = function () { - var requireKeyword = this.eatKeyword(66 /* RequireKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var stringLiteral = this.eatToken(14 /* StringLiteral */); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - return this.factory.externalModuleReference(requireKeyword, openParenToken, stringLiteral, closeParenToken); - }; - - ParserImpl.prototype.parseModuleNameModuleReference = function () { - var name = this.parseName(); - return this.factory.moduleNameModuleReference(name); - }; - - ParserImpl.prototype.parseIdentifierName = function () { - var identifierName = this.eatIdentifierNameToken(); - return identifierName; - }; - - ParserImpl.prototype.tryParseTypeArgumentList = function (inExpression) { - if (this.currentToken().kind() !== 80 /* LessThanToken */) { - return null; - } - - var lessThanToken; - var greaterThanToken; - var result; - var typeArguments; - - if (!inExpression) { - lessThanToken = this.eatToken(80 /* LessThanToken */); - - result = this.parseSeparatedSyntaxList(262144 /* TypeArgumentList_Types */); - typeArguments = result.list; - lessThanToken = this.addSkippedTokensAfterToken(lessThanToken, result.skippedTokens); - - greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - - return this.factory.typeArgumentList(lessThanToken, typeArguments, greaterThanToken); - } - - var rewindPoint = this.getRewindPoint(); - - lessThanToken = this.eatToken(80 /* LessThanToken */); - - result = this.parseSeparatedSyntaxList(262144 /* TypeArgumentList_Types */); - typeArguments = result.list; - lessThanToken = this.addSkippedTokensAfterToken(lessThanToken, result.skippedTokens); - - greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - - if (greaterThanToken.fullWidth() === 0 || !this.canFollowTypeArgumentListInExpression(this.currentToken().kind())) { - this.rewind(rewindPoint); - - this.releaseRewindPoint(rewindPoint); - return null; - } else { - this.releaseRewindPoint(rewindPoint); - var typeArgumentList = this.factory.typeArgumentList(lessThanToken, typeArguments, greaterThanToken); - - return typeArgumentList; - } - }; - - ParserImpl.prototype.canFollowTypeArgumentListInExpression = function (kind) { - switch (kind) { - case 72 /* OpenParenToken */: - case 76 /* DotToken */: - - case 73 /* CloseParenToken */: - case 75 /* CloseBracketToken */: - case 106 /* ColonToken */: - case 78 /* SemicolonToken */: - case 79 /* CommaToken */: - case 105 /* QuestionToken */: - case 84 /* EqualsEqualsToken */: - case 87 /* EqualsEqualsEqualsToken */: - case 86 /* ExclamationEqualsToken */: - case 88 /* ExclamationEqualsEqualsToken */: - case 103 /* AmpersandAmpersandToken */: - case 104 /* BarBarToken */: - case 100 /* CaretToken */: - case 98 /* AmpersandToken */: - case 99 /* BarToken */: - case 71 /* CloseBraceToken */: - case 10 /* EndOfFileToken */: - return true; - - default: - return false; - } - }; - - ParserImpl.prototype.parseName = function () { - var shouldContinue = this.isIdentifier(this.currentToken()); - var current = this.eatIdentifierToken(); - - while (shouldContinue && this.currentToken().tokenKind === 76 /* DotToken */) { - var dotToken = this.eatToken(76 /* DotToken */); - - var currentToken = this.currentToken(); - var identifierName; - - if (TypeScript.SyntaxFacts.isAnyKeyword(currentToken.tokenKind) && this.previousToken().hasTrailingNewLine() && !currentToken.hasTrailingNewLine() && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(this.peekToken(1))) { - identifierName = this.createMissingToken(11 /* IdentifierName */, currentToken); - } else { - identifierName = this.eatIdentifierNameToken(); - } - - current = this.factory.qualifiedName(current, dotToken, identifierName); - - shouldContinue = identifierName.fullWidth() > 0; - } - - return current; - }; - - ParserImpl.prototype.isEnumDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 46 /* EnumKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 46 /* EnumKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseEnumDeclaration = function () { - var modifiers = this.parseModifiers(); - var enumKeyword = this.eatKeyword(46 /* EnumKeyword */); - var identifier = this.eatIdentifierToken(); - - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - var enumElements = TypeScript.Syntax.emptySeparatedList; - - if (openBraceToken.width() > 0) { - var result = this.parseSeparatedSyntaxList(256 /* EnumDeclaration_EnumElements */); - enumElements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.enumDeclaration(modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken); - }; - - ParserImpl.prototype.isEnumElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().kind() === 243 /* EnumElement */) { - return true; - } - - return this.isPropertyName(this.currentToken(), inErrorRecovery); - }; - - ParserImpl.prototype.parseEnumElement = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 243 /* EnumElement */) { - return this.eatNode(); - } - - var propertyName = this.eatPropertyName(); - var equalsValueClause = null; - if (this.isEqualsValueClause(false)) { - equalsValueClause = this.parseEqualsValueClause(true); - } - - return this.factory.enumElement(propertyName, equalsValueClause); - }; - - ParserImpl.isModifier = function (token) { - switch (token.tokenKind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 58 /* StaticKeyword */: - case 47 /* ExportKeyword */: - case 63 /* DeclareKeyword */: - return true; - - default: - return false; - } - }; - - ParserImpl.prototype.modifierCount = function () { - var modifierCount = 0; - while (true) { - if (ParserImpl.isModifier(this.peekToken(modifierCount))) { - modifierCount++; - continue; - } - - break; - } - - return modifierCount; - }; - - ParserImpl.prototype.parseModifiers = function () { - var tokens = this.getArray(); - - while (true) { - if (ParserImpl.isModifier(this.currentToken())) { - tokens.push(this.eatAnyToken()); - continue; - } - - break; - } - - var result = TypeScript.Syntax.list(tokens); - - this.returnZeroOrOneLengthArray(tokens); - - return result; - }; - - ParserImpl.prototype.isClassDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 44 /* ClassKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 44 /* ClassKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseHeritageClauses = function () { - var heritageClauses = TypeScript.Syntax.emptyList; - - if (this.isHeritageClause()) { - var result = this.parseSyntaxList(1024 /* ClassOrInterfaceDeclaration_HeritageClauses */); - heritageClauses = result.list; - TypeScript.Debug.assert(result.skippedTokens.length === 0); - } - - return heritageClauses; - }; - - ParserImpl.prototype.parseClassDeclaration = function () { - var modifiers = this.parseModifiers(); - - var classKeyword = this.eatKeyword(44 /* ClassKeyword */); - var identifier = this.eatIdentifierToken(); - var typeParameterList = this.parseOptionalTypeParameterList(false); - var heritageClauses = this.parseHeritageClauses(); - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - var classElements = TypeScript.Syntax.emptyList; - - if (openBraceToken.width() > 0) { - var result = this.parseSyntaxList(2 /* ClassDeclaration_ClassElements */); - - classElements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - return this.factory.classDeclaration(modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken); - }; - - ParserImpl.isPublicOrPrivateKeyword = function (token) { - return token.tokenKind === 57 /* PublicKeyword */ || token.tokenKind === 55 /* PrivateKeyword */; - }; - - ParserImpl.prototype.isAccessor = function (inErrorRecovery) { - var index = this.modifierCount(); - - if (this.peekToken(index).tokenKind !== 64 /* GetKeyword */ && this.peekToken(index).tokenKind !== 68 /* SetKeyword */) { - return false; - } - - index++; - return this.isPropertyName(this.peekToken(index), inErrorRecovery); - }; - - ParserImpl.prototype.parseAccessor = function (checkForStrictMode) { - var modifiers = this.parseModifiers(); - - if (this.currentToken().tokenKind === 64 /* GetKeyword */) { - return this.parseGetMemberAccessorDeclaration(modifiers, checkForStrictMode); - } else if (this.currentToken().tokenKind === 68 /* SetKeyword */) { - return this.parseSetMemberAccessorDeclaration(modifiers, checkForStrictMode); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseGetMemberAccessorDeclaration = function (modifiers, checkForStrictMode) { - var getKeyword = this.eatKeyword(64 /* GetKeyword */); - var propertyName = this.eatPropertyName(); - var parameterList = this.parseParameterList(); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - var block = this.parseBlock(false, checkForStrictMode); - - return this.factory.getAccessor(modifiers, getKeyword, propertyName, parameterList, typeAnnotation, block); - }; - - ParserImpl.prototype.parseSetMemberAccessorDeclaration = function (modifiers, checkForStrictMode) { - var setKeyword = this.eatKeyword(68 /* SetKeyword */); - var propertyName = this.eatPropertyName(); - var parameterList = this.parseParameterList(); - var block = this.parseBlock(false, checkForStrictMode); - - return this.factory.setAccessor(modifiers, setKeyword, propertyName, parameterList, block); - }; - - ParserImpl.prototype.isClassElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isClassElement()) { - return true; - } - - return this.isConstructorDeclaration() || this.isMemberFunctionDeclaration(inErrorRecovery) || this.isAccessor(inErrorRecovery) || this.isMemberVariableDeclaration(inErrorRecovery) || this.isIndexMemberDeclaration(); - }; - - ParserImpl.prototype.parseClassElement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isClassElement()) { - return this.eatNode(); - } - - if (this.isConstructorDeclaration()) { - return this.parseConstructorDeclaration(); - } else if (this.isMemberFunctionDeclaration(inErrorRecovery)) { - return this.parseMemberFunctionDeclaration(); - } else if (this.isAccessor(inErrorRecovery)) { - return this.parseAccessor(false); - } else if (this.isMemberVariableDeclaration(inErrorRecovery)) { - return this.parseMemberVariableDeclaration(); - } else if (this.isIndexMemberDeclaration()) { - return this.parseIndexMemberDeclaration(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isConstructorDeclaration = function () { - var index = this.modifierCount(); - return this.peekToken(index).tokenKind === 62 /* ConstructorKeyword */; - }; - - ParserImpl.prototype.parseConstructorDeclaration = function () { - var modifiers = this.parseModifiers(); - var constructorKeyword = this.eatKeyword(62 /* ConstructorKeyword */); - var callSignature = this.parseCallSignature(false); - - var semicolonToken = null; - var block = null; - - if (this.isBlock()) { - block = this.parseBlock(false, true); - } else { - semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - } - - return this.factory.constructorDeclaration(modifiers, constructorKeyword, callSignature, block, semicolonToken); - }; - - ParserImpl.prototype.isMemberFunctionDeclaration = function (inErrorRecovery) { - var index = 0; - - while (true) { - var token = this.peekToken(index); - if (this.isPropertyName(token, inErrorRecovery) && this.isCallSignature(index + 1)) { - return true; - } - - if (ParserImpl.isModifier(token)) { - index++; - continue; - } - - return false; - } - }; - - ParserImpl.prototype.parseMemberFunctionDeclaration = function () { - var modifierArray = this.getArray(); - - while (true) { - var currentToken = this.currentToken(); - if (this.isPropertyName(currentToken, false) && this.isCallSignature(1)) { - break; - } - - TypeScript.Debug.assert(ParserImpl.isModifier(currentToken)); - modifierArray.push(this.eatAnyToken()); - } - - var modifiers = TypeScript.Syntax.list(modifierArray); - this.returnZeroOrOneLengthArray(modifierArray); - - var propertyName = this.eatPropertyName(); - var callSignature = this.parseCallSignature(false); - - var parseBlockEvenWithNoOpenBrace = false; - var newCallSignature = this.tryAddUnexpectedEqualsGreaterThanToken(callSignature); - if (newCallSignature !== callSignature) { - parseBlockEvenWithNoOpenBrace = true; - callSignature = newCallSignature; - } - - var block = null; - var semicolon = null; - - if (parseBlockEvenWithNoOpenBrace || this.isBlock()) { - block = this.parseBlock(parseBlockEvenWithNoOpenBrace, true); - } else { - semicolon = this.eatExplicitOrAutomaticSemicolon(false); - } - - return this.factory.memberFunctionDeclaration(modifiers, propertyName, callSignature, block, semicolon); - }; - - ParserImpl.prototype.isDefinitelyMemberVariablePropertyName = function (index) { - if (TypeScript.SyntaxFacts.isAnyKeyword(this.peekToken(index).tokenKind)) { - switch (this.peekToken(index + 1).tokenKind) { - case 78 /* SemicolonToken */: - case 107 /* EqualsToken */: - case 106 /* ColonToken */: - case 71 /* CloseBraceToken */: - case 10 /* EndOfFileToken */: - return true; - default: - return false; - } - } else { - return true; - } - }; - - ParserImpl.prototype.isMemberVariableDeclaration = function (inErrorRecovery) { - var index = 0; - - while (true) { - var token = this.peekToken(index); - if (this.isPropertyName(token, inErrorRecovery) && this.isDefinitelyMemberVariablePropertyName(index)) { - return true; - } - - if (ParserImpl.isModifier(this.peekToken(index))) { - index++; - continue; - } - - return false; - } - }; - - ParserImpl.prototype.parseMemberVariableDeclaration = function () { - var modifierArray = this.getArray(); - - while (true) { - var currentToken = this.currentToken(); - if (this.isPropertyName(currentToken, false) && this.isDefinitelyMemberVariablePropertyName(0)) { - break; - } - - TypeScript.Debug.assert(ParserImpl.isModifier(currentToken)); - modifierArray.push(this.eatAnyToken()); - } - - var modifiers = TypeScript.Syntax.list(modifierArray); - this.returnZeroOrOneLengthArray(modifierArray); - - var variableDeclarator = this.parseVariableDeclarator(true, true); - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.memberVariableDeclaration(modifiers, variableDeclarator, semicolon); - }; - - ParserImpl.prototype.isIndexMemberDeclaration = function () { - var index = this.modifierCount(); - return this.isIndexSignature(index); - }; - - ParserImpl.prototype.parseIndexMemberDeclaration = function () { - var modifiers = this.parseModifiers(); - var indexSignature = this.parseIndexSignature(); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.indexMemberDeclaration(modifiers, indexSignature, semicolonToken); - }; - - ParserImpl.prototype.tryAddUnexpectedEqualsGreaterThanToken = function (callSignature) { - var token0 = this.currentToken(); - - var hasEqualsGreaterThanToken = token0.tokenKind === 85 /* EqualsGreaterThanToken */; - if (hasEqualsGreaterThanToken) { - if (callSignature.lastToken()) { - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token0.width(), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [TypeScript.SyntaxFacts.getText(70 /* OpenBraceToken */)]); - this.addDiagnostic(diagnostic); - - var token = this.eatAnyToken(); - return this.addSkippedTokenAfterNode(callSignature, token0); - } - } - - return callSignature; - }; - - ParserImpl.prototype.isFunctionDeclaration = function () { - var index = this.modifierCount(); - return this.peekToken(index).tokenKind === 27 /* FunctionKeyword */; - }; - - ParserImpl.prototype.parseFunctionDeclaration = function () { - var modifiers = this.parseModifiers(); - var functionKeyword = this.eatKeyword(27 /* FunctionKeyword */); - var identifier = this.eatIdentifierToken(); - var callSignature = this.parseCallSignature(false); - - var parseBlockEvenWithNoOpenBrace = false; - var newCallSignature = this.tryAddUnexpectedEqualsGreaterThanToken(callSignature); - if (newCallSignature !== callSignature) { - parseBlockEvenWithNoOpenBrace = true; - callSignature = newCallSignature; - } - - var semicolonToken = null; - var block = null; - - if (parseBlockEvenWithNoOpenBrace || this.isBlock()) { - block = this.parseBlock(parseBlockEvenWithNoOpenBrace, true); - } else { - semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - } - - return this.factory.functionDeclaration(modifiers, functionKeyword, identifier, callSignature, block, semicolonToken); - }; - - ParserImpl.prototype.isModuleDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 65 /* ModuleKeyword */) { - return true; - } - - if (this.currentToken().tokenKind === 65 /* ModuleKeyword */) { - var token1 = this.peekToken(1); - return this.isIdentifier(token1) || token1.tokenKind === 14 /* StringLiteral */; - } - - return false; - }; - - ParserImpl.prototype.parseModuleDeclaration = function () { - var modifiers = this.parseModifiers(); - var moduleKeyword = this.eatKeyword(65 /* ModuleKeyword */); - - var moduleName = null; - var stringLiteral = null; - - if (this.currentToken().tokenKind === 14 /* StringLiteral */) { - stringLiteral = this.eatToken(14 /* StringLiteral */); - } else { - moduleName = this.parseName(); - } - - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var moduleElements = TypeScript.Syntax.emptyList; - if (openBraceToken.width() > 0) { - var result = this.parseSyntaxList(4 /* ModuleDeclaration_ModuleElements */); - moduleElements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.moduleDeclaration(modifiers, moduleKeyword, moduleName, stringLiteral, openBraceToken, moduleElements, closeBraceToken); - }; - - ParserImpl.prototype.isInterfaceDeclaration = function (modifierCount) { - if (modifierCount > 0 && this.peekToken(modifierCount).tokenKind === 52 /* InterfaceKeyword */) { - return true; - } - - return this.currentToken().tokenKind === 52 /* InterfaceKeyword */ && this.isIdentifier(this.peekToken(1)); - }; - - ParserImpl.prototype.parseInterfaceDeclaration = function () { - var modifiers = this.parseModifiers(); - var interfaceKeyword = this.eatKeyword(52 /* InterfaceKeyword */); - var identifier = this.eatIdentifierToken(); - var typeParameterList = this.parseOptionalTypeParameterList(false); - var heritageClauses = this.parseHeritageClauses(); - - var objectType = this.parseObjectType(); - return this.factory.interfaceDeclaration(modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, objectType); - }; - - ParserImpl.prototype.parseObjectType = function () { - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var typeMembers = TypeScript.Syntax.emptySeparatedList; - if (openBraceToken.width() > 0) { - var result = this.parseSeparatedSyntaxList(512 /* ObjectType_TypeMembers */); - typeMembers = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - return this.factory.objectType(openBraceToken, typeMembers, closeBraceToken); - }; - - ParserImpl.prototype.isTypeMember = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isTypeMember()) { - return true; - } - - return this.isCallSignature(0) || this.isConstructSignature() || this.isIndexSignature(0) || this.isMethodSignature(inErrorRecovery) || this.isPropertySignature(inErrorRecovery); - }; - - ParserImpl.prototype.parseTypeMember = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isTypeMember()) { - return this.eatNode(); - } - - if (this.isCallSignature(0)) { - return this.parseCallSignature(false); - } else if (this.isConstructSignature()) { - return this.parseConstructSignature(); - } else if (this.isIndexSignature(0)) { - return this.parseIndexSignature(); - } else if (this.isMethodSignature(inErrorRecovery)) { - return this.parseMethodSignature(); - } else if (this.isPropertySignature(inErrorRecovery)) { - return this.parsePropertySignature(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseConstructSignature = function () { - var newKeyword = this.eatKeyword(31 /* NewKeyword */); - var callSignature = this.parseCallSignature(false); - - return this.factory.constructSignature(newKeyword, callSignature); - }; - - ParserImpl.prototype.parseIndexSignature = function () { - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - var parameter = this.parseParameter(); - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - - return this.factory.indexSignature(openBracketToken, parameter, closeBracketToken, typeAnnotation); - }; - - ParserImpl.prototype.parseMethodSignature = function () { - var propertyName = this.eatPropertyName(); - var questionToken = this.tryEatToken(105 /* QuestionToken */); - var callSignature = this.parseCallSignature(false); - - return this.factory.methodSignature(propertyName, questionToken, callSignature); - }; - - ParserImpl.prototype.parsePropertySignature = function () { - var propertyName = this.eatPropertyName(); - var questionToken = this.tryEatToken(105 /* QuestionToken */); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - - return this.factory.propertySignature(propertyName, questionToken, typeAnnotation); - }; - - ParserImpl.prototype.isCallSignature = function (tokenIndex) { - var tokenKind = this.peekToken(tokenIndex).tokenKind; - return tokenKind === 72 /* OpenParenToken */ || tokenKind === 80 /* LessThanToken */; - }; - - ParserImpl.prototype.isConstructSignature = function () { - if (this.currentToken().tokenKind !== 31 /* NewKeyword */) { - return false; - } - - var token1 = this.peekToken(1); - return token1.tokenKind === 80 /* LessThanToken */ || token1.tokenKind === 72 /* OpenParenToken */; - }; - - ParserImpl.prototype.isIndexSignature = function (tokenIndex) { - return this.peekToken(tokenIndex).tokenKind === 74 /* OpenBracketToken */; - }; - - ParserImpl.prototype.isMethodSignature = function (inErrorRecovery) { - if (this.isPropertyName(this.currentToken(), inErrorRecovery)) { - if (this.isCallSignature(1)) { - return true; - } - - if (this.peekToken(1).tokenKind === 105 /* QuestionToken */ && this.isCallSignature(2)) { - return true; - } - } - - return false; - }; - - ParserImpl.prototype.isPropertySignature = function (inErrorRecovery) { - var currentToken = this.currentToken(); - - if (ParserImpl.isModifier(currentToken) && !currentToken.hasTrailingNewLine() && this.isPropertyName(this.peekToken(1), inErrorRecovery)) { - return false; - } - - return this.isPropertyName(currentToken, inErrorRecovery); - }; - - ParserImpl.prototype.isHeritageClause = function () { - var token0 = this.currentToken(); - return token0.tokenKind === 48 /* ExtendsKeyword */ || token0.tokenKind === 51 /* ImplementsKeyword */; - }; - - ParserImpl.prototype.isNotHeritageClauseTypeName = function () { - if (this.currentToken().tokenKind === 51 /* ImplementsKeyword */ || this.currentToken().tokenKind === 48 /* ExtendsKeyword */) { - return this.isIdentifier(this.peekToken(1)); - } - - return false; - }; - - ParserImpl.prototype.isHeritageClauseTypeName = function () { - if (this.isIdentifier(this.currentToken())) { - return !this.isNotHeritageClauseTypeName(); - } - - return false; - }; - - ParserImpl.prototype.parseHeritageClause = function () { - var extendsOrImplementsKeyword = this.eatAnyToken(); - TypeScript.Debug.assert(extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */ || extendsOrImplementsKeyword.tokenKind === 51 /* ImplementsKeyword */); - - var result = this.parseSeparatedSyntaxList(2048 /* HeritageClause_TypeNameList */); - var typeNames = result.list; - extendsOrImplementsKeyword = this.addSkippedTokensAfterToken(extendsOrImplementsKeyword, result.skippedTokens); - - return this.factory.heritageClause(extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */ ? 230 /* ExtendsHeritageClause */ : 231 /* ImplementsHeritageClause */, extendsOrImplementsKeyword, typeNames); - }; - - ParserImpl.prototype.isStatement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isStatement()) { - return true; - } - - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - switch (currentTokenKind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 58 /* StaticKeyword */: - var token1 = this.peekToken(1); - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { - return false; - } - - break; - - case 28 /* IfKeyword */: - case 70 /* OpenBraceToken */: - case 33 /* ReturnKeyword */: - case 34 /* SwitchKeyword */: - case 36 /* ThrowKeyword */: - case 15 /* BreakKeyword */: - case 18 /* ContinueKeyword */: - case 26 /* ForKeyword */: - case 42 /* WhileKeyword */: - case 43 /* WithKeyword */: - case 22 /* DoKeyword */: - case 38 /* TryKeyword */: - case 19 /* DebuggerKeyword */: - return true; - } - - if (this.isInterfaceDeclaration(0) || this.isClassDeclaration(0) || this.isEnumDeclaration(0) || this.isModuleDeclaration(0)) { - return false; - } - - return this.isLabeledStatement(currentToken) || this.isVariableStatement() || this.isFunctionDeclaration() || this.isEmptyStatement(currentToken, inErrorRecovery) || this.isExpressionStatement(currentToken); - }; - - ParserImpl.prototype.parseStatement = function (inErrorRecovery) { - if (this.currentNode() !== null && this.currentNode().isStatement()) { - return this.eatNode(); - } - - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - - switch (currentTokenKind) { - case 28 /* IfKeyword */: - return this.parseIfStatement(); - case 70 /* OpenBraceToken */: - return this.parseBlock(false, false); - case 33 /* ReturnKeyword */: - return this.parseReturnStatement(); - case 34 /* SwitchKeyword */: - return this.parseSwitchStatement(); - case 36 /* ThrowKeyword */: - return this.parseThrowStatement(); - case 15 /* BreakKeyword */: - return this.parseBreakStatement(); - case 18 /* ContinueKeyword */: - return this.parseContinueStatement(); - case 26 /* ForKeyword */: - return this.parseForOrForInStatement(); - case 42 /* WhileKeyword */: - return this.parseWhileStatement(); - case 43 /* WithKeyword */: - return this.parseWithStatement(); - case 22 /* DoKeyword */: - return this.parseDoStatement(); - case 38 /* TryKeyword */: - return this.parseTryStatement(); - case 19 /* DebuggerKeyword */: - return this.parseDebuggerStatement(); - } - - if (this.isVariableStatement()) { - return this.parseVariableStatement(); - } else if (this.isLabeledStatement(currentToken)) { - return this.parseLabeledStatement(); - } else if (this.isFunctionDeclaration()) { - return this.parseFunctionDeclaration(); - } else if (this.isEmptyStatement(currentToken, inErrorRecovery)) { - return this.parseEmptyStatement(); - } else { - return this.parseExpressionStatement(); - } - }; - - ParserImpl.prototype.parseDebuggerStatement = function () { - var debuggerKeyword = this.eatKeyword(19 /* DebuggerKeyword */); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.debuggerStatement(debuggerKeyword, semicolonToken); - }; - - ParserImpl.prototype.parseDoStatement = function () { - var doKeyword = this.eatKeyword(22 /* DoKeyword */); - var statement = this.parseStatement(false); - var whileKeyword = this.eatKeyword(42 /* WhileKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(true); - - return this.factory.doStatement(doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - }; - - ParserImpl.prototype.isLabeledStatement = function (currentToken) { - return this.isIdentifier(currentToken) && this.peekToken(1).tokenKind === 106 /* ColonToken */; - }; - - ParserImpl.prototype.parseLabeledStatement = function () { - var identifier = this.eatIdentifierToken(); - var colonToken = this.eatToken(106 /* ColonToken */); - var statement = this.parseStatement(false); - - return this.factory.labeledStatement(identifier, colonToken, statement); - }; - - ParserImpl.prototype.parseTryStatement = function () { - var tryKeyword = this.eatKeyword(38 /* TryKeyword */); - - var savedListParsingState = this.listParsingState; - this.listParsingState |= 64 /* TryBlock_Statements */; - var block = this.parseBlock(false, false); - this.listParsingState = savedListParsingState; - - var catchClause = null; - if (this.isCatchClause()) { - catchClause = this.parseCatchClause(); - } - - var finallyClause = null; - if (catchClause === null || this.isFinallyClause()) { - finallyClause = this.parseFinallyClause(); - } - - return this.factory.tryStatement(tryKeyword, block, catchClause, finallyClause); - }; - - ParserImpl.prototype.isCatchClause = function () { - return this.currentToken().tokenKind === 17 /* CatchKeyword */; - }; - - ParserImpl.prototype.parseCatchClause = function () { - var catchKeyword = this.eatKeyword(17 /* CatchKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var identifier = this.eatIdentifierToken(); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - var savedListParsingState = this.listParsingState; - this.listParsingState |= 128 /* CatchBlock_Statements */; - var block = this.parseBlock(false, false); - this.listParsingState = savedListParsingState; - - return this.factory.catchClause(catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block); - }; - - ParserImpl.prototype.isFinallyClause = function () { - return this.currentToken().tokenKind === 25 /* FinallyKeyword */; - }; - - ParserImpl.prototype.parseFinallyClause = function () { - var finallyKeyword = this.eatKeyword(25 /* FinallyKeyword */); - var block = this.parseBlock(false, false); - - return this.factory.finallyClause(finallyKeyword, block); - }; - - ParserImpl.prototype.parseWithStatement = function () { - var withKeyword = this.eatKeyword(43 /* WithKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.withStatement(withKeyword, openParenToken, condition, closeParenToken, statement); - }; - - ParserImpl.prototype.parseWhileStatement = function () { - var whileKeyword = this.eatKeyword(42 /* WhileKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.whileStatement(whileKeyword, openParenToken, condition, closeParenToken, statement); - }; - - ParserImpl.prototype.isEmptyStatement = function (currentToken, inErrorRecovery) { - if (inErrorRecovery) { - return false; - } - - return currentToken.tokenKind === 78 /* SemicolonToken */; - }; - - ParserImpl.prototype.parseEmptyStatement = function () { - var semicolonToken = this.eatToken(78 /* SemicolonToken */); - return this.factory.emptyStatement(semicolonToken); - }; - - ParserImpl.prototype.parseForOrForInStatement = function () { - var forKeyword = this.eatKeyword(26 /* ForKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - - var currentToken = this.currentToken(); - if (currentToken.tokenKind === 40 /* VarKeyword */) { - return this.parseForOrForInStatementWithVariableDeclaration(forKeyword, openParenToken); - } else if (currentToken.tokenKind === 78 /* SemicolonToken */) { - return this.parseForStatementWithNoVariableDeclarationOrInitializer(forKeyword, openParenToken); - } else { - return this.parseForOrForInStatementWithInitializer(forKeyword, openParenToken); - } - }; - - ParserImpl.prototype.parseForOrForInStatementWithVariableDeclaration = function (forKeyword, openParenToken) { - var variableDeclaration = this.parseVariableDeclaration(false); - - if (this.currentToken().tokenKind === 29 /* InKeyword */) { - return this.parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, null); - } - - return this.parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, null); - }; - - ParserImpl.prototype.parseForInStatementWithVariableDeclarationOrInitializer = function (forKeyword, openParenToken, variableDeclaration, initializer) { - var inKeyword = this.eatKeyword(29 /* InKeyword */); - var expression = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.forInStatement(forKeyword, openParenToken, variableDeclaration, initializer, inKeyword, expression, closeParenToken, statement); - }; - - ParserImpl.prototype.parseForOrForInStatementWithInitializer = function (forKeyword, openParenToken) { - var initializer = this.parseExpression(false); - if (this.currentToken().tokenKind === 29 /* InKeyword */) { - return this.parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, initializer); - } else { - return this.parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, initializer); - } - }; - - ParserImpl.prototype.parseForStatementWithNoVariableDeclarationOrInitializer = function (forKeyword, openParenToken) { - return this.parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, null); - }; - - ParserImpl.prototype.parseForStatementWithVariableDeclarationOrInitializer = function (forKeyword, openParenToken, variableDeclaration, initializer) { - var firstSemicolonToken = this.eatToken(78 /* SemicolonToken */); - - var condition = null; - if (this.currentToken().tokenKind !== 78 /* SemicolonToken */ && this.currentToken().tokenKind !== 73 /* CloseParenToken */ && this.currentToken().tokenKind !== 10 /* EndOfFileToken */) { - condition = this.parseExpression(true); - } - - var secondSemicolonToken = this.eatToken(78 /* SemicolonToken */); - - var incrementor = null; - if (this.currentToken().tokenKind !== 73 /* CloseParenToken */ && this.currentToken().tokenKind !== 10 /* EndOfFileToken */) { - incrementor = this.parseExpression(true); - } - - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - return this.factory.forStatement(forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement); - }; - - ParserImpl.prototype.parseBreakStatement = function () { - var breakKeyword = this.eatKeyword(15 /* BreakKeyword */); - - var identifier = null; - if (!this.canEatExplicitOrAutomaticSemicolon(false)) { - if (this.isIdentifier(this.currentToken())) { - identifier = this.eatIdentifierToken(); - } - } - - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - return this.factory.breakStatement(breakKeyword, identifier, semicolon); - }; - - ParserImpl.prototype.parseContinueStatement = function () { - var continueKeyword = this.eatKeyword(18 /* ContinueKeyword */); - - var identifier = null; - if (!this.canEatExplicitOrAutomaticSemicolon(false)) { - if (this.isIdentifier(this.currentToken())) { - identifier = this.eatIdentifierToken(); - } - } - - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - return this.factory.continueStatement(continueKeyword, identifier, semicolon); - }; - - ParserImpl.prototype.parseSwitchStatement = function () { - var switchKeyword = this.eatKeyword(34 /* SwitchKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var expression = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var switchClauses = TypeScript.Syntax.emptyList; - if (openBraceToken.width() > 0) { - var result = this.parseSyntaxList(8 /* SwitchStatement_SwitchClauses */); - switchClauses = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - return this.factory.switchStatement(switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken); - }; - - ParserImpl.prototype.isCaseSwitchClause = function () { - return this.currentToken().tokenKind === 16 /* CaseKeyword */; - }; - - ParserImpl.prototype.isDefaultSwitchClause = function () { - return this.currentToken().tokenKind === 20 /* DefaultKeyword */; - }; - - ParserImpl.prototype.isSwitchClause = function () { - if (this.currentNode() !== null && this.currentNode().isSwitchClause()) { - return true; - } - - return this.isCaseSwitchClause() || this.isDefaultSwitchClause(); - }; - - ParserImpl.prototype.parseSwitchClause = function () { - if (this.currentNode() !== null && this.currentNode().isSwitchClause()) { - return this.eatNode(); - } - - if (this.isCaseSwitchClause()) { - return this.parseCaseSwitchClause(); - } else if (this.isDefaultSwitchClause()) { - return this.parseDefaultSwitchClause(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseCaseSwitchClause = function () { - var caseKeyword = this.eatKeyword(16 /* CaseKeyword */); - var expression = this.parseExpression(true); - var colonToken = this.eatToken(106 /* ColonToken */); - var statements = TypeScript.Syntax.emptyList; - - if (colonToken.fullWidth() > 0) { - var result = this.parseSyntaxList(16 /* SwitchClause_Statements */); - statements = result.list; - colonToken = this.addSkippedTokensAfterToken(colonToken, result.skippedTokens); - } - - return this.factory.caseSwitchClause(caseKeyword, expression, colonToken, statements); - }; - - ParserImpl.prototype.parseDefaultSwitchClause = function () { - var defaultKeyword = this.eatKeyword(20 /* DefaultKeyword */); - var colonToken = this.eatToken(106 /* ColonToken */); - var statements = TypeScript.Syntax.emptyList; - - if (colonToken.fullWidth() > 0) { - var result = this.parseSyntaxList(16 /* SwitchClause_Statements */); - statements = result.list; - colonToken = this.addSkippedTokensAfterToken(colonToken, result.skippedTokens); - } - - return this.factory.defaultSwitchClause(defaultKeyword, colonToken, statements); - }; - - ParserImpl.prototype.parseThrowStatement = function () { - var throwKeyword = this.eatKeyword(36 /* ThrowKeyword */); - - var expression = null; - if (this.canEatExplicitOrAutomaticSemicolon(false)) { - var token = this.createMissingToken(11 /* IdentifierName */, null); - expression = token; - } else { - expression = this.parseExpression(true); - } - - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.throwStatement(throwKeyword, expression, semicolonToken); - }; - - ParserImpl.prototype.parseReturnStatement = function () { - var returnKeyword = this.eatKeyword(33 /* ReturnKeyword */); - - var expression = null; - if (!this.canEatExplicitOrAutomaticSemicolon(false)) { - expression = this.parseExpression(true); - } - - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.returnStatement(returnKeyword, expression, semicolonToken); - }; - - ParserImpl.prototype.isExpressionStatement = function (currentToken) { - var kind = currentToken.tokenKind; - if (kind === 70 /* OpenBraceToken */ || kind === 27 /* FunctionKeyword */) { - return false; - } - - return this.isExpression(currentToken); - }; - - ParserImpl.prototype.isAssignmentOrOmittedExpression = function () { - var currentToken = this.currentToken(); - if (currentToken.tokenKind === 79 /* CommaToken */) { - return true; - } - - return this.isExpression(currentToken); - }; - - ParserImpl.prototype.parseAssignmentOrOmittedExpression = function () { - if (this.currentToken().tokenKind === 79 /* CommaToken */) { - return this.factory.omittedExpression(); - } - - return this.parseAssignmentExpression(true); - }; - - ParserImpl.prototype.isExpression = function (currentToken) { - switch (currentToken.tokenKind) { - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 12 /* RegularExpressionLiteral */: - - case 74 /* OpenBracketToken */: - - case 72 /* OpenParenToken */: - - case 80 /* LessThanToken */: - - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - case 89 /* PlusToken */: - case 90 /* MinusToken */: - case 102 /* TildeToken */: - case 101 /* ExclamationToken */: - - case 70 /* OpenBraceToken */: - - case 85 /* EqualsGreaterThanToken */: - - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - - case 50 /* SuperKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - - case 31 /* NewKeyword */: - - case 21 /* DeleteKeyword */: - case 41 /* VoidKeyword */: - case 39 /* TypeOfKeyword */: - - case 27 /* FunctionKeyword */: - return true; - } - - return this.isIdentifier(currentToken); - }; - - ParserImpl.prototype.parseExpressionStatement = function () { - var expression = this.parseExpression(true); - - var semicolon = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.expressionStatement(expression, semicolon); - }; - - ParserImpl.prototype.parseIfStatement = function () { - var ifKeyword = this.eatKeyword(28 /* IfKeyword */); - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var condition = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - var statement = this.parseStatement(false); - - var elseClause = null; - if (this.isElseClause()) { - elseClause = this.parseElseClause(); - } - - return this.factory.ifStatement(ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause); - }; - - ParserImpl.prototype.isElseClause = function () { - return this.currentToken().tokenKind === 23 /* ElseKeyword */; - }; - - ParserImpl.prototype.parseElseClause = function () { - var elseKeyword = this.eatKeyword(23 /* ElseKeyword */); - var statement = this.parseStatement(false); - - return this.factory.elseClause(elseKeyword, statement); - }; - - ParserImpl.prototype.isVariableStatement = function () { - var index = this.modifierCount(); - return this.peekToken(index).tokenKind === 40 /* VarKeyword */; - }; - - ParserImpl.prototype.parseVariableStatement = function () { - var modifiers = this.parseModifiers(); - var variableDeclaration = this.parseVariableDeclaration(true); - var semicolonToken = this.eatExplicitOrAutomaticSemicolon(false); - - return this.factory.variableStatement(modifiers, variableDeclaration, semicolonToken); - }; - - ParserImpl.prototype.parseVariableDeclaration = function (allowIn) { - var varKeyword = this.eatKeyword(40 /* VarKeyword */); - - var listParsingState = allowIn ? 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */ : 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */; - - var result = this.parseSeparatedSyntaxList(listParsingState); - var variableDeclarators = result.list; - varKeyword = this.addSkippedTokensAfterToken(varKeyword, result.skippedTokens); - - return this.factory.variableDeclaration(varKeyword, variableDeclarators); - }; - - ParserImpl.prototype.isVariableDeclarator = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 225 /* VariableDeclarator */) { - return true; - } - - return this.isIdentifier(this.currentToken()); - }; - - ParserImpl.prototype.canReuseVariableDeclaratorNode = function (node) { - if (node === null || node.kind() !== 225 /* VariableDeclarator */) { - return false; - } - - var variableDeclarator = node; - return variableDeclarator.equalsValueClause === null; - }; - - ParserImpl.prototype.parseVariableDeclarator = function (allowIn, allowPropertyName) { - if (this.canReuseVariableDeclaratorNode(this.currentNode())) { - return this.eatNode(); - } - - var propertyName = allowPropertyName ? this.eatPropertyName() : this.eatIdentifierToken(); - var equalsValueClause = null; - var typeAnnotation = null; - - if (propertyName.width() > 0) { - typeAnnotation = this.parseOptionalTypeAnnotation(false); - - if (this.isEqualsValueClause(false)) { - equalsValueClause = this.parseEqualsValueClause(allowIn); - } - } - - return this.factory.variableDeclarator(propertyName, typeAnnotation, equalsValueClause); - }; - - ParserImpl.prototype.isColonValueClause = function () { - return this.currentToken().tokenKind === 106 /* ColonToken */; - }; - - ParserImpl.prototype.isEqualsValueClause = function (inParameter) { - var token0 = this.currentToken(); - if (token0.tokenKind === 107 /* EqualsToken */) { - return true; - } - - if (!this.previousToken().hasTrailingNewLine()) { - if (token0.tokenKind === 85 /* EqualsGreaterThanToken */) { - return false; - } - - if (token0.tokenKind === 70 /* OpenBraceToken */ && inParameter) { - return false; - } - - return this.isExpression(token0); - } - - return false; - }; - - ParserImpl.prototype.parseEqualsValueClause = function (allowIn) { - var equalsToken = this.eatToken(107 /* EqualsToken */); - var value = this.parseAssignmentExpression(allowIn); - - return this.factory.equalsValueClause(equalsToken, value); - }; - - ParserImpl.prototype.parseExpression = function (allowIn) { - return this.parseSubExpression(0, allowIn); - }; - - ParserImpl.prototype.parseAssignmentExpression = function (allowIn) { - return this.parseSubExpression(2 /* AssignmentExpressionPrecedence */, allowIn); - }; - - ParserImpl.prototype.parseUnaryExpressionOrLower = function () { - var currentTokenKind = this.currentToken().tokenKind; - if (TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(currentTokenKind)) { - var operatorKind = TypeScript.SyntaxFacts.getPrefixUnaryExpressionFromOperatorToken(currentTokenKind); - - var operatorToken = this.eatAnyToken(); - - var operand = this.parseUnaryExpressionOrLower(); - return this.factory.prefixUnaryExpression(operatorKind, operatorToken, operand); - } else if (currentTokenKind === 39 /* TypeOfKeyword */) { - return this.parseTypeOfExpression(); - } else if (currentTokenKind === 41 /* VoidKeyword */) { - return this.parseVoidExpression(); - } else if (currentTokenKind === 21 /* DeleteKeyword */) { - return this.parseDeleteExpression(); - } else if (currentTokenKind === 80 /* LessThanToken */) { - return this.parseCastExpression(); - } else { - return this.parsePostfixExpressionOrLower(); - } - }; - - ParserImpl.prototype.parseSubExpression = function (precedence, allowIn) { - if (precedence <= 2 /* AssignmentExpressionPrecedence */) { - if (this.isSimpleArrowFunctionExpression()) { - return this.parseSimpleArrowFunctionExpression(); - } - - var parethesizedArrowFunction = this.tryParseParenthesizedArrowFunctionExpression(); - if (parethesizedArrowFunction !== null) { - return parethesizedArrowFunction; - } - } - - var leftOperand = this.parseUnaryExpressionOrLower(); - return this.parseBinaryOrConditionalExpressions(precedence, allowIn, leftOperand); - }; - - ParserImpl.prototype.parseBinaryOrConditionalExpressions = function (precedence, allowIn, leftOperand) { - while (true) { - var token0 = this.currentToken(); - var token0Kind = token0.tokenKind; - - if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(token0Kind)) { - if (token0Kind === 29 /* InKeyword */ && !allowIn) { - break; - } - - var mergedToken = this.tryMergeBinaryExpressionTokens(); - var tokenKind = mergedToken === null ? token0Kind : mergedToken.syntaxKind; - - var binaryExpressionKind = TypeScript.SyntaxFacts.getBinaryExpressionFromOperatorToken(tokenKind); - var newPrecedence = ParserImpl.getPrecedence(binaryExpressionKind); - - if (newPrecedence < precedence) { - break; - } - - if (newPrecedence === precedence && !this.isRightAssociative(binaryExpressionKind)) { - break; - } - - var operatorToken = mergedToken === null ? token0 : TypeScript.Syntax.token(mergedToken.syntaxKind).withLeadingTrivia(token0.leadingTrivia()).withTrailingTrivia(this.peekToken(mergedToken.tokenCount - 1).trailingTrivia()); - - var skipCount = mergedToken === null ? 1 : mergedToken.tokenCount; - for (var i = 0; i < skipCount; i++) { - this.eatAnyToken(); - } - - leftOperand = this.factory.binaryExpression(binaryExpressionKind, leftOperand, operatorToken, this.parseSubExpression(newPrecedence, allowIn)); - continue; - } - - if (token0Kind === 105 /* QuestionToken */ && precedence <= 3 /* ConditionalExpressionPrecedence */) { - var questionToken = this.eatToken(105 /* QuestionToken */); - - var whenTrueExpression = this.parseAssignmentExpression(allowIn); - var colon = this.eatToken(106 /* ColonToken */); - - var whenFalseExpression = this.parseAssignmentExpression(allowIn); - leftOperand = this.factory.conditionalExpression(leftOperand, questionToken, whenTrueExpression, colon, whenFalseExpression); - continue; - } - - break; - } - - return leftOperand; - }; - - ParserImpl.prototype.tryMergeBinaryExpressionTokens = function () { - var token0 = this.currentToken(); - - if (token0.tokenKind === 81 /* GreaterThanToken */ && !token0.hasTrailingTrivia()) { - var storage = this.mergeTokensStorage; - storage[0] = 0 /* None */; - storage[1] = 0 /* None */; - storage[2] = 0 /* None */; - - for (var i = 0; i < storage.length; i++) { - var nextToken = this.peekToken(i + 1); - - if (!nextToken.hasLeadingTrivia()) { - storage[i] = nextToken.tokenKind; - } - - if (nextToken.hasTrailingTrivia()) { - break; - } - } - - if (storage[0] === 81 /* GreaterThanToken */) { - if (storage[1] === 81 /* GreaterThanToken */) { - if (storage[2] === 107 /* EqualsToken */) { - return { tokenCount: 4, syntaxKind: 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */ }; - } else { - return { tokenCount: 3, syntaxKind: 97 /* GreaterThanGreaterThanGreaterThanToken */ }; - } - } else if (storage[1] === 107 /* EqualsToken */) { - return { tokenCount: 3, syntaxKind: 113 /* GreaterThanGreaterThanEqualsToken */ }; - } else { - return { tokenCount: 2, syntaxKind: 96 /* GreaterThanGreaterThanToken */ }; - } - } else if (storage[0] === 107 /* EqualsToken */) { - return { tokenCount: 2, syntaxKind: 83 /* GreaterThanEqualsToken */ }; - } - } - - return null; - }; - - ParserImpl.prototype.isRightAssociative = function (expressionKind) { - switch (expressionKind) { - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - return true; - default: - return false; - } - }; - - ParserImpl.prototype.parseMemberExpressionOrLower = function (inObjectCreation) { - if (this.currentToken().tokenKind === 31 /* NewKeyword */) { - return this.parseObjectCreationExpression(); - } - - var expression = this.parsePrimaryExpression(); - if (expression === null) { - return this.eatIdentifierToken(); - } - - return this.parseMemberExpressionRest(expression, false, inObjectCreation); - }; - - ParserImpl.prototype.parseCallExpressionOrLower = function () { - var expression; - if (this.currentToken().tokenKind === 50 /* SuperKeyword */) { - expression = this.eatKeyword(50 /* SuperKeyword */); - - var currentTokenKind = this.currentToken().tokenKind; - if (currentTokenKind !== 72 /* OpenParenToken */ && currentTokenKind !== 76 /* DotToken */) { - expression = this.factory.memberAccessExpression(expression, this.eatToken(76 /* DotToken */), this.eatIdentifierNameToken()); - } - } else { - expression = this.parseMemberExpressionOrLower(false); - } - - return this.parseMemberExpressionRest(expression, true, false); - }; - - ParserImpl.prototype.parseMemberExpressionRest = function (expression, allowArguments, inObjectCreation) { - while (true) { - var currentTokenKind = this.currentToken().tokenKind; - - switch (currentTokenKind) { - case 72 /* OpenParenToken */: - if (!allowArguments) { - return expression; - } - - expression = this.factory.invocationExpression(expression, this.parseArgumentList(null)); - continue; - - case 80 /* LessThanToken */: - if (!allowArguments) { - return expression; - } - - var argumentList = this.tryParseArgumentList(); - if (argumentList !== null) { - expression = this.factory.invocationExpression(expression, argumentList); - continue; - } - - break; - - case 74 /* OpenBracketToken */: - expression = this.parseElementAccessExpression(expression, inObjectCreation); - continue; - - case 76 /* DotToken */: - expression = this.factory.memberAccessExpression(expression, this.eatToken(76 /* DotToken */), this.eatIdentifierNameToken()); - continue; - } - - return expression; - } - }; - - ParserImpl.prototype.parseLeftHandSideExpressionOrLower = function () { - if (this.currentToken().tokenKind === 31 /* NewKeyword */) { - return this.parseObjectCreationExpression(); - } else { - return this.parseCallExpressionOrLower(); - } - }; - - ParserImpl.prototype.parsePostfixExpressionOrLower = function () { - var expression = this.parseLeftHandSideExpressionOrLower(); - if (expression === null) { - return this.eatIdentifierToken(); - } - - var currentTokenKind = this.currentToken().tokenKind; - - switch (currentTokenKind) { - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - if (this.previousToken() !== null && this.previousToken().hasTrailingNewLine()) { - break; - } - - return this.factory.postfixUnaryExpression(TypeScript.SyntaxFacts.getPostfixUnaryExpressionFromOperatorToken(currentTokenKind), expression, this.eatAnyToken()); - } - - return expression; - }; - - ParserImpl.prototype.tryParseGenericArgumentList = function () { - var rewindPoint = this.getRewindPoint(); - - var typeArgumentList = this.tryParseTypeArgumentList(true); - var token0 = this.currentToken(); - - var isOpenParen = token0.tokenKind === 72 /* OpenParenToken */; - var isDot = token0.tokenKind === 76 /* DotToken */; - var isOpenParenOrDot = isOpenParen || isDot; - - var argumentList = null; - if (typeArgumentList === null || !isOpenParenOrDot) { - this.rewind(rewindPoint); - this.releaseRewindPoint(rewindPoint); - return null; - } else { - this.releaseRewindPoint(rewindPoint); - - if (isDot) { - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token0.width(), TypeScript.DiagnosticCode.A_parameter_list_must_follow_a_generic_type_argument_list_expected, null); - this.addDiagnostic(diagnostic); - - return this.factory.argumentList(typeArgumentList, TypeScript.Syntax.emptyToken(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList, TypeScript.Syntax.emptyToken(73 /* CloseParenToken */)); - } else { - return this.parseArgumentList(typeArgumentList); - } - } - }; - - ParserImpl.prototype.tryParseArgumentList = function () { - if (this.currentToken().tokenKind === 80 /* LessThanToken */) { - return this.tryParseGenericArgumentList(); - } - - if (this.currentToken().tokenKind === 72 /* OpenParenToken */) { - return this.parseArgumentList(null); - } - - return null; - }; - - ParserImpl.prototype.parseArgumentList = function (typeArgumentList) { - var openParenToken = this.eatToken(72 /* OpenParenToken */); - - var _arguments = TypeScript.Syntax.emptySeparatedList; - - if (openParenToken.fullWidth() > 0) { - var result = this.parseSeparatedSyntaxList(16384 /* ArgumentList_AssignmentExpressions */); - _arguments = result.list; - openParenToken = this.addSkippedTokensAfterToken(openParenToken, result.skippedTokens); - } - - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - return this.factory.argumentList(typeArgumentList, openParenToken, _arguments, closeParenToken); - }; - - ParserImpl.prototype.parseElementAccessExpression = function (expression, inObjectCreation) { - var start = this.currentTokenStart(); - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - var argumentExpression; - - if (this.currentToken().tokenKind === 75 /* CloseBracketToken */ && inObjectCreation) { - var end = this.currentTokenStart() + this.currentToken().width(); - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, start, end - start, TypeScript.DiagnosticCode.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead, null); - this.addDiagnostic(diagnostic); - - argumentExpression = TypeScript.Syntax.emptyToken(11 /* IdentifierName */); - } else { - argumentExpression = this.parseExpression(true); - } - - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - - return this.factory.elementAccessExpression(expression, openBracketToken, argumentExpression, closeBracketToken); - }; - - ParserImpl.prototype.parsePrimaryExpression = function () { - var currentToken = this.currentToken(); - - if (this.isIdentifier(currentToken)) { - return this.eatIdentifierToken(); - } - - var currentTokenKind = currentToken.tokenKind; - switch (currentTokenKind) { - case 35 /* ThisKeyword */: - return this.parseThisExpression(); - - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - return this.parseLiteralExpression(); - - case 32 /* NullKeyword */: - return this.parseLiteralExpression(); - - case 27 /* FunctionKeyword */: - return this.parseFunctionExpression(); - - case 13 /* NumericLiteral */: - return this.parseLiteralExpression(); - - case 12 /* RegularExpressionLiteral */: - return this.parseLiteralExpression(); - - case 14 /* StringLiteral */: - return this.parseLiteralExpression(); - - case 74 /* OpenBracketToken */: - return this.parseArrayLiteralExpression(); - - case 70 /* OpenBraceToken */: - return this.parseObjectLiteralExpression(); - - case 72 /* OpenParenToken */: - return this.parseParenthesizedExpression(); - - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - var result = this.tryReparseDivideAsRegularExpression(); - if (result !== null) { - return result; - } - break; - } - - return null; - }; - - ParserImpl.prototype.tryReparseDivideAsRegularExpression = function () { - var currentToken = this.currentToken(); - - if (this.previousToken() !== null) { - var previousTokenKind = this.previousToken().tokenKind; - switch (previousTokenKind) { - case 11 /* IdentifierName */: - return null; - - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - return null; - - case 14 /* StringLiteral */: - case 13 /* NumericLiteral */: - case 12 /* RegularExpressionLiteral */: - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - case 75 /* CloseBracketToken */: - return null; - } - } - - currentToken = this.currentTokenAllowingRegularExpression(); - - if (currentToken.tokenKind === 118 /* SlashToken */ || currentToken.tokenKind === 119 /* SlashEqualsToken */) { - return null; - } else if (currentToken.tokenKind === 12 /* RegularExpressionLiteral */) { - return this.parseLiteralExpression(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.parseTypeOfExpression = function () { - var typeOfKeyword = this.eatKeyword(39 /* TypeOfKeyword */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.typeOfExpression(typeOfKeyword, expression); - }; - - ParserImpl.prototype.parseDeleteExpression = function () { - var deleteKeyword = this.eatKeyword(21 /* DeleteKeyword */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.deleteExpression(deleteKeyword, expression); - }; - - ParserImpl.prototype.parseVoidExpression = function () { - var voidKeyword = this.eatKeyword(41 /* VoidKeyword */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.voidExpression(voidKeyword, expression); - }; - - ParserImpl.prototype.parseFunctionExpression = function () { - var functionKeyword = this.eatKeyword(27 /* FunctionKeyword */); - var identifier = null; - - if (this.isIdentifier(this.currentToken())) { - identifier = this.eatIdentifierToken(); - } - - var callSignature = this.parseCallSignature(false); - var block = this.parseBlock(false, true); - - return this.factory.functionExpression(functionKeyword, identifier, callSignature, block); - }; - - ParserImpl.prototype.parseObjectCreationExpression = function () { - var newKeyword = this.eatKeyword(31 /* NewKeyword */); - - var expression = this.parseObjectCreationExpressionOrLower(true); - var argumentList = this.tryParseArgumentList(); - - var result = this.factory.objectCreationExpression(newKeyword, expression, argumentList); - return this.parseMemberExpressionRest(result, true, false); - }; - - ParserImpl.prototype.parseObjectCreationExpressionOrLower = function (inObjectCreation) { - if (this.currentToken().tokenKind === 31 /* NewKeyword */) { - return this.parseObjectCreationExpression(); - } else { - return this.parseMemberExpressionOrLower(inObjectCreation); - } - }; - - ParserImpl.prototype.parseCastExpression = function () { - var lessThanToken = this.eatToken(80 /* LessThanToken */); - var type = this.parseType(); - var greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - var expression = this.parseUnaryExpressionOrLower(); - - return this.factory.castExpression(lessThanToken, type, greaterThanToken, expression); - }; - - ParserImpl.prototype.parseParenthesizedExpression = function () { - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var expression = this.parseExpression(true); - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - - return this.factory.parenthesizedExpression(openParenToken, expression, closeParenToken); - }; - - ParserImpl.prototype.tryParseParenthesizedArrowFunctionExpression = function () { - var tokenKind = this.currentToken().tokenKind; - if (tokenKind !== 72 /* OpenParenToken */ && tokenKind !== 80 /* LessThanToken */) { - return null; - } - - if (this.isDefinitelyArrowFunctionExpression()) { - return this.parseParenthesizedArrowFunctionExpression(false); - } - - if (!this.isPossiblyArrowFunctionExpression()) { - return null; - } - - var rewindPoint = this.getRewindPoint(); - - var arrowFunction = this.parseParenthesizedArrowFunctionExpression(true); - if (arrowFunction === null) { - this.rewind(rewindPoint); - } - - this.releaseRewindPoint(rewindPoint); - return arrowFunction; - }; - - ParserImpl.prototype.parseParenthesizedArrowFunctionExpression = function (requireArrow) { - var currentToken = this.currentToken(); - - var callSignature = this.parseCallSignature(true); - - if (requireArrow && this.currentToken().tokenKind !== 85 /* EqualsGreaterThanToken */) { - return null; - } - - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - - var block = this.tryParseArrowFunctionBlock(); - var expression = null; - if (block === null) { - expression = this.parseAssignmentExpression(true); - } - - return this.factory.parenthesizedArrowFunctionExpression(callSignature, equalsGreaterThanToken, block, expression); - }; - - ParserImpl.prototype.tryParseArrowFunctionBlock = function () { - if (this.isBlock()) { - return this.parseBlock(false, false); - } else { - if (this.isStatement(false) && !this.isExpressionStatement(this.currentToken()) && !this.isFunctionDeclaration()) { - return this.parseBlock(true, false); - } else { - return null; - } - } - }; - - ParserImpl.prototype.isSimpleArrowFunctionExpression = function () { - if (this.currentToken().tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - - return this.isIdentifier(this.currentToken()) && this.peekToken(1).tokenKind === 85 /* EqualsGreaterThanToken */; - }; - - ParserImpl.prototype.parseSimpleArrowFunctionExpression = function () { - var identifier = this.eatIdentifierToken(); - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - - var block = this.tryParseArrowFunctionBlock(); - var expression = null; - if (block === null) { - expression = this.parseAssignmentExpression(true); - } - - return this.factory.simpleArrowFunctionExpression(identifier, equalsGreaterThanToken, block, expression); - }; - - ParserImpl.prototype.isBlock = function () { - return this.currentToken().tokenKind === 70 /* OpenBraceToken */; - }; - - ParserImpl.prototype.isDefinitelyArrowFunctionExpression = function () { - var token0 = this.currentToken(); - if (token0.tokenKind !== 72 /* OpenParenToken */) { - return false; - } - - var token1 = this.peekToken(1); - var token2; - - if (token1.tokenKind === 73 /* CloseParenToken */) { - token2 = this.peekToken(2); - return token2.tokenKind === 106 /* ColonToken */ || token2.tokenKind === 85 /* EqualsGreaterThanToken */ || token2.tokenKind === 70 /* OpenBraceToken */; - } - - if (token1.tokenKind === 77 /* DotDotDotToken */) { - return true; - } - - token2 = this.peekToken(2); - if (token1.tokenKind === 57 /* PublicKeyword */ || token1.tokenKind === 55 /* PrivateKeyword */) { - if (this.isIdentifier(token2)) { - return true; - } - } - - if (!this.isIdentifier(token1)) { - return false; - } - - if (token2.tokenKind === 106 /* ColonToken */) { - return true; - } - - var token3 = this.peekToken(3); - if (token2.tokenKind === 105 /* QuestionToken */) { - if (token3.tokenKind === 106 /* ColonToken */ || token3.tokenKind === 73 /* CloseParenToken */ || token3.tokenKind === 79 /* CommaToken */) { - return true; - } - } - - if (token2.tokenKind === 73 /* CloseParenToken */) { - if (token3.tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - } - - return false; - }; - - ParserImpl.prototype.isPossiblyArrowFunctionExpression = function () { - var token0 = this.currentToken(); - if (token0.tokenKind !== 72 /* OpenParenToken */) { - return true; - } - - var token1 = this.peekToken(1); - - if (!this.isIdentifier(token1)) { - return false; - } - - var token2 = this.peekToken(2); - if (token2.tokenKind === 107 /* EqualsToken */) { - return true; - } - - if (token2.tokenKind === 79 /* CommaToken */) { - return true; - } - - if (token2.tokenKind === 73 /* CloseParenToken */) { - var token3 = this.peekToken(3); - if (token3.tokenKind === 106 /* ColonToken */) { - return true; - } - } - - return false; - }; - - ParserImpl.prototype.parseObjectLiteralExpression = function () { - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var result = this.parseSeparatedSyntaxList(32768 /* ObjectLiteralExpression_PropertyAssignments */); - var propertyAssignments = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.objectLiteralExpression(openBraceToken, propertyAssignments, closeBraceToken); - }; - - ParserImpl.prototype.parsePropertyAssignment = function (inErrorRecovery) { - if (this.isAccessor(inErrorRecovery)) { - return this.parseAccessor(true); - } else if (this.isFunctionPropertyAssignment(inErrorRecovery)) { - return this.parseFunctionPropertyAssignment(); - } else if (this.isSimplePropertyAssignment(inErrorRecovery)) { - return this.parseSimplePropertyAssignment(); - } else { - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isPropertyAssignment = function (inErrorRecovery) { - return this.isAccessor(inErrorRecovery) || this.isFunctionPropertyAssignment(inErrorRecovery) || this.isSimplePropertyAssignment(inErrorRecovery); - }; - - ParserImpl.prototype.eatPropertyName = function () { - return TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(this.currentToken()) ? this.eatIdentifierNameToken() : this.eatAnyToken(); - }; - - ParserImpl.prototype.isFunctionPropertyAssignment = function (inErrorRecovery) { - return this.isPropertyName(this.currentToken(), inErrorRecovery) && this.isCallSignature(1); - }; - - ParserImpl.prototype.parseFunctionPropertyAssignment = function () { - var propertyName = this.eatPropertyName(); - var callSignature = this.parseCallSignature(false); - var block = this.parseBlock(false, true); - - return this.factory.functionPropertyAssignment(propertyName, callSignature, block); - }; - - ParserImpl.prototype.isSimplePropertyAssignment = function (inErrorRecovery) { - return this.isPropertyName(this.currentToken(), inErrorRecovery); - }; - - ParserImpl.prototype.parseSimplePropertyAssignment = function () { - var propertyName = this.eatPropertyName(); - var colonToken = this.eatToken(106 /* ColonToken */); - var expression = this.parseAssignmentExpression(true); - - return this.factory.simplePropertyAssignment(propertyName, colonToken, expression); - }; - - ParserImpl.prototype.isPropertyName = function (token, inErrorRecovery) { - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { - if (inErrorRecovery) { - return this.isIdentifier(token); - } else { - return true; - } - } - - switch (token.tokenKind) { - case 14 /* StringLiteral */: - case 13 /* NumericLiteral */: - return true; - - default: - return false; - } - }; - - ParserImpl.prototype.parseArrayLiteralExpression = function () { - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - - var result = this.parseSeparatedSyntaxList(65536 /* ArrayLiteralExpression_AssignmentExpressions */); - var expressions = result.list; - openBracketToken = this.addSkippedTokensAfterToken(openBracketToken, result.skippedTokens); - - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - - return this.factory.arrayLiteralExpression(openBracketToken, expressions, closeBracketToken); - }; - - ParserImpl.prototype.parseLiteralExpression = function () { - return this.eatAnyToken(); - }; - - ParserImpl.prototype.parseThisExpression = function () { - return this.eatKeyword(35 /* ThisKeyword */); - }; - - ParserImpl.prototype.parseBlock = function (parseBlockEvenWithNoOpenBrace, checkForStrictMode) { - var openBraceToken = this.eatToken(70 /* OpenBraceToken */); - - var statements = TypeScript.Syntax.emptyList; - - if (parseBlockEvenWithNoOpenBrace || openBraceToken.width() > 0) { - var savedIsInStrictMode = this.isInStrictMode; - - var processItems = checkForStrictMode ? ParserImpl.updateStrictModeState : null; - var result = this.parseSyntaxList(32 /* Block_Statements */, processItems); - statements = result.list; - openBraceToken = this.addSkippedTokensAfterToken(openBraceToken, result.skippedTokens); - - this.setStrictMode(savedIsInStrictMode); - } - - var closeBraceToken = this.eatToken(71 /* CloseBraceToken */); - - return this.factory.block(openBraceToken, statements, closeBraceToken); - }; - - ParserImpl.prototype.parseCallSignature = function (requireCompleteTypeParameterList) { - var typeParameterList = this.parseOptionalTypeParameterList(requireCompleteTypeParameterList); - var parameterList = this.parseParameterList(); - var typeAnnotation = this.parseOptionalTypeAnnotation(false); - - return this.factory.callSignature(typeParameterList, parameterList, typeAnnotation); - }; - - ParserImpl.prototype.parseOptionalTypeParameterList = function (requireCompleteTypeParameterList) { - if (this.currentToken().tokenKind !== 80 /* LessThanToken */) { - return null; - } - - var rewindPoint = this.getRewindPoint(); - - var lessThanToken = this.eatToken(80 /* LessThanToken */); - - var result = this.parseSeparatedSyntaxList(524288 /* TypeParameterList_TypeParameters */); - var typeParameters = result.list; - lessThanToken = this.addSkippedTokensAfterToken(lessThanToken, result.skippedTokens); - - var greaterThanToken = this.eatToken(81 /* GreaterThanToken */); - - if (requireCompleteTypeParameterList && greaterThanToken.fullWidth() === 0) { - this.rewind(rewindPoint); - this.releaseRewindPoint(rewindPoint); - return null; - } else { - this.releaseRewindPoint(rewindPoint); - var typeParameterList = this.factory.typeParameterList(lessThanToken, typeParameters, greaterThanToken); - - return typeParameterList; - } - }; - - ParserImpl.prototype.isTypeParameter = function () { - return this.isIdentifier(this.currentToken()); - }; - - ParserImpl.prototype.parseTypeParameter = function () { - var identifier = this.eatIdentifierToken(); - var constraint = this.parseOptionalConstraint(); - - return this.factory.typeParameter(identifier, constraint); - }; - - ParserImpl.prototype.parseOptionalConstraint = function () { - if (this.currentToken().kind() !== 48 /* ExtendsKeyword */) { - return null; - } - - var extendsKeyword = this.eatKeyword(48 /* ExtendsKeyword */); - var type = this.parseType(); - - return this.factory.constraint(extendsKeyword, type); - }; - - ParserImpl.prototype.parseParameterList = function () { - var openParenToken = this.eatToken(72 /* OpenParenToken */); - var parameters = TypeScript.Syntax.emptySeparatedList; - - if (openParenToken.width() > 0) { - var result = this.parseSeparatedSyntaxList(131072 /* ParameterList_Parameters */); - parameters = result.list; - openParenToken = this.addSkippedTokensAfterToken(openParenToken, result.skippedTokens); - } - - var closeParenToken = this.eatToken(73 /* CloseParenToken */); - return this.factory.parameterList(openParenToken, parameters, closeParenToken); - }; - - ParserImpl.prototype.isTypeAnnotation = function () { - return this.currentToken().tokenKind === 106 /* ColonToken */; - }; - - ParserImpl.prototype.parseOptionalTypeAnnotation = function (allowStringLiteral) { - return this.isTypeAnnotation() ? this.parseTypeAnnotation(allowStringLiteral) : null; - }; - - ParserImpl.prototype.parseTypeAnnotation = function (allowStringLiteral) { - var colonToken = this.eatToken(106 /* ColonToken */); - var type = allowStringLiteral && this.currentToken().tokenKind === 14 /* StringLiteral */ ? this.eatToken(14 /* StringLiteral */) : this.parseType(); - - return this.factory.typeAnnotation(colonToken, type); - }; - - ParserImpl.prototype.isType = function () { - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - - switch (currentTokenKind) { - case 39 /* TypeOfKeyword */: - - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - case 41 /* VoidKeyword */: - - case 70 /* OpenBraceToken */: - - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - - case 31 /* NewKeyword */: - return true; - } - - return this.isIdentifier(currentToken); - }; - - ParserImpl.prototype.parseType = function () { - var currentToken = this.currentToken(); - var currentTokenKind = currentToken.tokenKind; - - var type = this.parseNonArrayType(currentToken); - - while (this.currentToken().tokenKind === 74 /* OpenBracketToken */) { - var openBracketToken = this.eatToken(74 /* OpenBracketToken */); - var closeBracketToken = this.eatToken(75 /* CloseBracketToken */); - - type = this.factory.arrayType(type, openBracketToken, closeBracketToken); - } - - return type; - }; - - ParserImpl.prototype.isTypeQuery = function () { - return this.currentToken().tokenKind === 39 /* TypeOfKeyword */; - }; - - ParserImpl.prototype.parseTypeQuery = function () { - var typeOfKeyword = this.eatToken(39 /* TypeOfKeyword */); - var name = this.parseName(); - - return this.factory.typeQuery(typeOfKeyword, name); - }; - - ParserImpl.prototype.parseNonArrayType = function (currentToken) { - var currentTokenKind = currentToken.tokenKind; - switch (currentTokenKind) { - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - case 41 /* VoidKeyword */: - return this.eatAnyToken(); - - case 70 /* OpenBraceToken */: - return this.parseObjectType(); - - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - return this.parseFunctionType(); - - case 31 /* NewKeyword */: - return this.parseConstructorType(); - - case 39 /* TypeOfKeyword */: - return this.parseTypeQuery(); - } - - return this.parseNameOrGenericType(); - }; - - ParserImpl.prototype.parseNameOrGenericType = function () { - var name = this.parseName(); - var typeArgumentList = this.tryParseTypeArgumentList(false); - - return typeArgumentList === null ? name : this.factory.genericType(name, typeArgumentList); - }; - - ParserImpl.prototype.parseFunctionType = function () { - var typeParameterList = this.parseOptionalTypeParameterList(false); - var parameterList = this.parseParameterList(); - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - var returnType = this.parseType(); - - return this.factory.functionType(typeParameterList, parameterList, equalsGreaterThanToken, returnType); - }; - - ParserImpl.prototype.parseConstructorType = function () { - var newKeyword = this.eatKeyword(31 /* NewKeyword */); - var typeParameterList = this.parseOptionalTypeParameterList(false); - var parameterList = this.parseParameterList(); - var equalsGreaterThanToken = this.eatToken(85 /* EqualsGreaterThanToken */); - var type = this.parseType(); - - return this.factory.constructorType(newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type); - }; - - ParserImpl.prototype.isParameter = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 242 /* Parameter */) { - return true; - } - - var token = this.currentToken(); - var tokenKind = token.tokenKind; - if (tokenKind === 77 /* DotDotDotToken */) { - return true; - } - - if (ParserImpl.isModifier(token) && !this.isModifierUsedAsParameterIdentifier(token)) { - return true; - } - - return this.isIdentifier(token); - }; - - ParserImpl.prototype.isModifierUsedAsParameterIdentifier = function (token) { - if (this.isIdentifier(token)) { - var nextTokenKind = this.peekToken(1).tokenKind; - switch (nextTokenKind) { - case 73 /* CloseParenToken */: - case 106 /* ColonToken */: - case 107 /* EqualsToken */: - case 79 /* CommaToken */: - case 105 /* QuestionToken */: - return true; - } - } - - return false; - }; - - ParserImpl.prototype.parseParameter = function () { - if (this.currentNode() !== null && this.currentNode().kind() === 242 /* Parameter */) { - return this.eatNode(); - } - - var dotDotDotToken = this.tryEatToken(77 /* DotDotDotToken */); - - var modifierArray = this.getArray(); - - while (true) { - var currentToken = this.currentToken(); - if (ParserImpl.isModifier(currentToken) && !this.isModifierUsedAsParameterIdentifier(currentToken)) { - modifierArray.push(this.eatAnyToken()); - continue; - } - - break; - } - - var modifiers = TypeScript.Syntax.list(modifierArray); - this.returnZeroOrOneLengthArray(modifierArray); - - var identifier = this.eatIdentifierToken(); - var questionToken = this.tryEatToken(105 /* QuestionToken */); - var typeAnnotation = this.parseOptionalTypeAnnotation(true); - - var equalsValueClause = null; - if (this.isEqualsValueClause(true)) { - equalsValueClause = this.parseEqualsValueClause(true); - } - - return this.factory.parameter(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); - }; - - ParserImpl.prototype.parseSyntaxList = function (currentListType, processItems) { - if (typeof processItems === "undefined") { processItems = null; } - var savedListParsingState = this.listParsingState; - this.listParsingState |= currentListType; - - var result = this.parseSyntaxListWorker(currentListType, processItems); - - this.listParsingState = savedListParsingState; - - return result; - }; - - ParserImpl.prototype.parseSeparatedSyntaxList = function (currentListType) { - var savedListParsingState = this.listParsingState; - this.listParsingState |= currentListType; - - var result = this.parseSeparatedSyntaxListWorker(currentListType); - - this.listParsingState = savedListParsingState; - - return result; - }; - - ParserImpl.prototype.abortParsingListOrMoveToNextToken = function (currentListType, items, skippedTokens) { - this.reportUnexpectedTokenDiagnostic(currentListType); - - for (var state = 524288 /* LastListParsingState */; state >= 1 /* FirstListParsingState */; state >>= 1) { - if ((this.listParsingState & state) !== 0) { - if (this.isExpectedListTerminator(state) || this.isExpectedListItem(state, true)) { - return true; - } - } - } - - var skippedToken = this.currentToken(); - - this.moveToNextToken(); - - this.addSkippedTokenToList(items, skippedTokens, skippedToken); - - return false; - }; - - ParserImpl.prototype.addSkippedTokenToList = function (items, skippedTokens, skippedToken) { - for (var i = items.length - 1; i >= 0; i--) { - var item = items[i]; - var lastToken = item.lastToken(); - if (lastToken.fullWidth() > 0) { - items[i] = this.addSkippedTokenAfterNodeOrToken(item, skippedToken); - return; - } - } - - skippedTokens.push(skippedToken); - }; - - ParserImpl.prototype.tryParseExpectedListItem = function (currentListType, inErrorRecovery, items, processItems) { - if (this.isExpectedListItem(currentListType, inErrorRecovery)) { - var item = this.parseExpectedListItem(currentListType, inErrorRecovery); - - items.push(item); - - if (processItems !== null) { - processItems(this, items); - } - } - }; - - ParserImpl.prototype.listIsTerminated = function (currentListType) { - return this.isExpectedListTerminator(currentListType) || this.currentToken().tokenKind === 10 /* EndOfFileToken */; - }; - - ParserImpl.prototype.getArray = function () { - if (this.arrayPool.length > 0) { - return this.arrayPool.pop(); - } - - return []; - }; - - ParserImpl.prototype.returnZeroOrOneLengthArray = function (array) { - if (array.length <= 1) { - this.returnArray(array); - } - }; - - ParserImpl.prototype.returnArray = function (array) { - array.length = 0; - this.arrayPool.push(array); - }; - - ParserImpl.prototype.parseSyntaxListWorker = function (currentListType, processItems) { - var items = this.getArray(); - var skippedTokens = this.getArray(); - - while (true) { - var oldItemsCount = items.length; - this.tryParseExpectedListItem(currentListType, false, items, processItems); - - var newItemsCount = items.length; - if (newItemsCount === oldItemsCount) { - if (this.listIsTerminated(currentListType)) { - break; - } - - var abort = this.abortParsingListOrMoveToNextToken(currentListType, items, skippedTokens); - if (abort) { - break; - } - } - } - - var result = TypeScript.Syntax.list(items); - - this.returnZeroOrOneLengthArray(items); - - return { skippedTokens: skippedTokens, list: result }; - }; - - ParserImpl.prototype.parseSeparatedSyntaxListWorker = function (currentListType) { - var items = this.getArray(); - var skippedTokens = this.getArray(); - TypeScript.Debug.assert(items.length === 0); - TypeScript.Debug.assert(skippedTokens.length === 0); - TypeScript.Debug.assert(skippedTokens !== items); - - var separatorKind = this.separatorKind(currentListType); - var allowAutomaticSemicolonInsertion = separatorKind === 78 /* SemicolonToken */; - - var inErrorRecovery = false; - var listWasTerminated = false; - while (true) { - var oldItemsCount = items.length; - - this.tryParseExpectedListItem(currentListType, inErrorRecovery, items, null); - - var newItemsCount = items.length; - if (newItemsCount === oldItemsCount) { - if (this.listIsTerminated(currentListType)) { - listWasTerminated = true; - break; - } - - var abort = this.abortParsingListOrMoveToNextToken(currentListType, items, skippedTokens); - if (abort) { - break; - } else { - inErrorRecovery = true; - continue; - } - } - - inErrorRecovery = false; - - var currentToken = this.currentToken(); - if (currentToken.tokenKind === separatorKind || currentToken.tokenKind === 79 /* CommaToken */) { - items.push(this.eatAnyToken()); - continue; - } - - if (this.listIsTerminated(currentListType)) { - listWasTerminated = true; - break; - } - - if (allowAutomaticSemicolonInsertion && this.canEatAutomaticSemicolon(false)) { - items.push(this.eatExplicitOrAutomaticSemicolon(false)); - - continue; - } - - items.push(this.eatToken(separatorKind)); - - inErrorRecovery = true; - } - - var result = TypeScript.Syntax.separatedList(items); - - this.returnZeroOrOneLengthArray(items); - - return { skippedTokens: skippedTokens, list: result }; - }; - - ParserImpl.prototype.separatorKind = function (currentListType) { - switch (currentListType) { - case 2048 /* HeritageClause_TypeNameList */: - case 16384 /* ArgumentList_AssignmentExpressions */: - case 256 /* EnumDeclaration_EnumElements */: - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - case 131072 /* ParameterList_Parameters */: - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - case 262144 /* TypeArgumentList_Types */: - case 524288 /* TypeParameterList_TypeParameters */: - return 79 /* CommaToken */; - - case 512 /* ObjectType_TypeMembers */: - return 78 /* SemicolonToken */; - - case 1 /* SourceUnit_ModuleElements */: - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - case 2 /* ClassDeclaration_ClassElements */: - case 4 /* ModuleDeclaration_ModuleElements */: - case 8 /* SwitchStatement_SwitchClauses */: - case 16 /* SwitchClause_Statements */: - case 32 /* Block_Statements */: - default: - throw TypeScript.Errors.notYetImplemented(); - } - }; - - ParserImpl.prototype.reportUnexpectedTokenDiagnostic = function (listType) { - var token = this.currentToken(); - - var diagnostic = new TypeScript.Diagnostic(this.fileName, this.lineMap, this.currentTokenStart(), token.width(), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [this.getExpectedListElementType(listType)]); - this.addDiagnostic(diagnostic); - }; - - ParserImpl.prototype.addDiagnostic = function (diagnostic) { - if (this.diagnostics.length > 0 && this.diagnostics[this.diagnostics.length - 1].start() === diagnostic.start()) { - return; - } - - this.diagnostics.push(diagnostic); - }; - - ParserImpl.prototype.isExpectedListTerminator = function (currentListType) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return this.isExpectedSourceUnit_ModuleElementsTerminator(); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return this.isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator(); - - case 2 /* ClassDeclaration_ClassElements */: - return this.isExpectedClassDeclaration_ClassElementsTerminator(); - - case 4 /* ModuleDeclaration_ModuleElements */: - return this.isExpectedModuleDeclaration_ModuleElementsTerminator(); - - case 8 /* SwitchStatement_SwitchClauses */: - return this.isExpectedSwitchStatement_SwitchClausesTerminator(); - - case 16 /* SwitchClause_Statements */: - return this.isExpectedSwitchClause_StatementsTerminator(); - - case 32 /* Block_Statements */: - return this.isExpectedBlock_StatementsTerminator(); - - case 64 /* TryBlock_Statements */: - return this.isExpectedTryBlock_StatementsTerminator(); - - case 128 /* CatchBlock_Statements */: - return this.isExpectedCatchBlock_StatementsTerminator(); - - case 256 /* EnumDeclaration_EnumElements */: - return this.isExpectedEnumDeclaration_EnumElementsTerminator(); - - case 512 /* ObjectType_TypeMembers */: - return this.isExpectedObjectType_TypeMembersTerminator(); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return this.isExpectedArgumentList_AssignmentExpressionsTerminator(); - - case 2048 /* HeritageClause_TypeNameList */: - return this.isExpectedHeritageClause_TypeNameListTerminator(); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return this.isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator(); - - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return this.isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator(); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return this.isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator(); - - case 131072 /* ParameterList_Parameters */: - return this.isExpectedParameterList_ParametersTerminator(); - - case 262144 /* TypeArgumentList_Types */: - return this.isExpectedTypeArgumentList_TypesTerminator(); - - case 524288 /* TypeParameterList_TypeParameters */: - return this.isExpectedTypeParameterList_TypeParametersTerminator(); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return this.isExpectedLiteralExpression_AssignmentExpressionsTerminator(); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isExpectedSourceUnit_ModuleElementsTerminator = function () { - return this.currentToken().tokenKind === 10 /* EndOfFileToken */; - }; - - ParserImpl.prototype.isExpectedEnumDeclaration_EnumElementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedModuleDeclaration_ModuleElementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedObjectType_TypeMembersTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedLiteralExpression_AssignmentExpressionsTerminator = function () { - return this.currentToken().tokenKind === 75 /* CloseBracketToken */; - }; - - ParserImpl.prototype.isExpectedTypeArgumentList_TypesTerminator = function () { - var token = this.currentToken(); - if (token.tokenKind === 81 /* GreaterThanToken */) { - return true; - } - - if (this.canFollowTypeArgumentListInExpression(token.tokenKind)) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedTypeParameterList_TypeParametersTerminator = function () { - var token = this.currentToken(); - if (token.tokenKind === 81 /* GreaterThanToken */) { - return true; - } - - if (token.tokenKind === 72 /* OpenParenToken */ || token.tokenKind === 70 /* OpenBraceToken */ || token.tokenKind === 48 /* ExtendsKeyword */ || token.tokenKind === 51 /* ImplementsKeyword */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedParameterList_ParametersTerminator = function () { - var token = this.currentToken(); - if (token.tokenKind === 73 /* CloseParenToken */) { - return true; - } - - if (token.tokenKind === 70 /* OpenBraceToken */) { - return true; - } - - if (token.tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator = function () { - if (this.currentToken().tokenKind === 78 /* SemicolonToken */ || this.currentToken().tokenKind === 73 /* CloseParenToken */) { - return true; - } - - if (this.currentToken().tokenKind === 29 /* InKeyword */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator = function () { - if (this.previousToken().tokenKind === 79 /* CommaToken */) { - return false; - } - - if (this.currentToken().tokenKind === 85 /* EqualsGreaterThanToken */) { - return true; - } - - return this.canEatExplicitOrAutomaticSemicolon(false); - }; - - ParserImpl.prototype.isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator = function () { - var token0 = this.currentToken(); - if (token0.tokenKind === 70 /* OpenBraceToken */ || token0.tokenKind === 71 /* CloseBraceToken */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedHeritageClause_TypeNameListTerminator = function () { - var token0 = this.currentToken(); - if (token0.tokenKind === 48 /* ExtendsKeyword */ || token0.tokenKind === 51 /* ImplementsKeyword */) { - return true; - } - - if (this.isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator()) { - return true; - } - - return false; - }; - - ParserImpl.prototype.isExpectedArgumentList_AssignmentExpressionsTerminator = function () { - var token0 = this.currentToken(); - return token0.tokenKind === 73 /* CloseParenToken */ || token0.tokenKind === 78 /* SemicolonToken */; - }; - - ParserImpl.prototype.isExpectedClassDeclaration_ClassElementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedSwitchStatement_SwitchClausesTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedSwitchClause_StatementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */ || this.isSwitchClause(); - }; - - ParserImpl.prototype.isExpectedBlock_StatementsTerminator = function () { - return this.currentToken().tokenKind === 71 /* CloseBraceToken */; - }; - - ParserImpl.prototype.isExpectedTryBlock_StatementsTerminator = function () { - return this.currentToken().tokenKind === 17 /* CatchKeyword */ || this.currentToken().tokenKind === 25 /* FinallyKeyword */; - }; - - ParserImpl.prototype.isExpectedCatchBlock_StatementsTerminator = function () { - return this.currentToken().tokenKind === 25 /* FinallyKeyword */; - }; - - ParserImpl.prototype.isExpectedListItem = function (currentListType, inErrorRecovery) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return this.isModuleElement(inErrorRecovery); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return this.isHeritageClause(); - - case 2 /* ClassDeclaration_ClassElements */: - return this.isClassElement(inErrorRecovery); - - case 4 /* ModuleDeclaration_ModuleElements */: - return this.isModuleElement(inErrorRecovery); - - case 8 /* SwitchStatement_SwitchClauses */: - return this.isSwitchClause(); - - case 16 /* SwitchClause_Statements */: - return this.isStatement(inErrorRecovery); - - case 32 /* Block_Statements */: - return this.isStatement(inErrorRecovery); - - case 64 /* TryBlock_Statements */: - case 128 /* CatchBlock_Statements */: - return false; - - case 256 /* EnumDeclaration_EnumElements */: - return this.isEnumElement(inErrorRecovery); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return this.isVariableDeclarator(); - - case 512 /* ObjectType_TypeMembers */: - return this.isTypeMember(inErrorRecovery); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return this.isExpectedArgumentList_AssignmentExpression(); - - case 2048 /* HeritageClause_TypeNameList */: - return this.isHeritageClauseTypeName(); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return this.isPropertyAssignment(inErrorRecovery); - - case 131072 /* ParameterList_Parameters */: - return this.isParameter(); - - case 262144 /* TypeArgumentList_Types */: - return this.isType(); - - case 524288 /* TypeParameterList_TypeParameters */: - return this.isTypeParameter(); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return this.isAssignmentOrOmittedExpression(); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.isExpectedArgumentList_AssignmentExpression = function () { - var currentToken = this.currentToken(); - if (this.isExpression(currentToken)) { - return true; - } - - if (currentToken.tokenKind === 79 /* CommaToken */) { - return true; - } - - return false; - }; - - ParserImpl.prototype.parseExpectedListItem = function (currentListType, inErrorRecovery) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return this.parseModuleElement(inErrorRecovery); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return this.parseHeritageClause(); - - case 2 /* ClassDeclaration_ClassElements */: - return this.parseClassElement(inErrorRecovery); - - case 4 /* ModuleDeclaration_ModuleElements */: - return this.parseModuleElement(inErrorRecovery); - - case 8 /* SwitchStatement_SwitchClauses */: - return this.parseSwitchClause(); - - case 16 /* SwitchClause_Statements */: - return this.parseStatement(inErrorRecovery); - - case 32 /* Block_Statements */: - return this.parseStatement(inErrorRecovery); - - case 256 /* EnumDeclaration_EnumElements */: - return this.parseEnumElement(); - - case 512 /* ObjectType_TypeMembers */: - return this.parseTypeMember(inErrorRecovery); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return this.parseAssignmentExpression(true); - - case 2048 /* HeritageClause_TypeNameList */: - return this.parseNameOrGenericType(); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return this.parseVariableDeclarator(true, false); - - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return this.parseVariableDeclarator(false, false); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return this.parsePropertyAssignment(inErrorRecovery); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return this.parseAssignmentOrOmittedExpression(); - - case 131072 /* ParameterList_Parameters */: - return this.parseParameter(); - - case 262144 /* TypeArgumentList_Types */: - return this.parseType(); - - case 524288 /* TypeParameterList_TypeParameters */: - return this.parseTypeParameter(); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - ParserImpl.prototype.getExpectedListElementType = function (currentListType) { - switch (currentListType) { - case 1 /* SourceUnit_ModuleElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, null); - - case 1024 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return '{'; - - case 2 /* ClassDeclaration_ClassElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.constructor_function_accessor_or_variable, null); - - case 4 /* ModuleDeclaration_ModuleElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, null); - - case 8 /* SwitchStatement_SwitchClauses */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.case_or_default_clause, null); - - case 16 /* SwitchClause_Statements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, null); - - case 32 /* Block_Statements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, null); - - case 4096 /* VariableDeclaration_VariableDeclarators_AllowIn */: - case 8192 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - - case 256 /* EnumDeclaration_EnumElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - - case 512 /* ObjectType_TypeMembers */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.call_construct_index_property_or_function_signature, null); - - case 16384 /* ArgumentList_AssignmentExpressions */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - - case 2048 /* HeritageClause_TypeNameList */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, null); - - case 32768 /* ObjectLiteralExpression_PropertyAssignments */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.property_or_accessor, null); - - case 131072 /* ParameterList_Parameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, null); - - case 262144 /* TypeArgumentList_Types */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null); - - case 524288 /* TypeParameterList_TypeParameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, null); - - case 65536 /* ArrayLiteralExpression_AssignmentExpressions */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - return ParserImpl; - })(); - - function parse(fileName, text, isDeclaration, options) { - var source = new NormalParserSource(fileName, text, options.languageVersion()); - - return new ParserImpl(fileName, text.lineMap(), source, options, text).parseSyntaxTree(isDeclaration); - } - Parser.parse = parse; - - function incrementalParse(oldSyntaxTree, textChangeRange, newText) { - if (textChangeRange.isUnchanged()) { - return oldSyntaxTree; - } - - var source = new IncrementalParserSource(oldSyntaxTree, textChangeRange, newText); - - return new ParserImpl(oldSyntaxTree.fileName(), newText.lineMap(), source, oldSyntaxTree.parseOptions(), newText).parseSyntaxTree(oldSyntaxTree.isDeclaration()); - } - Parser.incrementalParse = incrementalParse; - })(TypeScript.Parser || (TypeScript.Parser = {})); - var Parser = TypeScript.Parser; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxTree = (function () { - function SyntaxTree(sourceUnit, isDeclaration, diagnostics, fileName, lineMap, parseOtions) { - this._allDiagnostics = null; - this._sourceUnit = sourceUnit; - this._isDeclaration = isDeclaration; - this._parserDiagnostics = diagnostics; - this._fileName = fileName; - this._lineMap = lineMap; - this._parseOptions = parseOtions; - } - SyntaxTree.prototype.toJSON = function (key) { - var result = {}; - - result.isDeclaration = this._isDeclaration; - result.languageVersion = TypeScript.LanguageVersion[this._parseOptions.languageVersion()]; - result.parseOptions = this._parseOptions; - - if (this.diagnostics().length > 0) { - result.diagnostics = this.diagnostics(); - } - - result.sourceUnit = this._sourceUnit; - result.lineMap = this._lineMap; - - return result; - }; - - SyntaxTree.prototype.sourceUnit = function () { - return this._sourceUnit; - }; - - SyntaxTree.prototype.isDeclaration = function () { - return this._isDeclaration; - }; - - SyntaxTree.prototype.computeDiagnostics = function () { - if (this._parserDiagnostics.length > 0) { - return this._parserDiagnostics; - } - - var diagnostics = []; - this.sourceUnit().accept(new GrammarCheckerWalker(this, diagnostics)); - - return diagnostics; - }; - - SyntaxTree.prototype.diagnostics = function () { - if (this._allDiagnostics === null) { - this._allDiagnostics = this.computeDiagnostics(); - } - - return this._allDiagnostics; - }; - - SyntaxTree.prototype.fileName = function () { - return this._fileName; - }; - - SyntaxTree.prototype.lineMap = function () { - return this._lineMap; - }; - - SyntaxTree.prototype.parseOptions = function () { - return this._parseOptions; - }; - - SyntaxTree.prototype.structuralEquals = function (tree) { - return TypeScript.ArrayUtilities.sequenceEquals(this.diagnostics(), tree.diagnostics(), TypeScript.Diagnostic.equals) && this.sourceUnit().structuralEquals(tree.sourceUnit()); - }; - return SyntaxTree; - })(); - TypeScript.SyntaxTree = SyntaxTree; - - var GrammarCheckerWalker = (function (_super) { - __extends(GrammarCheckerWalker, _super); - function GrammarCheckerWalker(syntaxTree, diagnostics) { - _super.call(this); - this.syntaxTree = syntaxTree; - this.diagnostics = diagnostics; - this.inAmbientDeclaration = false; - this.inBlock = false; - this.inObjectLiteralExpression = false; - this.currentConstructor = null; - } - GrammarCheckerWalker.prototype.childFullStart = function (parent, child) { - return this.position() + TypeScript.Syntax.childOffset(parent, child); - }; - - GrammarCheckerWalker.prototype.childStart = function (parent, child) { - return this.childFullStart(parent, child) + child.leadingTriviaWidth(); - }; - - GrammarCheckerWalker.prototype.pushDiagnostic = function (start, length, diagnosticKey, args) { - if (typeof args === "undefined") { args = null; } - this.diagnostics.push(new TypeScript.Diagnostic(this.syntaxTree.fileName(), this.syntaxTree.lineMap(), start, length, diagnosticKey, args)); - }; - - GrammarCheckerWalker.prototype.pushDiagnostic1 = function (elementFullStart, element, diagnosticKey, args) { - if (typeof args === "undefined") { args = null; } - this.diagnostics.push(new TypeScript.Diagnostic(this.syntaxTree.fileName(), this.syntaxTree.lineMap(), elementFullStart + element.leadingTriviaWidth(), element.width(), diagnosticKey, args)); - }; - - GrammarCheckerWalker.prototype.visitCatchClause = function (node) { - if (node.typeAnnotation) { - this.pushDiagnostic(this.childStart(node, node.typeAnnotation), node.typeAnnotation.width(), TypeScript.DiagnosticCode.Catch_clause_parameter_cannot_have_a_type_annotation); - } - - _super.prototype.visitCatchClause.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkParameterListOrder = function (node) { - var parameterFullStart = this.childFullStart(node, node.parameters); - - var seenOptionalParameter = false; - var parameterCount = node.parameters.nonSeparatorCount(); - - for (var i = 0, n = node.parameters.childCount(); i < n; i++) { - var nodeOrToken = node.parameters.childAt(i); - if (i % 2 === 0) { - var parameterIndex = i / 2; - var parameter = node.parameters.childAt(i); - - if (parameter.dotDotDotToken) { - if (parameterIndex !== (parameterCount - 1)) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Rest_parameter_must_be_last_in_list); - return true; - } - - if (parameter.questionToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Rest_parameter_cannot_be_optional); - return true; - } - - if (parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Rest_parameter_cannot_have_an_initializer); - return true; - } - } else if (parameter.questionToken || parameter.equalsValueClause) { - seenOptionalParameter = true; - - if (parameter.questionToken && parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer); - return true; - } - } else { - if (seenOptionalParameter) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Required_parameter_cannot_follow_optional_parameter); - return true; - } - } - } - - parameterFullStart += nodeOrToken.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkParameterListAcessibilityModifiers = function (node) { - var parameterFullStart = this.childFullStart(node, node.parameters); - - for (var i = 0, n = node.parameters.childCount(); i < n; i++) { - var nodeOrToken = node.parameters.childAt(i); - if (i % 2 === 0) { - var parameter = node.parameters.childAt(i); - - if (this.checkParameterAccessibilityModifiers(node, parameter, parameterFullStart)) { - return true; - } - } - - parameterFullStart += nodeOrToken.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkParameterAccessibilityModifiers = function (parameterList, parameter, parameterFullStart) { - if (parameter.modifiers.childCount() > 0) { - var modifiers = parameter.modifiers; - var modifierFullStart = parameterFullStart + TypeScript.Syntax.childOffset(parameter, modifiers); - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var modifier = modifiers.childAt(i); - - if (this.checkParameterAccessibilityModifier(parameterList, modifier, modifierFullStart, i)) { - return true; - } - - modifierFullStart += modifier.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkParameterAccessibilityModifier = function (parameterList, modifier, modifierFullStart, modifierIndex) { - if (modifier.tokenKind !== 57 /* PublicKeyword */ && modifier.tokenKind !== 55 /* PrivateKeyword */) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]); - return true; - } else { - if (modifierIndex > 0) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return true; - } - - if (!this.inAmbientDeclaration && this.currentConstructor && !this.currentConstructor.block && this.currentConstructor.callSignature.parameterList === parameterList) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Parameter_property_declarations_cannot_be_used_in_a_constructor_overload); - return true; - } else if (this.inAmbientDeclaration || this.currentConstructor === null || this.currentConstructor.callSignature.parameterList !== parameterList) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Parameter_property_declarations_can_only_be_used_in_a_non_ambient_constructor_declaration); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForTrailingSeparator = function (parent, list) { - if (list.childCount() === 0 || list.childCount() % 2 === 1) { - return false; - } - - var currentElementFullStart = this.childFullStart(parent, list); - - for (var i = 0, n = list.childCount(); i < n; i++) { - var child = list.childAt(i); - if (i === n - 1) { - this.pushDiagnostic1(currentElementFullStart, child, TypeScript.DiagnosticCode.Trailing_separator_not_allowed); - } - - currentElementFullStart += child.fullWidth(); - } - - return true; - }; - - GrammarCheckerWalker.prototype.checkForAtLeastOneElement = function (parent, list, expected) { - if (list.childCount() > 0) { - return false; - } - - var listFullStart = this.childFullStart(parent, list); - var tokenAtStart = this.syntaxTree.sourceUnit().findToken(listFullStart); - - this.pushDiagnostic1(listFullStart, tokenAtStart.token(), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [expected]); - - return true; - }; - - GrammarCheckerWalker.prototype.visitParameterList = function (node) { - if (this.checkParameterListAcessibilityModifiers(node) || this.checkParameterListOrder(node) || this.checkForTrailingSeparator(node, node.parameters)) { - this.skip(node); - return; - } - - _super.prototype.visitParameterList.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitHeritageClause = function (node) { - if (this.checkForTrailingSeparator(node, node.typeNames) || this.checkForAtLeastOneElement(node, node.typeNames, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, null))) { - this.skip(node); - return; - } - - _super.prototype.visitHeritageClause.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitArgumentList = function (node) { - if (this.checkForTrailingSeparator(node, node.arguments)) { - this.skip(node); - return; - } - - _super.prototype.visitArgumentList.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitVariableDeclaration = function (node) { - if (this.checkForTrailingSeparator(node, node.variableDeclarators) || this.checkForAtLeastOneElement(node, node.variableDeclarators, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null))) { - this.skip(node); - return; - } - - _super.prototype.visitVariableDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitTypeArgumentList = function (node) { - if (this.checkForTrailingSeparator(node, node.typeArguments) || this.checkForAtLeastOneElement(node, node.typeArguments, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null))) { - this.skip(node); - return; - } - - _super.prototype.visitTypeArgumentList.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitTypeParameterList = function (node) { - if (this.checkForTrailingSeparator(node, node.typeParameters) || this.checkForAtLeastOneElement(node, node.typeParameters, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null))) { - this.skip(node); - return; - } - - _super.prototype.visitTypeParameterList.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkIndexSignatureParameter = function (node) { - var parameterFullStart = this.childFullStart(node, node.parameter); - var parameter = node.parameter; - - if (parameter.dotDotDotToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signatures_cannot_have_rest_parameters); - return true; - } else if (parameter.modifiers.childCount() > 0) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_accessibility_modifiers); - return true; - } else if (parameter.questionToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_a_question_mark); - return true; - } else if (parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_an_initializer); - return true; - } else if (!parameter.typeAnnotation) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_must_have_a_type_annotation); - return true; - } else if (parameter.typeAnnotation.type.kind() !== 69 /* StringKeyword */ && parameter.typeAnnotation.type.kind() !== 67 /* NumberKeyword */) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.Index_signature_parameter_type_must_be_string_or_number); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitIndexSignature = function (node) { - if (this.checkIndexSignatureParameter(node)) { - this.skip(node); - return; - } - - if (!node.typeAnnotation) { - this.pushDiagnostic1(this.position(), node, TypeScript.DiagnosticCode.Index_signature_must_have_a_type_annotation); - this.skip(node); - return; - } - - _super.prototype.visitIndexSignature.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkClassDeclarationHeritageClauses = function (node) { - var heritageClauseFullStart = this.childFullStart(node, node.heritageClauses); - - var seenExtendsClause = false; - var seenImplementsClause = false; - - for (var i = 0, n = node.heritageClauses.childCount(); i < n; i++) { - TypeScript.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses.childAt(i); - - if (heritageClause.extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */) { - if (seenExtendsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); - return true; - } - - if (seenImplementsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.extends_clause_must_precede_implements_clause); - return true; - } - - if (heritageClause.typeNames.nonSeparatorCount() > 1) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.Classes_can_only_extend_a_single_class); - return true; - } - - seenExtendsClause = true; - } else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.tokenKind === 51 /* ImplementsKeyword */); - if (seenImplementsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.implements_clause_already_seen); - return true; - } - - seenImplementsClause = true; - } - - heritageClauseFullStart += heritageClause.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifier = function (modifiers) { - if (this.inAmbientDeclaration) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 63 /* DeclareKeyword */); - - if (declareToken) { - this.pushDiagnostic1(this.childFullStart(modifiers, declareToken), declareToken, TypeScript.DiagnosticCode.declare_modifier_not_allowed_for_code_already_in_an_ambient_context); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForRequiredDeclareModifier = function (moduleElement, typeKeyword, modifiers) { - if (!this.inAmbientDeclaration && this.syntaxTree.isDeclaration()) { - if (!TypeScript.SyntaxUtilities.containsToken(modifiers, 63 /* DeclareKeyword */)) { - this.pushDiagnostic1(this.childFullStart(moduleElement, typeKeyword), typeKeyword.firstToken(), TypeScript.DiagnosticCode.declare_modifier_required_for_top_level_element); - return true; - } - } - }; - - GrammarCheckerWalker.prototype.checkFunctionOverloads = function (node, moduleElements) { - if (!this.inAmbientDeclaration && !this.syntaxTree.isDeclaration()) { - var moduleElementFullStart = this.childFullStart(node, moduleElements); - - var inFunctionOverloadChain = false; - var functionOverloadChainName = null; - - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var moduleElement = moduleElements.childAt(i); - var lastElement = i === (n - 1); - - if (inFunctionOverloadChain) { - if (moduleElement.kind() !== 129 /* FunctionDeclaration */) { - this.pushDiagnostic1(moduleElementFullStart, moduleElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - - var functionDeclaration = moduleElement; - if (functionDeclaration.identifier.valueText() !== functionOverloadChainName) { - var identifierFullStart = moduleElementFullStart + TypeScript.Syntax.childOffset(moduleElement, functionDeclaration.identifier); - this.pushDiagnostic1(identifierFullStart, functionDeclaration.identifier, TypeScript.DiagnosticCode.Function_overload_name_must_be_0, [functionOverloadChainName]); - return true; - } - } - - if (moduleElement.kind() === 129 /* FunctionDeclaration */) { - functionDeclaration = moduleElement; - if (!TypeScript.SyntaxUtilities.containsToken(functionDeclaration.modifiers, 63 /* DeclareKeyword */)) { - inFunctionOverloadChain = functionDeclaration.block === null; - functionOverloadChainName = functionDeclaration.identifier.valueText(); - - if (inFunctionOverloadChain) { - if (lastElement) { - this.pushDiagnostic1(moduleElementFullStart, moduleElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } else { - var nextElement = moduleElements.childAt(i + 1); - if (nextElement.kind() === 129 /* FunctionDeclaration */) { - var nextFunction = nextElement; - - if (nextFunction.identifier.valueText() !== functionOverloadChainName && nextFunction.block === null) { - var identifierFullStart = moduleElementFullStart + TypeScript.Syntax.childOffset(moduleElement, functionDeclaration.identifier); - this.pushDiagnostic1(identifierFullStart, functionDeclaration.identifier, TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - } - } - } - } else { - inFunctionOverloadChain = false; - functionOverloadChainName = ""; - } - } - - moduleElementFullStart += moduleElement.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkClassOverloads = function (node) { - if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { - var classElementFullStart = this.childFullStart(node, node.classElements); - - var inFunctionOverloadChain = false; - var inConstructorOverloadChain = false; - - var functionOverloadChainName = null; - var isInStaticOverloadChain = null; - var memberFunctionDeclaration = null; - - for (var i = 0, n = node.classElements.childCount(); i < n; i++) { - var classElement = node.classElements.childAt(i); - var lastElement = i === (n - 1); - var isStaticOverload = null; - - if (inFunctionOverloadChain) { - if (classElement.kind() !== 135 /* MemberFunctionDeclaration */) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - - memberFunctionDeclaration = classElement; - if (memberFunctionDeclaration.propertyName.valueText() !== functionOverloadChainName) { - var propertyNameFullStart = classElementFullStart + TypeScript.Syntax.childOffset(classElement, memberFunctionDeclaration.propertyName); - this.pushDiagnostic1(propertyNameFullStart, memberFunctionDeclaration.propertyName, TypeScript.DiagnosticCode.Function_overload_name_must_be_0, [functionOverloadChainName]); - return true; - } - - isStaticOverload = TypeScript.SyntaxUtilities.containsToken(memberFunctionDeclaration.modifiers, 58 /* StaticKeyword */); - if (isStaticOverload !== isInStaticOverloadChain) { - var propertyNameFullStart = classElementFullStart + TypeScript.Syntax.childOffset(classElement, memberFunctionDeclaration.propertyName); - var diagnostic = isInStaticOverloadChain ? TypeScript.DiagnosticCode.Function_overload_must_be_static : TypeScript.DiagnosticCode.Function_overload_must_not_be_static; - this.pushDiagnostic1(propertyNameFullStart, memberFunctionDeclaration.propertyName, diagnostic, null); - return true; - } - } else if (inConstructorOverloadChain) { - if (classElement.kind() !== 137 /* ConstructorDeclaration */) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Constructor_implementation_expected); - return true; - } - } - - if (classElement.kind() === 135 /* MemberFunctionDeclaration */) { - memberFunctionDeclaration = classElement; - - inFunctionOverloadChain = memberFunctionDeclaration.block === null; - functionOverloadChainName = memberFunctionDeclaration.propertyName.valueText(); - isInStaticOverloadChain = TypeScript.SyntaxUtilities.containsToken(memberFunctionDeclaration.modifiers, 58 /* StaticKeyword */); - - if (inFunctionOverloadChain) { - if (lastElement) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } else { - var nextElement = node.classElements.childAt(i + 1); - if (nextElement.kind() === 135 /* MemberFunctionDeclaration */) { - var nextMemberFunction = nextElement; - - if (nextMemberFunction.propertyName.valueText() !== functionOverloadChainName && nextMemberFunction.block === null) { - var propertyNameFullStart = classElementFullStart + TypeScript.Syntax.childOffset(classElement, memberFunctionDeclaration.propertyName); - this.pushDiagnostic1(propertyNameFullStart, memberFunctionDeclaration.propertyName, TypeScript.DiagnosticCode.Function_implementation_expected); - return true; - } - } - } - } - } else if (classElement.kind() === 137 /* ConstructorDeclaration */) { - var constructorDeclaration = classElement; - - inConstructorOverloadChain = constructorDeclaration.block === null; - if (lastElement && inConstructorOverloadChain) { - this.pushDiagnostic1(classElementFullStart, classElement.firstToken(), TypeScript.DiagnosticCode.Constructor_implementation_expected); - return true; - } - } - - classElementFullStart += classElement.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForReservedName = function (parent, name, diagnosticKey) { - var nameFullStart = this.childFullStart(parent, name); - var token; - var tokenFullStart; - - var current = name; - while (current !== null) { - if (current.kind() === 121 /* QualifiedName */) { - var qualifiedName = current; - token = qualifiedName.right; - tokenFullStart = nameFullStart + this.childFullStart(qualifiedName, token); - current = qualifiedName.left; - } else { - TypeScript.Debug.assert(current.kind() === 11 /* IdentifierName */); - token = current; - tokenFullStart = nameFullStart; - current = null; - } - - switch (token.valueText()) { - case "any": - case "number": - case "boolean": - case "string": - case "void": - this.pushDiagnostic(tokenFullStart + token.leadingTriviaWidth(), token.width(), diagnosticKey, [token.valueText()]); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitClassDeclaration = function (node) { - if (this.checkForReservedName(node, node.identifier, TypeScript.DiagnosticCode.Class_name_cannot_be_0) || this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.classKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkClassDeclarationHeritageClauses(node) || this.checkClassOverloads(node)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitClassDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkInterfaceDeclarationHeritageClauses = function (node) { - var heritageClauseFullStart = this.childFullStart(node, node.heritageClauses); - - var seenExtendsClause = false; - - for (var i = 0, n = node.heritageClauses.childCount(); i < n; i++) { - TypeScript.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses.childAt(i); - - if (heritageClause.extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */) { - if (seenExtendsClause) { - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); - return true; - } - - seenExtendsClause = true; - } else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.tokenKind === 51 /* ImplementsKeyword */); - this.pushDiagnostic1(heritageClauseFullStart, heritageClause, TypeScript.DiagnosticCode.Interface_declaration_cannot_have_implements_clause); - return true; - } - - heritageClauseFullStart += heritageClause.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkInterfaceModifiers = function (modifiers) { - var modifierFullStart = this.position(); - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var modifier = modifiers.childAt(i); - if (modifier.tokenKind === 63 /* DeclareKeyword */) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.declare_modifier_cannot_appear_on_an_interface_declaration); - return true; - } - - modifierFullStart += modifier.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitInterfaceDeclaration = function (node) { - if (this.checkForReservedName(node, node.identifier, TypeScript.DiagnosticCode.Interface_name_cannot_be_0) || this.checkInterfaceModifiers(node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkInterfaceDeclarationHeritageClauses(node)) { - this.skip(node); - return; - } - - _super.prototype.visitInterfaceDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkClassElementModifiers = function (list) { - var modifierFullStart = this.position(); - - var seenAccessibilityModifier = false; - var seenStaticModifier = false; - - for (var i = 0, n = list.childCount(); i < n; i++) { - var modifier = list.childAt(i); - if (modifier.tokenKind === 57 /* PublicKeyword */ || modifier.tokenKind === 55 /* PrivateKeyword */) { - if (seenAccessibilityModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return true; - } - - if (seenStaticModifier) { - var previousToken = list.childAt(i - 1); - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [modifier.text(), previousToken.text()]); - return true; - } - - seenAccessibilityModifier = true; - } else if (modifier.tokenKind === 58 /* StaticKeyword */) { - if (seenStaticModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); - return true; - } - - seenStaticModifier = true; - } else { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_class_element, [modifier.text()]); - return true; - } - - modifierFullStart += modifier.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitMemberVariableDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - _super.prototype.visitMemberVariableDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitMemberFunctionDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - _super.prototype.visitMemberFunctionDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkGetAccessorParameter = function (node, getKeyword, parameterList) { - var getKeywordFullStart = this.childFullStart(node, getKeyword); - if (parameterList.parameters.childCount() !== 0) { - this.pushDiagnostic1(getKeywordFullStart, getKeyword, TypeScript.DiagnosticCode.get_accessor_cannot_have_parameters); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitIndexMemberDeclaration = function (node) { - if (this.checkIndexMemberModifiers(node)) { - this.skip(node); - return; - } - - _super.prototype.visitIndexMemberDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkIndexMemberModifiers = function (node) { - if (node.modifiers.childCount() > 0) { - var modifierFullStart = this.childFullStart(node, node.modifiers); - this.pushDiagnostic1(modifierFullStart, node.modifiers.childAt(0), TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkEcmaScriptVersionIsAtLeast = function (parent, node, languageVersion, diagnosticKey) { - if (this.syntaxTree.parseOptions().languageVersion() < languageVersion) { - var nodeFullStart = this.childFullStart(parent, node); - this.pushDiagnostic1(nodeFullStart, node, diagnosticKey); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitObjectLiteralExpression = function (node) { - var savedInObjectLiteralExpression = this.inObjectLiteralExpression; - this.inObjectLiteralExpression = true; - _super.prototype.visitObjectLiteralExpression.call(this, node); - this.inObjectLiteralExpression = savedInObjectLiteralExpression; - }; - - GrammarCheckerWalker.prototype.visitGetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node, node.getKeyword, 1 /* EcmaScript5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkGetAccessorParameter(node, node.getKeyword, node.parameterList)) { - this.skip(node); - return; - } - - _super.prototype.visitGetAccessor.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkForAccessorDeclarationInAmbientContext = function (accessor) { - if (this.inAmbientDeclaration) { - this.pushDiagnostic1(this.position(), accessor, TypeScript.DiagnosticCode.Accessors_are_not_allowed_in_ambient_contexts, null); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkSetAccessorParameter = function (node, setKeyword, parameterList) { - var setKeywordFullStart = this.childFullStart(node, setKeyword); - if (parameterList.parameters.childCount() !== 1) { - this.pushDiagnostic1(setKeywordFullStart, setKeyword, TypeScript.DiagnosticCode.set_accessor_must_have_one_and_only_one_parameter); - return true; - } - - var parameterListFullStart = this.childFullStart(node, parameterList); - var parameterFullStart = parameterListFullStart + TypeScript.Syntax.childOffset(parameterList, parameterList.openParenToken); - var parameter = parameterList.parameters.childAt(0); - - if (parameter.questionToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_be_optional); - return true; - } - - if (parameter.equalsValueClause) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_have_an_initializer); - return true; - } - - if (parameter.dotDotDotToken) { - this.pushDiagnostic1(parameterFullStart, parameter, TypeScript.DiagnosticCode.set_accessor_cannot_have_rest_parameter); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitSetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node, node.setKeyword, 1 /* EcmaScript5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkSetAccessorParameter(node, node.setKeyword, node.parameterList)) { - this.skip(node); - return; - } - - _super.prototype.visitSetAccessor.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitEnumDeclaration = function (node) { - if (this.checkForReservedName(node, node.identifier, TypeScript.DiagnosticCode.Enum_name_cannot_be_0) || this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.enumKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers), this.checkEnumElements(node)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitEnumDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkEnumElements = function (node) { - var enumElementFullStart = this.childFullStart(node, node.enumElements); - - var previousValueWasComputed = false; - for (var i = 0, n = node.enumElements.childCount(); i < n; i++) { - var child = node.enumElements.childAt(i); - - if (i % 2 === 0) { - var enumElement = child; - - if (!enumElement.equalsValueClause && previousValueWasComputed) { - this.pushDiagnostic1(enumElementFullStart, enumElement, TypeScript.DiagnosticCode.Enum_member_must_have_initializer, null); - return true; - } - - if (enumElement.equalsValueClause) { - var value = enumElement.equalsValueClause.value; - previousValueWasComputed = !TypeScript.Syntax.isIntegerLiteral(value); - } - } - - enumElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitEnumElement = function (node) { - if (this.inAmbientDeclaration && node.equalsValueClause) { - var expression = node.equalsValueClause.value; - if (!TypeScript.Syntax.isIntegerLiteral(expression)) { - this.pushDiagnostic1(this.childFullStart(node, node.equalsValueClause), node.equalsValueClause.firstToken(), TypeScript.DiagnosticCode.Ambient_enum_elements_can_only_have_integer_literal_initializers); - this.skip(node); - return; - } - } - - _super.prototype.visitEnumElement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitInvocationExpression = function (node) { - if (node.expression.kind() === 50 /* SuperKeyword */ && node.argumentList.typeArgumentList !== null) { - this.pushDiagnostic1(this.position(), node, TypeScript.DiagnosticCode.super_invocation_cannot_have_type_arguments); - } - - _super.prototype.visitInvocationExpression.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkModuleElementModifiers = function (modifiers) { - var modifierFullStart = this.position(); - var seenExportModifier = false; - var seenDeclareModifier = false; - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var modifier = modifiers.childAt(i); - if (modifier.tokenKind === 57 /* PublicKeyword */ || modifier.tokenKind === 55 /* PrivateKeyword */ || modifier.tokenKind === 58 /* StaticKeyword */) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); - return true; - } - - if (modifier.tokenKind === 63 /* DeclareKeyword */) { - if (seenDeclareModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return; - } - - seenDeclareModifier = true; - } else if (modifier.tokenKind === 47 /* ExportKeyword */) { - if (seenExportModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); - return; - } - - if (seenDeclareModifier) { - this.pushDiagnostic1(modifierFullStart, modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [TypeScript.SyntaxFacts.getText(47 /* ExportKeyword */), TypeScript.SyntaxFacts.getText(63 /* DeclareKeyword */)]); - return; - } - - seenExportModifier = true; - } - - modifierFullStart += modifier.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedImportDeclaration = function (node) { - var currentElementFullStart = this.childFullStart(node, node.moduleElements); - - for (var i = 0, n = node.moduleElements.childCount(); i < n; i++) { - var child = node.moduleElements.childAt(i); - if (child.kind() === 133 /* ImportDeclaration */) { - var importDeclaration = child; - if (importDeclaration.moduleReference.kind() === 245 /* ExternalModuleReference */) { - if (node.stringLiteral === null) { - this.pushDiagnostic1(currentElementFullStart, importDeclaration, TypeScript.DiagnosticCode.Import_declarations_in_an_internal_module_cannot_reference_an_external_module, null); - } - } - } - - currentElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifierOnImportDeclaration = function (modifiers) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 63 /* DeclareKeyword */); - - if (declareToken) { - this.pushDiagnostic1(this.childFullStart(modifiers, declareToken), declareToken, TypeScript.DiagnosticCode.declare_modifier_not_allowed_on_import_declaration); - return true; - } - }; - - GrammarCheckerWalker.prototype.visitImportDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifierOnImportDeclaration(node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - _super.prototype.visitImportDeclaration.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitModuleDeclaration = function (node) { - if (this.checkForReservedName(node, node.name, TypeScript.DiagnosticCode.Module_name_cannot_be_0) || this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.moduleKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkForDisallowedImportDeclaration(node) || this.checkForDisallowedExports(node, node.moduleElements) || this.checkForMultipleExportAssignments(node, node.moduleElements)) { - this.skip(node); - return; - } - - if (!TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */) && this.checkFunctionOverloads(node, node.moduleElements)) { - this.skip(node); - return; - } - - if (node.stringLiteral) { - if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { - var stringLiteralFullStart = this.childFullStart(node, node.stringLiteral); - this.pushDiagnostic1(stringLiteralFullStart, node.stringLiteral, TypeScript.DiagnosticCode.Only_ambient_modules_can_use_quoted_names); - this.skip(node); - return; - } - } - - if (!node.stringLiteral && this.checkForDisallowedExportAssignment(node)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitModuleDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedExports = function (node, moduleElements) { - var seenExportedElement = false; - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var child = moduleElements.childAt(i); - - if (TypeScript.SyntaxUtilities.hasExportKeyword(child)) { - seenExportedElement = true; - break; - } - } - - var moduleElementFullStart = this.childFullStart(node, moduleElements); - if (seenExportedElement) { - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var child = moduleElements.childAt(i); - - if (child.kind() === 134 /* ExportAssignment */) { - this.pushDiagnostic1(moduleElementFullStart, child, TypeScript.DiagnosticCode.Export_assignment_not_allowed_in_module_with_exported_element); - return true; - } - - moduleElementFullStart += child.fullWidth(); - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkForMultipleExportAssignments = function (node, moduleElements) { - var moduleElementFullStart = this.childFullStart(node, moduleElements); - var seenExportAssignment = false; - var errorFound = false; - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var child = moduleElements.childAt(i); - if (child.kind() === 134 /* ExportAssignment */) { - if (seenExportAssignment) { - this.pushDiagnostic1(moduleElementFullStart, child, TypeScript.DiagnosticCode.Module_cannot_have_multiple_export_assignments); - errorFound = true; - } - seenExportAssignment = true; - } - - moduleElementFullStart += child.fullWidth(); - } - - return errorFound; - }; - - GrammarCheckerWalker.prototype.checkForDisallowedExportAssignment = function (node) { - var moduleElementFullStart = this.childFullStart(node, node.moduleElements); - - for (var i = 0, n = node.moduleElements.childCount(); i < n; i++) { - var child = node.moduleElements.childAt(i); - - if (child.kind() === 134 /* ExportAssignment */) { - this.pushDiagnostic1(moduleElementFullStart, child, TypeScript.DiagnosticCode.Export_assignment_cannot_be_used_in_internal_modules); - - return true; - } - - moduleElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitBlock = function (node) { - if (this.inAmbientDeclaration || this.syntaxTree.isDeclaration()) { - this.pushDiagnostic1(this.position(), node.firstToken(), TypeScript.DiagnosticCode.Implementations_are_not_allowed_in_ambient_contexts); - this.skip(node); - return; - } - - if (this.checkFunctionOverloads(node, node.statements)) { - this.skip(node); - return; - } - - var savedInBlock = this.inBlock; - this.inBlock = true; - _super.prototype.visitBlock.call(this, node); - this.inBlock = savedInBlock; - }; - - GrammarCheckerWalker.prototype.checkForStatementInAmbientContxt = function (node) { - if (this.inAmbientDeclaration || this.syntaxTree.isDeclaration()) { - this.pushDiagnostic1(this.position(), node.firstToken(), TypeScript.DiagnosticCode.Statements_are_not_allowed_in_ambient_contexts); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitBreakStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitBreakStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitContinueStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitContinueStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitDebuggerStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitDebuggerStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitDoStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitDoStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitEmptyStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitEmptyStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitExpressionStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitExpressionStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitForInStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkForInStatementVariableDeclaration(node)) { - this.skip(node); - return; - } - - _super.prototype.visitForInStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkForInStatementVariableDeclaration = function (node) { - if (node.variableDeclaration && node.variableDeclaration.variableDeclarators.nonSeparatorCount() > 1) { - var variableDeclarationFullStart = this.childFullStart(node, node.variableDeclaration); - - this.pushDiagnostic1(variableDeclarationFullStart, node.variableDeclaration, TypeScript.DiagnosticCode.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitForStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitForStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitIfStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitIfStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitLabeledStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitLabeledStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitReturnStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitReturnStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitSwitchStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitSwitchStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitThrowStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitThrowStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitTryStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitTryStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitWhileStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitWhileStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitWithStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - this.skip(node); - return; - } - - _super.prototype.visitWithStatement.call(this, node); - }; - - GrammarCheckerWalker.prototype.checkForDisallowedModifiers = function (parent, modifiers) { - if (this.inBlock || this.inObjectLiteralExpression) { - if (modifiers.childCount() > 0) { - var modifierFullStart = this.childFullStart(parent, modifiers); - this.pushDiagnostic1(modifierFullStart, modifiers.childAt(0), TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); - return true; - } - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitFunctionDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkForRequiredDeclareModifier(node, node.functionKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitFunctionDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitVariableStatement = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkForRequiredDeclareModifier(node, node.variableDeclaration, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); - _super.prototype.visitVariableStatement.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.checkListSeparators = function (parent, list, kind) { - var currentElementFullStart = this.childFullStart(parent, list); - - for (var i = 0, n = list.childCount(); i < n; i++) { - var child = list.childAt(i); - if (i % 2 === 1 && child.kind() !== kind) { - this.pushDiagnostic1(currentElementFullStart, child, TypeScript.DiagnosticCode._0_expected, [TypeScript.SyntaxFacts.getText(kind)]); - } - - currentElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitObjectType = function (node) { - if (this.checkListSeparators(node, node.typeMembers, 78 /* SemicolonToken */)) { - this.skip(node); - return; - } - - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitObjectType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitArrayType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitArrayType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitFunctionType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitFunctionType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitConstructorType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitConstructorType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - - GrammarCheckerWalker.prototype.visitVariableDeclarator = function (node) { - if (this.inAmbientDeclaration && node.equalsValueClause) { - this.pushDiagnostic1(this.childFullStart(node, node.equalsValueClause), node.equalsValueClause.firstToken(), TypeScript.DiagnosticCode.Initializers_are_not_allowed_in_ambient_contexts); - this.skip(node); - return; - } - - _super.prototype.visitVariableDeclarator.call(this, node); - }; - - GrammarCheckerWalker.prototype.visitConstructorDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers) || this.checkConstructorModifiers(node.modifiers) || this.checkConstructorTypeParameterList(node) || this.checkConstructorTypeAnnotation(node)) { - this.skip(node); - return; - } - - var savedCurrentConstructor = this.currentConstructor; - this.currentConstructor = node; - _super.prototype.visitConstructorDeclaration.call(this, node); - this.currentConstructor = savedCurrentConstructor; - }; - - GrammarCheckerWalker.prototype.checkConstructorModifiers = function (modifiers) { - var currentElementFullStart = this.position(); - - for (var i = 0, n = modifiers.childCount(); i < n; i++) { - var child = modifiers.childAt(i); - if (child.kind() !== 57 /* PublicKeyword */) { - this.pushDiagnostic1(currentElementFullStart, child, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_constructor_declaration, [TypeScript.SyntaxFacts.getText(child.kind())]); - return true; - } - - currentElementFullStart += child.fullWidth(); - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkConstructorTypeParameterList = function (node) { - var currentElementFullStart = this.position(); - - if (node.callSignature.typeParameterList) { - var callSignatureFullStart = this.childFullStart(node, node.callSignature); - var typeParameterListFullStart = callSignatureFullStart + TypeScript.Syntax.childOffset(node.callSignature, node.callSignature.typeAnnotation); - this.pushDiagnostic1(callSignatureFullStart, node.callSignature.typeParameterList, TypeScript.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.checkConstructorTypeAnnotation = function (node) { - var currentElementFullStart = this.position(); - - if (node.callSignature.typeAnnotation) { - var callSignatureFullStart = this.childFullStart(node, node.callSignature); - var typeAnnotationFullStart = callSignatureFullStart + TypeScript.Syntax.childOffset(node.callSignature, node.callSignature.typeAnnotation); - this.pushDiagnostic1(typeAnnotationFullStart, node.callSignature.typeAnnotation, TypeScript.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration); - return true; - } - - return false; - }; - - GrammarCheckerWalker.prototype.visitSourceUnit = function (node) { - if (this.checkFunctionOverloads(node, node.moduleElements) || this.checkForDisallowedExports(node, node.moduleElements) || this.checkForMultipleExportAssignments(node, node.moduleElements)) { - this.skip(node); - return; - } - - _super.prototype.visitSourceUnit.call(this, node); - }; - return GrammarCheckerWalker; - })(TypeScript.PositionTrackingWalker); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Unicode = (function () { - function Unicode() { - } - Unicode.lookupInUnicodeMap = function (code, map) { - if (code < map[0]) { - return false; - } - - var lo = 0; - var hi = map.length; - var mid; - - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - - if (code < map[mid]) { - hi = mid; - } else { - lo = mid + 2; - } - } - - return false; - }; - - Unicode.isIdentifierStart = function (code, languageVersion) { - if (languageVersion === 0 /* EcmaScript3 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierStart); - } else if (languageVersion === 1 /* EcmaScript5 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierStart); - } else { - throw TypeScript.Errors.argumentOutOfRange("languageVersion"); - } - }; - - Unicode.isIdentifierPart = function (code, languageVersion) { - if (languageVersion === 0 /* EcmaScript3 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierPart); - } else if (languageVersion === 1 /* EcmaScript5 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierPart); - } else { - throw TypeScript.Errors.argumentOutOfRange("languageVersion"); - } - }; - Unicode.unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - Unicode.unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - - Unicode.unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - Unicode.unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; - return Unicode; - })(); - TypeScript.Unicode = Unicode; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (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; - })(TypeScript.CompilerDiagnostics || (TypeScript.CompilerDiagnostics = {})); - var 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; - - function timeFunction(logger, funcDescription, func) { - var start = (new Date()).getTime(); - var result = func(); - var end = (new Date()).getTime(); - if (logger.information()) { - logger.log(funcDescription + " completed in " + (end - start) + " msec"); - } - return result; - } - TypeScript.timeFunction = timeFunction; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Document = (function () { - function Document(_compiler, _semanticInfoChain, fileName, referencedFiles, _scriptSnapshot, byteOrderMark, version, isOpen, _syntaxTree, _topLevelDecl) { - this._compiler = _compiler; - this._semanticInfoChain = _semanticInfoChain; - this.fileName = fileName; - this.referencedFiles = referencedFiles; - this._scriptSnapshot = _scriptSnapshot; - this.byteOrderMark = byteOrderMark; - this.version = version; - this.isOpen = isOpen; - this._syntaxTree = _syntaxTree; - this._topLevelDecl = _topLevelDecl; - this._diagnostics = null; - this._bloomFilter = null; - this._sourceUnit = null; - this._lineMap = null; - this._declASTMap = []; - this._astDeclMap = []; - this._amdDependencies = undefined; - this._externalModuleIndicatorSpan = undefined; - } - Document.prototype.invalidate = function () { - this._declASTMap.length = 0; - this._astDeclMap.length = 0; - this._topLevelDecl = null; - - this._syntaxTree = null; - this._sourceUnit = null; - this._diagnostics = null; - this._bloomFilter = null; - }; - - Document.prototype.isDeclareFile = function () { - return TypeScript.isDTSFile(this.fileName); - }; - - Document.prototype.cacheSyntaxTreeInfo = function (syntaxTree) { - var start = new Date().getTime(); - this._diagnostics = syntaxTree.diagnostics(); - TypeScript.syntaxDiagnosticsTime += new Date().getTime() - start; - - this._lineMap = syntaxTree.lineMap(); - - var sourceUnit = syntaxTree.sourceUnit(); - var leadingTrivia = sourceUnit.leadingTrivia(); - - this._externalModuleIndicatorSpan = this.getImplicitImportSpan(leadingTrivia) || this.getTopLevelImportOrExportSpan(sourceUnit); - - var amdDependencies = []; - for (var i = 0, n = leadingTrivia.count(); i < n; i++) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.isComment()) { - var amdDependency = this.getAmdDependency(trivia.fullText()); - if (amdDependency) { - amdDependencies.push(amdDependency); - } - } - } - - this._amdDependencies = amdDependencies; - }; - - Document.prototype.getAmdDependency = function (comment) { - var amdDependencyRegEx = /^\/\/\/\s*/gim; - var match = implicitImportRegEx.exec(trivia.fullText()); - - if (match) { - return new TypeScript.TextSpan(position, trivia.fullWidth()); - } - - return null; - }; - - Document.prototype.getTopLevelImportOrExportSpan = function (node) { - var firstToken; - var position = 0; - - for (var i = 0, n = node.moduleElements.childCount(); i < n; i++) { - var moduleElement = node.moduleElements.childAt(i); - - firstToken = moduleElement.firstToken(); - if (firstToken !== null && firstToken.tokenKind === 47 /* ExportKeyword */) { - return new TypeScript.TextSpan(position + firstToken.leadingTriviaWidth(), firstToken.width()); - } - - if (moduleElement.kind() === 133 /* ImportDeclaration */) { - var importDecl = moduleElement; - if (importDecl.moduleReference.kind() === 245 /* ExternalModuleReference */) { - return new TypeScript.TextSpan(position + importDecl.leadingTriviaWidth(), importDecl.width()); - } - } - - position += moduleElement.fullWidth(); - } - - return null; - ; - }; - - Document.prototype.sourceUnit = function () { - if (!this._sourceUnit) { - var start = new Date().getTime(); - var syntaxTree = this.syntaxTree(); - this._sourceUnit = TypeScript.SyntaxTreeToAstVisitor.visit(syntaxTree, this.fileName, this._compiler.compilationSettings(), this.isOpen); - TypeScript.astTranslationTime += new Date().getTime() - start; - - if (!this.isOpen) { - this._syntaxTree = null; - } - } - - return this._sourceUnit; - }; - - Document.prototype.diagnostics = function () { - if (this._diagnostics === null) { - this.syntaxTree(); - TypeScript.Debug.assert(this._diagnostics); - } - - return this._diagnostics; - }; - - Document.prototype.lineMap = function () { - if (this._lineMap === null) { - this.syntaxTree(); - TypeScript.Debug.assert(this._lineMap); - } - - return this._lineMap; - }; - - Document.prototype.isExternalModule = function () { - return this.externalModuleIndicatorSpan() !== null; - }; - - Document.prototype.externalModuleIndicatorSpan = function () { - if (this._externalModuleIndicatorSpan === undefined) { - this.syntaxTree(); - TypeScript.Debug.assert(this._externalModuleIndicatorSpan !== undefined); - } - - return this._externalModuleIndicatorSpan; - }; - - Document.prototype.amdDependencies = function () { - if (this._amdDependencies === undefined) { - this.syntaxTree(); - TypeScript.Debug.assert(this._amdDependencies !== undefined); - } - - return this._amdDependencies; - }; - - Document.prototype.syntaxTree = function () { - var result = this._syntaxTree; - if (!result) { - var start = new Date().getTime(); - - result = TypeScript.Parser.parse(this.fileName, TypeScript.SimpleText.fromScriptSnapshot(this._scriptSnapshot), TypeScript.isDTSFile(this.fileName), TypeScript.getParseOptions(this._compiler.compilationSettings())); - - TypeScript.syntaxTreeParseTime += new Date().getTime() - start; - - if (this.isOpen || !this._sourceUnit) { - this._syntaxTree = result; - } - } - - this.cacheSyntaxTreeInfo(result); - return result; - }; - - Document.prototype.bloomFilter = function () { - if (!this._bloomFilter) { - var identifiers = TypeScript.createIntrinsicsObject(); - var pre = function (cur) { - if (TypeScript.ASTHelpers.isValidAstNode(cur)) { - if (cur.kind() === 11 /* IdentifierName */) { - var nodeText = cur.valueText(); - - identifiers[nodeText] = true; - } - } - }; - - TypeScript.getAstWalkerFactory().simpleWalk(this.sourceUnit(), pre, null, identifiers); - - var identifierCount = 0; - for (var name in identifiers) { - if (identifiers[name]) { - identifierCount++; - } - } - - this._bloomFilter = new TypeScript.BloomFilter(identifierCount); - this._bloomFilter.addKeys(identifiers); - } - return this._bloomFilter; - }; - - Document.prototype.emitToOwnOutputFile = function () { - return !this._compiler.compilationSettings().outFileOption() || this.isExternalModule(); - }; - - Document.prototype.update = function (scriptSnapshot, version, isOpen, textChangeRange) { - var oldSyntaxTree = this._syntaxTree; - - if (textChangeRange !== null && TypeScript.Debug.shouldAssert(1 /* Normal */)) { - var oldText = this._scriptSnapshot; - var newText = scriptSnapshot; - - TypeScript.Debug.assert((oldText.getLength() - textChangeRange.span().length() + textChangeRange.newLength()) === newText.getLength()); - - if (TypeScript.Debug.shouldAssert(3 /* VeryAggressive */)) { - var oldTextPrefix = oldText.getText(0, textChangeRange.span().start()); - var newTextPrefix = newText.getText(0, textChangeRange.span().start()); - TypeScript.Debug.assert(oldTextPrefix === newTextPrefix); - - var oldTextSuffix = oldText.getText(textChangeRange.span().end(), oldText.getLength()); - var newTextSuffix = newText.getText(textChangeRange.newSpan().end(), newText.getLength()); - TypeScript.Debug.assert(oldTextSuffix === newTextSuffix); - } - } - - var text = TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot); - - var newSyntaxTree = textChangeRange === null || oldSyntaxTree === null ? TypeScript.Parser.parse(this.fileName, text, TypeScript.isDTSFile(this.fileName), TypeScript.getParseOptions(this._compiler.compilationSettings())) : TypeScript.Parser.incrementalParse(oldSyntaxTree, textChangeRange, text); - - return new Document(this._compiler, this._semanticInfoChain, this.fileName, this.referencedFiles, scriptSnapshot, this.byteOrderMark, version, isOpen, newSyntaxTree, null); - }; - - Document.create = function (compiler, semanticInfoChain, fileName, scriptSnapshot, byteOrderMark, version, isOpen, referencedFiles) { - return new Document(compiler, semanticInfoChain, fileName, referencedFiles, scriptSnapshot, byteOrderMark, version, isOpen, null, null); - }; - - Document.prototype.topLevelDecl = function () { - if (this._topLevelDecl === null) { - this._topLevelDecl = TypeScript.DeclarationCreator.create(this, this._semanticInfoChain, this._compiler.compilationSettings()); - } - - return this._topLevelDecl; - }; - - Document.prototype._getDeclForAST = function (ast) { - this.topLevelDecl(); - return this._astDeclMap[ast.syntaxID()]; - }; - - Document.prototype.getEnclosingDecl = function (ast) { - if (ast.kind() === 120 /* SourceUnit */) { - return this._getDeclForAST(ast); - } - - ast = ast.parent; - var decl = null; - while (ast) { - decl = this._getDeclForAST(ast); - - if (decl) { - break; - } - - ast = ast.parent; - } - - return decl._getEnclosingDeclFromParentDecl(); - }; - - Document.prototype._setDeclForAST = function (ast, decl) { - TypeScript.Debug.assert(decl.fileName() === this.fileName); - this._astDeclMap[ast.syntaxID()] = decl; - }; - - Document.prototype._getASTForDecl = function (decl) { - return this._declASTMap[decl.declID]; - }; - - Document.prototype._setASTForDecl = function (decl, ast) { - TypeScript.Debug.assert(decl.fileName() === this.fileName); - this._declASTMap[decl.declID] = ast; - }; - return Document; - })(); - TypeScript.Document = Document; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function hasFlag(val, flag) { - return (val & flag) !== 0; - } - TypeScript.hasFlag = hasFlag; - - (function (TypeRelationshipFlags) { - TypeRelationshipFlags[TypeRelationshipFlags["SuccessfulComparison"] = 0] = "SuccessfulComparison"; - 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"; - TypeRelationshipFlags[TypeRelationshipFlags["InconsistantPropertyAccesibility"] = 1 << 7] = "InconsistantPropertyAccesibility"; - })(TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {})); - var TypeRelationshipFlags = TypeScript.TypeRelationshipFlags; - - (function (ModuleGenTarget) { - ModuleGenTarget[ModuleGenTarget["Unspecified"] = 0] = "Unspecified"; - ModuleGenTarget[ModuleGenTarget["Synchronous"] = 1] = "Synchronous"; - ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 2] = "Asynchronous"; - })(TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {})); - var ModuleGenTarget = TypeScript.ModuleGenTarget; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var proto = "__proto__"; - - 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; - this["constructor"] = undefined; - - this[proto] = null; - this[proto] = undefined; - } - return BlockIntrinsics; - })(); - - function createIntrinsicsObject() { - return new BlockIntrinsics(); - } - TypeScript.createIntrinsicsObject = createIntrinsicsObject; - - var StringHashTable = (function () { - function StringHashTable() { - this.itemCount = 0; - this.table = createIntrinsicsObject(); - } - StringHashTable.prototype.getAllKeys = function () { - var result = []; - - for (var k in this.table) { - if (this.table[k] !== undefined) { - result.push(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]; - return data === undefined ? null : data; - }; - - StringHashTable.prototype.remove = function (key) { - if (this.table[key] !== undefined) { - this.table[key] = undefined; - this.itemCount--; - } - }; - return StringHashTable; - })(); - TypeScript.StringHashTable = StringHashTable; - - var IdentiferNameHashTable = (function (_super) { - __extends(IdentiferNameHashTable, _super); - function IdentiferNameHashTable() { - _super.apply(this, arguments); - } - IdentiferNameHashTable.prototype.getAllKeys = function () { - var result = []; - - _super.prototype.map.call(this, function (k, v, c) { - if (v !== undefined) { - result.push(k.substring(1)); - } - }, null); - - return result; - }; - - IdentiferNameHashTable.prototype.add = function (key, data) { - return _super.prototype.add.call(this, "#" + key, data); - }; - - IdentiferNameHashTable.prototype.addOrUpdate = function (key, data) { - return _super.prototype.addOrUpdate.call(this, "#" + key, data); - }; - - IdentiferNameHashTable.prototype.map = function (fn, context) { - return _super.prototype.map.call(this, function (k, v, c) { - return fn(k.substring(1), v, c); - }, context); - }; - - IdentiferNameHashTable.prototype.every = function (fn, context) { - return _super.prototype.every.call(this, function (k, v, c) { - return fn(k.substring(1), v, c); - }, context); - }; - - IdentiferNameHashTable.prototype.some = function (fn, context) { - return _super.prototype.some.call(this, function (k, v, c) { - return fn(k.substring(1), v, c); - }, context); - }; - - IdentiferNameHashTable.prototype.lookup = function (key) { - return _super.prototype.lookup.call(this, "#" + key); - }; - return IdentiferNameHashTable; - })(StringHashTable); - TypeScript.IdentiferNameHashTable = IdentiferNameHashTable; -})(TypeScript || (TypeScript = {})); - -var TypeScript; -(function (TypeScript) { - (function (ASTHelpers) { - function scriptIsElided(sourceUnit) { - return TypeScript.isDTSFile(sourceUnit.fileName()) || moduleMembersAreElided(sourceUnit.moduleElements); - } - ASTHelpers.scriptIsElided = scriptIsElided; - - function moduleIsElided(declaration) { - return TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */) || moduleMembersAreElided(declaration.moduleElements); - } - ASTHelpers.moduleIsElided = moduleIsElided; - - function moduleMembersAreElided(members) { - for (var i = 0, n = members.childCount(); i < n; i++) { - var member = members.childAt(i); - - if (member.kind() === 130 /* ModuleDeclaration */) { - if (!moduleIsElided(member)) { - return false; - } - } else if (member.kind() !== 128 /* InterfaceDeclaration */) { - return false; - } - } - - return true; - } - - function enumIsElided(declaration) { - if (TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */)) { - return true; - } - - return false; - } - ASTHelpers.enumIsElided = enumIsElided; - - function isValidAstNode(ast) { - if (!ast) - return false; - - if (ast.start() === -1 || ast.end() === -1) - return false; - - return true; - } - ASTHelpers.isValidAstNode = isValidAstNode; - - function getAstAtPosition(script, pos, useTrailingTriviaAsLimChar, forceInclusive) { - if (typeof useTrailingTriviaAsLimChar === "undefined") { useTrailingTriviaAsLimChar = true; } - if (typeof forceInclusive === "undefined") { forceInclusive = false; } - var top = null; - - var pre = function (cur, walker) { - if (isValidAstNode(cur)) { - var isInvalid1 = cur.kind() === 149 /* ExpressionStatement */ && cur.width() === 0; - - if (isInvalid1) { - walker.options.goChildren = false; - } else { - var inclusive = forceInclusive || cur.kind() === 11 /* IdentifierName */ || cur.kind() === 212 /* MemberAccessExpression */ || cur.kind() === 121 /* QualifiedName */ || cur.kind() === 224 /* VariableDeclaration */ || cur.kind() === 225 /* VariableDeclarator */ || cur.kind() === 213 /* InvocationExpression */ || pos === script.end() + script.trailingTriviaWidth(); - - var minChar = cur.start(); - var limChar = cur.end() + (useTrailingTriviaAsLimChar ? cur.trailingTriviaWidth() : 0) + (inclusive ? 1 : 0); - if (pos >= minChar && pos < limChar) { - if ((cur.kind() !== 1 /* List */ && cur.kind() !== 2 /* SeparatedList */) || cur.end() > cur.start()) { - if (top === null) { - top = cur; - } else if (cur.start() >= top.start() && (cur.end() + (useTrailingTriviaAsLimChar ? cur.trailingTriviaWidth() : 0)) <= (top.end() + (useTrailingTriviaAsLimChar ? top.trailingTriviaWidth() : 0))) { - if (top.width() !== 0 || cur.width() !== 0) { - top = cur; - } - } - } - } - - walker.options.goChildren = (minChar <= pos && pos <= limChar); - } - } - }; - - TypeScript.getAstWalkerFactory().walk(script, pre); - return top; - } - ASTHelpers.getAstAtPosition = getAstAtPosition; - - function getExtendsHeritageClause(clauses) { - if (!clauses) { - return null; - } - - return clauses.firstOrDefault(function (c) { - return c.typeNames.nonSeparatorCount() > 0 && c.kind() === 230 /* ExtendsHeritageClause */; - }); - } - ASTHelpers.getExtendsHeritageClause = getExtendsHeritageClause; - - function getImplementsHeritageClause(clauses) { - if (!clauses) { - return null; - } - - return clauses.firstOrDefault(function (c) { - return c.typeNames.nonSeparatorCount() > 0 && c.kind() === 231 /* ImplementsHeritageClause */; - }); - } - ASTHelpers.getImplementsHeritageClause = getImplementsHeritageClause; - - function isCallExpression(ast) { - return (ast && ast.kind() === 213 /* InvocationExpression */) || (ast && ast.kind() === 216 /* ObjectCreationExpression */); - } - ASTHelpers.isCallExpression = isCallExpression; - - function isCallExpressionTarget(ast) { - if (!ast) { - return false; - } - - var current = ast; - - while (current && current.parent) { - if (current.parent.kind() === 212 /* MemberAccessExpression */ && current.parent.name === current) { - current = current.parent; - continue; - } - - break; - } - - if (current && current.parent) { - if (current.parent.kind() === 213 /* InvocationExpression */ || current.parent.kind() === 216 /* ObjectCreationExpression */) { - return current === current.parent.expression; - } - } - - return false; - } - ASTHelpers.isCallExpressionTarget = isCallExpressionTarget; - - function isNameOfSomeDeclaration(ast) { - if (ast === null || ast.parent === null) { - return false; - } - if (ast.kind() !== 11 /* IdentifierName */) { - return false; - } - - switch (ast.parent.kind()) { - case 131 /* ClassDeclaration */: - return ast.parent.identifier === ast; - case 128 /* InterfaceDeclaration */: - return ast.parent.identifier === ast; - case 132 /* EnumDeclaration */: - return ast.parent.identifier === ast; - case 130 /* ModuleDeclaration */: - return ast.parent.name === ast || ast.parent.stringLiteral === ast; - case 225 /* VariableDeclarator */: - return ast.parent.propertyName === ast; - case 129 /* FunctionDeclaration */: - return ast.parent.identifier === ast; - case 135 /* MemberFunctionDeclaration */: - return ast.parent.propertyName === ast; - case 242 /* Parameter */: - return ast.parent.identifier === ast; - case 238 /* TypeParameter */: - return ast.parent.identifier === ast; - case 240 /* SimplePropertyAssignment */: - return ast.parent.propertyName === ast; - case 241 /* FunctionPropertyAssignment */: - return ast.parent.propertyName === ast; - case 243 /* EnumElement */: - return ast.parent.propertyName === ast; - case 133 /* ImportDeclaration */: - return ast.parent.identifier === ast; - } - - return false; - } - - function isDeclarationASTOrDeclarationNameAST(ast) { - return isNameOfSomeDeclaration(ast) || isDeclarationAST(ast); - } - ASTHelpers.isDeclarationASTOrDeclarationNameAST = isDeclarationASTOrDeclarationNameAST; - - function getEnclosingParameterForInitializer(ast) { - var current = ast; - while (current) { - switch (current.kind()) { - case 232 /* EqualsValueClause */: - if (current.parent && current.parent.kind() === 242 /* Parameter */) { - return current.parent; - } - break; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - return null; - } - - current = current.parent; - } - return null; - } - ASTHelpers.getEnclosingParameterForInitializer = getEnclosingParameterForInitializer; - - function getEnclosingMemberVariableDeclaration(ast) { - var current = ast; - - while (current) { - switch (current.kind()) { - case 136 /* MemberVariableDeclaration */: - return current; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - return null; - } - current = current.parent; - } - - return null; - } - ASTHelpers.getEnclosingMemberVariableDeclaration = getEnclosingMemberVariableDeclaration; - - function isNameOfFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 129 /* FunctionDeclaration */ && ast.parent.identifier === ast; - } - ASTHelpers.isNameOfFunction = isNameOfFunction; - - function isNameOfMemberFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 135 /* MemberFunctionDeclaration */ && ast.parent.propertyName === ast; - } - ASTHelpers.isNameOfMemberFunction = isNameOfMemberFunction; - - function isNameOfMemberAccessExpression(ast) { - if (ast && ast.parent && ast.parent.kind() === 212 /* MemberAccessExpression */ && ast.parent.name === ast) { - return true; - } - - return false; - } - ASTHelpers.isNameOfMemberAccessExpression = isNameOfMemberAccessExpression; - - function isRightSideOfQualifiedName(ast) { - if (ast && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.right === ast) { - return true; - } - - return false; - } - ASTHelpers.isRightSideOfQualifiedName = isRightSideOfQualifiedName; - - function parentIsModuleDeclaration(ast) { - return ast.parent && ast.parent.kind() === 130 /* ModuleDeclaration */; - } - ASTHelpers.parentIsModuleDeclaration = parentIsModuleDeclaration; - - function parametersFromIdentifier(id) { - return { - length: 1, - lastParameterIsRest: function () { - return false; - }, - ast: id, - astAt: function (index) { - return id; - }, - identifierAt: function (index) { - return id; - }, - typeAt: function (index) { - return null; - }, - initializerAt: function (index) { - return null; - }, - isOptionalAt: function (index) { - return false; - } - }; - } - ASTHelpers.parametersFromIdentifier = parametersFromIdentifier; - - function parametersFromParameter(parameter) { - return { - length: 1, - lastParameterIsRest: function () { - return parameter.dotDotDotToken !== null; - }, - ast: parameter, - astAt: function (index) { - return parameter; - }, - identifierAt: function (index) { - return parameter.identifier; - }, - typeAt: function (index) { - return getType(parameter); - }, - initializerAt: function (index) { - return parameter.equalsValueClause; - }, - isOptionalAt: function (index) { - return parameterIsOptional(parameter); - } - }; - } - ASTHelpers.parametersFromParameter = parametersFromParameter; - - function parameterIsOptional(parameter) { - return parameter.questionToken !== null || parameter.equalsValueClause !== null; - } - - function parametersFromParameterList(list) { - return { - length: list.parameters.nonSeparatorCount(), - lastParameterIsRest: function () { - return TypeScript.lastParameterIsRest(list); - }, - ast: list.parameters, - astAt: function (index) { - return list.parameters.nonSeparatorAt(index); - }, - identifierAt: function (index) { - return list.parameters.nonSeparatorAt(index).identifier; - }, - typeAt: function (index) { - return getType(list.parameters.nonSeparatorAt(index)); - }, - initializerAt: function (index) { - return list.parameters.nonSeparatorAt(index).equalsValueClause; - }, - isOptionalAt: function (index) { - return parameterIsOptional(list.parameters.nonSeparatorAt(index)); - } - }; - } - ASTHelpers.parametersFromParameterList = parametersFromParameterList; - - function isDeclarationAST(ast) { - switch (ast.kind()) { - case 225 /* VariableDeclarator */: - return getVariableStatement(ast) !== null; - - case 133 /* ImportDeclaration */: - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 242 /* Parameter */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 144 /* IndexSignature */: - case 129 /* FunctionDeclaration */: - case 130 /* ModuleDeclaration */: - case 124 /* ArrayType */: - case 122 /* ObjectType */: - case 238 /* TypeParameter */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 136 /* MemberVariableDeclaration */: - case 138 /* IndexMemberDeclaration */: - case 132 /* EnumDeclaration */: - case 243 /* EnumElement */: - case 240 /* SimplePropertyAssignment */: - case 241 /* FunctionPropertyAssignment */: - case 222 /* FunctionExpression */: - case 142 /* CallSignature */: - case 143 /* ConstructSignature */: - case 145 /* MethodSignature */: - case 141 /* PropertySignature */: - return true; - default: - return false; - } - } - ASTHelpers.isDeclarationAST = isDeclarationAST; - - function docComments(ast) { - if (isDeclarationAST(ast)) { - var preComments = ast.kind() === 225 /* VariableDeclarator */ ? getVariableStatement(ast).preComments() : ast.preComments(); - - if (preComments && preComments.length > 0) { - var preCommentsLength = preComments.length; - var docComments = new Array(); - for (var i = preCommentsLength - 1; i >= 0; i--) { - if (isDocComment(preComments[i])) { - docComments.push(preComments[i]); - continue; - } - - break; - } - - return docComments.reverse(); - } - } - - return TypeScript.sentinelEmptyArray; - } - ASTHelpers.docComments = docComments; - - function isDocComment(comment) { - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - var fullText = comment.fullText(); - return fullText.charAt(2) === "*" && fullText.charAt(3) !== "/"; - } - - return false; - } - - function getParameterList(ast) { - if (ast) { - switch (ast.kind()) { - case 137 /* ConstructorDeclaration */: - return getParameterList(ast.callSignature); - case 129 /* FunctionDeclaration */: - return getParameterList(ast.callSignature); - case 218 /* ParenthesizedArrowFunctionExpression */: - return getParameterList(ast.callSignature); - case 143 /* ConstructSignature */: - return getParameterList(ast.callSignature); - case 135 /* MemberFunctionDeclaration */: - return getParameterList(ast.callSignature); - case 241 /* FunctionPropertyAssignment */: - return getParameterList(ast.callSignature); - case 222 /* FunctionExpression */: - return getParameterList(ast.callSignature); - case 145 /* MethodSignature */: - return getParameterList(ast.callSignature); - case 125 /* ConstructorType */: - return ast.parameterList; - case 123 /* FunctionType */: - return ast.parameterList; - case 142 /* CallSignature */: - return ast.parameterList; - case 139 /* GetAccessor */: - return ast.parameterList; - case 140 /* SetAccessor */: - return ast.parameterList; - } - } - - return null; - } - ASTHelpers.getParameterList = getParameterList; - - function getType(ast) { - if (ast) { - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - return getType(ast.callSignature); - case 218 /* ParenthesizedArrowFunctionExpression */: - return getType(ast.callSignature); - case 143 /* ConstructSignature */: - return getType(ast.callSignature); - case 135 /* MemberFunctionDeclaration */: - return getType(ast.callSignature); - case 241 /* FunctionPropertyAssignment */: - return getType(ast.callSignature); - case 222 /* FunctionExpression */: - return getType(ast.callSignature); - case 145 /* MethodSignature */: - return getType(ast.callSignature); - case 142 /* CallSignature */: - return getType(ast.typeAnnotation); - case 144 /* IndexSignature */: - return getType(ast.typeAnnotation); - case 141 /* PropertySignature */: - return getType(ast.typeAnnotation); - case 139 /* GetAccessor */: - return getType(ast.typeAnnotation); - case 242 /* Parameter */: - return getType(ast.typeAnnotation); - case 136 /* MemberVariableDeclaration */: - return getType(ast.variableDeclarator); - case 225 /* VariableDeclarator */: - return getType(ast.typeAnnotation); - case 236 /* CatchClause */: - return getType(ast.typeAnnotation); - case 125 /* ConstructorType */: - return ast.type; - case 123 /* FunctionType */: - return ast.type; - case 244 /* TypeAnnotation */: - return ast.type; - } - } - - return null; - } - ASTHelpers.getType = getType; - - function getVariableStatement(variableDeclarator) { - if (variableDeclarator && variableDeclarator.parent && variableDeclarator.parent.parent && variableDeclarator.parent.parent.parent && variableDeclarator.parent.kind() === 2 /* SeparatedList */ && variableDeclarator.parent.parent.kind() === 224 /* VariableDeclaration */ && variableDeclarator.parent.parent.parent.kind() === 148 /* VariableStatement */) { - return variableDeclarator.parent.parent.parent; - } - - return null; - } - - function getVariableDeclaratorModifiers(variableDeclarator) { - var variableStatement = getVariableStatement(variableDeclarator); - return variableStatement ? variableStatement.modifiers : TypeScript.sentinelEmptyArray; - } - ASTHelpers.getVariableDeclaratorModifiers = getVariableDeclaratorModifiers; - - function isIntegerLiteralAST(expression) { - if (expression) { - switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - expression = expression.operand; - return expression.kind() === 13 /* NumericLiteral */ && TypeScript.IntegerUtilities.isInteger(expression.text()); - - case 13 /* NumericLiteral */: - var text = expression.text(); - return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); - } - } - - return false; - } - ASTHelpers.isIntegerLiteralAST = isIntegerLiteralAST; - - function getEnclosingModuleDeclaration(ast) { - while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { - return ast; - } - - ast = ast.parent; - } - - return null; - } - ASTHelpers.getEnclosingModuleDeclaration = getEnclosingModuleDeclaration; - - function isEntireNameOfModuleDeclaration(nameAST) { - return parentIsModuleDeclaration(nameAST) && nameAST.parent.name === nameAST; - } - - function getModuleDeclarationFromNameAST(ast) { - if (ast) { - switch (ast.kind()) { - case 14 /* StringLiteral */: - if (parentIsModuleDeclaration(ast) && ast.parent.stringLiteral === ast) { - return ast.parent; - } - return null; - - case 11 /* IdentifierName */: - case 121 /* QualifiedName */: - if (isEntireNameOfModuleDeclaration(ast)) { - return ast.parent; - } - break; - - default: - return null; - } - - for (ast = ast.parent; ast && ast.kind() === 121 /* QualifiedName */; ast = ast.parent) { - if (isEntireNameOfModuleDeclaration(ast)) { - return ast.parent; - } - } - } - - return null; - } - ASTHelpers.getModuleDeclarationFromNameAST = getModuleDeclarationFromNameAST; - - function isLastNameOfModule(ast, astName) { - if (ast) { - if (ast.stringLiteral) { - return astName === ast.stringLiteral; - } else if (ast.name.kind() === 121 /* QualifiedName */) { - return astName === ast.name.right; - } else { - return astName === ast.name; - } - } - - return false; - } - ASTHelpers.isLastNameOfModule = isLastNameOfModule; - - function getNameOfIdenfierOrQualifiedName(name) { - if (name.kind() === 11 /* IdentifierName */) { - return name.text(); - } else { - TypeScript.Debug.assert(name.kind() == 121 /* QualifiedName */); - var dotExpr = name; - return getNameOfIdenfierOrQualifiedName(dotExpr.left) + "." + getNameOfIdenfierOrQualifiedName(dotExpr.right); - } - } - ASTHelpers.getNameOfIdenfierOrQualifiedName = getNameOfIdenfierOrQualifiedName; - - function getModuleNames(name, result) { - result = result || []; - - if (name.kind() === 121 /* QualifiedName */) { - getModuleNames(name.left, result); - result.push(name.right); - } else { - result.push(name); - } - - return result; - } - ASTHelpers.getModuleNames = getModuleNames; - })(TypeScript.ASTHelpers || (TypeScript.ASTHelpers = {})); - var ASTHelpers = TypeScript.ASTHelpers; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function walkListChildren(preAst, walker) { - for (var i = 0, n = preAst.childCount(); i < n; i++) { - walker.walk(preAst.childAt(i)); - } - } - - function walkThrowStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkPrefixUnaryExpressionChildren(preAst, walker) { - walker.walk(preAst.operand); - } - - function walkPostfixUnaryExpressionChildren(preAst, walker) { - walker.walk(preAst.operand); - } - - function walkDeleteExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkTypeArgumentListChildren(preAst, walker) { - walker.walk(preAst.typeArguments); - } - - function walkTypeOfExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkVoidExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkArgumentListChildren(preAst, walker) { - walker.walk(preAst.typeArgumentList); - walker.walk(preAst.arguments); - } - - function walkArrayLiteralExpressionChildren(preAst, walker) { - walker.walk(preAst.expressions); - } - - function walkSimplePropertyAssignmentChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.expression); - } - - function walkFunctionPropertyAssignmentChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkGetAccessorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.parameterList); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.block); - } - - function walkSeparatedListChildren(preAst, walker) { - for (var i = 0, n = preAst.nonSeparatorCount(); i < n; i++) { - walker.walk(preAst.nonSeparatorAt(i)); - } - } - - function walkSetAccessorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.parameterList); - walker.walk(preAst.block); - } - - function walkObjectLiteralExpressionChildren(preAst, walker) { - walker.walk(preAst.propertyAssignments); - } - - function walkCastExpressionChildren(preAst, walker) { - walker.walk(preAst.type); - walker.walk(preAst.expression); - } - - function walkParenthesizedExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkElementAccessExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentExpression); - } - - function walkMemberAccessExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.name); - } - - function walkQualifiedNameChildren(preAst, walker) { - walker.walk(preAst.left); - walker.walk(preAst.right); - } - - function walkBinaryExpressionChildren(preAst, walker) { - walker.walk(preAst.left); - walker.walk(preAst.right); - } - - function walkEqualsValueClauseChildren(preAst, walker) { - walker.walk(preAst.value); - } - - function walkTypeParameterChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.constraint); - } - - function walkTypeParameterListChildren(preAst, walker) { - walker.walk(preAst.typeParameters); - } - - function walkGenericTypeChildren(preAst, walker) { - walker.walk(preAst.name); - walker.walk(preAst.typeArgumentList); - } - - function walkTypeAnnotationChildren(preAst, walker) { - walker.walk(preAst.type); - } - - function walkTypeQueryChildren(preAst, walker) { - walker.walk(preAst.name); - } - - function walkInvocationExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentList); - } - - function walkObjectCreationExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentList); - } - - function walkTrinaryExpressionChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.whenTrue); - walker.walk(preAst.whenFalse); - } - - function walkFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkFunctionTypeChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.type); - } - - function walkParenthesizedArrowFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - walker.walk(preAst.expression); - } - - function walkSimpleArrowFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.block); - walker.walk(preAst.expression); - } - - function walkMemberFunctionDeclarationChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkFuncDeclChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkIndexMemberDeclarationChildren(preAst, walker) { - walker.walk(preAst.indexSignature); - } - - function walkIndexSignatureChildren(preAst, walker) { - walker.walk(preAst.parameter); - walker.walk(preAst.typeAnnotation); - } - - function walkCallSignatureChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.typeAnnotation); - } - - function walkConstraintChildren(preAst, walker) { - walker.walk(preAst.type); - } - - function walkConstructorDeclarationChildren(preAst, walker) { - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - - function walkConstructorTypeChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.type); - } - - function walkConstructSignatureChildren(preAst, walker) { - walker.walk(preAst.callSignature); - } - - function walkParameterChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.equalsValueClause); - } - - function walkParameterListChildren(preAst, walker) { - walker.walk(preAst.parameters); - } - - function walkPropertySignatureChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.typeAnnotation); - } - - function walkVariableDeclaratorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.equalsValueClause); - } - - function walkMemberVariableDeclarationChildren(preAst, walker) { - walker.walk(preAst.variableDeclarator); - } - - function walkMethodSignatureChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - } - - function walkReturnStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkForStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - walker.walk(preAst.initializer); - walker.walk(preAst.condition); - walker.walk(preAst.incrementor); - walker.walk(preAst.statement); - } - - function walkForInStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - walker.walk(preAst.left); - walker.walk(preAst.expression); - walker.walk(preAst.statement); - } - - function walkIfStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - walker.walk(preAst.elseClause); - } - - function walkElseClauseChildren(preAst, walker) { - walker.walk(preAst.statement); - } - - function walkWhileStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - - function walkDoStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - - function walkBlockChildren(preAst, walker) { - walker.walk(preAst.statements); - } - - function walkVariableDeclarationChildren(preAst, walker) { - walker.walk(preAst.declarators); - } - - function walkCaseSwitchClauseChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.statements); - } - - function walkDefaultSwitchClauseChildren(preAst, walker) { - walker.walk(preAst.statements); - } - - function walkSwitchStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.switchClauses); - } - - function walkTryStatementChildren(preAst, walker) { - walker.walk(preAst.block); - walker.walk(preAst.catchClause); - walker.walk(preAst.finallyClause); - } - - function walkCatchClauseChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.block); - } - - function walkExternalModuleReferenceChildren(preAst, walker) { - walker.walk(preAst.stringLiteral); - } - - function walkFinallyClauseChildren(preAst, walker) { - walker.walk(preAst.block); - } - - function walkClassDeclChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeParameterList); - walker.walk(preAst.heritageClauses); - walker.walk(preAst.classElements); - } - - function walkScriptChildren(preAst, walker) { - walker.walk(preAst.moduleElements); - } - - function walkHeritageClauseChildren(preAst, walker) { - walker.walk(preAst.typeNames); - } - - function walkInterfaceDeclerationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeParameterList); - walker.walk(preAst.heritageClauses); - walker.walk(preAst.body); - } - - function walkObjectTypeChildren(preAst, walker) { - walker.walk(preAst.typeMembers); - } - - function walkArrayTypeChildren(preAst, walker) { - walker.walk(preAst.type); - } - - function walkModuleDeclarationChildren(preAst, walker) { - walker.walk(preAst.name); - walker.walk(preAst.stringLiteral); - walker.walk(preAst.moduleElements); - } - - function walkModuleNameModuleReferenceChildren(preAst, walker) { - walker.walk(preAst.moduleName); - } - - function walkEnumDeclarationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.enumElements); - } - - function walkEnumElementChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.equalsValueClause); - } - - function walkImportDeclarationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.moduleReference); - } - - function walkExportAssignmentChildren(preAst, walker) { - walker.walk(preAst.identifier); - } - - function walkWithStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - - function walkExpressionStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - - function walkLabeledStatementChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.statement); - } - - function walkVariableStatementChildren(preAst, walker) { - walker.walk(preAst.declaration); - } - - var childrenWalkers = new Array(246 /* Last */ + 1); - - for (var i = 9 /* FirstToken */, n = 119 /* LastToken */; i <= n; i++) { - childrenWalkers[i] = null; - } - for (var i = 4 /* FirstTrivia */, n = 8 /* LastTrivia */; i <= n; i++) { - childrenWalkers[i] = null; - } - - childrenWalkers[175 /* AddAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[208 /* AddExpression */] = walkBinaryExpressionChildren; - childrenWalkers[180 /* AndAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[60 /* AnyKeyword */] = null; - childrenWalkers[226 /* ArgumentList */] = walkArgumentListChildren; - childrenWalkers[214 /* ArrayLiteralExpression */] = walkArrayLiteralExpressionChildren; - childrenWalkers[124 /* ArrayType */] = walkArrayTypeChildren; - childrenWalkers[219 /* SimpleArrowFunctionExpression */] = walkSimpleArrowFunctionExpressionChildren; - childrenWalkers[218 /* ParenthesizedArrowFunctionExpression */] = walkParenthesizedArrowFunctionExpressionChildren; - childrenWalkers[174 /* AssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[191 /* BitwiseAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[190 /* BitwiseExclusiveOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[166 /* BitwiseNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[189 /* BitwiseOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[146 /* Block */] = walkBlockChildren; - childrenWalkers[61 /* BooleanKeyword */] = null; - childrenWalkers[152 /* BreakStatement */] = null; - childrenWalkers[142 /* CallSignature */] = walkCallSignatureChildren; - childrenWalkers[233 /* CaseSwitchClause */] = walkCaseSwitchClauseChildren; - childrenWalkers[220 /* CastExpression */] = walkCastExpressionChildren; - childrenWalkers[236 /* CatchClause */] = walkCatchClauseChildren; - childrenWalkers[131 /* ClassDeclaration */] = walkClassDeclChildren; - childrenWalkers[173 /* CommaExpression */] = walkBinaryExpressionChildren; - childrenWalkers[186 /* ConditionalExpression */] = walkTrinaryExpressionChildren; - childrenWalkers[239 /* Constraint */] = walkConstraintChildren; - childrenWalkers[137 /* ConstructorDeclaration */] = walkConstructorDeclarationChildren; - childrenWalkers[143 /* ConstructSignature */] = walkConstructSignatureChildren; - childrenWalkers[153 /* ContinueStatement */] = null; - childrenWalkers[125 /* ConstructorType */] = walkConstructorTypeChildren; - childrenWalkers[162 /* DebuggerStatement */] = null; - childrenWalkers[234 /* DefaultSwitchClause */] = walkDefaultSwitchClauseChildren; - childrenWalkers[170 /* DeleteExpression */] = walkDeleteExpressionChildren; - childrenWalkers[178 /* DivideAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[206 /* DivideExpression */] = walkBinaryExpressionChildren; - childrenWalkers[161 /* DoStatement */] = walkDoStatementChildren; - childrenWalkers[221 /* ElementAccessExpression */] = walkElementAccessExpressionChildren; - childrenWalkers[235 /* ElseClause */] = walkElseClauseChildren; - childrenWalkers[156 /* EmptyStatement */] = null; - childrenWalkers[132 /* EnumDeclaration */] = walkEnumDeclarationChildren; - childrenWalkers[243 /* EnumElement */] = walkEnumElementChildren; - childrenWalkers[194 /* EqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[232 /* EqualsValueClause */] = walkEqualsValueClauseChildren; - childrenWalkers[192 /* EqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[181 /* ExclusiveOrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[134 /* ExportAssignment */] = walkExportAssignmentChildren; - childrenWalkers[149 /* ExpressionStatement */] = walkExpressionStatementChildren; - childrenWalkers[230 /* ExtendsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[245 /* ExternalModuleReference */] = walkExternalModuleReferenceChildren; - childrenWalkers[24 /* FalseKeyword */] = null; - childrenWalkers[237 /* FinallyClause */] = walkFinallyClauseChildren; - childrenWalkers[155 /* ForInStatement */] = walkForInStatementChildren; - childrenWalkers[154 /* ForStatement */] = walkForStatementChildren; - childrenWalkers[129 /* FunctionDeclaration */] = walkFuncDeclChildren; - childrenWalkers[222 /* FunctionExpression */] = walkFunctionExpressionChildren; - childrenWalkers[241 /* FunctionPropertyAssignment */] = walkFunctionPropertyAssignmentChildren; - childrenWalkers[123 /* FunctionType */] = walkFunctionTypeChildren; - childrenWalkers[126 /* GenericType */] = walkGenericTypeChildren; - childrenWalkers[139 /* GetAccessor */] = walkGetAccessorChildren; - childrenWalkers[197 /* GreaterThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[199 /* GreaterThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[147 /* IfStatement */] = walkIfStatementChildren; - childrenWalkers[231 /* ImplementsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[133 /* ImportDeclaration */] = walkImportDeclarationChildren; - childrenWalkers[138 /* IndexMemberDeclaration */] = walkIndexMemberDeclarationChildren; - childrenWalkers[144 /* IndexSignature */] = walkIndexSignatureChildren; - childrenWalkers[201 /* InExpression */] = walkBinaryExpressionChildren; - childrenWalkers[200 /* InstanceOfExpression */] = walkBinaryExpressionChildren; - childrenWalkers[128 /* InterfaceDeclaration */] = walkInterfaceDeclerationChildren; - childrenWalkers[213 /* InvocationExpression */] = walkInvocationExpressionChildren; - childrenWalkers[160 /* LabeledStatement */] = walkLabeledStatementChildren; - childrenWalkers[183 /* LeftShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[202 /* LeftShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[196 /* LessThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[198 /* LessThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[1 /* List */] = walkListChildren; - childrenWalkers[188 /* LogicalAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[167 /* LogicalNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[187 /* LogicalOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[212 /* MemberAccessExpression */] = walkMemberAccessExpressionChildren; - childrenWalkers[135 /* MemberFunctionDeclaration */] = walkMemberFunctionDeclarationChildren; - childrenWalkers[136 /* MemberVariableDeclaration */] = walkMemberVariableDeclarationChildren; - childrenWalkers[145 /* MethodSignature */] = walkMethodSignatureChildren; - childrenWalkers[130 /* ModuleDeclaration */] = walkModuleDeclarationChildren; - childrenWalkers[246 /* ModuleNameModuleReference */] = walkModuleNameModuleReferenceChildren; - childrenWalkers[179 /* ModuloAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[207 /* ModuloExpression */] = walkBinaryExpressionChildren; - childrenWalkers[177 /* MultiplyAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[205 /* MultiplyExpression */] = walkBinaryExpressionChildren; - childrenWalkers[11 /* IdentifierName */] = null; - childrenWalkers[165 /* NegateExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[0 /* None */] = null; - childrenWalkers[195 /* NotEqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[193 /* NotEqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[32 /* NullKeyword */] = null; - childrenWalkers[67 /* NumberKeyword */] = null; - childrenWalkers[13 /* NumericLiteral */] = null; - childrenWalkers[216 /* ObjectCreationExpression */] = walkObjectCreationExpressionChildren; - childrenWalkers[215 /* ObjectLiteralExpression */] = walkObjectLiteralExpressionChildren; - childrenWalkers[122 /* ObjectType */] = walkObjectTypeChildren; - childrenWalkers[223 /* OmittedExpression */] = null; - childrenWalkers[182 /* OrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[242 /* Parameter */] = walkParameterChildren; - childrenWalkers[227 /* ParameterList */] = walkParameterListChildren; - childrenWalkers[217 /* ParenthesizedExpression */] = walkParenthesizedExpressionChildren; - childrenWalkers[164 /* PlusExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[211 /* PostDecrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[210 /* PostIncrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[169 /* PreDecrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[168 /* PreIncrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[141 /* PropertySignature */] = walkPropertySignatureChildren; - childrenWalkers[121 /* QualifiedName */] = walkQualifiedNameChildren; - childrenWalkers[12 /* RegularExpressionLiteral */] = null; - childrenWalkers[150 /* ReturnStatement */] = walkReturnStatementChildren; - childrenWalkers[120 /* SourceUnit */] = walkScriptChildren; - childrenWalkers[2 /* SeparatedList */] = walkSeparatedListChildren; - childrenWalkers[140 /* SetAccessor */] = walkSetAccessorChildren; - childrenWalkers[184 /* SignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[203 /* SignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[240 /* SimplePropertyAssignment */] = walkSimplePropertyAssignmentChildren; - childrenWalkers[14 /* StringLiteral */] = null; - childrenWalkers[69 /* StringKeyword */] = null; - childrenWalkers[176 /* SubtractAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[209 /* SubtractExpression */] = walkBinaryExpressionChildren; - childrenWalkers[50 /* SuperKeyword */] = null; - childrenWalkers[151 /* SwitchStatement */] = walkSwitchStatementChildren; - childrenWalkers[35 /* ThisKeyword */] = null; - childrenWalkers[157 /* ThrowStatement */] = walkThrowStatementChildren; - childrenWalkers[3 /* TriviaList */] = null; - childrenWalkers[37 /* TrueKeyword */] = null; - childrenWalkers[159 /* TryStatement */] = walkTryStatementChildren; - childrenWalkers[244 /* TypeAnnotation */] = walkTypeAnnotationChildren; - childrenWalkers[228 /* TypeArgumentList */] = walkTypeArgumentListChildren; - childrenWalkers[171 /* TypeOfExpression */] = walkTypeOfExpressionChildren; - childrenWalkers[238 /* TypeParameter */] = walkTypeParameterChildren; - childrenWalkers[229 /* TypeParameterList */] = walkTypeParameterListChildren; - childrenWalkers[127 /* TypeQuery */] = walkTypeQueryChildren; - childrenWalkers[185 /* UnsignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[204 /* UnsignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[224 /* VariableDeclaration */] = walkVariableDeclarationChildren; - childrenWalkers[225 /* VariableDeclarator */] = walkVariableDeclaratorChildren; - childrenWalkers[148 /* VariableStatement */] = walkVariableStatementChildren; - childrenWalkers[172 /* VoidExpression */] = walkVoidExpressionChildren; - childrenWalkers[41 /* VoidKeyword */] = null; - childrenWalkers[158 /* WhileStatement */] = walkWhileStatementChildren; - childrenWalkers[163 /* WithStatement */] = walkWithStatementChildren; - - for (var e in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind.hasOwnProperty(e) && TypeScript.StringUtilities.isString(TypeScript.SyntaxKind[e])) { - TypeScript.Debug.assert(childrenWalkers[e] !== undefined, "Fix initWalkers: " + TypeScript.SyntaxKind[e]); - } - } - - var AstWalkOptions = (function () { - function AstWalkOptions() { - this.goChildren = true; - this.stopWalking = false; - } - return AstWalkOptions; - })(); - TypeScript.AstWalkOptions = AstWalkOptions; - - var SimplePreAstWalker = (function () { - function SimplePreAstWalker(pre, state) { - this.pre = pre; - this.state = state; - this.options = new AstWalkOptions(); - } - SimplePreAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - - this.pre(ast, this.state); - - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - }; - return SimplePreAstWalker; - })(); - - var SimplePrePostAstWalker = (function () { - function SimplePrePostAstWalker(pre, post, state) { - this.pre = pre; - this.post = post; - this.state = state; - this.options = new AstWalkOptions(); - } - SimplePrePostAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - - this.pre(ast, this.state); - - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - - this.post(ast, this.state); - }; - return SimplePrePostAstWalker; - })(); - - var NormalAstWalker = (function () { - function NormalAstWalker(pre, post, state) { - this.pre = pre; - this.post = post; - this.state = state; - this.options = new AstWalkOptions(); - } - NormalAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - - if (this.options.stopWalking) { - return; - } - - this.pre(ast, this); - - if (this.options.stopWalking) { - return; - } - - if (this.options.goChildren) { - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - } else { - this.options.goChildren = true; - } - - if (this.post) { - this.post(ast, this); - } - }; - return NormalAstWalker; - })(); - - var AstWalkerFactory = (function () { - function AstWalkerFactory() { - } - AstWalkerFactory.prototype.walk = function (ast, pre, post, state) { - new NormalAstWalker(pre, post, state).walk(ast); - }; - - AstWalkerFactory.prototype.simpleWalk = function (ast, pre, post, state) { - if (post) { - new SimplePrePostAstWalker(pre, post, state).walk(ast); - } else { - new SimplePreAstWalker(pre, state).walk(ast); - } - }; - return AstWalkerFactory; - })(); - TypeScript.AstWalkerFactory = AstWalkerFactory; - - var globalAstWalkerFactory = new AstWalkerFactory(); - - function getAstWalkerFactory() { - return globalAstWalkerFactory; - } - TypeScript.getAstWalkerFactory = getAstWalkerFactory; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Base64Format = (function () { - function Base64Format() { - } - Base64Format.encode = function (inValue) { - if (inValue < 64) { - return Base64Format.encodedValues.charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - }; - - Base64Format.decodeChar = function (inChar) { - if (inChar.length === 1) { - return Base64Format.encodedValues.indexOf(inChar); - } else { - throw TypeError('"' + inChar + '" must have length 1'); - } - }; - Base64Format.encodedValues = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - return Base64Format; - })(); - - var Base64VLQFormat = (function () { - function Base64VLQFormat() { - } - Base64VLQFormat.encode = function (inValue) { - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } else { - inValue = inValue << 1; - } - - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + Base64Format.encode(currentDigit); - } while(inValue > 0); - - return encodedStr; - }; - - Base64VLQFormat.decode = function (inString) { - var result = 0; - var negative = false; - - var shift = 0; - for (var i = 0; i < inString.length; i++) { - var byte = Base64Format.decodeChar(inString[i]); - if (i === 0) { - if ((byte & 1) === 1) { - negative = true; - } - result = (byte >> 1) & 15; - } else { - result = result | ((byte & 31) << shift); - } - - shift += (i === 0) ? 4 : 5; - - if ((byte & 32) === 32) { - } else { - return { value: negative ? -(result) : result, rest: inString.substr(i + 1) }; - } - } - - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Base64_value_0_finished_with_a_continuation_bit, [inString])); - }; - return Base64VLQFormat; - })(); - TypeScript.Base64VLQFormat = Base64VLQFormat; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SourceMapPosition = (function () { - function SourceMapPosition() { - } - return SourceMapPosition; - })(); - TypeScript.SourceMapPosition = SourceMapPosition; - - var SourceMapping = (function () { - function SourceMapping() { - this.start = new SourceMapPosition(); - this.end = new SourceMapPosition(); - this.nameIndex = -1; - this.childMappings = []; - } - return SourceMapping; - })(); - TypeScript.SourceMapping = SourceMapping; - - var SourceMapEntry = (function () { - function SourceMapEntry(emittedFile, emittedLine, emittedColumn, sourceFile, sourceLine, sourceColumn, sourceName) { - this.emittedFile = emittedFile; - this.emittedLine = emittedLine; - this.emittedColumn = emittedColumn; - this.sourceFile = sourceFile; - this.sourceLine = sourceLine; - this.sourceColumn = sourceColumn; - this.sourceName = sourceName; - TypeScript.Debug.assert(isFinite(emittedLine)); - TypeScript.Debug.assert(isFinite(emittedColumn)); - TypeScript.Debug.assert(isFinite(sourceColumn)); - TypeScript.Debug.assert(isFinite(sourceLine)); - } - return SourceMapEntry; - })(); - TypeScript.SourceMapEntry = SourceMapEntry; - - var SourceMapper = (function () { - function SourceMapper(jsFile, sourceMapOut, document, jsFilePath, emitOptions, resolvePath) { - this.jsFile = jsFile; - this.sourceMapOut = sourceMapOut; - this.names = []; - this.mappingLevel = []; - this.tsFilePaths = []; - this.allSourceMappings = []; - this.sourceMapEntries = []; - this.setSourceMapOptions(document, jsFilePath, emitOptions, resolvePath); - this.setNewSourceFile(document, emitOptions); - } - SourceMapper.prototype.getOutputFile = function () { - var result = this.sourceMapOut.getOutputFile(); - result.sourceMapEntries = this.sourceMapEntries; - - return result; - }; - - SourceMapper.prototype.increaseMappingLevel = function (ast) { - this.mappingLevel.push(ast); - }; - - SourceMapper.prototype.decreaseMappingLevel = function (ast) { - TypeScript.Debug.assert(this.mappingLevel.length > 0, "Mapping level should never be less than 0. This suggests a missing start call."); - var expectedAst = this.mappingLevel.pop(); - var expectedAstInfo = expectedAst.kind ? TypeScript.SyntaxKind[expectedAst.kind()] : [expectedAst.start(), expectedAst.end()]; - var astInfo = ast.kind ? TypeScript.SyntaxKind[ast.kind()] : [ast.start(), ast.end()]; - TypeScript.Debug.assert(ast === expectedAst, "Provided ast is not the expected AST, Expected: " + expectedAstInfo + " Given: " + astInfo); - }; - - SourceMapper.prototype.setNewSourceFile = function (document, emitOptions) { - var sourceMappings = []; - this.allSourceMappings.push(sourceMappings); - this.currentMappings = [sourceMappings]; - this.currentNameIndex = []; - - this.setNewSourceFilePath(document, emitOptions); - }; - - SourceMapper.prototype.setSourceMapOptions = function (document, jsFilePath, emitOptions, resolvePath) { - var prettyJsFileName = TypeScript.getPrettyName(jsFilePath, false, true); - var prettyMapFileName = prettyJsFileName + SourceMapper.MapFileExtension; - this.jsFileName = prettyJsFileName; - - if (emitOptions.sourceMapRootDirectory()) { - this.sourceMapDirectory = emitOptions.sourceMapRootDirectory(); - if (document.emitToOwnOutputFile()) { - this.sourceMapDirectory = this.sourceMapDirectory + TypeScript.switchToForwardSlashes(TypeScript.getRootFilePath((document.fileName)).replace(emitOptions.commonDirectoryPath(), "")); - } - - if (TypeScript.isRelative(this.sourceMapDirectory)) { - this.sourceMapDirectory = emitOptions.commonDirectoryPath() + this.sourceMapDirectory; - this.sourceMapDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(resolvePath(this.sourceMapDirectory))); - this.sourceMapPath = TypeScript.getRelativePathToFixedPath(TypeScript.getRootFilePath(jsFilePath), this.sourceMapDirectory + prettyMapFileName); - } else { - this.sourceMapPath = this.sourceMapDirectory + prettyMapFileName; - } - } else { - this.sourceMapPath = prettyMapFileName; - this.sourceMapDirectory = TypeScript.getRootFilePath(jsFilePath); - } - this.sourceRoot = emitOptions.sourceRootDirectory(); - }; - - SourceMapper.prototype.setNewSourceFilePath = function (document, emitOptions) { - var tsFilePath = TypeScript.switchToForwardSlashes(document.fileName); - if (emitOptions.sourceRootDirectory()) { - tsFilePath = TypeScript.getRelativePathToFixedPath(emitOptions.commonDirectoryPath(), tsFilePath); - } else { - tsFilePath = TypeScript.getRelativePathToFixedPath(this.sourceMapDirectory, tsFilePath); - } - this.tsFilePaths.push(tsFilePath); - }; - - SourceMapper.prototype.emitSourceMapping = function () { - var _this = this; - TypeScript.Debug.assert(this.mappingLevel.length === 0, "Mapping level is not 0. This suggest a missing end call. Value: " + this.mappingLevel.map(function (item) { - return ['Node of type', TypeScript.SyntaxKind[item.kind()], 'at', item.start(), 'to', item.end()].join(' '); - }).join(', ')); - - this.jsFile.WriteLine("//# sourceMappingURL=" + this.sourceMapPath); - - var mappingsString = ""; - - var prevEmittedColumn = 0; - var prevEmittedLine = 0; - var prevSourceColumn = 0; - var prevSourceLine = 0; - var prevSourceIndex = 0; - var prevNameIndex = 0; - var emitComma = false; - - var recordedPosition = null; - for (var sourceIndex = 0; sourceIndex < this.tsFilePaths.length; sourceIndex++) { - var recordSourceMapping = function (mappedPosition, nameIndex) { - if (recordedPosition !== null && recordedPosition.emittedColumn === mappedPosition.emittedColumn && recordedPosition.emittedLine === mappedPosition.emittedLine) { - return; - } - - if (prevEmittedLine !== mappedPosition.emittedLine) { - while (prevEmittedLine < mappedPosition.emittedLine) { - prevEmittedColumn = 0; - mappingsString = mappingsString + ";"; - prevEmittedLine++; - } - emitComma = false; - } else if (emitComma) { - mappingsString = mappingsString + ","; - } - - _this.sourceMapEntries.push(new SourceMapEntry(_this.jsFileName, mappedPosition.emittedLine + 1, mappedPosition.emittedColumn + 1, _this.tsFilePaths[sourceIndex], mappedPosition.sourceLine, mappedPosition.sourceColumn + 1, nameIndex >= 0 ? _this.names[nameIndex] : undefined)); - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(mappedPosition.emittedColumn - prevEmittedColumn); - prevEmittedColumn = mappedPosition.emittedColumn; - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(sourceIndex - prevSourceIndex); - prevSourceIndex = sourceIndex; - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(mappedPosition.sourceLine - 1 - prevSourceLine); - prevSourceLine = mappedPosition.sourceLine - 1; - - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(mappedPosition.sourceColumn - prevSourceColumn); - prevSourceColumn = mappedPosition.sourceColumn; - - if (nameIndex >= 0) { - mappingsString = mappingsString + TypeScript.Base64VLQFormat.encode(nameIndex - prevNameIndex); - prevNameIndex = nameIndex; - } - - emitComma = true; - recordedPosition = mappedPosition; - }; - - var recordSourceMappingSiblings = function (sourceMappings) { - for (var i = 0; i < sourceMappings.length; i++) { - var sourceMapping = sourceMappings[i]; - recordSourceMapping(sourceMapping.start, sourceMapping.nameIndex); - recordSourceMappingSiblings(sourceMapping.childMappings); - recordSourceMapping(sourceMapping.end, sourceMapping.nameIndex); - } - }; - - recordSourceMappingSiblings(this.allSourceMappings[sourceIndex]); - } - - this.sourceMapOut.Write(JSON.stringify({ - version: 3, - file: this.jsFileName, - sourceRoot: this.sourceRoot, - sources: this.tsFilePaths, - names: this.names, - mappings: mappingsString - })); - - this.sourceMapOut.Close(); - }; - SourceMapper.MapFileExtension = ".map"; - return SourceMapper; - })(); - TypeScript.SourceMapper = SourceMapper; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (EmitContainer) { - EmitContainer[EmitContainer["Prog"] = 0] = "Prog"; - EmitContainer[EmitContainer["Module"] = 1] = "Module"; - EmitContainer[EmitContainer["DynamicModule"] = 2] = "DynamicModule"; - EmitContainer[EmitContainer["Class"] = 3] = "Class"; - EmitContainer[EmitContainer["Constructor"] = 4] = "Constructor"; - EmitContainer[EmitContainer["Function"] = 5] = "Function"; - EmitContainer[EmitContainer["Args"] = 6] = "Args"; - EmitContainer[EmitContainer["Interface"] = 7] = "Interface"; - })(TypeScript.EmitContainer || (TypeScript.EmitContainer = {})); - var EmitContainer = TypeScript.EmitContainer; - - var EmitState = (function () { - function EmitState() { - this.column = 0; - this.line = 0; - this.container = 0 /* Prog */; - } - return EmitState; - })(); - TypeScript.EmitState = EmitState; - - var EmitOptions = (function () { - function EmitOptions(compiler, resolvePath) { - this.resolvePath = resolvePath; - this._diagnostic = null; - this._settings = null; - this._commonDirectoryPath = ""; - this._sharedOutputFile = ""; - this._sourceRootDirectory = ""; - this._sourceMapRootDirectory = ""; - this._outputDirectory = ""; - var settings = compiler.compilationSettings(); - this._settings = settings; - - if (settings.moduleGenTarget() === 0 /* 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.isExternalModule()) { - var errorSpan = document.externalModuleIndicatorSpan(); - this._diagnostic = new TypeScript.Diagnostic(document.fileName, document.lineMap(), errorSpan.start(), errorSpan.length(), TypeScript.DiagnosticCode.Cannot_compile_external_modules_unless_the_module_flag_is_provided); - - return; - } - } - } - - if (!settings.mapSourceFiles()) { - if (settings.mapRoot()) { - if (settings.sourceRoot()) { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Options_mapRoot_and_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } else { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - } else if (settings.sourceRoot()) { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - } - - this._sourceMapRootDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(settings.mapRoot())); - this._sourceRootDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(settings.sourceRoot())); - - if (settings.outFileOption() || settings.outDirOption() || settings.mapRoot() || settings.sourceRoot()) { - if (settings.outFileOption()) { - this._sharedOutputFile = TypeScript.switchToForwardSlashes(resolvePath(settings.outFileOption())); - } - - if (settings.outDirOption()) { - this._outputDirectory = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(resolvePath(settings.outDirOption()))); - } - - if (this._outputDirectory || this._sourceMapRootDirectory || this.sourceRootDirectory) { - this.determineCommonDirectoryPath(compiler); - } - } - } - EmitOptions.prototype.diagnostic = function () { - return this._diagnostic; - }; - - EmitOptions.prototype.commonDirectoryPath = function () { - return this._commonDirectoryPath; - }; - EmitOptions.prototype.sharedOutputFile = function () { - return this._sharedOutputFile; - }; - EmitOptions.prototype.sourceRootDirectory = function () { - return this._sourceRootDirectory; - }; - EmitOptions.prototype.sourceMapRootDirectory = function () { - return this._sourceMapRootDirectory; - }; - EmitOptions.prototype.outputDirectory = function () { - return this._outputDirectory; - }; - - EmitOptions.prototype.compilationSettings = function () { - return this._settings; - }; - - EmitOptions.prototype.determineCommonDirectoryPath = function (compiler) { - var commonComponents = []; - 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 = TypeScript.filePathComponents(fileName); - if (commonComponentsLength === -1) { - commonComponents = fileComponents; - commonComponentsLength = commonComponents.length; - } else { - var updatedPath = false; - for (var j = 0; j < commonComponentsLength && j < fileComponents.length; j++) { - if (commonComponents[j] !== fileComponents[j]) { - commonComponentsLength = j; - updatedPath = true; - - if (j === 0) { - var isDynamicModuleCompilation = TypeScript.ArrayUtilities.any(fileNames, function (fileName) { - document = compiler.getDocument(fileName); - return !document.isDeclareFile() && document.isExternalModule(); - }); - - if (this._outputDirectory || this._sourceRootDirectory || (this._sourceMapRootDirectory && (!this._sharedOutputFile || isDynamicModuleCompilation))) { - this._diagnostic = new TypeScript.Diagnostic(null, null, 0, 0, TypeScript.DiagnosticCode.Cannot_find_the_common_subdirectory_path_for_the_input_files, null); - return; - } - - return; - } - - break; - } - } - - if (!updatedPath && fileComponents.length < commonComponentsLength) { - commonComponentsLength = fileComponents.length; - } - } - } - } - - this._commonDirectoryPath = commonComponents.slice(0, commonComponentsLength).join("/") + "/"; - }; - return EmitOptions; - })(); - TypeScript.EmitOptions = EmitOptions; - - var Indenter = (function () { - function Indenter() { - this.indentAmt = 0; - } - Indenter.prototype.increaseIndent = function () { - this.indentAmt += Indenter.indentStep; - }; - - Indenter.prototype.decreaseIndent = function () { - this.indentAmt -= Indenter.indentStep; - }; - - Indenter.prototype.getIndent = function () { - 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; - }; - Indenter.indentStep = 4; - Indenter.indentStepString = " "; - Indenter.indentStrings = []; - return Indenter; - })(); - TypeScript.Indenter = Indenter; - - function lastParameterIsRest(parameterList) { - var parameters = parameterList.parameters; - return parameters.nonSeparatorCount() > 0 && parameters.nonSeparatorAt(parameters.nonSeparatorCount() - 1).dotDotDotToken !== null; - } - TypeScript.lastParameterIsRest = lastParameterIsRest; - - var Emitter = (function () { - function Emitter(emittingFileName, outfile, emitOptions, semanticInfoChain) { - this.emittingFileName = emittingFileName; - this.outfile = outfile; - this.emitOptions = emitOptions; - this.semanticInfoChain = semanticInfoChain; - this.globalThisCapturePrologueEmitted = false; - this.extendsPrologueEmitted = false; - this.thisClassNode = null; - this.inArrowFunction = false; - this.moduleName = ""; - this.emitState = new EmitState(); - this.indenter = new Indenter(); - this.sourceMapper = null; - this.captureThisStmtString = "var _this = this;"; - this.declStack = []; - this.exportAssignment = null; - this.inWithBlock = false; - this.document = null; - this.detachedCommentsElement = null; - } - Emitter.prototype.pushDecl = function (decl) { - if (decl) { - this.declStack[this.declStack.length] = decl; - } - }; - - Emitter.prototype.popDecl = function (decl) { - if (decl) { - this.declStack.length--; - } - }; - - Emitter.prototype.getEnclosingDecl = function () { - var declStackLen = this.declStack.length; - var enclosingDecl = declStackLen > 0 ? this.declStack[declStackLen - 1] : null; - return enclosingDecl; - }; - - Emitter.prototype.setExportAssignment = function (exportAssignment) { - this.exportAssignment = exportAssignment; - }; - - Emitter.prototype.getExportAssignment = function () { - return this.exportAssignment; - }; - - Emitter.prototype.setDocument = function (document) { - this.document = document; - }; - - Emitter.prototype.shouldEmitImportDeclaration = function (importDeclAST) { - var isExternalModuleReference = importDeclAST.moduleReference.kind() === 245 /* ExternalModuleReference */; - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var isExported = TypeScript.hasFlag(importDecl.flags, 1 /* Exported */); - var isAmdCodeGen = this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */; - - if (isExternalModuleReference && !isExported && isAmdCodeGen) { - return false; - } - - var importSymbol = importDecl.getSymbol(); - if (importSymbol.isUsedAsValue()) { - return true; - } - - if (importDeclAST.moduleReference.kind() !== 245 /* ExternalModuleReference */) { - var canBeUsedExternally = isExported || importSymbol.typeUsedExternally() || importSymbol.isUsedInExportedAlias(); - if (!canBeUsedExternally && !this.document.isExternalModule()) { - canBeUsedExternally = TypeScript.hasFlag(importDecl.getParentDecl().kind, 1 /* Script */ | 32 /* DynamicModule */); - } - - if (canBeUsedExternally) { - if (importSymbol.getExportAssignedValueSymbol()) { - return true; - } - - var containerSymbol = importSymbol.getExportAssignedContainerSymbol(); - if (containerSymbol && containerSymbol.getInstanceSymbol()) { - return true; - } - } - } - - return false; - }; - - Emitter.prototype.emitImportDeclaration = function (importDeclAST) { - var isExternalModuleReference = importDeclAST.moduleReference.kind() === 245 /* ExternalModuleReference */; - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var isExported = TypeScript.hasFlag(importDecl.flags, 1 /* Exported */); - var isAmdCodeGen = this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */; - - this.emitComments(importDeclAST, true); - - var importSymbol = importDecl.getSymbol(); - - var parentSymbol = importSymbol.getContainer(); - var parentKind = parentSymbol ? parentSymbol.kind : 0 /* None */; - var associatedParentSymbol = parentSymbol ? parentSymbol.getAssociatedContainerType() : null; - var associatedParentSymbolKind = associatedParentSymbol ? associatedParentSymbol.kind : 0 /* None */; - - var needsPropertyAssignment = false; - var usePropertyAssignmentInsteadOfVarDecl = false; - var moduleNamePrefix; - - if (isExported && (parentKind === 4 /* Container */ || parentKind === 32 /* DynamicModule */ || associatedParentSymbolKind === 4 /* Container */ || associatedParentSymbolKind === 32 /* DynamicModule */)) { - if (importSymbol.getExportAssignedTypeSymbol() || importSymbol.getExportAssignedContainerSymbol()) { - needsPropertyAssignment = true; - } else { - var valueSymbol = importSymbol.getExportAssignedValueSymbol(); - if (valueSymbol && (valueSymbol.kind === 65536 /* Method */ || valueSymbol.kind === 16384 /* Function */)) { - needsPropertyAssignment = true; - } else { - usePropertyAssignmentInsteadOfVarDecl = true; - } - } - - if (this.emitState.container === 2 /* DynamicModule */) { - moduleNamePrefix = "exports."; - } else { - moduleNamePrefix = this.moduleName + "."; - } - } - - if (isAmdCodeGen && isExternalModuleReference) { - 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); - }; - - Emitter.prototype.createSourceMapper = function (document, jsFileName, jsFile, sourceMapOut, resolvePath) { - this.sourceMapper = new TypeScript.SourceMapper(jsFile, sourceMapOut, document, jsFileName, this.emitOptions, resolvePath); - }; - - Emitter.prototype.setSourceMapperNewSourceFile = function (document) { - this.sourceMapper.setNewSourceFile(document, this.emitOptions); - }; - - Emitter.prototype.updateLineAndColumn = function (s) { - var lineNumbers = TypeScript.TextUtilities.parseLineStarts(s); - if (lineNumbers.length > 1) { - this.emitState.line += lineNumbers.length - 1; - this.emitState.column = s.length - lineNumbers[lineNumbers.length - 1]; - } else { - this.emitState.column += s.length; - } - }; - - Emitter.prototype.writeToOutputWithSourceMapRecord = function (s, astSpan) { - this.recordSourceMappingStart(astSpan); - this.writeToOutput(s); - this.recordSourceMappingEnd(astSpan); - }; - - Emitter.prototype.writeToOutput = function (s) { - this.outfile.Write(s); - this.updateLineAndColumn(s); - }; - - Emitter.prototype.writeLineToOutput = function (s, force) { - if (typeof force === "undefined") { force = false; } - if (!force && s === "" && this.emitState.column === 0) { - return; - } - - this.outfile.WriteLine(s); - this.updateLineAndColumn(s); - this.emitState.column = 0; - this.emitState.line++; - }; - - Emitter.prototype.writeCaptureThisStatement = function (ast) { - this.emitIndent(); - this.writeToOutputWithSourceMapRecord(this.captureThisStmtString, ast); - this.writeLineToOutput(""); - }; - - Emitter.prototype.setContainer = function (c) { - var temp = this.emitState.container; - this.emitState.container = c; - return temp; - }; - - Emitter.prototype.getIndentString = function () { - return this.indenter.getIndent(); - }; - - Emitter.prototype.emitIndent = function () { - this.writeToOutput(this.getIndentString()); - }; - - Emitter.prototype.emitComment = function (comment, trailing, first) { - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var text = getTrimmedTextLines(comment); - var emitColumn = this.emitState.column; - - if (emitColumn === 0) { - this.emitIndent(); - } else if (trailing && first) { - this.writeToOutput(" "); - } - - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - this.recordSourceMappingStart(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.recordSourceMappingEnd(comment); - this.writeLineToOutput(""); - } else { - this.recordSourceMappingEnd(comment); - this.writeToOutput(" "); - return; - } - } else { - this.recordSourceMappingStart(comment); - this.writeToOutput(text[0]); - this.recordSourceMappingEnd(comment); - this.writeLineToOutput(""); - } - - if (!trailing && emitColumn !== 0) { - this.emitIndent(); - } - }; - - Emitter.prototype.emitComments = function (ast, pre, onlyPinnedOrTripleSlashComments) { - var _this = this; - if (typeof onlyPinnedOrTripleSlashComments === "undefined") { onlyPinnedOrTripleSlashComments = false; } - if (ast && ast.kind() !== 146 /* Block */) { - if (ast.parent.kind() === 219 /* SimpleArrowFunctionExpression */ || ast.parent.kind() === 218 /* ParenthesizedArrowFunctionExpression */) { - return; - } - } - - if (pre) { - var preComments = ast.preComments(); - - if (preComments && ast === this.detachedCommentsElement) { - var detachedComments = this.getDetachedComments(ast); - preComments = preComments.slice(detachedComments.length); - this.detachedCommentsElement = null; - } - - if (preComments && onlyPinnedOrTripleSlashComments) { - preComments = TypeScript.ArrayUtilities.where(preComments, function (c) { - return _this.isPinnedOrTripleSlash(c); - }); - } - - this.emitCommentsArray(preComments, false); - } else { - this.emitCommentsArray(ast.postComments(), true); - } - }; - - Emitter.prototype.isPinnedOrTripleSlash = function (comment) { - var fullText = comment.fullText(); - if (fullText.match(TypeScript.tripleSlashReferenceRegExp)) { - return true; - } else { - return fullText.indexOf("/*!") === 0; - } - }; - - Emitter.prototype.emitCommentsArray = function (comments, trailing) { - if (!this.emitOptions.compilationSettings().removeComments() && comments) { - for (var i = 0, n = comments.length; i < n; i++) { - this.emitComment(comments[i], trailing, i === 0); - } - } - }; - - Emitter.prototype.emitObjectLiteralExpression = function (objectLiteral) { - this.recordSourceMappingStart(objectLiteral); - - this.writeToOutput("{"); - this.emitCommaSeparatedList(objectLiteral, objectLiteral.propertyAssignments, " ", true); - this.writeToOutput("}"); - - this.recordSourceMappingEnd(objectLiteral); - }; - - Emitter.prototype.emitArrayLiteralExpression = function (arrayLiteral) { - this.recordSourceMappingStart(arrayLiteral); - - this.writeToOutput("["); - this.emitCommaSeparatedList(arrayLiteral, arrayLiteral.expressions, "", true); - this.writeToOutput("]"); - - this.recordSourceMappingEnd(arrayLiteral); - }; - - Emitter.prototype.emitObjectCreationExpression = function (objectCreationExpression) { - this.recordSourceMappingStart(objectCreationExpression); - this.writeToOutput("new "); - var target = objectCreationExpression.expression; - - this.emit(target); - if (objectCreationExpression.argumentList) { - this.recordSourceMappingStart(objectCreationExpression.argumentList); - this.writeToOutput("("); - this.emitCommaSeparatedList(objectCreationExpression.argumentList, objectCreationExpression.argumentList.arguments, "", false); - this.writeToOutputWithSourceMapRecord(")", objectCreationExpression.argumentList.closeParenToken); - this.recordSourceMappingEnd(objectCreationExpression.argumentList); - } - - this.recordSourceMappingEnd(objectCreationExpression); - }; - - Emitter.prototype.getConstantDecl = function (dotExpr) { - var pullSymbol = this.semanticInfoChain.getSymbolForAST(dotExpr); - if (pullSymbol && pullSymbol.kind === 67108864 /* EnumMember */) { - var pullDecls = pullSymbol.getDeclarations(); - if (pullDecls.length === 1) { - var pullDecl = pullDecls[0]; - if (pullDecl.kind === 67108864 /* EnumMember */) { - return pullDecl; - } - } - } - - return null; - }; - - Emitter.prototype.tryEmitConstant = function (dotExpr) { - 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; - }; - - Emitter.prototype.emitInvocationExpression = function (callNode) { - this.recordSourceMappingStart(callNode); - var target = callNode.expression; - var args = callNode.argumentList.arguments; - - if (target.kind() === 212 /* MemberAccessExpression */ && target.expression.kind() === 50 /* SuperKeyword */) { - this.emit(target); - this.writeToOutput(".call"); - this.recordSourceMappingStart(args); - this.writeToOutput("("); - this.emitThis(); - if (args && args.nonSeparatorCount() > 0) { - this.writeToOutput(", "); - this.emitCommaSeparatedList(callNode.argumentList, args, "", false); - } - } else { - if (callNode.expression.kind() === 50 /* SuperKeyword */ && this.emitState.container === 4 /* Constructor */) { - this.writeToOutput("_super.call"); - } else { - this.emitJavascript(target, false); - } - this.recordSourceMappingStart(args); - this.writeToOutput("("); - if (callNode.expression.kind() === 50 /* SuperKeyword */ && this.emitState.container === 4 /* Constructor */) { - this.writeToOutput("this"); - if (args && args.nonSeparatorCount() > 0) { - this.writeToOutput(", "); - } - } - this.emitCommaSeparatedList(callNode.argumentList, args, "", false); - } - - this.writeToOutputWithSourceMapRecord(")", callNode.argumentList.closeParenToken); - this.recordSourceMappingEnd(args); - this.recordSourceMappingEnd(callNode); - }; - - Emitter.prototype.emitParameterList = function (list) { - this.writeToOutput("("); - this.emitCommentsArray(list.openParenTrailingComments, true); - this.emitFunctionParameters(TypeScript.ASTHelpers.parametersFromParameterList(list)); - this.writeToOutput(")"); - }; - - Emitter.prototype.emitFunctionParameters = function (parameters) { - var argsLen = 0; - - if (parameters) { - this.emitComments(parameters.ast, true); - - var tempContainer = this.setContainer(6 /* Args */); - argsLen = parameters.length; - var printLen = argsLen; - if (parameters.lastParameterIsRest()) { - printLen--; - } - for (var i = 0; i < printLen; i++) { - var arg = parameters.astAt(i); - this.emit(arg); - - if (i < (printLen - 1)) { - this.writeToOutput(", "); - } - } - this.setContainer(tempContainer); - - this.emitComments(parameters.ast, false); - } - }; - - Emitter.prototype.emitFunctionBodyStatements = function (name, funcDecl, parameterList, block, bodyExpression) { - this.writeLineToOutput(" {"); - if (name) { - this.recordSourceMappingNameStart(name); - } - - this.indenter.increaseIndent(); - - if (block) { - this.emitDetachedComments(block.statements); - } - - if (this.shouldCaptureThis(funcDecl)) { - this.writeCaptureThisStatement(funcDecl); - } - - if (parameterList) { - this.emitDefaultValueAssignments(parameterList); - this.emitRestParameterInitializer(parameterList); - } - - if (block) { - this.emitList(block.statements); - this.emitCommentsArray(block.closeBraceLeadingComments, false); - } else { - this.emitIndent(); - this.emitCommentsArray(bodyExpression.preComments(), false); - this.writeToOutput("return "); - this.emit(bodyExpression); - this.writeLineToOutput(";"); - this.emitCommentsArray(bodyExpression.postComments(), true); - } - - this.indenter.decreaseIndent(); - this.emitIndent(); - - if (block) { - this.writeToOutputWithSourceMapRecord("}", block.closeBraceToken); - } else { - this.writeToOutputWithSourceMapRecord("}", bodyExpression); - } - - if (name) { - this.recordSourceMappingNameEnd(); - } - }; - - Emitter.prototype.emitDefaultValueAssignments = function (parameters) { - var n = parameters.length; - if (parameters.lastParameterIsRest()) { - n--; - } - - for (var i = 0; i < n; i++) { - var arg = parameters.astAt(i); - var id = parameters.identifierAt(i); - var equalsValueClause = parameters.initializerAt(i); - if (equalsValueClause) { - this.emitIndent(); - this.recordSourceMappingStart(arg); - this.writeToOutput("if (typeof " + id.text() + " === \"undefined\") { "); - this.writeToOutputWithSourceMapRecord(id.text(), id); - this.emitJavascript(equalsValueClause, false); - this.writeLineToOutput("; }"); - this.recordSourceMappingEnd(arg); - } - } - }; - - Emitter.prototype.emitRestParameterInitializer = function (parameters) { - if (parameters.lastParameterIsRest()) { - var n = parameters.length; - var lastArg = parameters.astAt(n - 1); - var id = parameters.identifierAt(n - 1); - this.emitIndent(); - this.recordSourceMappingStart(lastArg); - this.writeToOutput("var "); - this.writeToOutputWithSourceMapRecord(id.text(), 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("}"); - } - }; - - Emitter.prototype.getImportDecls = function (fileName) { - var topLevelDecl = this.semanticInfoChain.topLevelDecl(this.document.fileName); - var result = []; - - var dynamicModuleDecl = topLevelDecl.getChildDecls()[0]; - var queue = dynamicModuleDecl.getChildDecls(); - - for (var i = 0, n = queue.length; i < n; i++) { - var decl = queue[i]; - - if (decl.kind & 128 /* TypeAlias */) { - var importStatementAST = this.semanticInfoChain.getASTForDecl(decl); - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - var symbol = decl.getSymbol(); - var typeSymbol = symbol && symbol.type; - if (typeSymbol && typeSymbol !== this.semanticInfoChain.anyTypeSymbol && !typeSymbol.isError()) { - result.push(decl); - } - } - } - } - - return result; - }; - - Emitter.prototype.getModuleImportAndDependencyList = function (sourceUnit) { - var importList = ""; - var dependencyList = ""; - - var importDecls = this.getImportDecls(this.document.fileName); - - if (importDecls.length) { - for (var i = 0; i < importDecls.length; i++) { - var importStatementDecl = importDecls[i]; - var importStatementSymbol = importStatementDecl.getSymbol(); - var importStatementAST = this.semanticInfoChain.getASTForDecl(importStatementDecl); - - if (importStatementSymbol.isUsedAsValue()) { - if (i <= importDecls.length - 1) { - dependencyList += ", "; - importList += ", "; - } - - importList += importStatementDecl.name; - dependencyList += importStatementAST.moduleReference.stringLiteral.text(); - } - } - } - - var amdDependencies = this.document.amdDependencies(); - for (var i = 0; i < amdDependencies.length; i++) { - dependencyList += ", \"" + amdDependencies[i] + "\""; - } - - return { - importList: importList, - dependencyList: dependencyList - }; - }; - - Emitter.prototype.shouldCaptureThis = function (ast) { - if (ast.kind() === 120 /* SourceUnit */) { - var scriptDecl = this.semanticInfoChain.topLevelDecl(this.document.fileName); - return TypeScript.hasFlag(scriptDecl.flags, 262144 /* MustCaptureThis */); - } - - var decl = this.semanticInfoChain.getDeclForAST(ast); - if (decl) { - return TypeScript.hasFlag(decl.flags, 262144 /* MustCaptureThis */); - } - - return false; - }; - - Emitter.prototype.emitEnum = function (moduleDecl) { - var pullDecl = this.semanticInfoChain.getDeclForAST(moduleDecl); - this.pushDecl(pullDecl); - - var svModuleName = this.moduleName; - this.moduleName = moduleDecl.identifier.text(); - - var temp = this.setContainer(1 /* Module */); - var isExported = TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */); - - if (!isExported) { - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("var "); - this.recordSourceMappingStart(moduleDecl.identifier); - this.writeToOutput(this.moduleName); - this.recordSourceMappingEnd(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 === 2 /* DynamicModule */; - if (temp === 0 /* Prog */ && isExported) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(this." + this.moduleName + " || (this." + this.moduleName + " = {}));"); - } else if (isExported || temp === 0 /* Prog */) { - var dotMod = svModuleName !== "" ? (parentIsDynamic ? "exports" : svModuleName) + "." : svModuleName; - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(" + dotMod + this.moduleName + " || (" + dotMod + this.moduleName + " = {}));"); - } else if (!isExported && temp !== 0 /* Prog */) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(" + this.moduleName + " || (" + this.moduleName + " = {}));"); - } else { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")();"); - } - - this.recordSourceMappingEnd(moduleDecl); - if (temp !== 0 /* 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); - }; - - Emitter.prototype.getModuleDeclToVerifyChildNameCollision = function (moduleDecl, changeNameIfAnyDeclarationInContext) { - if (TypeScript.ArrayUtilities.contains(this.declStack, moduleDecl)) { - return moduleDecl; - } else if (changeNameIfAnyDeclarationInContext) { - var symbol = moduleDecl.getSymbol(); - if (symbol) { - var otherDecls = symbol.getDeclarations(); - for (var i = 0; i < otherDecls.length; i++) { - if (TypeScript.ArrayUtilities.contains(this.declStack, otherDecls[i])) { - return otherDecls[i]; - } - } - } - } - - return null; - }; - - Emitter.prototype.hasChildNameCollision = function (moduleName, parentDecl) { - var _this = this; - var childDecls = parentDecl.getChildDecls(); - return TypeScript.ArrayUtilities.any(childDecls, function (childDecl) { - var childAST = _this.semanticInfoChain.getASTForDecl(childDecl); - - if (childDecl.kind != 67108864 /* EnumMember */ && _this.shouldEmit(childAST)) { - if (childDecl.name === moduleName) { - if (parentDecl.kind != 8 /* Class */) { - return true; - } - - if (!(childDecl.kind == 65536 /* Method */ || childDecl.kind == 4096 /* Property */ || childDecl.kind == 524288 /* SetAccessor */ || childDecl.kind == 262144 /* GetAccessor */)) { - return true; - } - } - - if (_this.hasChildNameCollision(moduleName, childDecl)) { - return true; - } - } - return false; - }); - }; - - Emitter.prototype.getModuleName = function (moduleDecl, changeNameIfAnyDeclarationInContext) { - var moduleName = moduleDecl.name; - var moduleDisplayName = moduleDecl.getDisplayName(); - - moduleDecl = this.getModuleDeclToVerifyChildNameCollision(moduleDecl, changeNameIfAnyDeclarationInContext); - if (moduleDecl && moduleDecl.kind != 64 /* Enum */) { - while (this.hasChildNameCollision(moduleName, moduleDecl)) { - moduleName = "_" + moduleName; - moduleDisplayName = "_" + moduleDisplayName; - } - } - - return moduleDisplayName; - }; - - Emitter.prototype.emitModuleDeclarationWorker = function (moduleDecl) { - if (moduleDecl.stringLiteral) { - this.emitSingleModuleDeclaration(moduleDecl, moduleDecl.stringLiteral); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(moduleDecl.name); - this.emitSingleModuleDeclaration(moduleDecl, moduleNames[0]); - } - }; - - Emitter.prototype.emitSingleModuleDeclaration = function (moduleDecl, moduleName) { - var isLastName = TypeScript.ASTHelpers.isLastNameOfModule(moduleDecl, moduleName); - - if (isLastName) { - this.emitComments(moduleDecl, true); - } - - var pullDecl = this.semanticInfoChain.getDeclForAST(moduleName); - this.pushDecl(pullDecl); - - var svModuleName = this.moduleName; - - if (moduleDecl.stringLiteral) { - this.moduleName = moduleDecl.stringLiteral.valueText(); - if (TypeScript.isTSFile(this.moduleName)) { - this.moduleName = this.moduleName.substring(0, this.moduleName.length - ".ts".length); - } - } else { - this.moduleName = moduleName.text(); - } - - var temp = this.setContainer(1 /* Module */); - var isExported = TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */); - - if (!isExported) { - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("var "); - this.recordSourceMappingStart(moduleName); - this.writeToOutput(this.moduleName); - this.recordSourceMappingEnd(moduleName); - this.writeLineToOutput(";"); - this.recordSourceMappingEnd(moduleDecl); - this.emitIndent(); - } - - this.writeToOutput("("); - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("function ("); - - 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 = TypeScript.ASTHelpers.getModuleNames(moduleDecl.name); - var nameIndex = moduleNames.indexOf(moduleName); - TypeScript.Debug.assert(nameIndex >= 0); - - if (isLastName) { - this.emitList(moduleDecl.moduleElements); - } else { - this.emitIndent(); - this.emitSingleModuleDeclaration(moduleDecl, moduleNames[nameIndex + 1]); - this.writeLineToOutput(""); - } - } - - this.moduleName = moduleName.text(); - this.indenter.decreaseIndent(); - this.emitIndent(); - - var parentIsDynamic = temp === 2 /* DynamicModule */; - this.recordSourceMappingStart(moduleDecl.endingToken); - if (temp === 0 /* Prog */ && isExported) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")(this." + this.moduleName + " || (this." + this.moduleName + " = {}));"); - } else if (isExported || temp === 0 /* Prog */) { - var dotMod = svModuleName !== "" ? (parentIsDynamic ? "exports" : svModuleName) + "." : svModuleName; - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")(" + dotMod + this.moduleName + " || (" + dotMod + this.moduleName + " = {}));"); - } else if (!isExported && temp !== 0 /* Prog */) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")(" + this.moduleName + " || (" + this.moduleName + " = {}));"); - } else { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.endingToken); - this.writeToOutput(")();"); - } - - this.recordSourceMappingEnd(moduleDecl); - if (temp !== 0 /* 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) { - this.emitComments(moduleDecl, false); - } - }; - - Emitter.prototype.emitEnumElement = function (varDecl) { - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - TypeScript.Debug.assert(pullDecl && pullDecl.kind === 67108864 /* EnumMember */); - - this.emitComments(varDecl, true); - this.recordSourceMappingStart(varDecl); - var name = varDecl.propertyName.text(); - var quoted = TypeScript.isQuoted(name); - this.writeToOutput(this.moduleName); - this.writeToOutput('['); - this.writeToOutput(this.moduleName); - this.writeToOutput('['); - this.writeToOutput(quoted ? name : '"' + name + '"'); - 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(quoted ? name : '"' + name + '"'); - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - this.writeToOutput(';'); - }; - - Emitter.prototype.emitElementAccessExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.emit(expression.expression); - this.writeToOutput("["); - this.emit(expression.argumentExpression); - this.writeToOutput("]"); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitSimpleArrowFunctionExpression = function (arrowFunction) { - this.emitAnyArrowFunctionExpression(arrowFunction, null, TypeScript.ASTHelpers.parametersFromIdentifier(arrowFunction.identifier), arrowFunction.block, arrowFunction.expression); - }; - - Emitter.prototype.emitParenthesizedArrowFunctionExpression = function (arrowFunction) { - this.emitAnyArrowFunctionExpression(arrowFunction, null, TypeScript.ASTHelpers.parametersFromParameterList(arrowFunction.callSignature.parameterList), arrowFunction.block, arrowFunction.expression); - }; - - Emitter.prototype.emitAnyArrowFunctionExpression = function (arrowFunction, funcName, parameters, block, expression) { - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = true; - - var temp = this.setContainer(5 /* Function */); - - this.recordSourceMappingStart(arrowFunction); - - var pullDecl = this.semanticInfoChain.getDeclForAST(arrowFunction); - this.pushDecl(pullDecl); - - this.emitComments(arrowFunction, true); - - this.recordSourceMappingStart(arrowFunction); - this.writeToOutput("function "); - this.writeToOutput("("); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(funcName, arrowFunction, parameters, block, expression); - - this.recordSourceMappingEnd(arrowFunction); - - this.recordSourceMappingEnd(arrowFunction); - - this.emitComments(arrowFunction, false); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - }; - - Emitter.prototype.emitConstructor = function (funcDecl) { - if (!funcDecl.block) { - return; - } - var temp = this.setContainer(4 /* 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.writeToOutput("("); - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionParameters(parameters); - this.writeLineToOutput(") {"); - - this.recordSourceMappingNameStart("constructor"); - this.indenter.increaseIndent(); - - this.emitDefaultValueAssignments(parameters); - this.emitRestParameterInitializer(parameters); - - if (this.shouldCaptureThis(funcDecl)) { - this.writeCaptureThisStatement(funcDecl); - } - - this.emitConstructorStatements(funcDecl); - this.emitCommentsArray(funcDecl.block.closeBraceLeadingComments, false); - - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("}", funcDecl.block.closeBraceToken); - - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(funcDecl); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - this.setContainer(temp); - }; - - Emitter.prototype.emitGetAccessor = function (accessor) { - this.recordSourceMappingStart(accessor); - this.writeToOutput("get "); - - var temp = this.setContainer(5 /* Function */); - - this.recordSourceMappingStart(accessor); - - var pullDecl = this.semanticInfoChain.getDeclForAST(accessor); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(accessor); - - var accessorSymbol = TypeScript.PullHelpers.getAccessorSymbol(accessor, this.semanticInfoChain); - var container = accessorSymbol.getContainer(); - var containerKind = container.kind; - - this.recordSourceMappingNameStart(accessor.propertyName.text()); - this.writeToOutput(accessor.propertyName.text()); - this.writeToOutput("("); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(null, accessor, TypeScript.ASTHelpers.parametersFromParameterList(accessor.parameterList), accessor.block, null); - - this.recordSourceMappingEnd(accessor); - - this.recordSourceMappingEnd(accessor); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.recordSourceMappingEnd(accessor); - }; - - Emitter.prototype.emitSetAccessor = function (accessor) { - this.recordSourceMappingStart(accessor); - this.writeToOutput("set "); - - var temp = this.setContainer(5 /* Function */); - - this.recordSourceMappingStart(accessor); - - var pullDecl = this.semanticInfoChain.getDeclForAST(accessor); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(accessor); - - var accessorSymbol = TypeScript.PullHelpers.getAccessorSymbol(accessor, this.semanticInfoChain); - var container = accessorSymbol.getContainer(); - var containerKind = container.kind; - - this.recordSourceMappingNameStart(accessor.propertyName.text()); - this.writeToOutput(accessor.propertyName.text()); - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(accessor.parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(null, accessor, parameters, accessor.block, null); - - this.recordSourceMappingEnd(accessor); - - this.recordSourceMappingEnd(accessor); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.recordSourceMappingEnd(accessor); - }; - - Emitter.prototype.emitFunctionExpression = function (funcDecl) { - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(5 /* Function */); - - var funcName = funcDecl.identifier ? funcDecl.identifier.text() : null; - - this.recordSourceMappingStart(funcDecl); - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - - if (funcDecl.identifier) { - this.recordSourceMappingStart(funcDecl.identifier); - this.writeToOutput(funcDecl.identifier.text()); - this.recordSourceMappingEnd(funcDecl.identifier); - } - - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(funcName, funcDecl, parameters, funcDecl.block, null); - - this.recordSourceMappingEnd(funcDecl); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - }; - - Emitter.prototype.emitFunction = function (funcDecl) { - if (funcDecl.block === null) { - return; - } - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(5 /* 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.writeToOutput("function "); - - 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 = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionBodyStatements(funcDecl.identifier.text(), funcDecl, parameters, funcDecl.block, null); - - this.recordSourceMappingEnd(funcDecl); - - 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 === 1 /* Module */ || this.emitState.container === 2 /* DynamicModule */) && pullFunctionDecl && TypeScript.hasFlag(pullFunctionDecl.flags, 1 /* Exported */)) { - this.writeLineToOutput(""); - this.emitIndent(); - var modName = this.emitState.container === 1 /* Module */ ? this.moduleName : "exports"; - this.recordSourceMappingStart(funcDecl); - this.writeToOutput(modName + "." + funcName + " = " + funcName + ";"); - this.recordSourceMappingEnd(funcDecl); - } - } - }; - - Emitter.prototype.emitAmbientVarDecl = function (varDecl) { - 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); - } - }; - - Emitter.prototype.emitVarDeclVar = function () { - if (this.currentVariableDeclaration) { - this.writeToOutput("var "); - } - }; - - Emitter.prototype.emitVariableDeclaration = function (declaration) { - var varDecl = declaration.declarators.nonSeparatorAt(0); - - var symbol = this.semanticInfoChain.getSymbolForAST(varDecl); - - var parentSymbol = symbol ? symbol.getContainer() : null; - var parentKind = parentSymbol ? parentSymbol.kind : 0 /* None */; - - this.emitComments(declaration, true); - - var pullVarDecl = this.semanticInfoChain.getDeclForAST(varDecl); - var isAmbientWithoutInit = pullVarDecl && TypeScript.hasFlag(pullVarDecl.flags, 8 /* Ambient */) && varDecl.equalsValueClause === null; - if (!isAmbientWithoutInit) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.currentVariableDeclaration = declaration; - - for (var i = 0, n = declaration.declarators.nonSeparatorCount(); i < n; i++) { - var declarator = declaration.declarators.nonSeparatorAt(i); - - if (i > 0) { - this.writeToOutput(", "); - } - - this.emit(declarator); - } - this.currentVariableDeclaration = prevVariableDeclaration; - - this.recordSourceMappingEnd(declaration); - } - - this.emitComments(declaration, false); - }; - - Emitter.prototype.emitMemberVariableDeclaration = function (varDecl) { - TypeScript.Debug.assert(!TypeScript.hasModifier(varDecl.modifiers, 16 /* 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 = TypeScript.isQuoted(varDeclName) || varDecl.variableDeclarator.propertyName.kind() !== 11 /* 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) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.emit(varDecl.variableDeclarator.equalsValueClause); - this.currentVariableDeclaration = prevVariableDeclaration; - } - - if (this.emitState.container !== 6 /* Args */) { - this.writeToOutput(";"); - } - - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - - this.popDecl(pullDecl); - }; - - Emitter.prototype.emitVariableDeclarator = function (varDecl) { - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - this.pushDecl(pullDecl); - if (pullDecl && (pullDecl.flags & 8 /* Ambient */) === 8 /* 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 & 102400 /* SomeInitializedModule */); - - if (parentIsModule) { - if (!TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */)) { - this.emitVarDeclVar(); - } else { - if (this.emitState.container === 2 /* DynamicModule */) { - this.writeToOutput("exports."); - } else { - this.writeToOutput(this.moduleName + "."); - } - } - } else { - this.emitVarDeclVar(); - } - - this.writeToOutputWithSourceMapRecord(varDecl.propertyName.text(), varDecl.propertyName); - - if (varDecl.equalsValueClause) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.emit(varDecl.equalsValueClause); - this.currentVariableDeclaration = prevVariableDeclaration; - } - - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - } - this.currentVariableDeclaration = undefined; - this.popDecl(pullDecl); - }; - - Emitter.prototype.symbolIsUsedInItsEnclosingContainer = function (symbol, dynamic) { - if (typeof dynamic === "undefined") { 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; - - while (symbolDeclarationEnclosingContainer) { - if (symbolDeclarationEnclosingContainer.kind === (dynamic ? 32 /* DynamicModule */ : 4 /* Container */)) { - break; - } - symbolDeclarationEnclosingContainer = symbolDeclarationEnclosingContainer.getParentDecl(); - } - - if (symbolDeclarationEnclosingContainer) { - while (enclosingContainer) { - if (enclosingContainer.kind === (dynamic ? 32 /* DynamicModule */ : 4 /* Container */)) { - break; - } - - enclosingContainer = enclosingContainer.getParentDecl(); - } - } - - if (symbolDeclarationEnclosingContainer && enclosingContainer) { - var same = symbolDeclarationEnclosingContainer === enclosingContainer; - - if (!same && symbol.anyDeclHasFlag(32768 /* InitializedModule */)) { - same = symbolDeclarationEnclosingContainer === enclosingContainer.getParentDecl(); - } - - return same; - } - } - } - } - - return false; - }; - - Emitter.prototype.shouldQualifySymbolNameWithParentName = function (symbol) { - 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 === 67108864 /* EnumMember */) { - return true; - } - - if (!TypeScript.hasFlag(currentDecl.flags, 1 /* Exported */)) { - return false; - } - - if (currentDecl.kind === 512 /* Variable */ && !TypeScript.hasFlag(currentDecl.flags, 118784 /* ImplicitVariable */)) { - return true; - } - - if (TypeScript.ArrayUtilities.contains(this.declStack, declParent)) { - return false; - } - } - - return true; - }; - - Emitter.prototype.getSymbolForEmit = function (ast) { - var pullSymbol = this.semanticInfoChain.getSymbolForAST(ast); - var pullSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(ast); - if (pullSymbol && pullSymbolAlias) { - var symbolToCompare = TypeScript.isTypesOnlyLocation(ast) ? pullSymbolAlias.getExportAssignedTypeSymbol() : pullSymbolAlias.getExportAssignedValueSymbol(); - - if (pullSymbol === symbolToCompare) { - pullSymbol = pullSymbolAlias; - pullSymbolAlias = null; - } - } - return { symbol: pullSymbol, aliasSymbol: pullSymbolAlias }; - }; - - Emitter.prototype.emitName = function (name, addThis) { - 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 !== 6 /* Args */) && pullSymbol) { - var pullSymbolContainer = pullSymbol.getContainer(); - - if (pullSymbolContainer) { - var pullSymbolContainerKind = pullSymbolContainer.kind; - - if (TypeScript.PullHelpers.symbolIsModule(pullSymbolContainer) || pullSymbolContainerKind === 64 /* Enum */ || pullSymbolContainer.anyDeclHasFlag(32768 /* InitializedModule */ | 4096 /* Enum */)) { - var needToEmitParentName = this.shouldQualifySymbolNameWithParentName(pullSymbol); - if (needToEmitParentName) { - var parentDecl = pullSymbol.getDeclarations()[0].getParentDecl(); - TypeScript.Debug.assert(parentDecl && !parentDecl.isRootDecl()); - this.writeToOutput(this.getModuleName(parentDecl, true) + "."); - } - } else if (pullSymbolContainerKind === 32 /* DynamicModule */ || pullSymbolContainer.anyDeclHasFlag(65536 /* InitializedDynamicModule */)) { - if (pullSymbolKind === 4096 /* Property */) { - this.writeToOutput("exports."); - } else if (pullSymbol.anyDeclHasFlag(1 /* Exported */) && !isLocalAlias && !pullSymbol.anyDeclHasFlag(118784 /* ImplicitVariable */) && pullSymbol.kind !== 32768 /* ConstructorMethod */ && pullSymbol.kind !== 8 /* Class */ && pullSymbol.kind !== 64 /* Enum */) { - this.writeToOutput("exports."); - } - } - } - } - - this.writeToOutput(name.text()); - } - - this.recordSourceMappingEnd(name); - this.emitComments(name, false); - }; - - Emitter.prototype.recordSourceMappingNameStart = function (name) { - 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; - } - } - - 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); - } - }; - - Emitter.prototype.recordSourceMappingNameEnd = function () { - if (this.sourceMapper) { - this.sourceMapper.currentNameIndex.pop(); - } - }; - - Emitter.prototype.recordSourceMappingStart = function (ast) { - if (this.sourceMapper && TypeScript.ASTHelpers.isValidAstNode(ast)) { - var lineCol = { line: -1, character: -1 }; - var sourceMapping = new TypeScript.SourceMapping(); - sourceMapping.start.emittedColumn = this.emitState.column; - sourceMapping.start.emittedLine = this.emitState.line; - - var lineMap = this.document.lineMap(); - lineMap.fillLineAndCharacterFromPosition(ast.start(), lineCol); - sourceMapping.start.sourceColumn = lineCol.character; - sourceMapping.start.sourceLine = lineCol.line + 1; - lineMap.fillLineAndCharacterFromPosition(ast.end(), lineCol); - sourceMapping.end.sourceColumn = lineCol.character; - sourceMapping.end.sourceLine = lineCol.line + 1; - - TypeScript.Debug.assert(!isNaN(sourceMapping.start.emittedColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.start.emittedLine)); - TypeScript.Debug.assert(!isNaN(sourceMapping.start.sourceColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.start.sourceLine)); - TypeScript.Debug.assert(!isNaN(sourceMapping.end.sourceColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.end.sourceLine)); - - if (this.sourceMapper.currentNameIndex.length > 0) { - sourceMapping.nameIndex = this.sourceMapper.currentNameIndex[this.sourceMapper.currentNameIndex.length - 1]; - } - - var siblings = this.sourceMapper.currentMappings[this.sourceMapper.currentMappings.length - 1]; - siblings.push(sourceMapping); - this.sourceMapper.currentMappings.push(sourceMapping.childMappings); - this.sourceMapper.increaseMappingLevel(ast); - } - }; - - Emitter.prototype.recordSourceMappingEnd = function (ast) { - if (this.sourceMapper && TypeScript.ASTHelpers.isValidAstNode(ast)) { - this.sourceMapper.currentMappings.pop(); - - 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; - - TypeScript.Debug.assert(!isNaN(sourceMapping.end.emittedColumn)); - TypeScript.Debug.assert(!isNaN(sourceMapping.end.emittedLine)); - - this.sourceMapper.decreaseMappingLevel(ast); - } - }; - - Emitter.prototype.getOutputFiles = function () { - var result = []; - if (this.sourceMapper !== null) { - this.sourceMapper.emitSourceMapping(); - result.push(this.sourceMapper.getOutputFile()); - } - - result.push(this.outfile.getOutputFile()); - return result; - }; - - Emitter.prototype.emitParameterPropertyAndMemberVariableAssignments = function () { - var constructorDecl = getLastConstructor(this.thisClassNode); - - if (constructorDecl) { - for (var i = 0, n = constructorDecl.callSignature.parameterList.parameters.nonSeparatorCount(); i < n; i++) { - var parameter = constructorDecl.callSignature.parameterList.parameters.nonSeparatorAt(i); - var parameterDecl = this.semanticInfoChain.getDeclForAST(parameter); - if (TypeScript.hasFlag(parameterDecl.flags, 8388608 /* 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.childCount(); i < n; i++) { - if (this.thisClassNode.classElements.childAt(i).kind() === 136 /* MemberVariableDeclaration */) { - var varDecl = this.thisClassNode.classElements.childAt(i); - if (!TypeScript.hasModifier(varDecl.modifiers, 16 /* Static */) && varDecl.variableDeclarator.equalsValueClause) { - this.emitIndent(); - this.emitMemberVariableDeclaration(varDecl); - this.writeLineToOutput(""); - } - } - } - }; - - Emitter.prototype.isOnSameLine = function (pos1, pos2) { - var lineMap = this.document.lineMap(); - return lineMap.getLineNumberFromPosition(pos1) === lineMap.getLineNumberFromPosition(pos2); - }; - - Emitter.prototype.emitCommaSeparatedList = function (parent, list, buffer, preserveNewLines) { - if (list === null || list.nonSeparatorCount() === 0) { - return; - } - - var startLine = preserveNewLines && !this.isOnSameLine(parent.end(), list.nonSeparatorAt(0).end()); - - if (preserveNewLines) { - this.indenter.increaseIndent(); - } - - if (startLine) { - this.writeLineToOutput(""); - } else { - this.writeToOutput(buffer); - } - - for (var i = 0, n = list.nonSeparatorCount(); i < n; i++) { - var emitNode = list.nonSeparatorAt(i); - - this.emitJavascript(emitNode, startLine); - - if (i < (n - 1)) { - startLine = preserveNewLines && !this.isOnSameLine(emitNode.end(), list.nonSeparatorAt(i + 1).start()); - if (startLine) { - this.writeLineToOutput(","); - } else { - this.writeToOutput(", "); - } - } - } - - if (preserveNewLines) { - this.indenter.decreaseIndent(); - } - - if (preserveNewLines && !this.isOnSameLine(parent.end(), list.nonSeparatorAt(list.nonSeparatorCount() - 1).end())) { - this.writeLineToOutput(""); - this.emitIndent(); - } else { - this.writeToOutput(buffer); - } - }; - - Emitter.prototype.emitList = function (list, useNewLineSeparator, startInclusive, endExclusive) { - if (typeof useNewLineSeparator === "undefined") { useNewLineSeparator = true; } - if (typeof startInclusive === "undefined") { startInclusive = 0; } - if (typeof endExclusive === "undefined") { endExclusive = list.childCount(); } - if (list === null) { - return; - } - - this.emitComments(list, true); - var lastEmittedNode = null; - - for (var i = startInclusive; i < endExclusive; i++) { - var node = list.childAt(i); - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - if (useNewLineSeparator) { - this.writeLineToOutput(""); - } - - lastEmittedNode = node; - } - } - - this.emitComments(list, false); - }; - - Emitter.prototype.emitSeparatedList = function (list, useNewLineSeparator, startInclusive, endExclusive) { - if (typeof useNewLineSeparator === "undefined") { useNewLineSeparator = true; } - if (typeof startInclusive === "undefined") { startInclusive = 0; } - if (typeof endExclusive === "undefined") { endExclusive = list.nonSeparatorCount(); } - if (list === null) { - return; - } - - this.emitComments(list, true); - var lastEmittedNode = null; - - for (var i = startInclusive; i < endExclusive; i++) { - var node = list.nonSeparatorAt(i); - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - if (useNewLineSeparator) { - this.writeLineToOutput(""); - } - - lastEmittedNode = node; - } - } - - this.emitComments(list, false); - }; - - Emitter.prototype.isDirectivePrologueElement = function (node) { - if (node.kind() === 149 /* ExpressionStatement */) { - var exprStatement = node; - return exprStatement.expression.kind() === 14 /* StringLiteral */; - } - - return false; - }; - - Emitter.prototype.emitSpaceBetweenConstructs = function (node1, node2) { - if (node1 === null || node2 === null) { - return; - } - - if (node1.start() === -1 || node1.end() === -1 || node2.start() === -1 || node2.end() === -1) { - return; - } - - var lineMap = this.document.lineMap(); - var node1EndLine = lineMap.getLineNumberFromPosition(node1.end()); - var node2StartLine = lineMap.getLineNumberFromPosition(node2.start()); - - if ((node2StartLine - node1EndLine) > 1) { - this.writeLineToOutput("", true); - } - }; - - Emitter.prototype.getDetachedComments = function (element) { - var preComments = element.preComments(); - if (preComments) { - var lineMap = this.document.lineMap(); - - var detachedComments = []; - var lastComment = 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) { - return detachedComments; - } - } - - detachedComments.push(comment); - lastComment = comment; - } - - var lastCommentLine = lineMap.getLineNumberFromPosition(TypeScript.ArrayUtilities.last(detachedComments).end()); - var astLine = lineMap.getLineNumberFromPosition(element.start()); - if (astLine >= lastCommentLine + 2) { - return detachedComments; - } - } - - return []; - }; - - Emitter.prototype.emitPossibleCopyrightHeaders = function (script) { - this.emitDetachedComments(script.moduleElements); - }; - - Emitter.prototype.emitDetachedComments = function (list) { - if (list.childCount() > 0) { - var firstElement = list.childAt(0); - - this.detachedCommentsElement = firstElement; - this.emitCommentsArray(this.getDetachedComments(this.detachedCommentsElement), false); - } - }; - - Emitter.prototype.emitScriptElements = function (sourceUnit) { - var list = sourceUnit.moduleElements; - - this.emitPossibleCopyrightHeaders(sourceUnit); - - for (var i = 0, n = list.childCount(); i < n; i++) { - var node = list.childAt(i); - - if (!this.isDirectivePrologueElement(node)) { - break; - } - - this.emitJavascript(node, true); - this.writeLineToOutput(""); - } - - this.emitPrologue(sourceUnit); - - var isExternalModule = this.document.isExternalModule(); - var isNonElidedExternalModule = isExternalModule && !TypeScript.ASTHelpers.scriptIsElided(sourceUnit); - if (isNonElidedExternalModule) { - this.recordSourceMappingStart(sourceUnit); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - 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(2 /* DynamicModule */); - - var svModuleName = this.moduleName; - this.moduleName = sourceUnit.fileName(); - if (TypeScript.isTSFile(this.moduleName)) { - this.moduleName = this.moduleName.substring(0, this.moduleName.length - ".ts".length); - } - - this.setExportAssignment(null); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - this.indenter.increaseIndent(); - } - - var externalModule = this.semanticInfoChain.getDeclForAST(this.document.sourceUnit()); - - if (TypeScript.hasFlag(externalModule.flags, 262144 /* MustCaptureThis */)) { - this.writeCaptureThisStatement(sourceUnit); - } - - this.pushDecl(externalModule); - } - - this.emitList(list, true, i, n); - - if (isExternalModule) { - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - this.indenter.decreaseIndent(); - } - - if (isNonElidedExternalModule) { - var exportAssignment = this.getExportAssignment(); - var exportAssignmentIdentifierText = exportAssignment ? exportAssignment.identifier.text() : null; - var exportAssignmentValueSymbol = externalModule.getSymbol().getExportAssignedValueSymbol(); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === 2 /* Asynchronous */) { - if (exportAssignmentIdentifierText && exportAssignmentValueSymbol && !(exportAssignmentValueSymbol.kind & 58720272 /* SomeTypeReference */)) { - this.indenter.increaseIndent(); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("return " + exportAssignmentIdentifierText, exportAssignment); - this.writeLineToOutput(";"); - this.indenter.decreaseIndent(); - } - this.writeToOutput("});"); - } else if (exportAssignmentIdentifierText && exportAssignmentValueSymbol && !(exportAssignmentValueSymbol.kind & 58720272 /* 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); - } - }; - - Emitter.prototype.emitConstructorStatements = function (funcDecl) { - var list = funcDecl.block.statements; - - if (list === null) { - return; - } - - this.emitComments(list, true); - - var emitPropertyAssignmentsAfterSuperCall = TypeScript.ASTHelpers.getExtendsHeritageClause(this.thisClassNode.heritageClauses) !== null; - var propertyAssignmentIndex = emitPropertyAssignmentsAfterSuperCall ? 1 : 0; - var lastEmittedNode = null; - - for (var i = 0, n = list.childCount(); i < n; i++) { - if (i === propertyAssignmentIndex) { - this.emitParameterPropertyAndMemberVariableAssignments(); - } - - var node = list.childAt(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); - }; - - Emitter.prototype.emitJavascript = function (ast, startLine) { - if (ast === null) { - return; - } - - if (startLine && this.indenter.indentAmt > 0) { - this.emitIndent(); - } - - this.emit(ast); - }; - - Emitter.prototype.emitAccessorMemberDeclaration = function (funcDecl, name, className, isProto) { - if (funcDecl.kind() !== 139 /* GetAccessor */) { - var accessorSymbol = TypeScript.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 (TypeScript.isQuoted(functionName)) { - this.writeToOutput(functionName); - } else { - this.writeToOutput('"' + functionName + '"'); - } - - this.writeLineToOutput(", {"); - - this.indenter.increaseIndent(); - - var accessors = TypeScript.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.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.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); - }; - - Emitter.prototype.emitAccessorBody = function (funcDecl, parameterList, block) { - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(null, funcDecl, parameters, block, null); - - this.recordSourceMappingEnd(funcDecl); - - this.recordSourceMappingEnd(funcDecl); - this.popDecl(pullDecl); - }; - - Emitter.prototype.emitClass = function (classDecl) { - 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(3 /* Class */); - - this.recordSourceMappingStart(classDecl); - this.writeToOutput("var " + className); - - var hasBaseClass = TypeScript.ASTHelpers.getExtendsHeritageClause(classDecl.heritageClauses) !== null; - var baseTypeReference = null; - var varDecl = null; - - if (hasBaseClass) { - this.writeLineToOutput(" = (function (_super) {"); - } else { - this.writeLineToOutput(" = (function () {"); - } - - this.recordSourceMappingNameStart(className); - this.indenter.increaseIndent(); - - if (hasBaseClass) { - baseTypeReference = TypeScript.ASTHelpers.getExtendsHeritageClause(classDecl.heritageClauses).typeNames.nonSeparatorAt(0); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("__extends(" + className + ", _super)", baseTypeReference); - this.writeLineToOutput(";"); - } - - this.emitIndent(); - - var constrDecl = getLastConstructor(classDecl); - - if (constrDecl) { - this.emit(constrDecl); - this.writeLineToOutput(""); - } else { - this.recordSourceMappingStart(classDecl); - - 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.writeToOutputWithSourceMapRecord("}", 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.writeToOutputWithSourceMapRecord("}", classDecl.closeBraceToken); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingStart(classDecl); - this.writeToOutput(")("); - if (hasBaseClass) { - this.emitJavascript(baseTypeReference, false); - } - this.writeToOutput(");"); - this.recordSourceMappingEnd(classDecl); - - if ((temp === 1 /* Module */ || temp === 2 /* DynamicModule */) && TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */)) { - this.writeLineToOutput(""); - this.emitIndent(); - var modName = temp === 1 /* 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); - }; - - Emitter.prototype.emitClassMembers = function (classDecl) { - var lastEmittedMember = null; - - for (var i = 0, n = classDecl.classElements.childCount(); i < n; i++) { - var memberDecl = classDecl.classElements.childAt(i); - - if (memberDecl.kind() === 139 /* GetAccessor */) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - var getter = memberDecl; - this.emitAccessorMemberDeclaration(getter, getter.propertyName, classDecl.identifier.text(), !TypeScript.hasModifier(getter.modifiers, 16 /* Static */)); - lastEmittedMember = memberDecl; - } else if (memberDecl.kind() === 140 /* SetAccessor */) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - var setter = memberDecl; - this.emitAccessorMemberDeclaration(setter, setter.propertyName, classDecl.identifier.text(), !TypeScript.hasModifier(setter.modifiers, 16 /* Static */)); - lastEmittedMember = memberDecl; - } else if (memberDecl.kind() === 135 /* MemberFunctionDeclaration */) { - var memberFunction = memberDecl; - - if (memberFunction.block) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - - this.emitClassMemberFunctionDeclaration(classDecl, memberFunction); - lastEmittedMember = memberDecl; - } - } - } - - for (var i = 0, n = classDecl.classElements.childCount(); i < n; i++) { - var memberDecl = classDecl.classElements.childAt(i); - - if (memberDecl.kind() === 136 /* MemberVariableDeclaration */) { - var varDecl = memberDecl; - - if (TypeScript.hasModifier(varDecl.modifiers, 16 /* Static */) && varDecl.variableDeclarator.equalsValueClause) { - this.emitSpaceBetweenConstructs(lastEmittedMember, varDecl); - - this.emitIndent(); - this.recordSourceMappingStart(varDecl); - - var varDeclName = varDecl.variableDeclarator.propertyName.text(); - if (TypeScript.isQuoted(varDeclName) || varDecl.variableDeclarator.propertyName.kind() !== 11 /* 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; - } - } - } - }; - - Emitter.prototype.emitClassMemberFunctionDeclaration = function (classDecl, funcDecl) { - this.emitIndent(); - this.recordSourceMappingStart(funcDecl); - this.emitComments(funcDecl, true); - var functionName = funcDecl.propertyName.text(); - - this.writeToOutput(classDecl.identifier.text()); - - if (!TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */)) { - this.writeToOutput(".prototype"); - } - - if (TypeScript.isQuoted(functionName) || funcDecl.propertyName.kind() !== 11 /* 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 = TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionBodyStatements(funcDecl.propertyName.text(), funcDecl, parameters, funcDecl.block, null); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.recordSourceMappingEnd(funcDecl); - this.popDecl(pullDecl); - - this.writeLineToOutput(";"); - }; - - Emitter.prototype.requiresExtendsBlock = function (moduleElements) { - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var moduleElement = moduleElements.childAt(i); - - if (moduleElement.kind() === 130 /* ModuleDeclaration */) { - var moduleAST = moduleElement; - - if (!TypeScript.hasModifier(moduleAST.modifiers, 8 /* Ambient */) && this.requiresExtendsBlock(moduleAST.moduleElements)) { - return true; - } - } else if (moduleElement.kind() === 131 /* ClassDeclaration */) { - var classDeclaration = moduleElement; - - if (!TypeScript.hasModifier(classDeclaration.modifiers, 8 /* Ambient */) && TypeScript.ASTHelpers.getExtendsHeritageClause(classDeclaration.heritageClauses) !== null) { - return true; - } - } - } - - return false; - }; - - Emitter.prototype.emitPrologue = function (sourceUnit) { - 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); - } - } - }; - - Emitter.prototype.emitThis = function () { - if (!this.inWithBlock && this.inArrowFunction) { - this.writeToOutput("_this"); - } else { - this.writeToOutput("this"); - } - }; - - Emitter.prototype.emitBlockOrStatement = function (node) { - if (node.kind() === 146 /* Block */) { - this.emit(node); - } else { - this.writeLineToOutput(""); - this.indenter.increaseIndent(); - this.emitJavascript(node, true); - this.indenter.decreaseIndent(); - } - }; - - Emitter.prototype.emitLiteralExpression = function (expression) { - switch (expression.kind()) { - case 32 /* NullKeyword */: - this.writeToOutputWithSourceMapRecord("null", expression); - break; - case 24 /* FalseKeyword */: - this.writeToOutputWithSourceMapRecord("false", expression); - break; - case 37 /* TrueKeyword */: - this.writeToOutputWithSourceMapRecord("true", expression); - break; - default: - throw TypeScript.Errors.abstract(); - } - }; - - Emitter.prototype.emitThisExpression = function (expression) { - if (!this.inWithBlock && this.inArrowFunction) { - this.writeToOutputWithSourceMapRecord("_this", expression); - } else { - this.writeToOutputWithSourceMapRecord("this", expression); - } - }; - - Emitter.prototype.emitSuperExpression = function (expression) { - this.writeToOutputWithSourceMapRecord("_super.prototype", expression); - }; - - Emitter.prototype.emitParenthesizedExpression = function (parenthesizedExpression) { - var omitParentheses = false; - - if (parenthesizedExpression.expression.kind() === 220 /* CastExpression */ && parenthesizedExpression.openParenTrailingComments === null) { - var castedExpression = parenthesizedExpression.expression.expression; - - while (castedExpression.kind() == 220 /* CastExpression */) { - castedExpression = castedExpression.expression; - } - - switch (castedExpression.kind()) { - case 217 /* ParenthesizedExpression */: - case 11 /* IdentifierName */: - case 32 /* NullKeyword */: - case 35 /* ThisKeyword */: - case 14 /* StringLiteral */: - case 13 /* NumericLiteral */: - case 12 /* RegularExpressionLiteral */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - case 214 /* ArrayLiteralExpression */: - case 215 /* ObjectLiteralExpression */: - case 212 /* MemberAccessExpression */: - case 221 /* ElementAccessExpression */: - omitParentheses = true; - break; - - case 213 /* InvocationExpression */: - if (parenthesizedExpression.parent.kind() !== 216 /* ObjectCreationExpression */) { - omitParentheses = true; - } - - break; - } - } - - if (omitParentheses) { - this.emit(parenthesizedExpression.expression); - } else { - this.recordSourceMappingStart(parenthesizedExpression); - this.writeToOutput("("); - this.emitCommentsArray(parenthesizedExpression.openParenTrailingComments, false); - this.emit(parenthesizedExpression.expression); - this.writeToOutput(")"); - this.recordSourceMappingEnd(parenthesizedExpression); - } - }; - - Emitter.prototype.emitCastExpression = function (expression) { - this.emit(expression.expression); - }; - - Emitter.prototype.emitPrefixUnaryExpression = function (expression) { - var nodeType = expression.kind(); - - this.recordSourceMappingStart(expression); - switch (nodeType) { - case 167 /* LogicalNotExpression */: - this.writeToOutput("!"); - this.emit(expression.operand); - break; - case 166 /* BitwiseNotExpression */: - this.writeToOutput("~"); - this.emit(expression.operand); - break; - case 165 /* NegateExpression */: - this.writeToOutput("-"); - if (expression.operand.kind() === 165 /* NegateExpression */ || expression.operand.kind() === 169 /* PreDecrementExpression */) { - this.writeToOutput(" "); - } - this.emit(expression.operand); - break; - case 164 /* PlusExpression */: - this.writeToOutput("+"); - if (expression.operand.kind() === 164 /* PlusExpression */ || expression.operand.kind() === 168 /* PreIncrementExpression */) { - this.writeToOutput(" "); - } - this.emit(expression.operand); - break; - case 168 /* PreIncrementExpression */: - this.writeToOutput("++"); - this.emit(expression.operand); - break; - case 169 /* PreDecrementExpression */: - this.writeToOutput("--"); - this.emit(expression.operand); - break; - default: - throw TypeScript.Errors.abstract(); - } - - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitPostfixUnaryExpression = function (expression) { - var nodeType = expression.kind(); - - this.recordSourceMappingStart(expression); - switch (nodeType) { - case 210 /* PostIncrementExpression */: - this.emit(expression.operand); - this.writeToOutput("++"); - break; - case 211 /* PostDecrementExpression */: - this.emit(expression.operand); - this.writeToOutput("--"); - break; - default: - throw TypeScript.Errors.abstract(); - } - - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitTypeOfExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.writeToOutput("typeof "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitDeleteExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.writeToOutput("delete "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitVoidExpression = function (expression) { - this.recordSourceMappingStart(expression); - this.writeToOutput("void "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.canEmitDottedNameMemberAccessExpression = function (expression) { - var memberExpressionNodeType = expression.expression.kind(); - - if (memberExpressionNodeType === 11 /* IdentifierName */ || memberExpressionNodeType == 212 /* MemberAccessExpression */) { - var memberAccessSymbol = this.getSymbolForEmit(expression).symbol; - var memberAccessExpressionSymbol = this.getSymbolForEmit(expression.expression).symbol; - if (memberAccessSymbol && memberAccessExpressionSymbol && !this.semanticInfoChain.getAliasSymbolForAST(expression.expression) && (TypeScript.PullHelpers.symbolIsModule(memberAccessExpressionSymbol) || memberAccessExpressionSymbol.kind === 64 /* Enum */ || memberAccessExpressionSymbol.anyDeclHasFlag(32768 /* InitializedModule */ | 4096 /* Enum */))) { - var memberAccessSymbolKind = memberAccessSymbol.kind; - if (memberAccessSymbolKind === 4096 /* Property */ || memberAccessSymbolKind === 67108864 /* EnumMember */ || (memberAccessSymbol.anyDeclHasFlag(1 /* Exported */) && memberAccessSymbolKind === 512 /* Variable */ && !memberAccessSymbol.anyDeclHasFlag(32768 /* InitializedModule */ | 4096 /* Enum */)) || ((memberAccessSymbol.anyDeclHasFlag(1 /* Exported */) && !this.symbolIsUsedInItsEnclosingContainer(memberAccessSymbol)))) { - if (memberExpressionNodeType === 212 /* MemberAccessExpression */) { - return this.canEmitDottedNameMemberAccessExpression(expression.expression); - } - - return true; - } - } - } - - return false; - }; - - Emitter.prototype.emitDottedNameMemberAccessExpression = function (expression) { - this.recordSourceMappingStart(expression); - if (expression.expression.kind() === 212 /* MemberAccessExpression */) { - this.emitDottedNameMemberAccessExpressionRecurse(expression.expression); - } else { - this.emitName(expression.expression, true); - } - - this.writeToOutput("."); - this.emitName(expression.name, false); - - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitDottedNameMemberAccessExpressionRecurse = function (expression) { - this.emitComments(expression, true); - this.emitDottedNameMemberAccessExpression(expression); - this.emitComments(expression, false); - }; - - Emitter.prototype.emitMemberAccessExpression = function (expression) { - if (!this.tryEmitConstant(expression)) { - if (this.canEmitDottedNameMemberAccessExpression(expression)) { - this.emitDottedNameMemberAccessExpression(expression); - } else { - this.recordSourceMappingStart(expression); - this.emit(expression.expression); - this.writeToOutput("."); - this.emitName(expression.name, false); - this.recordSourceMappingEnd(expression); - } - } - }; - - Emitter.prototype.emitQualifiedName = function (name) { - this.recordSourceMappingStart(name); - - this.emit(name.left); - this.writeToOutput("."); - this.emitName(name.right, false); - - this.recordSourceMappingEnd(name); - }; - - Emitter.prototype.emitBinaryExpression = function (expression) { - this.recordSourceMappingStart(expression); - switch (expression.kind()) { - case 173 /* CommaExpression */: - this.emit(expression.left); - this.writeToOutput(", "); - this.emit(expression.right); - break; - default: { - this.emit(expression.left); - var binOp = TypeScript.SyntaxFacts.getText(TypeScript.SyntaxFacts.getOperatorTokenFromBinaryExpression(expression.kind())); - if (binOp === "instanceof") { - this.writeToOutput(" instanceof "); - } else if (binOp === "in") { - this.writeToOutput(" in "); - } else { - this.writeToOutput(" " + binOp + " "); - } - this.emit(expression.right); - } - } - this.recordSourceMappingEnd(expression); - }; - - Emitter.prototype.emitSimplePropertyAssignment = function (property) { - this.recordSourceMappingStart(property); - this.emit(property.propertyName); - this.writeToOutput(": "); - this.emit(property.expression); - this.recordSourceMappingEnd(property); - }; - - Emitter.prototype.emitFunctionPropertyAssignment = function (funcProp) { - 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(5 /* Function */); - var funcName = funcProp.propertyName; - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcProp); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcProp); - this.writeToOutput("function "); - - this.writeToOutput("("); - - var parameters = TypeScript.ASTHelpers.parametersFromParameterList(funcProp.callSignature.parameterList); - this.emitFunctionParameters(parameters); - this.writeToOutput(")"); - - this.emitFunctionBodyStatements(funcProp.propertyName.text(), funcProp, parameters, funcProp.block, null); - - this.recordSourceMappingEnd(funcProp); - - this.recordSourceMappingEnd(funcProp); - - this.emitComments(funcProp, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - }; - - Emitter.prototype.emitConditionalExpression = function (expression) { - this.emit(expression.condition); - this.writeToOutput(" ? "); - this.emit(expression.whenTrue); - this.writeToOutput(" : "); - this.emit(expression.whenFalse); - }; - - Emitter.prototype.emitThrowStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("throw "); - this.emit(statement.expression); - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitExpressionStatement = function (statement) { - var isArrowExpression = statement.expression.kind() === 219 /* SimpleArrowFunctionExpression */ || statement.expression.kind() === 218 /* ParenthesizedArrowFunctionExpression */; - - this.recordSourceMappingStart(statement); - if (isArrowExpression) { - this.writeToOutput("("); - } - - this.emit(statement.expression); - - if (isArrowExpression) { - this.writeToOutput(")"); - } - - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitLabeledStatement = function (statement) { - this.writeToOutputWithSourceMapRecord(statement.identifier.text(), statement.identifier); - this.writeLineToOutput(":"); - this.emitJavascript(statement.statement, true); - }; - - Emitter.prototype.emitBlock = function (block) { - this.recordSourceMappingStart(block); - this.writeLineToOutput(" {"); - this.indenter.increaseIndent(); - if (block.statements) { - this.emitList(block.statements); - } - this.emitCommentsArray(block.closeBraceLeadingComments, false); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToOutput("}"); - this.recordSourceMappingEnd(block); - }; - - Emitter.prototype.emitBreakStatement = function (jump) { - this.recordSourceMappingStart(jump); - this.writeToOutput("break"); - - if (jump.identifier) { - this.writeToOutput(" " + jump.identifier.text()); - } - - this.recordSourceMappingEnd(jump); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitContinueStatement = function (jump) { - this.recordSourceMappingStart(jump); - this.writeToOutput("continue"); - - if (jump.identifier) { - this.writeToOutput(" " + jump.identifier.text()); - } - - this.recordSourceMappingEnd(jump); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitWhileStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("while ("); - this.emit(statement.condition); - this.writeToOutput(")"); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitDoStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("do"); - this.emitBlockOrStatement(statement.statement); - this.writeToOutputWithSourceMapRecord(" while", statement.whileKeyword); - this.writeToOutput('('); - this.emit(statement.condition); - this.writeToOutput(")"); - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitIfStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("if ("); - this.emit(statement.condition); - this.writeToOutput(")"); - - this.emitBlockOrStatement(statement.statement); - - if (statement.elseClause) { - if (statement.statement.kind() !== 146 /* Block */) { - this.writeLineToOutput(""); - this.emitIndent(); - } else { - this.writeToOutput(" "); - } - - this.emit(statement.elseClause); - } - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitElseClause = function (elseClause) { - if (elseClause.statement.kind() === 147 /* IfStatement */) { - this.writeToOutput("else "); - this.emit(elseClause.statement); - } else { - this.writeToOutput("else"); - this.emitBlockOrStatement(elseClause.statement); - } - }; - - Emitter.prototype.emitReturnStatement = function (statement) { - this.recordSourceMappingStart(statement); - if (statement.expression) { - this.writeToOutput("return "); - this.emit(statement.expression); - } else { - this.writeToOutput("return"); - } - this.recordSourceMappingEnd(statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitForInStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("for ("); - if (statement.left) { - this.emit(statement.left); - } else { - this.emit(statement.variableDeclaration); - } - this.writeToOutput(" in "); - this.emit(statement.expression); - this.writeToOutput(")"); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitForStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("for ("); - if (statement.variableDeclaration) { - this.emit(statement.variableDeclaration); - } else if (statement.initializer) { - this.emit(statement.initializer); - } - - this.writeToOutput("; "); - this.emitJavascript(statement.condition, false); - this.writeToOutput(";"); - if (statement.incrementor) { - this.writeToOutput(" "); - this.emitJavascript(statement.incrementor, false); - } - this.writeToOutput(")"); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitWithStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("with ("); - if (statement.condition) { - this.emit(statement.condition); - } - - this.writeToOutput(")"); - var prevInWithBlock = this.inWithBlock; - this.inWithBlock = true; - this.emitBlockOrStatement(statement.statement); - this.inWithBlock = prevInWithBlock; - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitSwitchStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("switch ("); - this.emit(statement.expression); - this.recordSourceMappingStart(statement.closeParenToken); - this.writeToOutput(")"); - this.recordSourceMappingEnd(statement.closeParenToken); - this.writeLineToOutput(" {"); - this.indenter.increaseIndent(); - this.emitList(statement.switchClauses, false); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToOutput("}"); - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitCaseSwitchClause = function (clause) { - this.recordSourceMappingStart(clause); - this.writeToOutput("case "); - this.emit(clause.expression); - this.writeToOutput(":"); - - this.emitSwitchClauseBody(clause.statements); - this.recordSourceMappingEnd(clause); - }; - - Emitter.prototype.emitSwitchClauseBody = function (body) { - if (body.childCount() === 1 && body.childAt(0).kind() === 146 /* Block */) { - this.emit(body.childAt(0)); - this.writeLineToOutput(""); - } else { - this.writeLineToOutput(""); - this.indenter.increaseIndent(); - this.emit(body); - this.indenter.decreaseIndent(); - } - }; - - Emitter.prototype.emitDefaultSwitchClause = function (clause) { - this.recordSourceMappingStart(clause); - this.writeToOutput("default:"); - - this.emitSwitchClauseBody(clause.statements); - this.recordSourceMappingEnd(clause); - }; - - Emitter.prototype.emitTryStatement = function (statement) { - this.recordSourceMappingStart(statement); - this.writeToOutput("try "); - this.emit(statement.block); - this.emitJavascript(statement.catchClause, false); - - if (statement.finallyClause) { - this.emit(statement.finallyClause); - } - this.recordSourceMappingEnd(statement); - }; - - Emitter.prototype.emitCatchClause = function (clause) { - this.writeToOutput(" "); - this.recordSourceMappingStart(clause); - this.writeToOutput("catch ("); - this.emit(clause.identifier); - this.writeToOutput(")"); - this.emit(clause.block); - this.recordSourceMappingEnd(clause); - }; - - Emitter.prototype.emitFinallyClause = function (clause) { - this.writeToOutput(" finally"); - this.emit(clause.block); - }; - - Emitter.prototype.emitDebuggerStatement = function (statement) { - this.writeToOutputWithSourceMapRecord("debugger", statement); - this.writeToOutput(";"); - }; - - Emitter.prototype.emitNumericLiteral = function (literal) { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - }; - - Emitter.prototype.emitRegularExpressionLiteral = function (literal) { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - }; - - Emitter.prototype.emitStringLiteral = function (literal) { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - }; - - Emitter.prototype.emitEqualsValueClause = function (clause) { - this.writeToOutput(" = "); - this.emit(clause.value); - }; - - Emitter.prototype.emitParameter = function (parameter) { - this.writeToOutputWithSourceMapRecord(parameter.identifier.text(), parameter); - }; - - Emitter.prototype.emitConstructorDeclaration = function (declaration) { - if (declaration.block) { - this.emitConstructor(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitFunctionDeclaration = function (declaration) { - return declaration.preComments() !== null || (!TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */) && declaration.block !== null); - }; - - Emitter.prototype.emitFunctionDeclaration = function (declaration) { - if (!TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */) && declaration.block !== null) { - this.emitFunction(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.emitSourceUnit = function (sourceUnit) { - if (!this.document.isDeclareFile()) { - var pullDecl = this.semanticInfoChain.getDeclForAST(sourceUnit); - this.pushDecl(pullDecl); - this.emitScriptElements(sourceUnit); - this.popDecl(pullDecl); - - this.emitCommentsArray(sourceUnit.endOfFileTokenLeadingComments, false); - } - }; - - Emitter.prototype.shouldEmitEnumDeclaration = function (declaration) { - return declaration.preComments() !== null || !TypeScript.ASTHelpers.enumIsElided(declaration); - }; - - Emitter.prototype.emitEnumDeclaration = function (declaration) { - if (!TypeScript.ASTHelpers.enumIsElided(declaration)) { - this.emitComments(declaration, true); - this.emitEnum(declaration); - this.emitComments(declaration, false); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitModuleDeclaration = function (declaration) { - return declaration.preComments() !== null || !TypeScript.ASTHelpers.moduleIsElided(declaration); - }; - - Emitter.prototype.emitModuleDeclaration = function (declaration) { - if (!TypeScript.ASTHelpers.moduleIsElided(declaration)) { - this.emitModuleDeclarationWorker(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitClassDeclaration = function (declaration) { - return declaration.preComments() !== null || !TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */); - }; - - Emitter.prototype.emitClassDeclaration = function (declaration) { - if (!TypeScript.hasModifier(declaration.modifiers, 8 /* Ambient */)) { - this.emitClass(declaration); - } else { - this.emitComments(declaration, true, true); - } - }; - - Emitter.prototype.shouldEmitInterfaceDeclaration = function (declaration) { - return declaration.preComments() !== null; - }; - - Emitter.prototype.emitInterfaceDeclaration = function (declaration) { - this.emitComments(declaration, true, true); - }; - - Emitter.prototype.firstVariableDeclarator = function (statement) { - return statement.declaration.declarators.nonSeparatorAt(0); - }; - - Emitter.prototype.isNotAmbientOrHasInitializer = function (variableStatement) { - return !TypeScript.hasModifier(variableStatement.modifiers, 8 /* Ambient */) || this.firstVariableDeclarator(variableStatement).equalsValueClause !== null; - }; - - Emitter.prototype.shouldEmitVariableStatement = function (statement) { - return statement.preComments() !== null || this.isNotAmbientOrHasInitializer(statement); - }; - - Emitter.prototype.emitVariableStatement = function (statement) { - if (this.isNotAmbientOrHasInitializer(statement)) { - this.emitComments(statement, true); - this.emit(statement.declaration); - this.writeToOutput(";"); - this.emitComments(statement, false); - } else { - this.emitComments(statement, true, true); - } - }; - - Emitter.prototype.emitGenericType = function (type) { - this.emit(type.name); - }; - - Emitter.prototype.shouldEmit = function (ast) { - if (!ast) { - return false; - } - - switch (ast.kind()) { - case 133 /* ImportDeclaration */: - return this.shouldEmitImportDeclaration(ast); - case 131 /* ClassDeclaration */: - return this.shouldEmitClassDeclaration(ast); - case 128 /* InterfaceDeclaration */: - return this.shouldEmitInterfaceDeclaration(ast); - case 129 /* FunctionDeclaration */: - return this.shouldEmitFunctionDeclaration(ast); - case 130 /* ModuleDeclaration */: - return this.shouldEmitModuleDeclaration(ast); - case 148 /* VariableStatement */: - return this.shouldEmitVariableStatement(ast); - case 223 /* OmittedExpression */: - return false; - case 132 /* EnumDeclaration */: - return this.shouldEmitEnumDeclaration(ast); - } - - return true; - }; - - Emitter.prototype.emit = function (ast) { - if (!ast) { - return; - } - - switch (ast.kind()) { - case 2 /* SeparatedList */: - return this.emitSeparatedList(ast); - case 1 /* List */: - return this.emitList(ast); - case 120 /* SourceUnit */: - return this.emitSourceUnit(ast); - case 133 /* ImportDeclaration */: - return this.emitImportDeclaration(ast); - case 134 /* ExportAssignment */: - return this.setExportAssignment(ast); - case 131 /* ClassDeclaration */: - return this.emitClassDeclaration(ast); - case 128 /* InterfaceDeclaration */: - return this.emitInterfaceDeclaration(ast); - case 11 /* IdentifierName */: - return this.emitName(ast, true); - case 225 /* VariableDeclarator */: - return this.emitVariableDeclarator(ast); - case 219 /* SimpleArrowFunctionExpression */: - return this.emitSimpleArrowFunctionExpression(ast); - case 218 /* ParenthesizedArrowFunctionExpression */: - return this.emitParenthesizedArrowFunctionExpression(ast); - case 129 /* FunctionDeclaration */: - return this.emitFunctionDeclaration(ast); - case 130 /* ModuleDeclaration */: - return this.emitModuleDeclaration(ast); - case 224 /* VariableDeclaration */: - return this.emitVariableDeclaration(ast); - case 126 /* GenericType */: - return this.emitGenericType(ast); - case 137 /* ConstructorDeclaration */: - return this.emitConstructorDeclaration(ast); - case 132 /* EnumDeclaration */: - return this.emitEnumDeclaration(ast); - case 243 /* EnumElement */: - return this.emitEnumElement(ast); - case 222 /* FunctionExpression */: - return this.emitFunctionExpression(ast); - case 148 /* VariableStatement */: - return this.emitVariableStatement(ast); - } - - this.emitComments(ast, true); - this.emitWorker(ast); - this.emitComments(ast, false); - }; - - Emitter.prototype.emitWorker = function (ast) { - if (!ast) { - return; - } - - switch (ast.kind()) { - case 13 /* NumericLiteral */: - return this.emitNumericLiteral(ast); - case 12 /* RegularExpressionLiteral */: - return this.emitRegularExpressionLiteral(ast); - case 14 /* StringLiteral */: - return this.emitStringLiteral(ast); - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 37 /* TrueKeyword */: - return this.emitLiteralExpression(ast); - case 35 /* ThisKeyword */: - return this.emitThisExpression(ast); - case 50 /* SuperKeyword */: - return this.emitSuperExpression(ast); - case 217 /* ParenthesizedExpression */: - return this.emitParenthesizedExpression(ast); - case 214 /* ArrayLiteralExpression */: - return this.emitArrayLiteralExpression(ast); - case 211 /* PostDecrementExpression */: - case 210 /* PostIncrementExpression */: - return this.emitPostfixUnaryExpression(ast); - case 167 /* LogicalNotExpression */: - case 166 /* BitwiseNotExpression */: - case 165 /* NegateExpression */: - case 164 /* PlusExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - return this.emitPrefixUnaryExpression(ast); - case 213 /* InvocationExpression */: - return this.emitInvocationExpression(ast); - case 221 /* ElementAccessExpression */: - return this.emitElementAccessExpression(ast); - case 212 /* MemberAccessExpression */: - return this.emitMemberAccessExpression(ast); - case 121 /* QualifiedName */: - return this.emitQualifiedName(ast); - case 173 /* CommaExpression */: - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 187 /* LogicalOrExpression */: - case 188 /* LogicalAndExpression */: - case 189 /* BitwiseOrExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 191 /* BitwiseAndExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: - return this.emitBinaryExpression(ast); - case 186 /* ConditionalExpression */: - return this.emitConditionalExpression(ast); - case 232 /* EqualsValueClause */: - return this.emitEqualsValueClause(ast); - case 242 /* Parameter */: - return this.emitParameter(ast); - case 146 /* Block */: - return this.emitBlock(ast); - case 235 /* ElseClause */: - return this.emitElseClause(ast); - case 147 /* IfStatement */: - return this.emitIfStatement(ast); - case 149 /* ExpressionStatement */: - return this.emitExpressionStatement(ast); - case 139 /* GetAccessor */: - return this.emitGetAccessor(ast); - case 140 /* SetAccessor */: - return this.emitSetAccessor(ast); - case 157 /* ThrowStatement */: - return this.emitThrowStatement(ast); - case 150 /* ReturnStatement */: - return this.emitReturnStatement(ast); - case 216 /* ObjectCreationExpression */: - return this.emitObjectCreationExpression(ast); - case 151 /* SwitchStatement */: - return this.emitSwitchStatement(ast); - case 233 /* CaseSwitchClause */: - return this.emitCaseSwitchClause(ast); - case 234 /* DefaultSwitchClause */: - return this.emitDefaultSwitchClause(ast); - case 152 /* BreakStatement */: - return this.emitBreakStatement(ast); - case 153 /* ContinueStatement */: - return this.emitContinueStatement(ast); - case 154 /* ForStatement */: - return this.emitForStatement(ast); - case 155 /* ForInStatement */: - return this.emitForInStatement(ast); - case 158 /* WhileStatement */: - return this.emitWhileStatement(ast); - case 163 /* WithStatement */: - return this.emitWithStatement(ast); - case 220 /* CastExpression */: - return this.emitCastExpression(ast); - case 215 /* ObjectLiteralExpression */: - return this.emitObjectLiteralExpression(ast); - case 240 /* SimplePropertyAssignment */: - return this.emitSimplePropertyAssignment(ast); - case 241 /* FunctionPropertyAssignment */: - return this.emitFunctionPropertyAssignment(ast); - case 156 /* EmptyStatement */: - return this.writeToOutputWithSourceMapRecord(";", ast); - case 159 /* TryStatement */: - return this.emitTryStatement(ast); - case 236 /* CatchClause */: - return this.emitCatchClause(ast); - case 237 /* FinallyClause */: - return this.emitFinallyClause(ast); - case 160 /* LabeledStatement */: - return this.emitLabeledStatement(ast); - case 161 /* DoStatement */: - return this.emitDoStatement(ast); - case 171 /* TypeOfExpression */: - return this.emitTypeOfExpression(ast); - case 170 /* DeleteExpression */: - return this.emitDeleteExpression(ast); - case 172 /* VoidExpression */: - return this.emitVoidExpression(ast); - case 162 /* DebuggerStatement */: - return this.emitDebuggerStatement(ast); - } - }; - return Emitter; - })(); - TypeScript.Emitter = Emitter; - - function getLastConstructor(classDecl) { - return classDecl.classElements.lastOrDefault(function (e) { - return e.kind() === 137 /* ConstructorDeclaration */; - }); - } - TypeScript.getLastConstructor = getLastConstructor; - - function getTrimmedTextLines(comment) { - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - return comment.fullText().split("\n").map(function (s) { - return s.trim(); - }); - } else { - return [comment.fullText().trim()]; - } - } - TypeScript.getTrimmedTextLines = getTrimmedTextLines; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var MemberName = (function () { - function MemberName() { - this.prefix = ""; - this.suffix = ""; - } - MemberName.prototype.isString = function () { - return false; - }; - MemberName.prototype.isArray = function () { - return false; - }; - MemberName.prototype.isMarker = function () { - return !this.isString() && !this.isArray(); - }; - - MemberName.prototype.toString = function () { - return MemberName.memberNameToString(this); - }; - - MemberName.memberNameToString = function (memberName, markerInfo, markerBaseLength) { - if (typeof markerBaseLength === "undefined") { markerBaseLength = 0; } - var result = memberName.prefix; - - if (memberName.isString()) { - result += memberName.text; - } else if (memberName.isArray()) { - var ar = memberName; - for (var index = 0; index < ar.entries.length; index++) { - if (ar.entries[index].isMarker()) { - if (markerInfo) { - markerInfo.push(markerBaseLength + result.length); - } - continue; - } - - result += MemberName.memberNameToString(ar.entries[index], markerInfo, markerBaseLength + result.length); - result += ar.delim; - } - } - - result += memberName.suffix; - return result; - }; - - MemberName.create = function (arg1, arg2, arg3) { - if (typeof arg1 === "string") { - return new MemberNameString(arg1); - } else { - var result = new MemberNameArray(); - if (arg2) - result.prefix = arg2; - if (arg3) - result.suffix = arg3; - result.entries.push(arg1); - return result; - } - }; - return MemberName; - })(); - TypeScript.MemberName = MemberName; - - var MemberNameString = (function (_super) { - __extends(MemberNameString, _super); - function MemberNameString(text) { - _super.call(this); - this.text = text; - } - MemberNameString.prototype.isString = function () { - return true; - }; - return MemberNameString; - })(MemberName); - TypeScript.MemberNameString = MemberNameString; - - var MemberNameArray = (function (_super) { - __extends(MemberNameArray, _super); - function MemberNameArray() { - _super.call(this); - this.delim = ""; - this.entries = []; - } - MemberNameArray.prototype.isArray = function () { - return true; - }; - - MemberNameArray.prototype.add = function (entry) { - this.entries.push(entry); - }; - - MemberNameArray.prototype.addAll = function (entries) { - for (var i = 0; i < entries.length; i++) { - this.entries.push(entries[i]); - } - }; - return MemberNameArray; - })(MemberName); - TypeScript.MemberNameArray = MemberNameArray; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function stripStartAndEndQuotes(str) { - var firstCharCode = str && str.charCodeAt(0); - if (str && str.length >= 2 && firstCharCode === str.charCodeAt(str.length - 1) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { - return str.substring(1, str.length - 1); - } - - return str; - } - TypeScript.stripStartAndEndQuotes = stripStartAndEndQuotes; - - function isSingleQuoted(str) { - return str && str.length >= 2 && str.charCodeAt(0) === str.charCodeAt(str.length - 1) && str.charCodeAt(0) === 39 /* singleQuote */; - } - TypeScript.isSingleQuoted = isSingleQuoted; - - function isDoubleQuoted(str) { - return str && str.length >= 2 && str.charCodeAt(0) === str.charCodeAt(str.length - 1) && str.charCodeAt(0) === 34 /* doubleQuote */; - } - TypeScript.isDoubleQuoted = isDoubleQuoted; - - function isQuoted(str) { - return isDoubleQuoted(str) || isSingleQuoted(str); - } - TypeScript.isQuoted = isQuoted; - - function quoteStr(str) { - return "\"" + str + "\""; - } - TypeScript.quoteStr = quoteStr; - - var switchToForwardSlashesRegEx = /\\/g; - function switchToForwardSlashes(path) { - return path.replace(switchToForwardSlashesRegEx, "/"); - } - TypeScript.switchToForwardSlashes = switchToForwardSlashes; - - function trimModName(modName) { - if (modName.length > 5 && modName.substring(modName.length - 5, modName.length) === ".d.ts") { - return modName.substring(0, modName.length - 5); - } - if (modName.length > 3 && modName.substring(modName.length - 3, modName.length) === ".ts") { - return modName.substring(0, modName.length - 3); - } - - if (modName.length > 3 && modName.substring(modName.length - 3, modName.length) === ".js") { - return modName.substring(0, modName.length - 3); - } - - return modName; - } - TypeScript.trimModName = trimModName; - - function getDeclareFilePath(fname) { - return isTSFile(fname) ? changePathToDTS(fname) : changePathToDTS(fname); - } - TypeScript.getDeclareFilePath = getDeclareFilePath; - - function isFileOfExtension(fname, ext) { - var invariantFname = fname.toLocaleUpperCase(); - var invariantExt = ext.toLocaleUpperCase(); - var extLength = invariantExt.length; - return invariantFname.length > extLength && invariantFname.substring(invariantFname.length - extLength, invariantFname.length) === invariantExt; - } - - function isTSFile(fname) { - return isFileOfExtension(fname, ".ts"); - } - TypeScript.isTSFile = isTSFile; - - function isDTSFile(fname) { - return isFileOfExtension(fname, ".d.ts"); - } - TypeScript.isDTSFile = isDTSFile; - - function getPrettyName(modPath, quote, treatAsFileName) { - if (typeof quote === "undefined") { quote = true; } - if (typeof treatAsFileName === "undefined") { treatAsFileName = false; } - var modName = treatAsFileName ? switchToForwardSlashes(modPath) : trimModName(stripStartAndEndQuotes(modPath)); - var components = this.getPathComponents(modName); - return components.length ? (quote ? quoteStr(components[components.length - 1]) : components[components.length - 1]) : modPath; - } - TypeScript.getPrettyName = getPrettyName; - - function getPathComponents(path) { - return path.split("/"); - } - TypeScript.getPathComponents = getPathComponents; - - function getRelativePathToFixedPath(fixedModFilePath, absoluteModPath, isAbsoultePathURL) { - if (typeof isAbsoultePathURL === "undefined") { isAbsoultePathURL = true; } - absoluteModPath = switchToForwardSlashes(absoluteModPath); - - var modComponents = this.getPathComponents(absoluteModPath); - var fixedModComponents = this.getPathComponents(fixedModFilePath); - - var joinStartIndex = 0; - for (; joinStartIndex < modComponents.length && joinStartIndex < fixedModComponents.length; joinStartIndex++) { - if (fixedModComponents[joinStartIndex] !== modComponents[joinStartIndex]) { - break; - } - } - - if (joinStartIndex !== 0) { - var relativePath = ""; - var relativePathComponents = modComponents.slice(joinStartIndex, modComponents.length); - for (; joinStartIndex < fixedModComponents.length; joinStartIndex++) { - if (fixedModComponents[joinStartIndex] !== "") { - relativePath = relativePath + "../"; - } - } - - return relativePath + relativePathComponents.join("/"); - } - - if (isAbsoultePathURL && absoluteModPath.indexOf("://") === -1) { - absoluteModPath = "file:///" + absoluteModPath; - } - - return absoluteModPath; - } - TypeScript.getRelativePathToFixedPath = getRelativePathToFixedPath; - - function changePathToDTS(modPath) { - return trimModName(stripStartAndEndQuotes(modPath)) + ".d.ts"; - } - TypeScript.changePathToDTS = changePathToDTS; - - function isRelative(path) { - return path.length > 0 && path.charAt(0) === "."; - } - TypeScript.isRelative = isRelative; - function isRooted(path) { - return path.length > 0 && (path.charAt(0) === "\\" || path.charAt(0) === "/" || (path.indexOf(":\\") !== -1) || (path.indexOf(":/") !== -1)); - } - TypeScript.isRooted = isRooted; - - function getRootFilePath(outFname) { - if (outFname === "") { - return outFname; - } else { - var isPath = outFname.indexOf("/") !== -1; - return isPath ? filePath(outFname) : ""; - } - } - TypeScript.getRootFilePath = getRootFilePath; - - function filePathComponents(fullPath) { - fullPath = switchToForwardSlashes(fullPath); - var components = getPathComponents(fullPath); - return components.slice(0, components.length - 1); - } - TypeScript.filePathComponents = filePathComponents; - - function filePath(fullPath) { - var path = filePathComponents(fullPath); - return path.join("/") + "/"; - } - TypeScript.filePath = filePath; - - function convertToDirectoryPath(dirPath) { - if (dirPath && dirPath.charAt(dirPath.length - 1) !== "/") { - dirPath += "/"; - } - - return dirPath; - } - TypeScript.convertToDirectoryPath = convertToDirectoryPath; - - var normalizePathRegEx = /^\\\\[^\\]/; - function normalizePath(path) { - if (normalizePathRegEx.test(path)) { - path = "file:" + path; - } - var parts = this.getPathComponents(switchToForwardSlashes(path)); - var normalizedParts = []; - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part === ".") { - continue; - } - - if (normalizedParts.length > 0 && TypeScript.ArrayUtilities.last(normalizedParts) !== ".." && part === "..") { - normalizedParts.pop(); - continue; - } - - normalizedParts.push(part); - } - - return normalizedParts.join("/"); - } - TypeScript.normalizePath = normalizePath; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - - - function isNoDefaultLibMatch(comment) { - var isNoDefaultLibRegex = /^(\/\/\/\s*/gim; - return isNoDefaultLibRegex.exec(comment); - } - - TypeScript.tripleSlashReferenceRegExp = /^(\/\/\/\s*/; - - function getFileReferenceFromReferencePath(fileName, lineMap, position, comment, diagnostics) { - var simpleReferenceRegEx = /^\/\/\/\s*= 7 && fullReference[6] === "true"; - if (isResident) { - TypeScript.CompilerDiagnostics.debugPrint(path + " is resident"); - } - return { - line: 0, - character: 0, - position: 0, - length: 0, - path: TypeScript.switchToForwardSlashes(adjustedPath), - isResident: isResident - }; - } - } - } - - return null; - } - - var scannerWindow = TypeScript.ArrayUtilities.createArray(2048, 0); - var scannerDiagnostics = []; - - function processImports(lineMap, scanner, token, importedFiles) { - var position = 0; - var lineChar = { line: -1, character: -1 }; - - var start = new Date().getTime(); - - while (token.tokenKind !== 10 /* EndOfFileToken */) { - if (token.tokenKind === 49 /* ImportKeyword */) { - var importStart = position + token.leadingTriviaWidth(); - token = scanner.scan(scannerDiagnostics, false); - - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { - token = scanner.scan(scannerDiagnostics, false); - - if (token.tokenKind === 107 /* EqualsToken */) { - token = scanner.scan(scannerDiagnostics, false); - - if (token.tokenKind === 65 /* ModuleKeyword */ || token.tokenKind === 66 /* RequireKeyword */) { - token = scanner.scan(scannerDiagnostics, false); - - if (token.tokenKind === 72 /* OpenParenToken */) { - var afterOpenParenPosition = scanner.absoluteIndex(); - token = scanner.scan(scannerDiagnostics, false); - - lineMap.fillLineAndCharacterFromPosition(importStart, lineChar); - - if (token.tokenKind === 14 /* StringLiteral */) { - var ref = { - line: lineChar.line, - character: lineChar.character, - position: afterOpenParenPosition + token.leadingTriviaWidth(), - length: token.width(), - path: TypeScript.stripStartAndEndQuotes(TypeScript.switchToForwardSlashes(token.text())), - isResident: false - }; - importedFiles.push(ref); - } - } - } - } - } - } - - position = scanner.absoluteIndex(); - token = scanner.scan(scannerDiagnostics, false); - } - - var totalTime = new Date().getTime() - start; - TypeScript.fileResolutionScanImportsTime += totalTime; - } - - function processTripleSlashDirectives(fileName, lineMap, firstToken) { - var leadingTrivia = firstToken.leadingTrivia(); - - var position = 0; - var lineChar = { line: -1, character: -1 }; - var noDefaultLib = false; - var diagnostics = []; - var referencedFiles = []; - - for (var i = 0, n = leadingTrivia.count(); i < n; i++) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - - if (trivia.kind() === 7 /* SingleLineCommentTrivia */) { - var triviaText = trivia.fullText(); - var referencedCode = getFileReferenceFromReferencePath(fileName, lineMap, position, triviaText, diagnostics); - - if (referencedCode) { - lineMap.fillLineAndCharacterFromPosition(position, lineChar); - referencedCode.position = position; - referencedCode.length = trivia.fullWidth(); - referencedCode.line = lineChar.line; - referencedCode.character = lineChar.character; - - referencedFiles.push(referencedCode); - } - - var isNoDefaultLib = isNoDefaultLibMatch(triviaText); - if (isNoDefaultLib) { - noDefaultLib = isNoDefaultLib[3] === "true"; - } - } - - position += trivia.fullWidth(); - } - - return { noDefaultLib: noDefaultLib, diagnostics: diagnostics, referencedFiles: referencedFiles }; - } - - function preProcessFile(fileName, sourceText, readImportFiles) { - if (typeof readImportFiles === "undefined") { readImportFiles = true; } - var text = TypeScript.SimpleText.fromScriptSnapshot(sourceText); - var scanner = new TypeScript.Scanner(fileName, text, 1 /* EcmaScript5 */, scannerWindow); - - var firstToken = scanner.scan(scannerDiagnostics, false); - - var importedFiles = []; - if (readImportFiles) { - processImports(text.lineMap(), scanner, firstToken, importedFiles); - } - - var properties = processTripleSlashDirectives(fileName, text.lineMap(), firstToken); - - scannerDiagnostics.length = 0; - return { referencedFiles: properties.referencedFiles, importedFiles: importedFiles, isLibFile: properties.noDefaultLib, diagnostics: properties.diagnostics }; - } - TypeScript.preProcessFile = preProcessFile; - - function getParseOptions(settings) { - return new TypeScript.ParseOptions(settings.codeGenTarget(), settings.allowAutomaticSemicolonInsertion()); - } - TypeScript.getParseOptions = getParseOptions; - - function getReferencedFiles(fileName, sourceText) { - return preProcessFile(fileName, sourceText, false).referencedFiles; - } - TypeScript.getReferencedFiles = getReferencedFiles; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ReferenceResolutionResult = (function () { - function ReferenceResolutionResult() { - this.resolvedFiles = []; - this.diagnostics = []; - this.seenNoDefaultLibTag = false; - } - return ReferenceResolutionResult; - })(); - TypeScript.ReferenceResolutionResult = ReferenceResolutionResult; - - var ReferenceLocation = (function () { - function ReferenceLocation(filePath, lineMap, position, length, isImported) { - this.filePath = filePath; - this.lineMap = lineMap; - this.position = position; - this.length = length; - this.isImported = isImported; - } - return ReferenceLocation; - })(); - - var ReferenceResolver = (function () { - function ReferenceResolver(inputFileNames, host, useCaseSensitiveFileResolution) { - this.useCaseSensitiveFileResolution = useCaseSensitiveFileResolution; - this.inputFileNames = inputFileNames; - this.host = host; - this.visited = {}; - } - ReferenceResolver.resolve = function (inputFileNames, host, useCaseSensitiveFileResolution) { - var resolver = new ReferenceResolver(inputFileNames, host, useCaseSensitiveFileResolution); - return resolver.resolveInputFiles(); - }; - - ReferenceResolver.prototype.resolveInputFiles = function () { - var _this = this; - var result = new ReferenceResolutionResult(); - - if (!this.inputFileNames || this.inputFileNames.length <= 0) { - return result; - } - - var referenceLocation = new ReferenceLocation(null, null, 0, 0, false); - this.inputFileNames.forEach(function (fileName) { - return _this.resolveIncludedFile(fileName, referenceLocation, result); - }); - - return result; - }; - - ReferenceResolver.prototype.resolveIncludedFile = function (path, referenceLocation, resolutionResult) { - var normalizedPath = this.getNormalizedFilePath(path, referenceLocation.filePath); - - if (this.isSameFile(normalizedPath, referenceLocation.filePath)) { - if (!referenceLocation.isImported) { - resolutionResult.diagnostics.push(new TypeScript.Diagnostic(referenceLocation.filePath, referenceLocation.lineMap, referenceLocation.position, referenceLocation.length, TypeScript.DiagnosticCode.A_file_cannot_have_a_reference_to_itself, null)); - } - - return normalizedPath; - } - - if (!TypeScript.isTSFile(normalizedPath) && !TypeScript.isDTSFile(normalizedPath)) { - var dtsFile = normalizedPath + ".d.ts"; - var tsFile = normalizedPath + ".ts"; - - if (this.host.fileExists(tsFile)) { - normalizedPath = tsFile; - } else { - normalizedPath = dtsFile; - } - } - - if (!this.host.fileExists(normalizedPath)) { - if (!referenceLocation.isImported) { - resolutionResult.diagnostics.push(new TypeScript.Diagnostic(referenceLocation.filePath, referenceLocation.lineMap, referenceLocation.position, referenceLocation.length, TypeScript.DiagnosticCode.Cannot_resolve_referenced_file_0, [path])); - } - - return normalizedPath; - } - - return this.resolveFile(normalizedPath, resolutionResult); - }; - - ReferenceResolver.prototype.resolveImportedFile = function (path, referenceLocation, resolutionResult) { - var isRelativePath = TypeScript.isRelative(path); - var isRootedPath = isRelativePath ? false : TypeScript.isRooted(path); - - if (isRelativePath || isRootedPath) { - return this.resolveIncludedFile(path, referenceLocation, resolutionResult); - } else { - var parentDirectory = this.host.getParentDirectory(referenceLocation.filePath); - var searchFilePath = null; - var dtsFileName = path + ".d.ts"; - var tsFilePath = path + ".ts"; - - var start = new Date().getTime(); - - do { - currentFilePath = this.host.resolveRelativePath(tsFilePath, parentDirectory); - if (this.host.fileExists(currentFilePath)) { - searchFilePath = currentFilePath; - break; - } - - var currentFilePath = this.host.resolveRelativePath(dtsFileName, parentDirectory); - if (this.host.fileExists(currentFilePath)) { - searchFilePath = currentFilePath; - break; - } - - parentDirectory = this.host.getParentDirectory(parentDirectory); - } while(parentDirectory); - - TypeScript.fileResolutionImportFileSearchTime += new Date().getTime() - start; - - if (!searchFilePath) { - return path; - } - - return this.resolveFile(searchFilePath, resolutionResult); - } - }; - - ReferenceResolver.prototype.resolveFile = function (normalizedPath, resolutionResult) { - var _this = this; - var visitedPath = this.isVisited(normalizedPath); - if (!visitedPath) { - this.recordVisitedFile(normalizedPath); - - var start = new Date().getTime(); - var scriptSnapshot = this.host.getScriptSnapshot(normalizedPath); - var totalTime = new Date().getTime() - start; - TypeScript.fileResolutionIOTime += totalTime; - - var lineMap = TypeScript.LineMap1.fromScriptSnapshot(scriptSnapshot); - var preprocessedFileInformation = TypeScript.preProcessFile(normalizedPath, scriptSnapshot); - resolutionResult.diagnostics.push.apply(resolutionResult.diagnostics, preprocessedFileInformation.diagnostics); - - if (preprocessedFileInformation.isLibFile) { - resolutionResult.seenNoDefaultLibTag = true; - } - - var normalizedReferencePaths = []; - preprocessedFileInformation.referencedFiles.forEach(function (fileReference) { - var currentReferenceLocation = new ReferenceLocation(normalizedPath, lineMap, fileReference.position, fileReference.length, false); - var normalizedReferencePath = _this.resolveIncludedFile(fileReference.path, currentReferenceLocation, resolutionResult); - normalizedReferencePaths.push(normalizedReferencePath); - }); - - var normalizedImportPaths = []; - for (var i = 0; i < preprocessedFileInformation.importedFiles.length; i++) { - var fileImport = preprocessedFileInformation.importedFiles[i]; - var currentReferenceLocation = new ReferenceLocation(normalizedPath, lineMap, fileImport.position, fileImport.length, true); - var normalizedImportPath = this.resolveImportedFile(fileImport.path, currentReferenceLocation, resolutionResult); - normalizedImportPaths.push(normalizedImportPath); - } - - resolutionResult.resolvedFiles.push({ - path: normalizedPath, - referencedFiles: normalizedReferencePaths, - importedFiles: normalizedImportPaths - }); - } else { - normalizedPath = visitedPath; - } - - return normalizedPath; - }; - - ReferenceResolver.prototype.getNormalizedFilePath = function (path, parentFilePath) { - var parentFileDirectory = parentFilePath ? this.host.getParentDirectory(parentFilePath) : ""; - var normalizedPath = this.host.resolveRelativePath(path, parentFileDirectory); - return normalizedPath; - }; - - ReferenceResolver.prototype.getUniqueFileId = function (filePath) { - return this.useCaseSensitiveFileResolution ? filePath : filePath.toLocaleUpperCase(); - }; - - ReferenceResolver.prototype.recordVisitedFile = function (filePath) { - this.visited[this.getUniqueFileId(filePath)] = filePath; - }; - - ReferenceResolver.prototype.isVisited = function (filePath) { - return this.visited[this.getUniqueFileId(filePath)]; - }; - - ReferenceResolver.prototype.isSameFile = function (filePath1, filePath2) { - if (!filePath1 || !filePath2) { - return false; - } - - if (this.useCaseSensitiveFileResolution) { - return filePath1 === filePath2; - } else { - return filePath1.toLocaleUpperCase() === filePath2.toLocaleUpperCase(); - } - }; - return ReferenceResolver; - })(); - TypeScript.ReferenceResolver = ReferenceResolver; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextWriter = (function () { - function TextWriter(name, writeByteOrderMark, outputFileType) { - this.name = name; - this.writeByteOrderMark = writeByteOrderMark; - this.outputFileType = outputFileType; - this.contents = ""; - this.onNewLine = true; - } - TextWriter.prototype.Write = function (s) { - this.contents += s; - this.onNewLine = false; - }; - - TextWriter.prototype.WriteLine = function (s) { - this.contents += s; - this.contents += TypeScript.newLine(); - this.onNewLine = true; - }; - - TextWriter.prototype.Close = function () { - }; - - TextWriter.prototype.getOutputFile = function () { - return new TypeScript.OutputFile(this.name, this.writeByteOrderMark, this.contents, this.outputFileType); - }; - return TextWriter; - })(); - TypeScript.TextWriter = TextWriter; - - var DeclarationEmitter = (function () { - function DeclarationEmitter(emittingFileName, document, compiler, emitOptions, semanticInfoChain) { - this.emittingFileName = emittingFileName; - this.document = document; - this.compiler = compiler; - this.emitOptions = emitOptions; - this.semanticInfoChain = semanticInfoChain; - this.declFile = null; - this.indenter = new TypeScript.Indenter(); - this.emittedReferencePaths = false; - this.declFile = new TextWriter(emittingFileName, this.document.byteOrderMark !== 0 /* None */, 2 /* Declaration */); - } - DeclarationEmitter.prototype.getOutputFile = function () { - return this.declFile.getOutputFile(); - }; - - DeclarationEmitter.prototype.emitDeclarations = function (sourceUnit) { - this.emitDeclarationsForSourceUnit(sourceUnit); - }; - - DeclarationEmitter.prototype.emitDeclarationsForList = function (list) { - for (var i = 0, n = list.childCount(); i < n; i++) { - this.emitDeclarationsForAST(list.childAt(i)); - } - }; - - DeclarationEmitter.prototype.emitSeparatedList = function (list) { - for (var i = 0, n = list.nonSeparatorCount(); i < n; i++) { - this.emitDeclarationsForAST(list.nonSeparatorAt(i)); - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForAST = function (ast) { - switch (ast.kind()) { - case 148 /* VariableStatement */: - return this.emitDeclarationsForVariableStatement(ast); - case 141 /* PropertySignature */: - return this.emitPropertySignature(ast); - case 225 /* VariableDeclarator */: - return this.emitVariableDeclarator(ast, true, true); - case 136 /* MemberVariableDeclaration */: - return this.emitDeclarationsForMemberVariableDeclaration(ast); - case 137 /* ConstructorDeclaration */: - return this.emitDeclarationsForConstructorDeclaration(ast); - case 139 /* GetAccessor */: - return this.emitDeclarationsForGetAccessor(ast); - case 140 /* SetAccessor */: - return this.emitDeclarationsForSetAccessor(ast); - case 138 /* IndexMemberDeclaration */: - return this.emitIndexMemberDeclaration(ast); - case 144 /* IndexSignature */: - return this.emitIndexSignature(ast); - case 142 /* CallSignature */: - return this.emitCallSignature(ast); - case 143 /* ConstructSignature */: - return this.emitConstructSignature(ast); - case 145 /* MethodSignature */: - return this.emitMethodSignature(ast); - case 129 /* FunctionDeclaration */: - return this.emitDeclarationsForFunctionDeclaration(ast); - case 135 /* MemberFunctionDeclaration */: - return this.emitMemberFunctionDeclaration(ast); - case 131 /* ClassDeclaration */: - return this.emitDeclarationsForClassDeclaration(ast); - case 128 /* InterfaceDeclaration */: - return this.emitDeclarationsForInterfaceDeclaration(ast); - case 133 /* ImportDeclaration */: - return this.emitDeclarationsForImportDeclaration(ast); - case 130 /* ModuleDeclaration */: - return this.emitDeclarationsForModuleDeclaration(ast); - case 132 /* EnumDeclaration */: - return this.emitDeclarationsForEnumDeclaration(ast); - case 134 /* ExportAssignment */: - return this.emitDeclarationsForExportAssignment(ast); - } - }; - - DeclarationEmitter.prototype.getIndentString = function (declIndent) { - if (typeof declIndent === "undefined") { declIndent = false; } - return this.indenter.getIndent(); - }; - - DeclarationEmitter.prototype.emitIndent = function () { - this.declFile.Write(this.getIndentString()); - }; - - DeclarationEmitter.prototype.canEmitDeclarations = function (declAST) { - var container = DeclarationEmitter.getEnclosingContainer(declAST); - if (container.kind() === 130 /* ModuleDeclaration */ || container.kind() === 120 /* SourceUnit */) { - var pullDecl = this.semanticInfoChain.getDeclForAST(declAST); - if (!TypeScript.hasFlag(pullDecl.flags, 1 /* Exported */)) { - var start = new Date().getTime(); - var declSymbol = this.semanticInfoChain.getSymbolForAST(declAST); - var result = declSymbol && declSymbol.isExternallyVisible(); - TypeScript.declarationEmitIsExternallyVisibleTime += new Date().getTime() - start; - - return result; - } - } - - return true; - }; - - DeclarationEmitter.prototype.getDeclFlagsString = function (pullDecl, typeString) { - var result = this.getIndentString(); - var pullFlags = pullDecl.flags; - - if (TypeScript.hasFlag(pullFlags, 16 /* Static */)) { - if (TypeScript.hasFlag(pullFlags, 2 /* Private */)) { - result += "private "; - } - result += "static "; - } else { - if (TypeScript.hasFlag(pullFlags, 2 /* Private */)) { - result += "private "; - } else if (TypeScript.hasFlag(pullFlags, 4 /* Public */)) { - result += "public "; - } else { - var emitDeclare = !TypeScript.hasFlag(pullFlags, 1 /* Exported */); - - var declAST = this.semanticInfoChain.getASTForDecl(pullDecl); - var container = DeclarationEmitter.getEnclosingContainer(declAST); - - var isExternalModule = container.kind() === 120 /* SourceUnit */ && this.document.isExternalModule(); - - if (isExternalModule && TypeScript.hasFlag(pullFlags, 1 /* Exported */)) { - result += "export "; - emitDeclare = true; - } - - if (isExternalModule || container.kind() === 120 /* SourceUnit */) { - if (emitDeclare && typeString !== "interface" && typeString !== "import") { - result += "declare "; - } - } - - result += typeString + " "; - } - } - - return result; - }; - - DeclarationEmitter.prototype.emitDeclFlags = function (declarationAST, typeString) { - this.declFile.Write(this.getDeclFlagsString(this.semanticInfoChain.getDeclForAST(declarationAST), typeString)); - }; - - DeclarationEmitter.prototype.emitTypeNamesMember = function (memberName, emitIndent) { - if (typeof emitIndent === "undefined") { emitIndent = false; } - if (memberName.prefix === "{ ") { - if (emitIndent) { - this.emitIndent(); - } - - this.declFile.WriteLine("{"); - this.indenter.increaseIndent(); - emitIndent = true; - } else if (memberName.prefix !== "") { - if (emitIndent) { - this.emitIndent(); - } - - this.declFile.Write(memberName.prefix); - emitIndent = false; - } - - if (memberName.isString()) { - if (emitIndent) { - this.emitIndent(); - } - - this.declFile.Write(memberName.text); - } else if (memberName.isArray()) { - var ar = memberName; - for (var index = 0; index < ar.entries.length; index++) { - this.emitTypeNamesMember(ar.entries[index], emitIndent); - if (ar.delim === "; ") { - this.declFile.WriteLine(";"); - } - } - } - - if (memberName.suffix === "}") { - this.indenter.decreaseIndent(); - this.emitIndent(); - this.declFile.Write(memberName.suffix); - } else { - this.declFile.Write(memberName.suffix); - } - }; - - DeclarationEmitter.prototype.emitTypeSignature = function (ast, type) { - var declarationContainerAst = DeclarationEmitter.getEnclosingContainer(ast); - - var start = new Date().getTime(); - var declarationContainerDecl = this.semanticInfoChain.getDeclForAST(declarationContainerAst); - - var declarationPullSymbol = declarationContainerDecl.getSymbol(); - TypeScript.declarationEmitTypeSignatureTime += new Date().getTime() - start; - - var isNotAGenericType = ast.kind() !== 126 /* GenericType */; - - var typeNameMembers = type.getScopedNameEx(declarationPullSymbol, false, false, false, false, false, isNotAGenericType); - this.emitTypeNamesMember(typeNameMembers); - }; - - DeclarationEmitter.prototype.emitComment = function (comment) { - var text = TypeScript.getTrimmedTextLines(comment); - if (this.declFile.onNewLine) { - this.emitIndent(); - } else if (comment.kind() !== 6 /* MultiLineCommentTrivia */) { - this.declFile.WriteLine(""); - this.emitIndent(); - } - - this.declFile.Write(text[0]); - - for (var i = 1; i < text.length; i++) { - this.declFile.WriteLine(""); - this.emitIndent(); - this.declFile.Write(text[i]); - } - - if (comment.endsLine || comment.kind() !== 6 /* MultiLineCommentTrivia */) { - this.declFile.WriteLine(""); - } else { - this.declFile.Write(" "); - } - }; - - DeclarationEmitter.prototype.emitDeclarationComments = function (astOrSymbol, endLine) { - if (typeof endLine === "undefined") { endLine = true; } - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var declComments = astOrSymbol.docComments ? astOrSymbol.docComments() : TypeScript.ASTHelpers.docComments(astOrSymbol); - this.writeDeclarationComments(declComments, endLine); - }; - - DeclarationEmitter.prototype.writeDeclarationComments = function (declComments, endLine) { - if (typeof endLine === "undefined") { endLine = true; } - if (declComments.length > 0) { - for (var i = 0; i < declComments.length; i++) { - this.emitComment(declComments[i]); - } - - if (endLine) { - if (!this.declFile.onNewLine) { - this.declFile.WriteLine(""); - } - } else { - if (this.declFile.onNewLine) { - this.emitIndent(); - } - } - } - }; - - DeclarationEmitter.prototype.emitTypeOfVariableDeclaratorOrParameter = function (boundDecl) { - var start = new Date().getTime(); - var decl = this.semanticInfoChain.getDeclForAST(boundDecl); - var pullSymbol = decl.getSymbol(); - TypeScript.declarationEmitGetBoundDeclTypeTime += new Date().getTime() - start; - - var type = pullSymbol.type; - TypeScript.Debug.assert(type); - - this.declFile.Write(": "); - this.emitTypeSignature(boundDecl, type); - }; - - DeclarationEmitter.prototype.emitPropertySignature = function (varDecl) { - this.emitDeclarationComments(varDecl); - this.emitIndent(); - this.declFile.Write(varDecl.propertyName.text()); - if (varDecl.questionToken) { - this.declFile.Write("?"); - } - - this.emitTypeOfVariableDeclaratorOrParameter(varDecl); - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitVariableDeclarator = function (varDecl, isFirstVarInList, isLastVarInList) { - if (this.canEmitDeclarations(varDecl)) { - this.emitDeclarationComments(varDecl); - - if (isFirstVarInList) { - this.emitDeclFlags(varDecl, "var"); - } - - this.declFile.Write(varDecl.propertyName.text()); - - if (!TypeScript.hasModifier(TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl), 2 /* Private */)) { - this.emitTypeOfVariableDeclaratorOrParameter(varDecl); - } - - if (isLastVarInList) { - this.declFile.WriteLine(";"); - } else { - this.declFile.Write(", "); - } - } - }; - - DeclarationEmitter.prototype.emitClassElementModifiers = function (modifiers) { - if (TypeScript.hasModifier(modifiers, 16 /* Static */)) { - if (TypeScript.hasModifier(modifiers, 2 /* Private */)) { - this.declFile.Write("private "); - } - this.declFile.Write("static "); - } else { - if (TypeScript.hasModifier(modifiers, 2 /* Private */)) { - this.declFile.Write("private "); - } else { - this.declFile.Write("public "); - } - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForMemberVariableDeclaration = function (varDecl) { - if (this.canEmitDeclarations(varDecl)) { - this.emitDeclarationComments(varDecl); - - this.declFile.Write(this.getIndentString()); - this.emitClassElementModifiers(varDecl.modifiers); - ; - - this.declFile.Write(varDecl.variableDeclarator.propertyName.text()); - - if (!TypeScript.hasModifier(varDecl.modifiers, 2 /* Private */)) { - this.emitTypeOfVariableDeclaratorOrParameter(varDecl); - } - - this.declFile.WriteLine(";"); - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForVariableStatement = function (variableStatement) { - this.emitDeclarationsForVariableDeclaration(variableStatement.declaration); - }; - - DeclarationEmitter.prototype.emitDeclarationsForVariableDeclaration = function (variableDeclaration) { - var varListCount = variableDeclaration.declarators.nonSeparatorCount(); - for (var i = 0; i < varListCount; i++) { - this.emitVariableDeclarator(variableDeclaration.declarators.nonSeparatorAt(i), i === 0, i === varListCount - 1); - } - }; - - DeclarationEmitter.prototype.emitArgDecl = function (argDecl, id, isOptional, isPrivate) { - this.indenter.increaseIndent(); - - this.emitDeclarationComments(argDecl, false); - this.declFile.Write(id.text()); - if (isOptional) { - this.declFile.Write("?"); - } - - this.indenter.decreaseIndent(); - - if (!isPrivate) { - this.emitTypeOfVariableDeclaratorOrParameter(argDecl); - } - }; - - DeclarationEmitter.prototype.isOverloadedCallSignature = function (funcDecl) { - var start = new Date().getTime(); - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSymbol = functionDecl.getSymbol(); - TypeScript.declarationEmitIsOverloadedCallSignatureTime += new Date().getTime() - start; - - var funcTypeSymbol = funcSymbol.type; - var signatures = funcTypeSymbol.getCallSignatures(); - var result = signatures && signatures.length > 1; - - return result; - }; - - DeclarationEmitter.prototype.emitDeclarationsForConstructorDeclaration = function (funcDecl) { - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - var funcTypeSymbol = funcSymbol.type; - if (funcDecl.block) { - var constructSignatures = funcTypeSymbol.getConstructSignatures(); - if (constructSignatures && constructSignatures.length > 1) { - return; - } - } - - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write("constructor"); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitParameterList = function (isPrivate, parameterList) { - this.declFile.Write("("); - this.emitParameters(isPrivate, TypeScript.ASTHelpers.parametersFromParameterList(parameterList)); - this.declFile.Write(")"); - }; - - DeclarationEmitter.prototype.emitParameters = function (isPrivate, parameterList) { - var hasLastParameterRestParameter = parameterList.lastParameterIsRest(); - var argsLen = parameterList.length; - if (hasLastParameterRestParameter) { - argsLen--; - } - - for (var i = 0; i < argsLen; i++) { - this.emitArgDecl(parameterList.astAt(i), parameterList.identifierAt(i), parameterList.isOptionalAt(i), isPrivate); - if (i < (argsLen - 1)) { - this.declFile.Write(", "); - } - } - - if (hasLastParameterRestParameter) { - if (parameterList.length > 1) { - this.declFile.Write(", ..."); - } else { - this.declFile.Write("..."); - } - - var index = parameterList.length - 1; - this.emitArgDecl(parameterList.astAt(index), parameterList.identifierAt(index), parameterList.isOptionalAt(index), isPrivate); - } - }; - - DeclarationEmitter.prototype.emitMemberFunctionDeclaration = function (funcDecl) { - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - var funcTypeSymbol = funcSymbol.type; - if (funcDecl.block) { - var constructSignatures = funcTypeSymbol.getConstructSignatures(); - if (constructSignatures && constructSignatures.length > 1) { - return; - } else if (this.isOverloadedCallSignature(funcDecl)) { - return; - } - } else if (TypeScript.hasModifier(funcDecl.modifiers, 2 /* Private */) && this.isOverloadedCallSignature(funcDecl)) { - var callSignatures = funcTypeSymbol.getCallSignatures(); - TypeScript.Debug.assert(callSignatures && callSignatures.length > 1); - var firstSignature = callSignatures[0].isDefinition() ? callSignatures[1] : callSignatures[0]; - var firstSignatureDecl = firstSignature.getDeclarations()[0]; - var firstFuncDecl = this.semanticInfoChain.getASTForDecl(firstSignatureDecl); - if (firstFuncDecl !== funcDecl) { - return; - } - } - - if (!this.canEmitDeclarations(funcDecl)) { - return; - } - - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitDeclarationComments(funcDecl); - - this.emitDeclFlags(funcDecl, "function"); - var id = funcDecl.propertyName.text(); - this.declFile.Write(id); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - var isPrivate = TypeScript.hasModifier(funcDecl.modifiers, 2 /* Private */); - - this.emitParameterList(isPrivate, funcDecl.callSignature.parameterList); - - if (!isPrivate) { - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - this.emitTypeSignature(funcDecl, returnType); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitCallSignature = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - this.emitDeclarationComments(funcDecl); - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.typeParameterList, funcSignature); - - this.emitIndent(); - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitConstructSignature = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write("new"); - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitMethodSignature = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write(funcDecl.propertyName.text()); - if (funcDecl.questionToken) { - this.declFile.Write("? "); - } - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForFunctionDeclaration = function (funcDecl) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - - var start = new Date().getTime(); - var funcSymbol = this.semanticInfoChain.getSymbolForAST(funcDecl); - - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime += new Date().getTime() - start; - - if (funcDecl.block) { - var funcTypeSymbol = funcSymbol.type; - var constructSignatures = funcTypeSymbol.getConstructSignatures(); - if (constructSignatures && constructSignatures.length > 1) { - return; - } else if (this.isOverloadedCallSignature(funcDecl)) { - return; - } - } - - if (!this.canEmitDeclarations(funcDecl)) { - return; - } - - this.emitDeclarationComments(funcDecl); - - var id = funcDecl.identifier.text(); - this.emitDeclFlags(funcDecl, "function"); - if (id !== "" || !funcDecl.identifier || funcDecl.identifier.text().length > 0) { - this.declFile.Write(id); - } else if (funcPullDecl.kind === 2097152 /* ConstructSignature */) { - this.declFile.Write("new"); - } - - var funcSignature = funcPullDecl.getSignatureSymbol(); - this.emitTypeParameters(funcDecl.callSignature.typeParameterList, funcSignature); - - this.declFile.Write("("); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList)); - this.declFile.Write(")"); - - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - if (returnType) { - this.emitTypeSignature(funcDecl, returnType); - } else { - this.declFile.Write("any"); - } - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitIndexMemberDeclaration = function (funcDecl) { - this.emitDeclarationsForAST(funcDecl.indexSignature); - }; - - DeclarationEmitter.prototype.emitIndexSignature = function (funcDecl) { - if (!this.canEmitDeclarations(funcDecl)) { - return; - } - - this.emitDeclarationComments(funcDecl); - - this.emitIndent(); - this.declFile.Write("["); - this.emitParameters(false, TypeScript.ASTHelpers.parametersFromParameter(funcDecl.parameter)); - this.declFile.Write("]"); - - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSignature = funcPullDecl.getSignatureSymbol(); - var returnType = funcSignature.returnType; - this.declFile.Write(": "); - this.emitTypeSignature(funcDecl, returnType); - - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitBaseList = function (bases, useExtendsList) { - if (bases && (bases.nonSeparatorCount() > 0)) { - var qual = useExtendsList ? "extends" : "implements"; - this.declFile.Write(" " + qual + " "); - var basesLen = bases.nonSeparatorCount(); - for (var i = 0; i < basesLen; i++) { - if (i > 0) { - this.declFile.Write(", "); - } - var base = bases.nonSeparatorAt(i); - var baseType = this.semanticInfoChain.getSymbolForAST(base); - this.emitTypeSignature(base, baseType); - } - } - }; - - DeclarationEmitter.prototype.emitAccessorDeclarationComments = function (funcDecl) { - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var start = new Date().getTime(); - var accessors = TypeScript.PullHelpers.getGetterAndSetterFunction(funcDecl, this.semanticInfoChain); - TypeScript.declarationEmitGetAccessorFunctionTime += new Date().getTime(); - - var comments = []; - if (accessors.getter) { - comments = comments.concat(TypeScript.ASTHelpers.docComments(accessors.getter)); - } - if (accessors.setter) { - comments = comments.concat(TypeScript.ASTHelpers.docComments(accessors.setter)); - } - - this.writeDeclarationComments(comments); - }; - - DeclarationEmitter.prototype.emitDeclarationsForGetAccessor = function (funcDecl) { - this.emitMemberAccessorDeclaration(funcDecl, funcDecl.modifiers, funcDecl.propertyName); - }; - - DeclarationEmitter.prototype.emitDeclarationsForSetAccessor = function (funcDecl) { - this.emitMemberAccessorDeclaration(funcDecl, funcDecl.modifiers, funcDecl.propertyName); - }; - - DeclarationEmitter.prototype.emitMemberAccessorDeclaration = function (funcDecl, modifiers, name) { - var start = new Date().getTime(); - var accessorSymbol = TypeScript.PullHelpers.getAccessorSymbol(funcDecl, this.semanticInfoChain); - TypeScript.declarationEmitGetAccessorFunctionTime += new Date().getTime(); - - if (funcDecl.kind() === 140 /* SetAccessor */ && accessorSymbol.getGetter()) { - return; - } - - var isPrivate = TypeScript.hasModifier(modifiers, 2 /* Private */); - this.emitAccessorDeclarationComments(funcDecl); - this.declFile.Write(this.getIndentString()); - this.emitClassElementModifiers(modifiers); - this.declFile.Write(name.text()); - if (!isPrivate) { - this.declFile.Write(" : "); - var type = accessorSymbol.type; - this.emitTypeSignature(funcDecl, type); - } - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.emitClassMembersFromConstructorDefinition = function (funcDecl) { - var argsLen = funcDecl.callSignature.parameterList.parameters.nonSeparatorCount(); - if (TypeScript.lastParameterIsRest(funcDecl.callSignature.parameterList)) { - argsLen--; - } - - for (var i = 0; i < argsLen; i++) { - var parameter = funcDecl.callSignature.parameterList.parameters.nonSeparatorAt(i); - var parameterDecl = this.semanticInfoChain.getDeclForAST(parameter); - if (TypeScript.hasFlag(parameterDecl.flags, 8388608 /* PropertyParameter */)) { - var funcPullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.emitDeclarationComments(parameter); - this.declFile.Write(this.getIndentString()); - this.emitClassElementModifiers(parameter.modifiers); - this.declFile.Write(parameter.identifier.text()); - - if (!TypeScript.hasModifier(parameter.modifiers, 2 /* Private */)) { - this.emitTypeOfVariableDeclaratorOrParameter(parameter); - } - this.declFile.WriteLine(";"); - } - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForClassDeclaration = function (classDecl) { - if (!this.canEmitDeclarations(classDecl)) { - return; - } - - var className = classDecl.identifier.text(); - this.emitDeclarationComments(classDecl); - var classPullDecl = this.semanticInfoChain.getDeclForAST(classDecl); - this.emitDeclFlags(classDecl, "class"); - this.declFile.Write(className); - - this.emitTypeParameters(classDecl.typeParameterList); - this.emitHeritageClauses(classDecl.heritageClauses); - this.declFile.WriteLine(" {"); - - this.indenter.increaseIndent(); - var constructorDecl = TypeScript.getLastConstructor(classDecl); - if (constructorDecl) { - this.emitClassMembersFromConstructorDefinition(constructorDecl); - } - - this.emitDeclarationsForList(classDecl.classElements); - - this.indenter.decreaseIndent(); - - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitHeritageClauses = function (clauses) { - if (clauses) { - for (var i = 0, n = clauses.childCount(); i < n; i++) { - this.emitHeritageClause(clauses.childAt(i)); - } - } - }; - - DeclarationEmitter.prototype.emitHeritageClause = function (clause) { - this.emitBaseList(clause.typeNames, clause.kind() === 230 /* ExtendsHeritageClause */); - }; - - DeclarationEmitter.getEnclosingContainer = function (ast) { - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(ast); - ast = enclosingModule || ast; - - ast = ast.parent; - while (ast) { - if (ast.kind() === 131 /* ClassDeclaration */ || ast.kind() === 128 /* InterfaceDeclaration */ || ast.kind() === 130 /* ModuleDeclaration */ || ast.kind() === 120 /* SourceUnit */) { - return ast; - } - - ast = ast.parent; - } - - return null; - }; - - DeclarationEmitter.prototype.emitTypeParameters = function (typeParams, funcSignature) { - if (!typeParams || !typeParams.typeParameters.nonSeparatorCount()) { - return; - } - - this.declFile.Write("<"); - var containerAst = DeclarationEmitter.getEnclosingContainer(typeParams); - - var start = new Date().getTime(); - var containerDecl = this.semanticInfoChain.getDeclForAST(containerAst); - var containerSymbol = containerDecl.getSymbol(); - TypeScript.declarationEmitGetTypeParameterSymbolTime += new Date().getTime() - start; - - var typars; - if (funcSignature) { - typars = funcSignature.getTypeParameters(); - } else { - typars = containerSymbol.getTypeArgumentsOrTypeParameters(); - } - - for (var i = 0; i < typars.length; i++) { - if (i) { - this.declFile.Write(", "); - } - - var memberName = typars[i].getScopedNameEx(containerSymbol, false, true); - this.emitTypeNamesMember(memberName); - } - - this.declFile.Write(">"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForInterfaceDeclaration = function (interfaceDecl) { - if (!this.canEmitDeclarations(interfaceDecl)) { - return; - } - - var interfaceName = interfaceDecl.identifier.text(); - this.emitDeclarationComments(interfaceDecl); - var interfacePullDecl = this.semanticInfoChain.getDeclForAST(interfaceDecl); - this.emitDeclFlags(interfaceDecl, "interface"); - this.declFile.Write(interfaceName); - - this.emitTypeParameters(interfaceDecl.typeParameterList); - this.emitHeritageClauses(interfaceDecl.heritageClauses); - this.declFile.WriteLine(" {"); - - this.indenter.increaseIndent(); - - this.emitSeparatedList(interfaceDecl.body.typeMembers); - - this.indenter.decreaseIndent(); - - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForImportDeclaration = function (importDeclAST) { - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var importSymbol = importDecl.getSymbol(); - var isExportedImportDecl = TypeScript.hasModifier(importDeclAST.modifiers, 1 /* Exported */); - - if (isExportedImportDecl || importSymbol.typeUsedExternally() || TypeScript.PullContainerSymbol.usedAsSymbol(importSymbol.getContainer(), importSymbol)) { - this.emitDeclarationComments(importDeclAST); - this.emitIndent(); - if (isExportedImportDecl) { - this.declFile.Write("export "); - } - this.declFile.Write("import "); - this.declFile.Write(importDeclAST.identifier.text() + " = "); - if (importDeclAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - this.declFile.WriteLine("require(" + importDeclAST.moduleReference.stringLiteral.text() + ");"); - } else { - this.declFile.WriteLine(TypeScript.ASTHelpers.getNameOfIdenfierOrQualifiedName(importDeclAST.moduleReference.moduleName) + ";"); - } - } - }; - - DeclarationEmitter.prototype.emitDeclarationsForEnumDeclaration = function (moduleDecl) { - if (!this.canEmitDeclarations(moduleDecl)) { - return; - } - - this.emitDeclarationComments(moduleDecl); - var modulePullDecl = this.semanticInfoChain.getDeclForAST(moduleDecl); - this.emitDeclFlags(moduleDecl, "enum"); - this.declFile.WriteLine(moduleDecl.identifier.text() + " {"); - - this.indenter.increaseIndent(); - var membersLen = moduleDecl.enumElements.nonSeparatorCount(); - for (var j = 0; j < membersLen; j++) { - var memberDecl = moduleDecl.enumElements.nonSeparatorAt(j); - var enumElement = memberDecl; - var enumElementDecl = this.semanticInfoChain.getDeclForAST(enumElement); - this.emitDeclarationComments(enumElement); - this.emitIndent(); - this.declFile.Write(enumElement.propertyName.text()); - if (enumElementDecl.constantValue !== null) { - this.declFile.Write(" = " + enumElementDecl.constantValue); - } - this.declFile.WriteLine(","); - } - this.indenter.decreaseIndent(); - - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForModuleDeclaration = function (moduleDecl) { - var name = moduleDecl.stringLiteral || TypeScript.ArrayUtilities.first(TypeScript.ASTHelpers.getModuleNames(moduleDecl.name)); - if (!this.canEmitDeclarations(name)) { - return; - } - - this.emitDeclarationComments(moduleDecl); - this.emitDeclFlags(name, "module"); - - if (moduleDecl.stringLiteral) { - this.declFile.Write(moduleDecl.stringLiteral.text()); - } else { - this.declFile.Write(TypeScript.ASTHelpers.getNameOfIdenfierOrQualifiedName(moduleDecl.name)); - } - - this.declFile.WriteLine(" {"); - this.indenter.increaseIndent(); - - this.emitDeclarationsForList(moduleDecl.moduleElements); - - this.indenter.decreaseIndent(); - this.emitIndent(); - this.declFile.WriteLine("}"); - }; - - DeclarationEmitter.prototype.emitDeclarationsForExportAssignment = function (ast) { - this.emitIndent(); - this.declFile.Write("export = "); - this.declFile.Write(ast.identifier.text()); - this.declFile.WriteLine(";"); - }; - - DeclarationEmitter.prototype.resolveScriptReference = function (document, reference) { - if (!this.emitOptions.compilationSettings().noResolve() || TypeScript.isRooted(reference)) { - return reference; - } - - var documentDir = TypeScript.convertToDirectoryPath(TypeScript.switchToForwardSlashes(TypeScript.getRootFilePath(document.fileName))); - var resolvedReferencePath = this.emitOptions.resolvePath(documentDir + reference); - return resolvedReferencePath; - }; - - DeclarationEmitter.prototype.emitReferencePaths = function (sourceUnit) { - if (this.emittedReferencePaths) { - return; - } - - var documents = []; - if (this.document.emitToOwnOutputFile()) { - var scriptReferences = this.document.referencedFiles; - var addedGlobalDocument = false; - for (var j = 0; j < scriptReferences.length; j++) { - var currentReference = this.resolveScriptReference(this.document, scriptReferences[j]); - var document = this.compiler.getDocument(currentReference); - - if (document && (document.emitToOwnOutputFile() || document.isDeclareFile() || !addedGlobalDocument)) { - documents = documents.concat(document); - - if (!document.isDeclareFile() && document.isExternalModule()) { - addedGlobalDocument = true; - } - } - } - } else { - var fileNames = this.compiler.fileNames(); - for (var i = 0; i < fileNames.length; i++) { - var doc = this.compiler.getDocument(fileNames[i]); - if (!doc.isDeclareFile() && !doc.isExternalModule()) { - var scriptReferences = doc.referencedFiles; - for (var j = 0; j < scriptReferences.length; j++) { - var currentReference = this.resolveScriptReference(doc, scriptReferences[j]); - var document = this.compiler.getDocument(currentReference); - - if (document && (document.isDeclareFile() || document.isExternalModule())) { - for (var k = 0; k < documents.length; k++) { - if (documents[k] === document) { - break; - } - } - - if (k === documents.length) { - documents = documents.concat(document); - } - } - } - } - } - } - - var emittingFilePath = documents.length ? TypeScript.getRootFilePath(this.emittingFileName) : null; - for (var i = 0; i < documents.length; i++) { - var document = documents[i]; - var declFileName; - if (document.isDeclareFile()) { - declFileName = document.fileName; - } else { - declFileName = this.compiler.mapOutputFileName(document, this.emitOptions, TypeScript.TypeScriptCompiler.mapToDTSFileName); - } - - declFileName = TypeScript.getRelativePathToFixedPath(emittingFilePath, declFileName, false); - this.declFile.WriteLine('/// '); - } - - this.emittedReferencePaths = true; - }; - - DeclarationEmitter.prototype.emitDeclarationsForSourceUnit = function (sourceUnit) { - this.emitReferencePaths(sourceUnit); - this.emitDeclarationsForList(sourceUnit.moduleElements); - }; - return DeclarationEmitter; - })(); - TypeScript.DeclarationEmitter = DeclarationEmitter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var BloomFilter = (function () { - function BloomFilter(expectedCount) { - var m = Math.max(1, BloomFilter.computeM(expectedCount)); - var k = Math.max(1, BloomFilter.computeK(expectedCount)); - ; - - var sizeInEvenBytes = (m + 7) & ~7; - - this.bitArray = []; - for (var i = 0, len = sizeInEvenBytes; i < len; i++) { - this.bitArray[i] = false; - } - this.hashFunctionCount = k; - } - BloomFilter.computeM = function (expectedCount) { - var p = BloomFilter.falsePositiveProbability; - var n = expectedCount; - - var numerator = n * Math.log(p); - var denominator = Math.log(1.0 / Math.pow(2.0, Math.log(2.0))); - return Math.ceil(numerator / denominator); - }; - - BloomFilter.computeK = function (expectedCount) { - var n = expectedCount; - var m = BloomFilter.computeM(expectedCount); - - var temp = Math.log(2.0) * m / n; - return Math.round(temp); - }; - - BloomFilter.prototype.computeHash = function (key, seed) { - return TypeScript.Hash.computeMurmur2StringHashCode(key, seed); - }; - - BloomFilter.prototype.addKeys = function (keys) { - for (var name in keys) { - if (keys[name]) { - this.add(name); - } - } - }; - - BloomFilter.prototype.add = function (value) { - for (var i = 0; i < this.hashFunctionCount; i++) { - var hash = this.computeHash(value, i); - hash = hash % this.bitArray.length; - this.bitArray[Math.abs(hash)] = true; - } - }; - - BloomFilter.prototype.probablyContains = function (value) { - for (var i = 0; i < this.hashFunctionCount; i++) { - var hash = this.computeHash(value, i); - hash = hash % this.bitArray.length; - if (!this.bitArray[Math.abs(hash)]) { - return false; - } - } - - return true; - }; - - BloomFilter.prototype.isEquivalent = function (filter) { - return BloomFilter.isEquivalent(this.bitArray, filter.bitArray) && this.hashFunctionCount === filter.hashFunctionCount; - }; - - BloomFilter.isEquivalent = function (array1, array2) { - if (array1.length !== array2.length) { - return false; - } - - for (var i = 0; i < array1.length; i++) { - if (array1[i] !== array2[i]) { - return false; - } - } - - return true; - }; - BloomFilter.falsePositiveProbability = 0.0001; - return BloomFilter; - })(); - TypeScript.BloomFilter = BloomFilter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var IdentifierWalker = (function (_super) { - __extends(IdentifierWalker, _super); - function IdentifierWalker(list) { - _super.call(this); - this.list = list; - } - IdentifierWalker.prototype.visitToken = function (token) { - this.list[token.text()] = true; - }; - return IdentifierWalker; - })(TypeScript.SyntaxWalker); - TypeScript.IdentifierWalker = IdentifierWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CompilationSettings = (function () { - function CompilationSettings() { - this.propagateEnumConstants = false; - this.removeComments = false; - this.watch = false; - this.noResolve = false; - this.allowAutomaticSemicolonInsertion = true; - this.noImplicitAny = false; - this.noLib = false; - this.codeGenTarget = 0 /* EcmaScript3 */; - this.moduleGenTarget = 0 /* Unspecified */; - this.outFileOption = ""; - this.outDirOption = ""; - this.mapSourceFiles = false; - this.mapRoot = ""; - this.sourceRoot = ""; - this.generateDeclarationFiles = false; - this.useCaseSensitiveFileResolution = false; - this.gatherDiagnostics = false; - this.codepage = null; - this.createFileLog = false; - } - return CompilationSettings; - })(); - TypeScript.CompilationSettings = CompilationSettings; - - var ImmutableCompilationSettings = (function () { - function ImmutableCompilationSettings(propagateEnumConstants, removeComments, watch, noResolve, allowAutomaticSemicolonInsertion, noImplicitAny, noLib, codeGenTarget, moduleGenTarget, outFileOption, outDirOption, mapSourceFiles, mapRoot, sourceRoot, generateDeclarationFiles, useCaseSensitiveFileResolution, gatherDiagnostics, codepage, createFileLog) { - this._propagateEnumConstants = propagateEnumConstants; - this._removeComments = removeComments; - this._watch = watch; - this._noResolve = noResolve; - this._allowAutomaticSemicolonInsertion = allowAutomaticSemicolonInsertion; - this._noImplicitAny = noImplicitAny; - this._noLib = noLib; - this._codeGenTarget = codeGenTarget; - this._moduleGenTarget = moduleGenTarget; - this._outFileOption = outFileOption; - this._outDirOption = outDirOption; - this._mapSourceFiles = mapSourceFiles; - this._mapRoot = mapRoot; - this._sourceRoot = sourceRoot; - this._generateDeclarationFiles = generateDeclarationFiles; - this._useCaseSensitiveFileResolution = useCaseSensitiveFileResolution; - this._gatherDiagnostics = gatherDiagnostics; - this._codepage = codepage; - this._createFileLog = createFileLog; - } - ImmutableCompilationSettings.prototype.propagateEnumConstants = function () { - return this._propagateEnumConstants; - }; - ImmutableCompilationSettings.prototype.removeComments = function () { - return this._removeComments; - }; - ImmutableCompilationSettings.prototype.watch = function () { - return this._watch; - }; - ImmutableCompilationSettings.prototype.noResolve = function () { - return this._noResolve; - }; - ImmutableCompilationSettings.prototype.allowAutomaticSemicolonInsertion = function () { - return this._allowAutomaticSemicolonInsertion; - }; - ImmutableCompilationSettings.prototype.noImplicitAny = function () { - return this._noImplicitAny; - }; - ImmutableCompilationSettings.prototype.noLib = function () { - return this._noLib; - }; - ImmutableCompilationSettings.prototype.codeGenTarget = function () { - return this._codeGenTarget; - }; - ImmutableCompilationSettings.prototype.moduleGenTarget = function () { - return this._moduleGenTarget; - }; - ImmutableCompilationSettings.prototype.outFileOption = function () { - return this._outFileOption; - }; - ImmutableCompilationSettings.prototype.outDirOption = function () { - return this._outDirOption; - }; - ImmutableCompilationSettings.prototype.mapSourceFiles = function () { - return this._mapSourceFiles; - }; - ImmutableCompilationSettings.prototype.mapRoot = function () { - return this._mapRoot; - }; - ImmutableCompilationSettings.prototype.sourceRoot = function () { - return this._sourceRoot; - }; - ImmutableCompilationSettings.prototype.generateDeclarationFiles = function () { - return this._generateDeclarationFiles; - }; - ImmutableCompilationSettings.prototype.useCaseSensitiveFileResolution = function () { - return this._useCaseSensitiveFileResolution; - }; - ImmutableCompilationSettings.prototype.gatherDiagnostics = function () { - return this._gatherDiagnostics; - }; - ImmutableCompilationSettings.prototype.codepage = function () { - return this._codepage; - }; - ImmutableCompilationSettings.prototype.createFileLog = function () { - return this._createFileLog; - }; - - ImmutableCompilationSettings.defaultSettings = function () { - if (!ImmutableCompilationSettings._defaultSettings) { - ImmutableCompilationSettings._defaultSettings = ImmutableCompilationSettings.fromCompilationSettings(new CompilationSettings()); - } - - return ImmutableCompilationSettings._defaultSettings; - }; - - ImmutableCompilationSettings.fromCompilationSettings = function (settings) { - return new ImmutableCompilationSettings(settings.propagateEnumConstants, settings.removeComments, settings.watch, settings.noResolve, settings.allowAutomaticSemicolonInsertion, settings.noImplicitAny, settings.noLib, settings.codeGenTarget, settings.moduleGenTarget, settings.outFileOption, settings.outDirOption, settings.mapSourceFiles, settings.mapRoot, settings.sourceRoot, settings.generateDeclarationFiles, settings.useCaseSensitiveFileResolution, settings.gatherDiagnostics, settings.codepage, settings.createFileLog); - }; - - ImmutableCompilationSettings.prototype.toCompilationSettings = function () { - var result = new CompilationSettings(); - - var thisAsIndexable = this; - var resultAsIndexable = result; - for (var name in this) { - if (this.hasOwnProperty(name) && TypeScript.StringUtilities.startsWith(name, "_")) { - resultAsIndexable[name.substr(1)] = thisAsIndexable[name]; - } - } - - return result; - }; - return ImmutableCompilationSettings; - })(); - TypeScript.ImmutableCompilationSettings = ImmutableCompilationSettings; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (PullElementFlags) { - PullElementFlags[PullElementFlags["None"] = 0] = "None"; - PullElementFlags[PullElementFlags["Exported"] = 1] = "Exported"; - PullElementFlags[PullElementFlags["Private"] = 1 << 1] = "Private"; - PullElementFlags[PullElementFlags["Public"] = 1 << 2] = "Public"; - PullElementFlags[PullElementFlags["Ambient"] = 1 << 3] = "Ambient"; - PullElementFlags[PullElementFlags["Static"] = 1 << 4] = "Static"; - PullElementFlags[PullElementFlags["Optional"] = 1 << 7] = "Optional"; - PullElementFlags[PullElementFlags["Signature"] = 1 << 11] = "Signature"; - PullElementFlags[PullElementFlags["Enum"] = 1 << 12] = "Enum"; - PullElementFlags[PullElementFlags["ArrowFunction"] = 1 << 13] = "ArrowFunction"; - - PullElementFlags[PullElementFlags["ClassConstructorVariable"] = 1 << 14] = "ClassConstructorVariable"; - PullElementFlags[PullElementFlags["InitializedModule"] = 1 << 15] = "InitializedModule"; - PullElementFlags[PullElementFlags["InitializedDynamicModule"] = 1 << 16] = "InitializedDynamicModule"; - - PullElementFlags[PullElementFlags["MustCaptureThis"] = 1 << 18] = "MustCaptureThis"; - - PullElementFlags[PullElementFlags["DeclaredInAWithBlock"] = 1 << 21] = "DeclaredInAWithBlock"; - - PullElementFlags[PullElementFlags["HasReturnStatement"] = 1 << 22] = "HasReturnStatement"; - - PullElementFlags[PullElementFlags["PropertyParameter"] = 1 << 23] = "PropertyParameter"; - - PullElementFlags[PullElementFlags["IsAnnotatedWithAny"] = 1 << 24] = "IsAnnotatedWithAny"; - - PullElementFlags[PullElementFlags["HasDefaultArgs"] = 1 << 25] = "HasDefaultArgs"; - - PullElementFlags[PullElementFlags["ConstructorParameter"] = 1 << 26] = "ConstructorParameter"; - - PullElementFlags[PullElementFlags["ImplicitVariable"] = PullElementFlags.ClassConstructorVariable | PullElementFlags.InitializedModule | PullElementFlags.InitializedDynamicModule | PullElementFlags.Enum] = "ImplicitVariable"; - PullElementFlags[PullElementFlags["SomeInitializedModule"] = PullElementFlags.InitializedModule | PullElementFlags.InitializedDynamicModule | PullElementFlags.Enum] = "SomeInitializedModule"; - })(TypeScript.PullElementFlags || (TypeScript.PullElementFlags = {})); - var PullElementFlags = TypeScript.PullElementFlags; - - function hasModifier(modifiers, flag) { - for (var i = 0, n = modifiers.length; i < n; i++) { - if (TypeScript.hasFlag(modifiers[i], flag)) { - return true; - } - } - - return false; - } - TypeScript.hasModifier = hasModifier; - - (function (PullElementKind) { - PullElementKind[PullElementKind["None"] = 0] = "None"; - PullElementKind[PullElementKind["Global"] = 0] = "Global"; - - PullElementKind[PullElementKind["Script"] = 1 << 0] = "Script"; - PullElementKind[PullElementKind["Primitive"] = 1 << 1] = "Primitive"; - - PullElementKind[PullElementKind["Container"] = 1 << 2] = "Container"; - PullElementKind[PullElementKind["Class"] = 1 << 3] = "Class"; - PullElementKind[PullElementKind["Interface"] = 1 << 4] = "Interface"; - PullElementKind[PullElementKind["DynamicModule"] = 1 << 5] = "DynamicModule"; - PullElementKind[PullElementKind["Enum"] = 1 << 6] = "Enum"; - PullElementKind[PullElementKind["TypeAlias"] = 1 << 7] = "TypeAlias"; - PullElementKind[PullElementKind["ObjectLiteral"] = 1 << 8] = "ObjectLiteral"; - - PullElementKind[PullElementKind["Variable"] = 1 << 9] = "Variable"; - PullElementKind[PullElementKind["CatchVariable"] = 1 << 10] = "CatchVariable"; - PullElementKind[PullElementKind["Parameter"] = 1 << 11] = "Parameter"; - PullElementKind[PullElementKind["Property"] = 1 << 12] = "Property"; - PullElementKind[PullElementKind["TypeParameter"] = 1 << 13] = "TypeParameter"; - - PullElementKind[PullElementKind["Function"] = 1 << 14] = "Function"; - PullElementKind[PullElementKind["ConstructorMethod"] = 1 << 15] = "ConstructorMethod"; - PullElementKind[PullElementKind["Method"] = 1 << 16] = "Method"; - PullElementKind[PullElementKind["FunctionExpression"] = 1 << 17] = "FunctionExpression"; - - PullElementKind[PullElementKind["GetAccessor"] = 1 << 18] = "GetAccessor"; - PullElementKind[PullElementKind["SetAccessor"] = 1 << 19] = "SetAccessor"; - - PullElementKind[PullElementKind["CallSignature"] = 1 << 20] = "CallSignature"; - PullElementKind[PullElementKind["ConstructSignature"] = 1 << 21] = "ConstructSignature"; - PullElementKind[PullElementKind["IndexSignature"] = 1 << 22] = "IndexSignature"; - - PullElementKind[PullElementKind["ObjectType"] = 1 << 23] = "ObjectType"; - PullElementKind[PullElementKind["FunctionType"] = 1 << 24] = "FunctionType"; - PullElementKind[PullElementKind["ConstructorType"] = 1 << 25] = "ConstructorType"; - - PullElementKind[PullElementKind["EnumMember"] = 1 << 26] = "EnumMember"; - - PullElementKind[PullElementKind["WithBlock"] = 1 << 27] = "WithBlock"; - PullElementKind[PullElementKind["CatchBlock"] = 1 << 28] = "CatchBlock"; - - PullElementKind[PullElementKind["All"] = PullElementKind.Script | PullElementKind.Global | PullElementKind.Primitive | PullElementKind.Container | PullElementKind.Class | PullElementKind.Interface | PullElementKind.DynamicModule | PullElementKind.Enum | PullElementKind.TypeAlias | PullElementKind.ObjectLiteral | PullElementKind.Variable | PullElementKind.Parameter | PullElementKind.Property | PullElementKind.TypeParameter | PullElementKind.Function | PullElementKind.ConstructorMethod | PullElementKind.Method | PullElementKind.FunctionExpression | PullElementKind.GetAccessor | PullElementKind.SetAccessor | PullElementKind.CallSignature | PullElementKind.ConstructSignature | PullElementKind.IndexSignature | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType | PullElementKind.EnumMember | PullElementKind.WithBlock | PullElementKind.CatchBlock] = "All"; - - PullElementKind[PullElementKind["SomeFunction"] = PullElementKind.Function | PullElementKind.ConstructorMethod | PullElementKind.Method | PullElementKind.FunctionExpression | PullElementKind.GetAccessor | PullElementKind.SetAccessor] = "SomeFunction"; - - PullElementKind[PullElementKind["SomeValue"] = PullElementKind.Variable | PullElementKind.Parameter | PullElementKind.Property | PullElementKind.EnumMember | PullElementKind.SomeFunction] = "SomeValue"; - - PullElementKind[PullElementKind["SomeType"] = PullElementKind.Script | PullElementKind.Global | PullElementKind.Primitive | PullElementKind.Class | PullElementKind.Interface | PullElementKind.Enum | PullElementKind.ObjectLiteral | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType | PullElementKind.TypeParameter] = "SomeType"; - - PullElementKind[PullElementKind["AcceptableAlias"] = PullElementKind.Variable | PullElementKind.SomeFunction | PullElementKind.Class | PullElementKind.Interface | PullElementKind.Enum | PullElementKind.Container | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType] = "AcceptableAlias"; - - PullElementKind[PullElementKind["SomeContainer"] = PullElementKind.Container | PullElementKind.DynamicModule | PullElementKind.TypeAlias] = "SomeContainer"; - - PullElementKind[PullElementKind["SomeSignature"] = PullElementKind.CallSignature | PullElementKind.ConstructSignature | PullElementKind.IndexSignature] = "SomeSignature"; - - PullElementKind[PullElementKind["SomeTypeReference"] = PullElementKind.Interface | PullElementKind.ObjectType | PullElementKind.FunctionType | PullElementKind.ConstructorType] = "SomeTypeReference"; - - PullElementKind[PullElementKind["SomeInstantiatableType"] = PullElementKind.Class | PullElementKind.Interface | PullElementKind.TypeParameter] = "SomeInstantiatableType"; - })(TypeScript.PullElementKind || (TypeScript.PullElementKind = {})); - var PullElementKind = TypeScript.PullElementKind; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var pullDeclID = 0; - var sentinelEmptyPullDeclArray = []; - - var PullDecl = (function () { - function PullDecl(declName, displayName, kind, declFlags, semanticInfoChain) { - this.declID = pullDeclID++; - this.flags = 0 /* None */; - this.declGroups = null; - this.childDecls = null; - this.typeParameters = null; - this.synthesizedValDecl = null; - this.containerDecl = null; - this.childDeclTypeCache = null; - this.childDeclValueCache = null; - this.childDeclNamespaceCache = null; - this.childDeclTypeParameterCache = null; - this.name = declName; - this.kind = kind; - this.flags = declFlags; - this.semanticInfoChain = semanticInfoChain; - - if (displayName !== this.name) { - this.declDisplayName = displayName; - } - } - PullDecl.prototype.fileName = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.getParentPath = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.getParentDecl = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.isExternalModule = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype.getEnclosingDecl = function () { - throw TypeScript.Errors.abstract(); - }; - - PullDecl.prototype._getEnclosingDeclFromParentDecl = function () { - var decl = this; - while (decl) { - switch (decl.kind) { - default: - return decl; - case 512 /* Variable */: - case 8192 /* TypeParameter */: - case 2048 /* Parameter */: - case 128 /* TypeAlias */: - case 67108864 /* EnumMember */: - } - - decl = decl.getParentDecl(); - } - - TypeScript.Debug.fail(); - }; - - PullDecl.prototype.getDisplayName = function () { - return this.declDisplayName === undefined ? this.name : this.declDisplayName; - }; - - PullDecl.prototype.setSymbol = function (symbol) { - this.semanticInfoChain.setSymbolForDecl(this, symbol); - }; - - PullDecl.prototype.ensureSymbolIsBound = function () { - if (!this.hasBeenBound() && this.kind !== 1 /* Script */) { - var binder = this.semanticInfoChain.getBinder(); - binder.bindDeclToPullSymbol(this); - } - }; - - PullDecl.prototype.getSymbol = function () { - if (this.kind === 1 /* Script */) { - return null; - } - - this.ensureSymbolIsBound(); - - return this.semanticInfoChain.getSymbolForDecl(this); - }; - - PullDecl.prototype.hasSymbol = function () { - var symbol = this.semanticInfoChain.getSymbolForDecl(this); - return !!symbol; - }; - - PullDecl.prototype.setSignatureSymbol = function (signatureSymbol) { - this.semanticInfoChain.setSignatureSymbolForDecl(this, signatureSymbol); - }; - - PullDecl.prototype.getSignatureSymbol = function () { - this.ensureSymbolIsBound(); - return this.semanticInfoChain.getSignatureSymbolForDecl(this); - }; - - PullDecl.prototype.hasSignatureSymbol = function () { - var signatureSymbol = this.semanticInfoChain.getSignatureSymbolForDecl(this); - return !!signatureSymbol; - }; - - PullDecl.prototype.setFlags = function (flags) { - this.flags = flags; - }; - - PullDecl.prototype.setFlag = function (flags) { - this.flags |= flags; - }; - - PullDecl.prototype.setValueDecl = function (valDecl) { - this.synthesizedValDecl = valDecl; - valDecl.containerDecl = this; - }; - - PullDecl.prototype.getValueDecl = function () { - return this.synthesizedValDecl; - }; - - PullDecl.prototype.getContainerDecl = function () { - return this.containerDecl; - }; - - PullDecl.prototype.getChildDeclCache = function (declKind) { - if (declKind === 8192 /* TypeParameter */) { - if (!this.childDeclTypeParameterCache) { - this.childDeclTypeParameterCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclTypeParameterCache; - } else if (TypeScript.hasFlag(declKind, 164 /* SomeContainer */)) { - if (!this.childDeclNamespaceCache) { - this.childDeclNamespaceCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclNamespaceCache; - } else if (TypeScript.hasFlag(declKind, 58728795 /* SomeType */)) { - if (!this.childDeclTypeCache) { - this.childDeclTypeCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclTypeCache; - } else { - if (!this.childDeclValueCache) { - this.childDeclValueCache = TypeScript.createIntrinsicsObject(); - } - - return this.childDeclValueCache; - } - }; - - PullDecl.prototype.addChildDecl = function (childDecl) { - if (childDecl.kind === 8192 /* TypeParameter */) { - if (!this.typeParameters) { - this.typeParameters = []; - } - this.typeParameters[this.typeParameters.length] = childDecl; - } else { - if (!this.childDecls) { - this.childDecls = []; - } - this.childDecls[this.childDecls.length] = childDecl; - } - - var declName = childDecl.name; - - if (!(childDecl.kind & 7340032 /* SomeSignature */)) { - var cache = this.getChildDeclCache(childDecl.kind); - var childrenOfName = cache[declName]; - if (!childrenOfName) { - childrenOfName = []; - } - - childrenOfName.push(childDecl); - cache[declName] = childrenOfName; - } - }; - - PullDecl.prototype.searchChildDecls = function (declName, searchKind) { - var cacheVal = null; - - if (searchKind & 58728795 /* SomeType */) { - cacheVal = this.childDeclTypeCache ? this.childDeclTypeCache[declName] : null; - } else if (searchKind & 164 /* SomeContainer */) { - cacheVal = this.childDeclNamespaceCache ? this.childDeclNamespaceCache[declName] : null; - } else { - cacheVal = this.childDeclValueCache ? this.childDeclValueCache[declName] : null; - } - - if (cacheVal) { - return cacheVal; - } else { - if (searchKind & 58728795 /* SomeType */) { - cacheVal = this.childDeclTypeParameterCache ? this.childDeclTypeParameterCache[declName] : null; - - if (cacheVal) { - return cacheVal; - } - } - - return sentinelEmptyPullDeclArray; - } - }; - - PullDecl.prototype.getChildDecls = function () { - return this.childDecls || sentinelEmptyPullDeclArray; - }; - - PullDecl.prototype.getTypeParameters = function () { - return this.typeParameters || sentinelEmptyPullDeclArray; - }; - - PullDecl.prototype.addVariableDeclToGroup = function (decl) { - if (!this.declGroups) { - this.declGroups = TypeScript.createIntrinsicsObject(); - } - - var declGroup = this.declGroups[decl.name]; - if (declGroup) { - declGroup.addDecl(decl); - } else { - declGroup = new PullDeclGroup(decl.name); - declGroup.addDecl(decl); - this.declGroups[decl.name] = declGroup; - } - }; - - PullDecl.prototype.getVariableDeclGroups = function () { - var declGroups = null; - - if (this.declGroups) { - for (var declName in this.declGroups) { - if (this.declGroups[declName]) { - if (declGroups === null) { - declGroups = []; - } - - declGroups.push(this.declGroups[declName].getDecls()); - } - } - } - - return declGroups || sentinelEmptyPullDeclArray; - }; - - PullDecl.prototype.hasBeenBound = function () { - return this.hasSymbol() || this.hasSignatureSymbol(); - }; - - PullDecl.prototype.isSynthesized = function () { - return false; - }; - - PullDecl.prototype.ast = function () { - return this.semanticInfoChain.getASTForDecl(this); - }; - - PullDecl.prototype.isRootDecl = function () { - throw TypeScript.Errors.abstract(); - }; - return PullDecl; - })(); - TypeScript.PullDecl = PullDecl; - - var RootPullDecl = (function (_super) { - __extends(RootPullDecl, _super); - function RootPullDecl(name, fileName, kind, declFlags, semanticInfoChain, isExternalModule) { - _super.call(this, name, name, kind, declFlags, semanticInfoChain); - this.semanticInfoChain = semanticInfoChain; - this._isExternalModule = isExternalModule; - this._fileName = fileName; - } - RootPullDecl.prototype.fileName = function () { - return this._fileName; - }; - - RootPullDecl.prototype.getParentPath = function () { - return [this]; - }; - - RootPullDecl.prototype.getParentDecl = function () { - return null; - }; - - RootPullDecl.prototype.isExternalModule = function () { - return this._isExternalModule; - }; - - RootPullDecl.prototype.getEnclosingDecl = function () { - return this; - }; - - RootPullDecl.prototype.isRootDecl = function () { - return true; - }; - return RootPullDecl; - })(PullDecl); - TypeScript.RootPullDecl = RootPullDecl; - - var NormalPullDecl = (function (_super) { - __extends(NormalPullDecl, _super); - function NormalPullDecl(declName, displayName, kind, declFlags, parentDecl, addToParent) { - if (typeof addToParent === "undefined") { addToParent = true; } - _super.call(this, declName, displayName, kind, declFlags, parentDecl ? parentDecl.semanticInfoChain : null); - this.parentDecl = null; - this.parentPath = null; - - this.parentDecl = parentDecl; - if (addToParent) { - parentDecl.addChildDecl(this); - } - - if (this.parentDecl) { - if (this.parentDecl.isRootDecl()) { - this._rootDecl = this.parentDecl; - } else { - this._rootDecl = this.parentDecl._rootDecl; - } - } else { - TypeScript.Debug.assert(this.isSynthesized()); - this._rootDecl = null; - } - } - NormalPullDecl.prototype.fileName = function () { - return this._rootDecl.fileName(); - }; - - NormalPullDecl.prototype.getParentDecl = function () { - return this.parentDecl; - }; - - NormalPullDecl.prototype.getParentPath = function () { - if (!this.parentPath) { - var path = [this]; - var parentDecl = this.parentDecl; - - while (parentDecl) { - if (parentDecl && path[path.length - 1] !== parentDecl && !(parentDecl.kind & (256 /* ObjectLiteral */ | 8388608 /* ObjectType */))) { - path.unshift(parentDecl); - } - - parentDecl = parentDecl.getParentDecl(); - } - - this.parentPath = path; - } - - return this.parentPath; - }; - - NormalPullDecl.prototype.isExternalModule = function () { - return false; - }; - - NormalPullDecl.prototype.getEnclosingDecl = function () { - return this.parentDecl && this.parentDecl._getEnclosingDeclFromParentDecl(); - }; - - NormalPullDecl.prototype.isRootDecl = function () { - return false; - }; - return NormalPullDecl; - })(PullDecl); - TypeScript.NormalPullDecl = NormalPullDecl; - - var PullEnumElementDecl = (function (_super) { - __extends(PullEnumElementDecl, _super); - function PullEnumElementDecl(declName, displayName, parentDecl) { - _super.call(this, declName, displayName, 67108864 /* EnumMember */, 4 /* Public */, parentDecl); - this.constantValue = null; - } - return PullEnumElementDecl; - })(NormalPullDecl); - TypeScript.PullEnumElementDecl = PullEnumElementDecl; - - var PullFunctionExpressionDecl = (function (_super) { - __extends(PullFunctionExpressionDecl, _super); - function PullFunctionExpressionDecl(expressionName, declFlags, parentDecl, displayName) { - if (typeof displayName === "undefined") { displayName = ""; } - _super.call(this, "", displayName, 131072 /* FunctionExpression */, declFlags, parentDecl); - this.functionExpressionName = expressionName; - } - PullFunctionExpressionDecl.prototype.getFunctionExpressionName = function () { - return this.functionExpressionName; - }; - return PullFunctionExpressionDecl; - })(NormalPullDecl); - TypeScript.PullFunctionExpressionDecl = PullFunctionExpressionDecl; - - var PullSynthesizedDecl = (function (_super) { - __extends(PullSynthesizedDecl, _super); - function PullSynthesizedDecl(declName, displayName, kind, declFlags, parentDecl, semanticInfoChain) { - _super.call(this, declName, displayName, kind, declFlags, parentDecl, false); - this.semanticInfoChain = semanticInfoChain; - } - PullSynthesizedDecl.prototype.isSynthesized = function () { - return true; - }; - - PullSynthesizedDecl.prototype.fileName = function () { - return this._rootDecl ? this._rootDecl.fileName() : ""; - }; - return PullSynthesizedDecl; - })(NormalPullDecl); - TypeScript.PullSynthesizedDecl = PullSynthesizedDecl; - - var PullDeclGroup = (function () { - function PullDeclGroup(name) { - this.name = name; - this._decls = []; - } - PullDeclGroup.prototype.addDecl = function (decl) { - if (decl.name === this.name) { - this._decls[this._decls.length] = decl; - } - }; - - PullDeclGroup.prototype.getDecls = function () { - return this._decls; - }; - return PullDeclGroup; - })(); - TypeScript.PullDeclGroup = PullDeclGroup; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.pullSymbolID = 0; - TypeScript.sentinelEmptyArray = []; - - var PullSymbol = (function () { - function PullSymbol(name, declKind) { - this.pullSymbolID = ++TypeScript.pullSymbolID; - this._container = null; - this.type = null; - this._declarations = null; - this.isResolved = false; - this.isOptional = false; - this.inResolution = false; - this.isSynthesized = false; - this.isVarArg = false; - this.rootSymbol = null; - this._enclosingSignature = null; - this._docComments = null; - this.isPrinting = false; - this.name = name; - this.kind = declKind; - } - PullSymbol.prototype.isAny = function () { - return false; - }; - - PullSymbol.prototype.isType = function () { - return (this.kind & 58728795 /* SomeType */) !== 0; - }; - - PullSymbol.prototype.isTypeReference = function () { - return false; - }; - - PullSymbol.prototype.isSignature = function () { - return (this.kind & 7340032 /* SomeSignature */) !== 0; - }; - - PullSymbol.prototype.isArrayNamedTypeReference = function () { - return false; - }; - - PullSymbol.prototype.isPrimitive = function () { - return this.kind === 2 /* Primitive */; - }; - - PullSymbol.prototype.isAccessor = function () { - return false; - }; - - PullSymbol.prototype.isError = function () { - return false; - }; - - PullSymbol.prototype.isInterface = function () { - return this.kind === 16 /* Interface */; - }; - - PullSymbol.prototype.isMethod = function () { - return this.kind === 65536 /* Method */; - }; - - PullSymbol.prototype.isProperty = function () { - return this.kind === 4096 /* Property */; - }; - - PullSymbol.prototype.isAlias = function () { - return false; - }; - - PullSymbol.prototype.isContainer = function () { - return false; - }; - - PullSymbol.prototype.findAliasedTypeSymbols = function (scopeSymbol, skipScopeSymbolAliasesLookIn, lookIntoOnlyExportedAlias, aliasSymbols, visitedScopeDeclarations) { - if (typeof aliasSymbols === "undefined") { aliasSymbols = []; } - if (typeof visitedScopeDeclarations === "undefined") { visitedScopeDeclarations = []; } - var scopeDeclarations = scopeSymbol.getDeclarations(); - var scopeSymbolAliasesToLookIn = []; - - for (var i = 0; i < scopeDeclarations.length; i++) { - var scopeDecl = scopeDeclarations[i]; - if (!TypeScript.ArrayUtilities.contains(visitedScopeDeclarations, scopeDecl)) { - visitedScopeDeclarations.push(scopeDecl); - - var childDecls = scopeDecl.getChildDecls(); - for (var j = 0; j < childDecls.length; j++) { - var childDecl = childDecls[j]; - if (childDecl.kind === 128 /* TypeAlias */ && (!lookIntoOnlyExportedAlias || (childDecl.flags & 1 /* Exported */))) { - var symbol = childDecl.getSymbol(); - - if (PullContainerSymbol.usedAsSymbol(symbol, this) || (this.rootSymbol && PullContainerSymbol.usedAsSymbol(symbol, this.rootSymbol))) { - aliasSymbols.push(symbol); - return aliasSymbols; - } - - if (!skipScopeSymbolAliasesLookIn && PullSymbol._isExternalModuleReferenceAlias(symbol) && (!symbol.assignedContainer().hasExportAssignment() || (symbol.assignedContainer().getExportAssignedContainerSymbol() && symbol.assignedContainer().getExportAssignedContainerSymbol().kind === 32 /* DynamicModule */))) { - scopeSymbolAliasesToLookIn.push(symbol); - } - } - } - } - } - - for (var i = 0; i < scopeSymbolAliasesToLookIn.length; i++) { - var scopeSymbolAlias = scopeSymbolAliasesToLookIn[i]; - - aliasSymbols.push(scopeSymbolAlias); - var result = this.findAliasedTypeSymbols(scopeSymbolAlias.assignedContainer().hasExportAssignment() ? scopeSymbolAlias.assignedContainer().getExportAssignedContainerSymbol() : scopeSymbolAlias.assignedContainer(), false, true, aliasSymbols, visitedScopeDeclarations); - if (result) { - return result; - } - - aliasSymbols.pop(); - } - - return null; - }; - - PullSymbol.prototype.getExternalAliasedSymbols = function (scopeSymbol) { - if (!scopeSymbol) { - return null; - } - - var scopePath = scopeSymbol.pathToRoot(); - if (scopePath.length && scopePath[scopePath.length - 1].kind === 32 /* DynamicModule */) { - var symbols = this.findAliasedTypeSymbols(scopePath[scopePath.length - 1]); - return symbols; - } - - return null; - }; - - PullSymbol._isExternalModuleReferenceAlias = function (aliasSymbol) { - if (aliasSymbol) { - if (aliasSymbol.assignedValue()) { - return false; - } - - if (aliasSymbol.assignedType() && aliasSymbol.assignedType() !== aliasSymbol.assignedContainer()) { - return false; - } - - if (aliasSymbol.assignedContainer() && aliasSymbol.assignedContainer().kind !== 32 /* DynamicModule */) { - return false; - } - - return true; - } - - return false; - }; - - PullSymbol.prototype.getExportedInternalAliasSymbol = function (scopeSymbol) { - if (scopeSymbol) { - if (this.kind !== 128 /* TypeAlias */) { - var scopePath = scopeSymbol.pathToRoot(); - for (var i = 0; i < scopePath.length; i++) { - var internalAliases = this.findAliasedTypeSymbols(scopeSymbol, true, true); - if (internalAliases) { - TypeScript.Debug.assert(internalAliases.length === 1); - return internalAliases[0]; - } - } - } - } - - return null; - }; - - PullSymbol.prototype.getAliasSymbolName = function (scopeSymbol, aliasNameGetter, aliasPartsNameGetter, skipInternalAlias) { - if (!skipInternalAlias) { - var internalAlias = this.getExportedInternalAliasSymbol(scopeSymbol); - if (internalAlias) { - return aliasNameGetter(internalAlias); - } - } - - var externalAliases = this.getExternalAliasedSymbols(scopeSymbol); - - if (externalAliases && externalAliases[0] != this && PullSymbol._isExternalModuleReferenceAlias(externalAliases[externalAliases.length - 1])) { - var aliasFullName = aliasNameGetter(externalAliases[0]); - if (!aliasFullName) { - return null; - } - for (var i = 1, symbolsLen = externalAliases.length; i < symbolsLen; i++) { - aliasFullName = aliasFullName + "." + aliasPartsNameGetter(externalAliases[i]); - } - return aliasFullName; - } - - return null; - }; - - PullSymbol.prototype._getResolver = function () { - TypeScript.Debug.assert(this._declarations && this._declarations.length > 0); - return this._declarations[0].semanticInfoChain.getResolver(); - }; - - PullSymbol.prototype._resolveDeclaredSymbol = function () { - return this._getResolver().resolveDeclaredSymbol(this); - }; - - PullSymbol.prototype.getName = function (scopeSymbol, useConstraintInName) { - var aliasName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getName(scopeSymbol, useConstraintInName); - }, function (symbol) { - return symbol.getName(); - }); - return aliasName || this.name; - }; - - PullSymbol.prototype.getDisplayName = function (scopeSymbol, useConstraintInName, skipInternalAliasName) { - var aliasDisplayName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getDisplayName(scopeSymbol, useConstraintInName); - }, function (symbol) { - return symbol.getDisplayName(); - }, skipInternalAliasName); - if (aliasDisplayName) { - return aliasDisplayName; - } - - var decls = this.getDeclarations(); - var name = decls.length && decls[0].getDisplayName(); - - return (name && name.length) ? name : this.name; - }; - - PullSymbol.prototype.getIsSpecialized = function () { - return false; - }; - - PullSymbol.prototype.getRootSymbol = function () { - if (!this.rootSymbol) { - return this; - } - return this.rootSymbol; - }; - PullSymbol.prototype.setRootSymbol = function (symbol) { - this.rootSymbol = symbol; - }; - - PullSymbol.prototype.setIsSynthesized = function (value) { - if (typeof value === "undefined") { value = true; } - TypeScript.Debug.assert(this.rootSymbol == null); - this.isSynthesized = value; - }; - - PullSymbol.prototype.getIsSynthesized = function () { - if (this.rootSymbol) { - return this.rootSymbol.getIsSynthesized(); - } - return this.isSynthesized; - }; - - PullSymbol.prototype.setEnclosingSignature = function (signature) { - this._enclosingSignature = signature; - }; - - PullSymbol.prototype.getEnclosingSignature = function () { - return this._enclosingSignature; - }; - - PullSymbol.prototype.addDeclaration = function (decl) { - TypeScript.Debug.assert(!!decl); - - if (this.rootSymbol) { - return; - } - - if (!this._declarations) { - this._declarations = [decl]; - } else { - this._declarations[this._declarations.length] = decl; - } - }; - - PullSymbol.prototype.getDeclarations = function () { - if (this.rootSymbol) { - return this.rootSymbol.getDeclarations(); - } - - if (!this._declarations) { - this._declarations = []; - } - - return this._declarations; - }; - - PullSymbol.prototype.hasDeclaration = function (decl) { - if (!this._declarations) { - return false; - } - - return TypeScript.ArrayUtilities.any(this._declarations, function (eachDecl) { - return eachDecl === decl; - }); - }; - - PullSymbol.prototype.setContainer = function (containerSymbol) { - if (this.rootSymbol) { - return; - } - - this._container = containerSymbol; - }; - - PullSymbol.prototype.getContainer = function () { - if (this.rootSymbol) { - return this.rootSymbol.getContainer(); - } - - return this._container; - }; - - PullSymbol.prototype.setResolved = function () { - this.isResolved = true; - this.inResolution = false; - }; - - PullSymbol.prototype.startResolving = function () { - this.inResolution = true; - }; - - PullSymbol.prototype.setUnresolved = function () { - this.isResolved = false; - this.inResolution = false; - }; - - PullSymbol.prototype.anyDeclHasFlag = function (flag) { - var declarations = this.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - if (TypeScript.hasFlag(declarations[i].flags, flag)) { - return true; - } - } - return false; - }; - - PullSymbol.prototype.allDeclsHaveFlag = function (flag) { - var declarations = this.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - if (!TypeScript.hasFlag(declarations[i].flags, flag)) { - return false; - } - } - return true; - }; - - PullSymbol.prototype.pathToRoot = function () { - var path = []; - var node = this; - while (node) { - if (node.isType()) { - var associatedContainerSymbol = node.getAssociatedContainerType(); - if (associatedContainerSymbol) { - node = associatedContainerSymbol; - } - } - path[path.length] = node; - var nodeKind = node.kind; - if (nodeKind === 2048 /* Parameter */) { - break; - } else { - node = node.getContainer(); - } - } - return path; - }; - - PullSymbol.unqualifiedNameReferencesDifferentSymbolInScope = function (symbol, scopePath, endScopePathIndex) { - var declPath = scopePath[0].getDeclarations()[0].getParentPath(); - for (var i = 0, declIndex = declPath.length - 1; i <= endScopePathIndex; i++, declIndex--) { - if (scopePath[i].isContainer()) { - var scopeContainer = scopePath[i]; - if (symbol.isContainer()) { - var memberSymbol = scopeContainer.findContainedNonMemberContainer(symbol.name, 164 /* SomeContainer */); - if (memberSymbol && memberSymbol != symbol && memberSymbol.getDeclarations()[0].getParentDecl() == declPath[declIndex]) { - return true; - } - - var memberSymbol = scopeContainer.findNestedContainer(symbol.name, 164 /* SomeContainer */); - if (memberSymbol && memberSymbol != symbol) { - return true; - } - } else if (symbol.isType()) { - var memberSymbol = scopeContainer.findContainedNonMemberType(symbol.name, 58728795 /* SomeType */); - var symbolRootType = TypeScript.PullHelpers.getRootType(symbol); - if (memberSymbol && TypeScript.PullHelpers.getRootType(memberSymbol) != symbolRootType && memberSymbol.getDeclarations()[0].getParentDecl() == declPath[declIndex]) { - return true; - } - - var memberSymbol = scopeContainer.findNestedType(symbol.name, 58728795 /* SomeType */); - if (memberSymbol && TypeScript.PullHelpers.getRootType(memberSymbol) != symbolRootType) { - return true; - } - } - } - } - - return false; - }; - - PullSymbol.prototype.findQualifyingSymbolPathInScopeSymbol = function (scopeSymbol) { - var thisPath = this.pathToRoot(); - if (thisPath.length === 1) { - return thisPath; - } - - var scopeSymbolPath; - if (scopeSymbol) { - scopeSymbolPath = scopeSymbol.pathToRoot(); - } else { - return thisPath; - } - - var thisCommonAncestorIndex = TypeScript.ArrayUtilities.indexOf(thisPath, function (thisNode) { - return TypeScript.ArrayUtilities.contains(scopeSymbolPath, thisNode); - }); - if (thisCommonAncestorIndex > 0) { - var thisCommonAncestor = thisPath[thisCommonAncestorIndex]; - var scopeCommonAncestorIndex = TypeScript.ArrayUtilities.indexOf(scopeSymbolPath, function (scopeNode) { - return scopeNode === thisCommonAncestor; - }); - TypeScript.Debug.assert(thisPath.length - thisCommonAncestorIndex === scopeSymbolPath.length - scopeCommonAncestorIndex); - - for (; thisCommonAncestorIndex < thisPath.length; thisCommonAncestorIndex++, scopeCommonAncestorIndex++) { - if (!PullSymbol.unqualifiedNameReferencesDifferentSymbolInScope(thisPath[thisCommonAncestorIndex - 1], scopeSymbolPath, scopeCommonAncestorIndex)) { - break; - } - } - } - - if (thisCommonAncestorIndex >= 0 && thisCommonAncestorIndex < thisPath.length) { - return thisPath.slice(0, thisCommonAncestorIndex); - } else { - return thisPath; - } - }; - - PullSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - var str = this.getNameAndTypeName(scopeSymbol); - return str; - }; - - PullSymbol.prototype.getNamePartForFullName = function () { - return this.getDisplayName(null, true); - }; - - PullSymbol.prototype.fullName = function (scopeSymbol) { - var _this = this; - var path = this.pathToRoot(); - var fullName = ""; - - var aliasFullName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.fullName(scopeSymbol); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }); - if (aliasFullName) { - return aliasFullName; - } - - for (var i = 1; i < path.length; i++) { - var aliasFullName = path[i].getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol === _this ? null : symbol.fullName(scopeSymbol); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }); - if (aliasFullName) { - fullName = aliasFullName + "." + fullName; - break; - } - - var scopedName = path[i].getNamePartForFullName(); - if (path[i].kind === 32 /* DynamicModule */ && !TypeScript.isQuoted(scopedName)) { - break; - } - - if (scopedName === "") { - break; - } - - fullName = scopedName + "." + fullName; - } - - fullName = fullName + this.getNamePartForFullName(); - return fullName; - }; - - PullSymbol.prototype.getScopedName = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName) { - var path = this.findQualifyingSymbolPathInScopeSymbol(scopeSymbol); - var fullName = ""; - - var aliasFullName = this.getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getScopedName(scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }, skipInternalAliasName); - if (aliasFullName) { - return aliasFullName; - } - - for (var i = 1; i < path.length; i++) { - var kind = path[i].kind; - if (kind === 4 /* Container */ || kind === 32 /* DynamicModule */) { - var aliasFullName = path[i].getAliasSymbolName(scopeSymbol, function (symbol) { - return symbol.getScopedName(scopeSymbol, skipTypeParametersInName, false, skipInternalAliasName); - }, function (symbol) { - return symbol.getNamePartForFullName(); - }, skipInternalAliasName); - if (aliasFullName) { - fullName = aliasFullName + "." + fullName; - break; - } - - if (kind === 4 /* Container */) { - fullName = path[i].getDisplayName() + "." + fullName; - } else { - var displayName = path[i].getDisplayName(); - if (TypeScript.isQuoted(displayName)) { - fullName = displayName + "." + fullName; - } - break; - } - } else { - break; - } - } - fullName = fullName + this.getDisplayName(scopeSymbol, useConstraintInName, skipInternalAliasName); - return fullName; - }; - - PullSymbol.prototype.getScopedNameEx = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, getPrettyTypeName, getTypeParamMarkerInfo, skipInternalAliasName) { - var name = this.getScopedName(scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName); - return TypeScript.MemberName.create(name); - }; - - PullSymbol.prototype.getTypeName = function (scopeSymbol, getPrettyTypeName) { - var memberName = this.getTypeNameEx(scopeSymbol, getPrettyTypeName); - return memberName.toString(); - }; - - PullSymbol.prototype.getTypeNameEx = function (scopeSymbol, getPrettyTypeName) { - var type = this.type; - if (type) { - var memberName = getPrettyTypeName ? this.getTypeNameForFunctionSignature("", scopeSymbol, getPrettyTypeName) : null; - if (!memberName) { - memberName = type.getScopedNameEx(scopeSymbol, false, true, getPrettyTypeName); - } - - return memberName; - } - return TypeScript.MemberName.create(""); - }; - - PullSymbol.prototype.getTypeNameForFunctionSignature = function (prefix, scopeSymbol, getPrettyTypeName) { - var type = this.type; - if (type && !type.isNamedTypeSymbol() && this.kind !== 4096 /* Property */ && this.kind !== 512 /* Variable */ && this.kind !== 2048 /* Parameter */) { - var signatures = type.getCallSignatures(); - if (signatures.length === 1 || (getPrettyTypeName && signatures.length)) { - var typeName = new TypeScript.MemberNameArray(); - var signatureName = PullSignatureSymbol.getSignaturesTypeNameEx(signatures, prefix, false, false, scopeSymbol, getPrettyTypeName); - typeName.addAll(signatureName); - return typeName; - } - } - - return null; - }; - - PullSymbol.prototype.getNameAndTypeName = function (scopeSymbol) { - var nameAndTypeName = this.getNameAndTypeNameEx(scopeSymbol); - return nameAndTypeName.toString(); - }; - - PullSymbol.prototype.getNameAndTypeNameEx = function (scopeSymbol) { - var type = this.type; - var nameStr = this.getDisplayName(scopeSymbol); - if (type) { - nameStr = nameStr + (this.isOptional ? "?" : ""); - var memberName = this.getTypeNameForFunctionSignature(nameStr, scopeSymbol); - if (!memberName) { - var typeNameEx = type.getScopedNameEx(scopeSymbol); - memberName = TypeScript.MemberName.create(typeNameEx, nameStr + ": ", ""); - } - return memberName; - } - return TypeScript.MemberName.create(nameStr); - }; - - PullSymbol.getTypeParameterString = function (typars, scopeSymbol, useContraintInName) { - return PullSymbol.getTypeParameterStringEx(typars, scopeSymbol, undefined, useContraintInName).toString(); - }; - - PullSymbol.getTypeParameterStringEx = function (typeParameters, scopeSymbol, getTypeParamMarkerInfo, useContraintInName) { - var builder = new TypeScript.MemberNameArray(); - builder.prefix = ""; - - if (typeParameters && typeParameters.length) { - builder.add(TypeScript.MemberName.create("<")); - - for (var i = 0; i < typeParameters.length; i++) { - if (i) { - builder.add(TypeScript.MemberName.create(", ")); - } - - if (getTypeParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - - builder.add(typeParameters[i].getScopedNameEx(scopeSymbol, false, useContraintInName)); - - if (getTypeParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - } - - builder.add(TypeScript.MemberName.create(">")); - } - - return builder; - }; - - PullSymbol.getIsExternallyVisible = function (symbol, fromIsExternallyVisibleSymbol, inIsExternallyVisibleSymbols) { - if (inIsExternallyVisibleSymbols) { - for (var i = 0; i < inIsExternallyVisibleSymbols.length; i++) { - if (inIsExternallyVisibleSymbols[i] === symbol) { - return true; - } - } - } else { - inIsExternallyVisibleSymbols = []; - } - - if (fromIsExternallyVisibleSymbol === symbol) { - return true; - } - - inIsExternallyVisibleSymbols.push(fromIsExternallyVisibleSymbol); - - var result = symbol.isExternallyVisible(inIsExternallyVisibleSymbols); - - TypeScript.Debug.assert(TypeScript.ArrayUtilities.last(inIsExternallyVisibleSymbols) === fromIsExternallyVisibleSymbol); - inIsExternallyVisibleSymbols.pop(); - - return result; - }; - - PullSymbol.prototype.isExternallyVisible = function (inIsExternallyVisibleSymbols) { - var kind = this.kind; - if (kind === 2 /* Primitive */) { - return true; - } - - if (this.rootSymbol) { - return PullSymbol.getIsExternallyVisible(this.rootSymbol, this, inIsExternallyVisibleSymbols); - } - - if (this.isType()) { - var associatedContainerSymbol = this.getAssociatedContainerType(); - if (associatedContainerSymbol) { - return PullSymbol.getIsExternallyVisible(associatedContainerSymbol, this, inIsExternallyVisibleSymbols); - } - } - - if (this.anyDeclHasFlag(2 /* Private */)) { - return false; - } - - var container = this.getContainer(); - if (container === null) { - var decls = this.getDeclarations(); - if (decls.length) { - var parentDecl = decls[0].getParentDecl(); - if (parentDecl) { - var parentSymbol = parentDecl.getSymbol(); - if (!parentSymbol || parentDecl.kind === 1 /* Script */) { - return true; - } - - return PullSymbol.getIsExternallyVisible(parentSymbol, this, inIsExternallyVisibleSymbols); - } - } - - return true; - } - - if (container.kind === 32 /* DynamicModule */ || (container.getAssociatedContainerType() && container.getAssociatedContainerType().kind === 32 /* DynamicModule */)) { - var containerSymbol = container.kind === 32 /* DynamicModule */ ? container : container.getAssociatedContainerType(); - if (PullContainerSymbol.usedAsSymbol(containerSymbol, this)) { - return true; - } - } - - if (!this.anyDeclHasFlag(1 /* Exported */) && kind !== 4096 /* Property */ && kind !== 65536 /* Method */) { - return false; - } - - return PullSymbol.getIsExternallyVisible(container, this, inIsExternallyVisibleSymbols); - }; - - PullSymbol.prototype.getDocCommentsOfDecl = function (decl) { - var ast = decl.ast(); - - if (ast) { - var enclosingModuleDeclaration = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(ast); - if (TypeScript.ASTHelpers.isLastNameOfModule(enclosingModuleDeclaration, ast)) { - return TypeScript.ASTHelpers.docComments(enclosingModuleDeclaration); - } - - if (ast.kind() !== 130 /* ModuleDeclaration */ || decl.kind !== 512 /* Variable */) { - return TypeScript.ASTHelpers.docComments(ast); - } - } - - return []; - }; - - PullSymbol.prototype.getDocCommentArray = function (symbol) { - var docComments = []; - if (!symbol) { - return docComments; - } - - var isParameter = symbol.kind === 2048 /* Parameter */; - var decls = symbol.getDeclarations(); - for (var i = 0; i < decls.length; i++) { - if (isParameter && decls[i].kind === 4096 /* Property */) { - continue; - } - docComments = docComments.concat(this.getDocCommentsOfDecl(decls[i])); - } - return docComments; - }; - - PullSymbol.getDefaultConstructorSymbolForDocComments = function (classSymbol) { - if (classSymbol.getHasDefaultConstructor()) { - var extendedTypes = classSymbol.getExtendedTypes(); - if (extendedTypes.length) { - return PullSymbol.getDefaultConstructorSymbolForDocComments(extendedTypes[0]); - } - } - - return classSymbol.type.getConstructSignatures()[0]; - }; - - PullSymbol.prototype.getDocCommentText = function (comments) { - var docCommentText = new Array(); - for (var c = 0; c < comments.length; c++) { - var commentText = this.getDocCommentTextValue(comments[c]); - if (commentText !== "") { - docCommentText.push(commentText); - } - } - return docCommentText.join("\n"); - }; - - PullSymbol.prototype.getDocCommentTextValue = function (comment) { - return this.cleanJSDocComment(comment.fullText()); - }; - - PullSymbol.prototype.docComments = function (useConstructorAsClass) { - var decls = this.getDeclarations(); - if (useConstructorAsClass && decls.length && decls[0].kind === 32768 /* ConstructorMethod */) { - var classDecl = decls[0].getParentDecl(); - return this.getDocCommentText(this.getDocCommentsOfDecl(classDecl)); - } - - if (this._docComments === null) { - var docComments = ""; - if (!useConstructorAsClass && this.kind === 2097152 /* ConstructSignature */ && decls.length && decls[0].kind === 8 /* Class */) { - var classSymbol = this.returnType; - var extendedTypes = classSymbol.getExtendedTypes(); - if (extendedTypes.length) { - docComments = extendedTypes[0].getConstructorMethod().docComments(); - } else { - docComments = ""; - } - } else if (this.kind === 2048 /* Parameter */) { - var parameterComments = []; - - var funcContainer = this.getEnclosingSignature(); - var funcDocComments = this.getDocCommentArray(funcContainer); - var paramComment = this.getParameterDocCommentText(this.getDisplayName(), funcDocComments); - if (paramComment != "") { - parameterComments.push(paramComment); - } - - var paramSelfComment = this.getDocCommentText(this.getDocCommentArray(this)); - if (paramSelfComment != "") { - parameterComments.push(paramSelfComment); - } - docComments = parameterComments.join("\n"); - } else { - var getSymbolComments = true; - if (this.kind === 16777216 /* FunctionType */) { - var functionSymbol = this.getFunctionSymbol(); - - if (functionSymbol) { - docComments = functionSymbol._docComments || ""; - getSymbolComments = false; - } else { - var declarationList = this.getDeclarations(); - if (declarationList.length > 0) { - docComments = declarationList[0].getSymbol()._docComments || ""; - getSymbolComments = false; - } - } - } - if (getSymbolComments) { - docComments = this.getDocCommentText(this.getDocCommentArray(this)); - if (docComments === "") { - if (this.kind === 1048576 /* CallSignature */) { - var callTypeSymbol = this.functionType; - if (callTypeSymbol && callTypeSymbol.getCallSignatures().length === 1) { - docComments = callTypeSymbol.docComments(); - } - } - } - } - } - - this._docComments = docComments; - } - - return this._docComments; - }; - - PullSymbol.prototype.getParameterDocCommentText = function (param, fncDocComments) { - if (fncDocComments.length === 0 || fncDocComments[0].kind() !== 6 /* MultiLineCommentTrivia */) { - return ""; - } - - for (var i = 0; i < fncDocComments.length; i++) { - var commentContents = fncDocComments[i].fullText(); - for (var j = commentContents.indexOf("@param", 0); 0 <= j; j = commentContents.indexOf("@param", j)) { - j += 6; - if (!this.isSpaceChar(commentContents, j)) { - continue; - } - - j = this.consumeLeadingSpace(commentContents, j); - if (j === -1) { - break; - } - - if (commentContents.charCodeAt(j) === 123 /* openBrace */) { - j++; - - var charCode = 0; - for (var curlies = 1; j < commentContents.length; j++) { - charCode = commentContents.charCodeAt(j); - - if (charCode === 123 /* openBrace */) { - curlies++; - continue; - } - - if (charCode === 125 /* closeBrace */) { - curlies--; - if (curlies === 0) { - break; - } else { - continue; - } - } - - if (charCode === 64 /* at */) { - break; - } - } - - if (j === commentContents.length) { - break; - } - - if (charCode === 64 /* at */) { - continue; - } - - j = this.consumeLeadingSpace(commentContents, j + 1); - if (j === -1) { - break; - } - } - - if (param !== commentContents.substr(j, param.length) || !this.isSpaceChar(commentContents, j + param.length)) { - continue; - } - - j = this.consumeLeadingSpace(commentContents, j + param.length); - if (j === -1) { - return ""; - } - - var endOfParam = commentContents.indexOf("@", j); - var paramHelpString = commentContents.substring(j, endOfParam < 0 ? commentContents.length : endOfParam); - - var paramSpacesToRemove = undefined; - var paramLineIndex = commentContents.substring(0, j).lastIndexOf("\n") + 1; - if (paramLineIndex !== 0) { - if (paramLineIndex < j && commentContents.charAt(paramLineIndex + 1) === "\r") { - paramLineIndex++; - } - } - var startSpaceRemovalIndex = this.consumeLeadingSpace(commentContents, paramLineIndex); - if (startSpaceRemovalIndex !== j && commentContents.charAt(startSpaceRemovalIndex) === "*") { - paramSpacesToRemove = j - startSpaceRemovalIndex - 1; - } - - return this.cleanJSDocComment(paramHelpString, paramSpacesToRemove); - } - } - - return ""; - }; - - PullSymbol.prototype.cleanJSDocComment = function (content, spacesToRemove) { - var docCommentLines = new Array(); - content = content.replace("/**", ""); - if (content.length >= 2 && content.charAt(content.length - 1) === "/" && content.charAt(content.length - 2) === "*") { - content = content.substring(0, content.length - 2); - } - var lines = content.split("\n"); - var inParamTag = false; - for (var l = 0; l < lines.length; l++) { - var line = lines[l]; - var cleanLinePos = this.cleanDocCommentLine(line, true, spacesToRemove); - if (!cleanLinePos) { - continue; - } - - var docCommentText = ""; - var prevPos = cleanLinePos.start; - for (var i = line.indexOf("@", cleanLinePos.start); 0 <= i && i < cleanLinePos.end; i = line.indexOf("@", i + 1)) { - var wasInParamtag = inParamTag; - - if (line.indexOf("param", i + 1) === i + 1 && this.isSpaceChar(line, i + 6)) { - if (!wasInParamtag) { - docCommentText += line.substring(prevPos, i); - } - - prevPos = i; - inParamTag = true; - } else if (wasInParamtag) { - prevPos = i; - inParamTag = false; - } - } - - if (!inParamTag) { - docCommentText += line.substring(prevPos, cleanLinePos.end); - } - - var newCleanPos = this.cleanDocCommentLine(docCommentText, false); - if (newCleanPos) { - if (spacesToRemove === undefined) { - spacesToRemove = cleanLinePos.jsDocSpacesRemoved; - } - docCommentLines.push(docCommentText); - } - } - - return docCommentLines.join("\n"); - }; - - PullSymbol.prototype.consumeLeadingSpace = function (line, startIndex, maxSpacesToRemove) { - var endIndex = line.length; - if (maxSpacesToRemove !== undefined) { - endIndex = TypeScript.MathPrototype.min(startIndex + maxSpacesToRemove, endIndex); - } - - for (; startIndex < endIndex; startIndex++) { - var charCode = line.charCodeAt(startIndex); - if (charCode !== 32 /* space */ && charCode !== 9 /* tab */) { - return startIndex; - } - } - - if (endIndex !== line.length) { - return endIndex; - } - - return -1; - }; - - PullSymbol.prototype.isSpaceChar = function (line, index) { - var length = line.length; - if (index < length) { - var charCode = line.charCodeAt(index); - - return charCode === 32 /* space */ || charCode === 9 /* tab */; - } - - return index === length; - }; - - PullSymbol.prototype.cleanDocCommentLine = function (line, jsDocStyleComment, jsDocLineSpaceToRemove) { - var nonSpaceIndex = this.consumeLeadingSpace(line, 0); - if (nonSpaceIndex !== -1) { - var jsDocSpacesRemoved = nonSpaceIndex; - if (jsDocStyleComment && line.charAt(nonSpaceIndex) === '*') { - var startIndex = nonSpaceIndex + 1; - nonSpaceIndex = this.consumeLeadingSpace(line, startIndex, jsDocLineSpaceToRemove); - - if (nonSpaceIndex !== -1) { - jsDocSpacesRemoved = nonSpaceIndex - startIndex; - } else { - return null; - } - } - - return { - start: nonSpaceIndex, - end: line.charAt(line.length - 1) === "\r" ? line.length - 1 : line.length, - jsDocSpacesRemoved: jsDocSpacesRemoved - }; - } - - return null; - }; - return PullSymbol; - })(); - TypeScript.PullSymbol = PullSymbol; - - - - var PullSignatureSymbol = (function (_super) { - __extends(PullSignatureSymbol, _super); - function PullSignatureSymbol(kind, _isDefinition) { - if (typeof _isDefinition === "undefined") { _isDefinition = false; } - _super.call(this, "", kind); - this._isDefinition = _isDefinition; - this._memberTypeParameterNameCache = null; - this._stringConstantOverload = undefined; - this.parameters = TypeScript.sentinelEmptyArray; - this._typeParameters = null; - this.returnType = null; - this.functionType = null; - this.hasOptionalParam = false; - this.nonOptionalParamCount = 0; - this.hasVarArgs = false; - this._allowedToReferenceTypeParameters = null; - this._instantiationCache = null; - this.hasBeenChecked = false; - this.inWrapCheck = false; - this.inWrapInfiniteExpandingReferenceCheck = false; - } - PullSignatureSymbol.prototype.isDefinition = function () { - return this._isDefinition; - }; - - PullSignatureSymbol.prototype.isGeneric = function () { - var typeParameters = this.getTypeParameters(); - return !!typeParameters && typeParameters.length !== 0; - }; - - PullSignatureSymbol.prototype.addParameter = function (parameter, isOptional) { - if (typeof isOptional === "undefined") { isOptional = false; } - if (this.parameters === TypeScript.sentinelEmptyArray) { - this.parameters = []; - } - - this.parameters[this.parameters.length] = parameter; - this.hasOptionalParam = isOptional; - - if (!parameter.getEnclosingSignature()) { - parameter.setEnclosingSignature(this); - } - - if (!isOptional) { - this.nonOptionalParamCount++; - } - }; - - PullSignatureSymbol.prototype.addTypeParameter = function (typeParameter) { - if (!this._typeParameters) { - this._typeParameters = []; - } - - if (!this._memberTypeParameterNameCache) { - this._memberTypeParameterNameCache = TypeScript.createIntrinsicsObject(); - } - - this._typeParameters[this._typeParameters.length] = typeParameter; - - this._memberTypeParameterNameCache[typeParameter.getName()] = typeParameter; - }; - - PullSignatureSymbol.prototype.addTypeParametersFromReturnType = function () { - var typeParameters = this.returnType.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - this.addTypeParameter(typeParameters[i]); - } - }; - - PullSignatureSymbol.prototype.getTypeParameters = function () { - if (!this._typeParameters) { - this._typeParameters = []; - } - - return this._typeParameters; - }; - - PullSignatureSymbol.prototype.findTypeParameter = function (name) { - var memberSymbol; - - if (!this._memberTypeParameterNameCache) { - this._memberTypeParameterNameCache = TypeScript.createIntrinsicsObject(); - - for (var i = 0; i < this.getTypeParameters().length; i++) { - this._memberTypeParameterNameCache[this._typeParameters[i].getName()] = this._typeParameters[i]; - } - } - - memberSymbol = this._memberTypeParameterNameCache[name]; - - return memberSymbol; - }; - - PullSignatureSymbol.prototype.getTypeParameterArgumentMap = function () { - return null; - }; - - PullSignatureSymbol.prototype.getAllowedToReferenceTypeParameters = function () { - TypeScript.Debug.assert(this.getRootSymbol() == this); - if (!this._allowedToReferenceTypeParameters) { - this._allowedToReferenceTypeParameters = TypeScript.PullInstantiationHelpers.getAllowedToReferenceTypeParametersFromDecl(this.getDeclarations()[0]); - } - - return this._allowedToReferenceTypeParameters; - }; - - PullSignatureSymbol.prototype.addSpecialization = function (specializedVersionOfThisSignature, typeArgumentMap) { - TypeScript.Debug.assert(this.getRootSymbol() == this); - if (!this._instantiationCache) { - this._instantiationCache = TypeScript.createIntrinsicsObject(); - } - - this._instantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)] = specializedVersionOfThisSignature; - }; - - PullSignatureSymbol.prototype.getSpecialization = function (typeArgumentMap) { - TypeScript.Debug.assert(this.getRootSymbol() == this); - if (!this._instantiationCache) { - return null; - } - - var result = this._instantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)]; - return result || null; - }; - - PullSignatureSymbol.prototype.isStringConstantOverloadSignature = function () { - if (this._stringConstantOverload === undefined) { - var params = this.parameters; - this._stringConstantOverload = false; - for (var i = 0; i < params.length; i++) { - var paramType = params[i].type; - if (paramType && paramType.isPrimitive() && paramType.isStringConstant()) { - this._stringConstantOverload = true; - } - } - } - - return this._stringConstantOverload; - }; - - PullSignatureSymbol.prototype.getParameterTypeAtIndex = function (iParam) { - if (iParam < this.parameters.length - 1 || (iParam < this.parameters.length && !this.hasVarArgs)) { - return this.parameters[iParam].type; - } else if (this.hasVarArgs) { - var paramType = this.parameters[this.parameters.length - 1].type; - if (paramType.isArrayNamedTypeReference()) { - paramType = paramType.getElementType(); - } - return paramType; - } - - return null; - }; - - PullSignatureSymbol.getSignatureTypeMemberName = function (candidateSignature, signatures, scopeSymbol) { - var allMemberNames = new TypeScript.MemberNameArray(); - var signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(signatures, "", false, false, scopeSymbol, true, candidateSignature); - allMemberNames.addAll(signatureMemberName); - return allMemberNames; - }; - - PullSignatureSymbol.getSignaturesTypeNameEx = function (signatures, prefix, shortform, brackets, scopeSymbol, getPrettyTypeName, candidateSignature) { - var result = []; - if (!signatures) { - return result; - } - - var len = signatures.length; - if (!getPrettyTypeName && len > 1) { - shortform = false; - } - - var foundDefinition = false; - if (candidateSignature && candidateSignature.isDefinition() && len > 1) { - candidateSignature = null; - } - - for (var i = 0; i < len; i++) { - if (len > 1 && signatures[i].isDefinition()) { - foundDefinition = true; - continue; - } - - var signature = signatures[i]; - if (getPrettyTypeName && candidateSignature) { - signature = candidateSignature; - } - - result.push(signature.getSignatureTypeNameEx(prefix, shortform, brackets, scopeSymbol)); - if (getPrettyTypeName) { - break; - } - } - - if (getPrettyTypeName && result.length && len > 1) { - var lastMemberName = result[result.length - 1]; - for (var i = i + 1; i < len; i++) { - if (signatures[i].isDefinition()) { - foundDefinition = true; - break; - } - } - var overloadString = TypeScript.getLocalizedText(TypeScript.DiagnosticCode._0_overload_s, [foundDefinition ? len - 2 : len - 1]); - lastMemberName.add(TypeScript.MemberName.create(overloadString)); - } - - return result; - }; - - PullSignatureSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - var s = this.getSignatureTypeNameEx(this.getScopedNameEx().toString(), false, false, scopeSymbol, undefined, useConstraintInName).toString(); - return s; - }; - - PullSignatureSymbol.prototype.getSignatureTypeNameEx = function (prefix, shortform, brackets, scopeSymbol, getParamMarkerInfo, getTypeParamMarkerInfo) { - var typeParamterBuilder = new TypeScript.MemberNameArray(); - - typeParamterBuilder.add(PullSymbol.getTypeParameterStringEx(this.getTypeParameters(), scopeSymbol, getTypeParamMarkerInfo, true)); - - if (brackets) { - typeParamterBuilder.add(TypeScript.MemberName.create("[")); - } else { - typeParamterBuilder.add(TypeScript.MemberName.create("(")); - } - - var builder = new TypeScript.MemberNameArray(); - builder.prefix = prefix; - - if (getTypeParamMarkerInfo) { - builder.prefix = prefix; - builder.addAll(typeParamterBuilder.entries); - } else { - builder.prefix = prefix + typeParamterBuilder.toString(); - } - - var params = this.parameters; - var paramLen = params.length; - for (var i = 0; i < paramLen; i++) { - var paramType = params[i].type; - var typeString = paramType ? ": " : ""; - var paramIsVarArg = params[i].isVarArg; - var varArgPrefix = paramIsVarArg ? "..." : ""; - var optionalString = (!paramIsVarArg && params[i].isOptional) ? "?" : ""; - if (getParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - builder.add(TypeScript.MemberName.create(varArgPrefix + params[i].getScopedNameEx(scopeSymbol).toString() + optionalString + typeString)); - if (paramType) { - builder.add(paramType.getScopedNameEx(scopeSymbol)); - } - if (getParamMarkerInfo) { - builder.add(new TypeScript.MemberName()); - } - if (i < paramLen - 1) { - builder.add(TypeScript.MemberName.create(", ")); - } - } - - if (shortform) { - if (brackets) { - builder.add(TypeScript.MemberName.create("] => ")); - } else { - builder.add(TypeScript.MemberName.create(") => ")); - } - } else { - if (brackets) { - builder.add(TypeScript.MemberName.create("]: ")); - } else { - builder.add(TypeScript.MemberName.create("): ")); - } - } - - if (this.returnType) { - builder.add(this.returnType.getScopedNameEx(scopeSymbol)); - } else { - builder.add(TypeScript.MemberName.create("any")); - } - - return builder; - }; - - PullSignatureSymbol.prototype.forAllParameterTypes = function (length, predicate) { - if (this.parameters.length < length && !this.hasVarArgs) { - length = this.parameters.length; - } - - for (var i = 0; i < length; i++) { - var paramType = this.getParameterTypeAtIndex(i); - if (!predicate(paramType, i)) { - return false; - } - } - - return true; - }; - - PullSignatureSymbol.prototype.forAllCorrespondingParameterTypesInThisAndOtherSignature = function (otherSignature, predicate) { - var length; - if (this.hasVarArgs) { - length = otherSignature.hasVarArgs ? Math.max(this.parameters.length, otherSignature.parameters.length) : otherSignature.parameters.length; - } else { - length = otherSignature.hasVarArgs ? this.parameters.length : Math.min(this.parameters.length, otherSignature.parameters.length); - } - - for (var i = 0; i < length; i++) { - var thisParamType = this.getParameterTypeAtIndex(i); - var otherParamType = otherSignature.getParameterTypeAtIndex(i); - if (!predicate(thisParamType, otherParamType, i)) { - return false; - } - } - - return true; - }; - - PullSignatureSymbol.prototype.wrapsSomeTypeParameter = function (typeParameterArgumentMap) { - return this.getWrappingTypeParameterID(typeParameterArgumentMap) !== 0; - }; - - PullSignatureSymbol.prototype.getWrappingTypeParameterID = function (typeParameterArgumentMap) { - var signature = this; - if (signature.inWrapCheck) { - return 0; - } - - this._wrapsTypeParameterCache = this._wrapsTypeParameterCache || new TypeScript.WrapsTypeParameterCache(); - - var wrappingTypeParameterID = this._wrapsTypeParameterCache.getWrapsTypeParameter(typeParameterArgumentMap); - if (wrappingTypeParameterID === undefined) { - wrappingTypeParameterID = this.getWrappingTypeParameterIDWorker(typeParameterArgumentMap); - this._wrapsTypeParameterCache.setWrapsTypeParameter(typeParameterArgumentMap, wrappingTypeParameterID); - } - - return wrappingTypeParameterID; - }; - - PullSignatureSymbol.prototype.getWrappingTypeParameterIDWorker = function (typeParameterArgumentMap) { - var signature = this; - signature.inWrapCheck = true; - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(signature); - var wrappingTypeParameterID = signature.returnType ? signature.returnType.getWrappingTypeParameterID(typeParameterArgumentMap) : 0; - - var parameters = signature.parameters; - for (var i = 0; !wrappingTypeParameterID && i < parameters.length; i++) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(parameters[i]); - wrappingTypeParameterID = parameters[i].type.getWrappingTypeParameterID(typeParameterArgumentMap); - } - - signature.inWrapCheck = false; - - return wrappingTypeParameterID; - }; - - PullSignatureSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference = function (enclosingType, knownWrapMap) { - var wrapsIntoInfinitelyExpandingTypeReference = knownWrapMap.valueAt(this.pullSymbolID, enclosingType.pullSymbolID); - if (wrapsIntoInfinitelyExpandingTypeReference != undefined) { - return wrapsIntoInfinitelyExpandingTypeReference; - } - - if (this.inWrapInfiniteExpandingReferenceCheck) { - return false; - } - - this.inWrapInfiniteExpandingReferenceCheck = true; - wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker(enclosingType, knownWrapMap); - knownWrapMap.setValueAt(this.pullSymbolID, enclosingType.pullSymbolID, wrapsIntoInfinitelyExpandingTypeReference); - this.inWrapInfiniteExpandingReferenceCheck = false; - - return wrapsIntoInfinitelyExpandingTypeReference; - }; - - PullSignatureSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker = function (enclosingType, knownWrapMap) { - if (this.returnType && this.returnType._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap)) { - return true; - } - - var parameters = this.parameters; - - for (var i = 0; i < parameters.length; i++) { - if (parameters[i].type && parameters[i].type._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap)) { - return true; - } - } - - return false; - }; - return PullSignatureSymbol; - })(PullSymbol); - TypeScript.PullSignatureSymbol = PullSignatureSymbol; - - var PullTypeSymbol = (function (_super) { - __extends(PullTypeSymbol, _super); - function PullTypeSymbol(name, kind) { - _super.call(this, name, kind); - this._members = TypeScript.sentinelEmptyArray; - this._enclosedMemberTypes = null; - this._enclosedMemberContainers = null; - this._typeParameters = null; - this._allowedToReferenceTypeParameters = null; - this._specializedVersionsOfThisType = null; - this._arrayVersionOfThisType = null; - this._implementedTypes = null; - this._extendedTypes = null; - this._typesThatExplicitlyImplementThisType = null; - this._typesThatExtendThisType = null; - this._callSignatures = null; - this._allCallSignatures = null; - this._constructSignatures = null; - this._allConstructSignatures = null; - this._indexSignatures = null; - this._allIndexSignatures = null; - this._allIndexSignaturesOfAugmentedType = null; - this._memberNameCache = null; - this._enclosedTypeNameCache = null; - this._enclosedContainerCache = null; - this._typeParameterNameCache = null; - this._containedNonMemberNameCache = null; - this._containedNonMemberTypeNameCache = null; - this._containedNonMemberContainerCache = null; - this._simpleInstantiationCache = null; - this._complexInstantiationCache = null; - this._hasGenericSignature = false; - this._hasGenericMember = false; - this._hasBaseTypeConflict = false; - this._knownBaseTypeCount = 0; - this._associatedContainerTypeSymbol = null; - this._constructorMethod = null; - this._hasDefaultConstructor = false; - this._functionSymbol = null; - this._inMemberTypeNameEx = false; - this.inSymbolPrivacyCheck = false; - this.inWrapCheck = false; - this.inWrapInfiniteExpandingReferenceCheck = false; - this.typeReference = null; - this._widenedType = null; - this._isArrayNamedTypeReference = undefined; - this.type = this; - } - PullTypeSymbol.prototype.isArrayNamedTypeReference = function () { - if (this._isArrayNamedTypeReference === undefined) { - this._isArrayNamedTypeReference = this.computeIsArrayNamedTypeReference(); - } - - return this._isArrayNamedTypeReference; - }; - - PullTypeSymbol.prototype.computeIsArrayNamedTypeReference = function () { - var typeArgs = this.getTypeArguments(); - if (typeArgs && this.getTypeArguments().length === 1 && this.name === "Array") { - var declaration = this.getDeclarations()[0]; - - if (declaration && declaration.getParentDecl() && declaration.getParentDecl().getParentDecl() === null) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype.isType = function () { - return true; - }; - PullTypeSymbol.prototype.isClass = function () { - return this.kind === 8 /* Class */ || (this._constructorMethod !== null); - }; - PullTypeSymbol.prototype.isFunction = function () { - return (this.kind & (33554432 /* ConstructorType */ | 16777216 /* FunctionType */)) !== 0; - }; - PullTypeSymbol.prototype.isConstructor = function () { - return this.kind === 33554432 /* ConstructorType */ || (this._associatedContainerTypeSymbol && this._associatedContainerTypeSymbol.isClass()); - }; - PullTypeSymbol.prototype.isTypeParameter = function () { - return false; - }; - PullTypeSymbol.prototype.isTypeVariable = function () { - return false; - }; - PullTypeSymbol.prototype.isError = function () { - return false; - }; - PullTypeSymbol.prototype.isEnum = function () { - return this.kind === 64 /* Enum */; - }; - - PullTypeSymbol.prototype.getTypeParameterArgumentMap = function () { - return null; - }; - - PullTypeSymbol.prototype.isObject = function () { - return TypeScript.hasFlag(this.kind, 8 /* Class */ | 33554432 /* ConstructorType */ | 64 /* Enum */ | 16777216 /* FunctionType */ | 16 /* Interface */ | 8388608 /* ObjectType */ | 256 /* ObjectLiteral */); - }; - - PullTypeSymbol.prototype.isFunctionType = function () { - return this.getCallSignatures().length > 0 || this.getConstructSignatures().length > 0; - }; - - PullTypeSymbol.prototype.getKnownBaseTypeCount = function () { - return this._knownBaseTypeCount; - }; - PullTypeSymbol.prototype.resetKnownBaseTypeCount = function () { - this._knownBaseTypeCount = 0; - }; - PullTypeSymbol.prototype.incrementKnownBaseCount = function () { - this._knownBaseTypeCount++; - }; - - PullTypeSymbol.prototype.setHasBaseTypeConflict = function () { - this._hasBaseTypeConflict = true; - }; - PullTypeSymbol.prototype.hasBaseTypeConflict = function () { - return this._hasBaseTypeConflict; - }; - - PullTypeSymbol.prototype.hasMembers = function () { - if (this._members !== TypeScript.sentinelEmptyArray) { - return true; - } - - var parents = this.getExtendedTypes(); - - for (var i = 0; i < parents.length; i++) { - if (parents[i].hasMembers()) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype.setHasGenericSignature = function () { - this._hasGenericSignature = true; - }; - PullTypeSymbol.prototype.getHasGenericSignature = function () { - return this._hasGenericSignature; - }; - - PullTypeSymbol.prototype.setHasGenericMember = function () { - this._hasGenericMember = true; - }; - PullTypeSymbol.prototype.getHasGenericMember = function () { - return this._hasGenericMember; - }; - - PullTypeSymbol.prototype.setAssociatedContainerType = function (type) { - this._associatedContainerTypeSymbol = type; - }; - - PullTypeSymbol.prototype.getAssociatedContainerType = function () { - return this._associatedContainerTypeSymbol; - }; - - PullTypeSymbol.prototype.getArrayType = function () { - return this._arrayVersionOfThisType; - }; - - PullTypeSymbol.prototype.getElementType = function () { - return null; - }; - - PullTypeSymbol.prototype.setArrayType = function (arrayType) { - this._arrayVersionOfThisType = arrayType; - }; - - PullTypeSymbol.prototype.getFunctionSymbol = function () { - return this._functionSymbol; - }; - - PullTypeSymbol.prototype.setFunctionSymbol = function (symbol) { - if (symbol) { - this._functionSymbol = symbol; - } - }; - - PullTypeSymbol.prototype.findContainedNonMember = function (name) { - if (!this._containedNonMemberNameCache) { - return null; - } - - return this._containedNonMemberNameCache[name]; - }; - - PullTypeSymbol.prototype.findContainedNonMemberType = function (typeName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - if (!this._containedNonMemberTypeNameCache) { - return null; - } - - var nonMemberSymbol = this._containedNonMemberTypeNameCache[typeName]; - - if (nonMemberSymbol && kind !== 0 /* None */) { - nonMemberSymbol = TypeScript.hasFlag(nonMemberSymbol.kind, kind) ? nonMemberSymbol : null; - } - - return nonMemberSymbol; - }; - - PullTypeSymbol.prototype.findContainedNonMemberContainer = function (containerName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - if (!this._containedNonMemberContainerCache) { - return null; - } - - var nonMemberSymbol = this._containedNonMemberContainerCache[containerName]; - - if (nonMemberSymbol && kind !== 0 /* None */) { - nonMemberSymbol = TypeScript.hasFlag(nonMemberSymbol.kind, kind) ? nonMemberSymbol : null; - } - - return nonMemberSymbol; - }; - - PullTypeSymbol.prototype.addMember = function (memberSymbol) { - if (!memberSymbol) { - return; - } - - memberSymbol.setContainer(this); - - if (!this._memberNameCache) { - this._memberNameCache = TypeScript.createIntrinsicsObject(); - } - - if (this._members === TypeScript.sentinelEmptyArray) { - this._members = []; - } - - this._members.push(memberSymbol); - this._memberNameCache[memberSymbol.name] = memberSymbol; - }; - - PullTypeSymbol.prototype.addEnclosedMemberType = function (enclosedType) { - if (!enclosedType) { - return; - } - - enclosedType.setContainer(this); - - if (!this._enclosedTypeNameCache) { - this._enclosedTypeNameCache = TypeScript.createIntrinsicsObject(); - } - - if (!this._enclosedMemberTypes) { - this._enclosedMemberTypes = []; - } - - this._enclosedMemberTypes[this._enclosedMemberTypes.length] = enclosedType; - this._enclosedTypeNameCache[enclosedType.name] = enclosedType; - }; - - PullTypeSymbol.prototype.addEnclosedMemberContainer = function (enclosedContainer) { - if (!enclosedContainer) { - return; - } - - enclosedContainer.setContainer(this); - - if (!this._enclosedContainerCache) { - this._enclosedContainerCache = TypeScript.createIntrinsicsObject(); - } - - if (!this._enclosedMemberContainers) { - this._enclosedMemberContainers = []; - } - - this._enclosedMemberContainers[this._enclosedMemberContainers.length] = enclosedContainer; - this._enclosedContainerCache[enclosedContainer.name] = enclosedContainer; - }; - - PullTypeSymbol.prototype.addEnclosedNonMember = function (enclosedNonMember) { - if (!enclosedNonMember) { - return; - } - - enclosedNonMember.setContainer(this); - - if (!this._containedNonMemberNameCache) { - this._containedNonMemberNameCache = TypeScript.createIntrinsicsObject(); - } - - this._containedNonMemberNameCache[enclosedNonMember.name] = enclosedNonMember; - }; - - PullTypeSymbol.prototype.addEnclosedNonMemberType = function (enclosedNonMemberType) { - if (!enclosedNonMemberType) { - return; - } - - enclosedNonMemberType.setContainer(this); - - if (!this._containedNonMemberTypeNameCache) { - this._containedNonMemberTypeNameCache = TypeScript.createIntrinsicsObject(); - } - - this._containedNonMemberTypeNameCache[enclosedNonMemberType.name] = enclosedNonMemberType; - }; - - PullTypeSymbol.prototype.addEnclosedNonMemberContainer = function (enclosedNonMemberContainer) { - if (!enclosedNonMemberContainer) { - return; - } - - enclosedNonMemberContainer.setContainer(this); - - if (!this._containedNonMemberContainerCache) { - this._containedNonMemberContainerCache = TypeScript.createIntrinsicsObject(); - } - - this._containedNonMemberContainerCache[enclosedNonMemberContainer.name] = enclosedNonMemberContainer; - }; - - PullTypeSymbol.prototype.addTypeParameter = function (typeParameter) { - if (!typeParameter) { - return; - } - - if (!typeParameter.getContainer()) { - typeParameter.setContainer(this); - } - - if (!this._typeParameterNameCache) { - this._typeParameterNameCache = TypeScript.createIntrinsicsObject(); - } - - if (!this._typeParameters) { - this._typeParameters = []; - } - - this._typeParameters[this._typeParameters.length] = typeParameter; - this._typeParameterNameCache[typeParameter.getName()] = typeParameter; - }; - - PullTypeSymbol.prototype.getMembers = function () { - return this._members; - }; - - PullTypeSymbol.prototype.setHasDefaultConstructor = function (hasOne) { - if (typeof hasOne === "undefined") { hasOne = true; } - this._hasDefaultConstructor = hasOne; - }; - - PullTypeSymbol.prototype.getHasDefaultConstructor = function () { - return this._hasDefaultConstructor; - }; - - PullTypeSymbol.prototype.getConstructorMethod = function () { - return this._constructorMethod; - }; - - PullTypeSymbol.prototype.setConstructorMethod = function (constructorMethod) { - this._constructorMethod = constructorMethod; - }; - - PullTypeSymbol.prototype.getTypeParameters = function () { - if (!this._typeParameters) { - return TypeScript.sentinelEmptyArray; - } - - return this._typeParameters; - }; - - PullTypeSymbol.prototype.getAllowedToReferenceTypeParameters = function () { - if (!!(this.kind && 8216 /* SomeInstantiatableType */) && this.isNamedTypeSymbol() && !this.isTypeParameter()) { - return this.getTypeParameters(); - } - - if (!this._allowedToReferenceTypeParameters) { - this._allowedToReferenceTypeParameters = TypeScript.PullInstantiationHelpers.getAllowedToReferenceTypeParametersFromDecl(this.getDeclarations()[0]); - } - - return this._allowedToReferenceTypeParameters; - }; - - PullTypeSymbol.prototype.isGeneric = function () { - return (this._typeParameters && this._typeParameters.length > 0) || this._hasGenericSignature || this._hasGenericMember || this.isArrayNamedTypeReference(); - }; - - PullTypeSymbol.prototype.canUseSimpleInstantiationCache = function (typeArgumentMap) { - if (this.isTypeParameter()) { - return true; - } - - var typeParameters = this.getTypeParameters(); - return typeArgumentMap && this.isNamedTypeSymbol() && typeParameters.length === 1 && typeArgumentMap[typeParameters[0].pullSymbolID].kind !== 8388608 /* ObjectType */; - }; - - PullTypeSymbol.prototype.getSimpleInstantiationCacheId = function (typeArgumentMap) { - if (this.isTypeParameter()) { - return typeArgumentMap[0].pullSymbolID; - } - - return typeArgumentMap[this.getTypeParameters()[0].pullSymbolID].pullSymbolID; - }; - - PullTypeSymbol.prototype.addSpecialization = function (specializedVersionOfThisType, typeArgumentMap) { - if (this.canUseSimpleInstantiationCache(typeArgumentMap)) { - if (!this._simpleInstantiationCache) { - this._simpleInstantiationCache = []; - } - - this._simpleInstantiationCache[this.getSimpleInstantiationCacheId(typeArgumentMap)] = specializedVersionOfThisType; - } else { - if (!this._complexInstantiationCache) { - this._complexInstantiationCache = TypeScript.createIntrinsicsObject(); - } - - this._complexInstantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)] = specializedVersionOfThisType; - } - - if (!this._specializedVersionsOfThisType) { - this._specializedVersionsOfThisType = []; - } - - this._specializedVersionsOfThisType.push(specializedVersionOfThisType); - }; - - PullTypeSymbol.prototype.getSpecialization = function (typeArgumentMap) { - if (this.canUseSimpleInstantiationCache(typeArgumentMap)) { - if (!this._simpleInstantiationCache) { - return null; - } - - var result = this._simpleInstantiationCache[this.getSimpleInstantiationCacheId(typeArgumentMap)]; - return result || null; - } else { - if (!this._complexInstantiationCache) { - return null; - } - - if (this.getAllowedToReferenceTypeParameters().length == 0) { - return this; - } - - var result = this._complexInstantiationCache[getIDForTypeSubstitutions(this, typeArgumentMap)]; - return result || null; - } - }; - - PullTypeSymbol.prototype.getKnownSpecializations = function () { - if (!this._specializedVersionsOfThisType) { - return TypeScript.sentinelEmptyArray; - } - - return this._specializedVersionsOfThisType; - }; - - PullTypeSymbol.prototype.getTypeArguments = function () { - return null; - }; - - PullTypeSymbol.prototype.getTypeArgumentsOrTypeParameters = function () { - return this.getTypeParameters(); - }; - - PullTypeSymbol.prototype.addCallOrConstructSignaturePrerequisiteBase = function (signature) { - if (signature.isGeneric()) { - this._hasGenericSignature = true; - } - - signature.functionType = this; - }; - - PullTypeSymbol.prototype.addCallSignaturePrerequisite = function (callSignature) { - if (!this._callSignatures) { - this._callSignatures = []; - } - - this.addCallOrConstructSignaturePrerequisiteBase(callSignature); - }; - - PullTypeSymbol.prototype.appendCallSignature = function (callSignature) { - this.addCallSignaturePrerequisite(callSignature); - this._callSignatures.push(callSignature); - }; - - PullTypeSymbol.prototype.insertCallSignatureAtIndex = function (callSignature, index) { - this.addCallSignaturePrerequisite(callSignature); - TypeScript.Debug.assert(index <= this._callSignatures.length); - if (index === this._callSignatures.length) { - this._callSignatures.push(callSignature); - } else { - this._callSignatures.splice(index, 0, callSignature); - } - }; - - PullTypeSymbol.prototype.addConstructSignaturePrerequisite = function (constructSignature) { - if (!this._constructSignatures) { - this._constructSignatures = []; - } - - this.addCallOrConstructSignaturePrerequisiteBase(constructSignature); - }; - - PullTypeSymbol.prototype.appendConstructSignature = function (constructSignature) { - this.addConstructSignaturePrerequisite(constructSignature); - this._constructSignatures.push(constructSignature); - }; - - PullTypeSymbol.prototype.insertConstructSignatureAtIndex = function (constructSignature, index) { - this.addConstructSignaturePrerequisite(constructSignature); - TypeScript.Debug.assert(index <= this._constructSignatures.length); - if (index === this._constructSignatures.length) { - this._constructSignatures.push(constructSignature); - } else { - this._constructSignatures.splice(index, 0, constructSignature); - } - }; - - PullTypeSymbol.prototype.addIndexSignature = function (indexSignature) { - if (!this._indexSignatures) { - this._indexSignatures = []; - } - - this._indexSignatures[this._indexSignatures.length] = indexSignature; - - if (indexSignature.isGeneric()) { - this._hasGenericSignature = true; - } - - indexSignature.functionType = this; - }; - - PullTypeSymbol.prototype.hasOwnCallSignatures = function () { - return this._callSignatures !== null; - }; - - PullTypeSymbol.prototype.getOwnCallSignatures = function () { - return this._callSignatures || TypeScript.sentinelEmptyArray; - }; - - PullTypeSymbol.prototype.getCallSignatures = function () { - if (this._allCallSignatures) { - return this._allCallSignatures; - } - - var signatures = []; - - if (this._callSignatures) { - signatures = signatures.concat(this._callSignatures); - } - - if (this._extendedTypes && this.kind === 16 /* Interface */) { - for (var i = 0; i < this._extendedTypes.length; i++) { - if (this._extendedTypes[i].hasBase(this)) { - continue; - } - - this._getResolver()._addUnhiddenSignaturesFromBaseType(this._callSignatures, this._extendedTypes[i].getCallSignatures(), signatures); - } - } - - this._allCallSignatures = signatures; - - return signatures; - }; - - PullTypeSymbol.prototype.hasOwnConstructSignatures = function () { - return this._constructSignatures !== null; - }; - - PullTypeSymbol.prototype.getOwnDeclaredConstructSignatures = function () { - return this._constructSignatures || TypeScript.sentinelEmptyArray; - }; - - PullTypeSymbol.prototype.getConstructSignatures = function () { - if (this._allConstructSignatures) { - return this._allConstructSignatures; - } - - var signatures = []; - - if (this._constructSignatures) { - signatures = signatures.concat(this._constructSignatures); - } else if (this.isConstructor()) { - if (this._extendedTypes && this._extendedTypes.length > 0) { - signatures = this.getBaseClassConstructSignatures(this._extendedTypes[0]); - } else { - signatures = [this.getDefaultClassConstructSignature()]; - } - } - - if (this._extendedTypes && this.kind === 16 /* Interface */) { - for (var i = 0; i < this._extendedTypes.length; i++) { - if (this._extendedTypes[i].hasBase(this)) { - continue; - } - - this._getResolver()._addUnhiddenSignaturesFromBaseType(this._constructSignatures, this._extendedTypes[i].getConstructSignatures(), signatures); - } - } - - this._allConstructSignatures = signatures; - - return signatures; - }; - - PullTypeSymbol.prototype.hasOwnIndexSignatures = function () { - return this._indexSignatures !== null; - }; - - PullTypeSymbol.prototype.getOwnIndexSignatures = function () { - return this._indexSignatures || TypeScript.sentinelEmptyArray; - }; - - PullTypeSymbol.prototype.getIndexSignatures = function () { - if (this._allIndexSignatures) { - return this._allIndexSignatures; - } - - var signatures = []; - - if (this._indexSignatures) { - signatures = signatures.concat(this._indexSignatures); - } - - if (this._extendedTypes) { - for (var i = 0; i < this._extendedTypes.length; i++) { - if (this._extendedTypes[i].hasBase(this)) { - continue; - } - - this._getResolver()._addUnhiddenSignaturesFromBaseType(this._indexSignatures, this._extendedTypes[i].getIndexSignatures(), signatures); - } - } - - this._allIndexSignatures = signatures; - - return signatures; - }; - - PullTypeSymbol.prototype.getIndexSignaturesOfAugmentedType = function (resolver, globalFunctionInterface, globalObjectInterface) { - if (!this._allIndexSignaturesOfAugmentedType) { - var initialIndexSignatures = this.getIndexSignatures(); - var shouldAddFunctionSignatures = false; - var shouldAddObjectSignatures = false; - - if (globalFunctionInterface && this.isFunctionType() && this !== globalFunctionInterface) { - var functionIndexSignatures = globalFunctionInterface.getIndexSignatures(); - if (functionIndexSignatures.length) { - shouldAddFunctionSignatures = true; - } - } - - if (globalObjectInterface && this !== globalObjectInterface) { - var objectIndexSignatures = globalObjectInterface.getIndexSignatures(); - if (objectIndexSignatures.length) { - shouldAddObjectSignatures = true; - } - } - - if (shouldAddFunctionSignatures || shouldAddObjectSignatures) { - this._allIndexSignaturesOfAugmentedType = initialIndexSignatures.slice(0); - if (shouldAddFunctionSignatures) { - resolver._addUnhiddenSignaturesFromBaseType(initialIndexSignatures, functionIndexSignatures, this._allIndexSignaturesOfAugmentedType); - } - if (shouldAddObjectSignatures) { - if (shouldAddFunctionSignatures) { - initialIndexSignatures = initialIndexSignatures.concat(functionIndexSignatures); - } - resolver._addUnhiddenSignaturesFromBaseType(initialIndexSignatures, objectIndexSignatures, this._allIndexSignaturesOfAugmentedType); - } - } else { - this._allIndexSignaturesOfAugmentedType = initialIndexSignatures; - } - } - - return this._allIndexSignaturesOfAugmentedType; - }; - - PullTypeSymbol.prototype.getBaseClassConstructSignatures = function (baseType) { - TypeScript.Debug.assert(this.isConstructor() && baseType.isConstructor()); - var instanceTypeSymbol = this.getAssociatedContainerType(); - TypeScript.Debug.assert(instanceTypeSymbol.getDeclarations().length === 1); - if (baseType.hasBase(this)) { - return null; - } - - var baseConstructSignatures = baseType.getConstructSignatures(); - var signatures = []; - for (var i = 0; i < baseConstructSignatures.length; i++) { - var baseSignature = baseConstructSignatures[i]; - - baseSignature._resolveDeclaredSymbol(); - var currentSignature = new PullSignatureSymbol(2097152 /* ConstructSignature */, baseSignature.isDefinition()); - currentSignature.returnType = instanceTypeSymbol; - currentSignature.addTypeParametersFromReturnType(); - for (var j = 0; j < baseSignature.parameters.length; j++) { - currentSignature.addParameter(baseSignature.parameters[j], baseSignature.parameters[j].isOptional); - } - if (baseSignature.parameters.length > 0) { - currentSignature.hasVarArgs = baseSignature.parameters[baseSignature.parameters.length - 1].isVarArg; - } - - currentSignature.addDeclaration(instanceTypeSymbol.getDeclarations()[0]); - this.addCallOrConstructSignaturePrerequisiteBase(currentSignature); - signatures.push(currentSignature); - } - - return signatures; - }; - - PullTypeSymbol.prototype.getDefaultClassConstructSignature = function () { - TypeScript.Debug.assert(this.isConstructor()); - var instanceTypeSymbol = this.getAssociatedContainerType(); - TypeScript.Debug.assert(instanceTypeSymbol.getDeclarations().length == 1); - var signature = new PullSignatureSymbol(2097152 /* ConstructSignature */, true); - signature.returnType = instanceTypeSymbol; - signature.addTypeParametersFromReturnType(); - signature.addDeclaration(instanceTypeSymbol.getDeclarations()[0]); - this.addCallOrConstructSignaturePrerequisiteBase(signature); - - return signature; - }; - - PullTypeSymbol.prototype.addImplementedType = function (implementedType) { - if (!implementedType) { - return; - } - - if (!this._implementedTypes) { - this._implementedTypes = []; - } - - this._implementedTypes[this._implementedTypes.length] = implementedType; - - implementedType.addTypeThatExplicitlyImplementsThisType(this); - }; - - PullTypeSymbol.prototype.getImplementedTypes = function () { - if (!this._implementedTypes) { - return TypeScript.sentinelEmptyArray; - } - - return this._implementedTypes; - }; - - PullTypeSymbol.prototype.addExtendedType = function (extendedType) { - if (!extendedType) { - return; - } - - if (!this._extendedTypes) { - this._extendedTypes = []; - } - - this._extendedTypes[this._extendedTypes.length] = extendedType; - - extendedType.addTypeThatExtendsThisType(this); - }; - - PullTypeSymbol.prototype.getExtendedTypes = function () { - if (!this._extendedTypes) { - return TypeScript.sentinelEmptyArray; - } - - return this._extendedTypes; - }; - - PullTypeSymbol.prototype.addTypeThatExtendsThisType = function (type) { - if (!type) { - return; - } - - if (!this._typesThatExtendThisType) { - this._typesThatExtendThisType = []; - } - - this._typesThatExtendThisType[this._typesThatExtendThisType.length] = type; - }; - - PullTypeSymbol.prototype.getTypesThatExtendThisType = function () { - if (!this._typesThatExtendThisType) { - this._typesThatExtendThisType = []; - } - - return this._typesThatExtendThisType; - }; - - PullTypeSymbol.prototype.addTypeThatExplicitlyImplementsThisType = function (type) { - if (!type) { - return; - } - - if (!this._typesThatExplicitlyImplementThisType) { - this._typesThatExplicitlyImplementThisType = []; - } - - this._typesThatExplicitlyImplementThisType[this._typesThatExplicitlyImplementThisType.length] = type; - }; - - PullTypeSymbol.prototype.getTypesThatExplicitlyImplementThisType = function () { - if (!this._typesThatExplicitlyImplementThisType) { - this._typesThatExplicitlyImplementThisType = []; - } - - return this._typesThatExplicitlyImplementThisType; - }; - - PullTypeSymbol.prototype.hasBase = function (potentialBase, visited) { - if (typeof visited === "undefined") { visited = []; } - if (this === potentialBase || this.getRootSymbol() === potentialBase || this === potentialBase.getRootSymbol()) { - return true; - } - - if (TypeScript.ArrayUtilities.contains(visited, this)) { - return true; - } - - visited.push(this); - - var extendedTypes = this.getExtendedTypes(); - - for (var i = 0; i < extendedTypes.length; i++) { - if (extendedTypes[i].hasBase(potentialBase, visited)) { - return true; - } - } - - var implementedTypes = this.getImplementedTypes(); - - for (var i = 0; i < implementedTypes.length; i++) { - if (implementedTypes[i].hasBase(potentialBase, visited)) { - return true; - } - } - - visited.pop(); - - return false; - }; - - PullTypeSymbol.prototype.isValidBaseKind = function (baseType, isExtendedType) { - if (baseType.isError()) { - return false; - } - - var thisIsClass = this.isClass(); - if (isExtendedType) { - if (thisIsClass) { - return baseType.kind === 8 /* Class */; - } - } else { - if (!thisIsClass) { - return false; - } - } - - return !!(baseType.kind & (16 /* Interface */ | 8 /* Class */)); - }; - - PullTypeSymbol.prototype.findMember = function (name, lookInParent) { - var memberSymbol = null; - - if (this._memberNameCache) { - memberSymbol = this._memberNameCache[name]; - } - - if (memberSymbol || !lookInParent) { - return memberSymbol; - } - - if (this._extendedTypes) { - for (var i = 0; i < this._extendedTypes.length; i++) { - memberSymbol = this._extendedTypes[i].findMember(name, lookInParent); - - if (memberSymbol) { - return memberSymbol; - } - } - } - - return null; - }; - - PullTypeSymbol.prototype.findNestedType = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - var memberSymbol; - - if (!this._enclosedTypeNameCache) { - return null; - } - - memberSymbol = this._enclosedTypeNameCache[name]; - - if (memberSymbol && kind !== 0 /* None */) { - memberSymbol = TypeScript.hasFlag(memberSymbol.kind, kind) ? memberSymbol : null; - } - - return memberSymbol; - }; - - PullTypeSymbol.prototype.findNestedContainer = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - var memberSymbol; - - if (!this._enclosedContainerCache) { - return null; - } - - memberSymbol = this._enclosedContainerCache[name]; - - if (memberSymbol && kind !== 0 /* None */) { - memberSymbol = TypeScript.hasFlag(memberSymbol.kind, kind) ? memberSymbol : null; - } - - return memberSymbol; - }; - - PullTypeSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisiblity) { - var allMembers = []; - - if (this._members !== TypeScript.sentinelEmptyArray) { - for (var i = 0, n = this._members.length; i < n; i++) { - var member = this._members[i]; - if ((member.kind & searchDeclKind) && (memberVisiblity !== 2 /* externallyVisible */ || !member.anyDeclHasFlag(2 /* Private */))) { - allMembers[allMembers.length] = member; - } - } - } - - if (this._extendedTypes) { - var extenedMembersVisibility = memberVisiblity !== 0 /* all */ ? 2 /* externallyVisible */ : 0 /* all */; - - for (var i = 0, n = this._extendedTypes.length; i < n; i++) { - var extendedMembers = this._extendedTypes[i].getAllMembers(searchDeclKind, extenedMembersVisibility); - - for (var j = 0, m = extendedMembers.length; j < m; j++) { - var extendedMember = extendedMembers[j]; - if (!(this._memberNameCache && this._memberNameCache[extendedMember.name])) { - allMembers[allMembers.length] = extendedMember; - } - } - } - } - - if (this.isContainer()) { - if (this._enclosedMemberTypes) { - for (var i = 0; i < this._enclosedMemberTypes.length; i++) { - allMembers[allMembers.length] = this._enclosedMemberTypes[i]; - } - } - if (this._enclosedMemberContainers) { - for (var i = 0; i < this._enclosedMemberContainers.length; i++) { - allMembers[allMembers.length] = this._enclosedMemberContainers[i]; - } - } - } - - return allMembers; - }; - - PullTypeSymbol.prototype.findTypeParameter = function (name) { - if (!this._typeParameterNameCache) { - return null; - } - - return this._typeParameterNameCache[name]; - }; - - PullTypeSymbol.prototype.setResolved = function () { - _super.prototype.setResolved.call(this); - }; - - PullTypeSymbol.prototype.getNamePartForFullName = function () { - var name = _super.prototype.getNamePartForFullName.call(this); - - var typars = this.getTypeArgumentsOrTypeParameters(); - var typarString = PullSymbol.getTypeParameterString(typars, this, true); - return name + typarString; - }; - - PullTypeSymbol.prototype.getScopedName = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName) { - return this.getScopedNameEx(scopeSymbol, skipTypeParametersInName, useConstraintInName, false, false, skipInternalAliasName).toString(); - }; - - PullTypeSymbol.prototype.isNamedTypeSymbol = function () { - var kind = this.kind; - if (kind === 2 /* Primitive */ || kind === 8 /* Class */ || kind === 4 /* Container */ || kind === 32 /* DynamicModule */ || kind === 128 /* TypeAlias */ || kind === 64 /* Enum */ || kind === 8192 /* TypeParameter */ || ((kind === 16 /* Interface */ || kind === 8388608 /* ObjectType */) && this.name !== "")) { - return true; - } - - return false; - }; - - PullTypeSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - var s = this.getScopedNameEx(scopeSymbol, false, useConstraintInName).toString(); - return s; - }; - - PullTypeSymbol.prototype.getScopedNameEx = function (scopeSymbol, skipTypeParametersInName, useConstraintInName, getPrettyTypeName, getTypeParamMarkerInfo, skipInternalAliasName, shouldAllowArrayType) { - if (typeof shouldAllowArrayType === "undefined") { shouldAllowArrayType = true; } - if (this.isArrayNamedTypeReference() && shouldAllowArrayType) { - var elementType = this.getElementType(); - var elementMemberName = elementType ? (elementType.isArrayNamedTypeReference() || elementType.isNamedTypeSymbol() ? elementType.getScopedNameEx(scopeSymbol, false, false, getPrettyTypeName, getTypeParamMarkerInfo, skipInternalAliasName) : elementType.getMemberTypeNameEx(false, scopeSymbol, getPrettyTypeName)) : TypeScript.MemberName.create("any"); - return TypeScript.MemberName.create(elementMemberName, "", "[]"); - } - - if (!this.isNamedTypeSymbol()) { - return this.getMemberTypeNameEx(true, scopeSymbol, getPrettyTypeName); - } - - if (skipTypeParametersInName) { - return TypeScript.MemberName.create(_super.prototype.getScopedName.call(this, scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName)); - } else { - var builder = new TypeScript.MemberNameArray(); - builder.prefix = _super.prototype.getScopedName.call(this, scopeSymbol, skipTypeParametersInName, useConstraintInName, skipInternalAliasName); - - var typars = this.getTypeArgumentsOrTypeParameters(); - builder.add(PullSymbol.getTypeParameterStringEx(typars, scopeSymbol, getTypeParamMarkerInfo, useConstraintInName)); - - return builder; - } - }; - - PullTypeSymbol.prototype.hasOnlyOverloadCallSignatures = function () { - var members = this.getMembers(); - var callSignatures = this.getCallSignatures(); - var constructSignatures = this.getConstructSignatures(); - return members.length === 0 && constructSignatures.length === 0 && callSignatures.length > 1; - }; - - PullTypeSymbol.prototype.getTypeOfSymbol = function () { - var associatedContainerType = this.getAssociatedContainerType(); - if (associatedContainerType && associatedContainerType.isNamedTypeSymbol()) { - return associatedContainerType; - } - - var functionSymbol = this.getFunctionSymbol(); - if (functionSymbol && functionSymbol.kind === 16384 /* Function */ && !TypeScript.PullHelpers.isSymbolLocal(functionSymbol)) { - return TypeScript.PullHelpers.isExportedSymbolInClodule(functionSymbol) ? null : functionSymbol; - } - - return null; - }; - - PullTypeSymbol.prototype.getMemberTypeNameEx = function (topLevel, scopeSymbol, getPrettyTypeName) { - var members = this.getMembers(); - var callSignatures = this.getCallSignatures(); - var constructSignatures = this.getConstructSignatures(); - var indexSignatures = this.getIndexSignatures(); - - var typeOfSymbol = this.getTypeOfSymbol(); - if (typeOfSymbol) { - var nameForTypeOf = typeOfSymbol.getScopedNameEx(scopeSymbol, true); - return TypeScript.MemberName.create(nameForTypeOf, "typeof ", ""); - } - - if (members.length > 0 || callSignatures.length > 0 || constructSignatures.length > 0 || indexSignatures.length > 0) { - if (this._inMemberTypeNameEx) { - return TypeScript.MemberName.create("any"); - } - - this._inMemberTypeNameEx = true; - - var allMemberNames = new TypeScript.MemberNameArray(); - var curlies = !topLevel || indexSignatures.length !== 0; - var delim = "; "; - for (var i = 0; i < members.length; i++) { - if (members[i].kind === 65536 /* Method */ && members[i].type.hasOnlyOverloadCallSignatures()) { - var methodCallSignatures = members[i].type.getCallSignatures(); - var nameStr = members[i].getDisplayName(scopeSymbol) + (members[i].isOptional ? "?" : ""); - ; - var methodMemberNames = PullSignatureSymbol.getSignaturesTypeNameEx(methodCallSignatures, nameStr, false, false, scopeSymbol); - allMemberNames.addAll(methodMemberNames); - } else { - var memberTypeName = members[i].getNameAndTypeNameEx(scopeSymbol); - if (memberTypeName.isArray() && memberTypeName.delim === delim) { - allMemberNames.addAll(memberTypeName.entries); - } else { - allMemberNames.add(memberTypeName); - } - } - curlies = true; - } - - var getPrettyFunctionOverload = getPrettyTypeName && !curlies && this.hasOnlyOverloadCallSignatures(); - - var signatureCount = callSignatures.length + constructSignatures.length + indexSignatures.length; - var useShortFormSignature = !curlies && (signatureCount === 1); - var signatureMemberName; - - if (callSignatures.length > 0) { - signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(callSignatures, "", useShortFormSignature, false, scopeSymbol, getPrettyFunctionOverload); - allMemberNames.addAll(signatureMemberName); - } - - if (constructSignatures.length > 0) { - signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(constructSignatures, "new", useShortFormSignature, false, scopeSymbol); - allMemberNames.addAll(signatureMemberName); - } - - if (indexSignatures.length > 0) { - signatureMemberName = PullSignatureSymbol.getSignaturesTypeNameEx(indexSignatures, "", useShortFormSignature, true, scopeSymbol); - allMemberNames.addAll(signatureMemberName); - } - - if ((curlies) || (!getPrettyFunctionOverload && (signatureCount > 1) && topLevel)) { - allMemberNames.prefix = "{ "; - allMemberNames.suffix = "}"; - allMemberNames.delim = delim; - } else if (allMemberNames.entries.length > 1) { - allMemberNames.delim = delim; - } - - this._inMemberTypeNameEx = false; - - return allMemberNames; - } - - return TypeScript.MemberName.create("{}"); - }; - - PullTypeSymbol.prototype.getGenerativeTypeClassification = function (enclosingType) { - return 2 /* Closed */; - }; - - PullTypeSymbol.prototype.wrapsSomeTypeParameter = function (typeParameterArgumentMap, skipTypeArgumentCheck) { - return this.getWrappingTypeParameterID(typeParameterArgumentMap, skipTypeArgumentCheck) != 0; - }; - - PullTypeSymbol.prototype.getWrappingTypeParameterID = function (typeParameterArgumentMap, skipTypeArgumentCheck) { - var type = this; - - if (type.isTypeParameter()) { - if (typeParameterArgumentMap[type.pullSymbolID] || typeParameterArgumentMap[type.getRootSymbol().pullSymbolID]) { - return type.pullSymbolID; - } - - var constraint = type.getConstraint(); - var wrappingTypeParameterID = constraint ? constraint.getWrappingTypeParameterID(typeParameterArgumentMap) : 0; - return wrappingTypeParameterID; - } - - if (type.inWrapCheck) { - return 0; - } - - this._wrapsTypeParameterCache = this._wrapsTypeParameterCache || new TypeScript.WrapsTypeParameterCache(); - var wrappingTypeParameterID = this._wrapsTypeParameterCache.getWrapsTypeParameter(typeParameterArgumentMap); - if (wrappingTypeParameterID === undefined) { - wrappingTypeParameterID = this.getWrappingTypeParameterIDWorker(typeParameterArgumentMap, skipTypeArgumentCheck); - - this._wrapsTypeParameterCache.setWrapsTypeParameter(typeParameterArgumentMap, wrappingTypeParameterID); - } - return wrappingTypeParameterID; - }; - - PullTypeSymbol.prototype.getWrappingTypeParameterIDFromSignatures = function (signatures, typeParameterArgumentMap) { - for (var i = 0; i < signatures.length; i++) { - var wrappingTypeParameterID = signatures[i].getWrappingTypeParameterID(typeParameterArgumentMap); - if (wrappingTypeParameterID !== 0) { - return wrappingTypeParameterID; - } - } - - return 0; - }; - - PullTypeSymbol.prototype.getWrappingTypeParameterIDWorker = function (typeParameterArgumentMap, skipTypeArgumentCheck) { - var type = this; - var wrappingTypeParameterID = 0; - - if (!skipTypeArgumentCheck) { - type.inWrapCheck = true; - - var typeArguments = type.getTypeArguments(); - - if (type.isGeneric() && !typeArguments) { - typeArguments = type.getTypeParameters(); - } - - if (typeArguments) { - for (var i = 0; !wrappingTypeParameterID && i < typeArguments.length; i++) { - wrappingTypeParameterID = typeArguments[i].getWrappingTypeParameterID(typeParameterArgumentMap); - } - } - } - - if (skipTypeArgumentCheck || !(type.kind & 8216 /* SomeInstantiatableType */) || !type.name) { - var members = type.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - for (var i = 0; !wrappingTypeParameterID && i < members.length; i++) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(members[i]); - wrappingTypeParameterID = members[i].type.getWrappingTypeParameterID(typeParameterArgumentMap); - } - - wrappingTypeParameterID = wrappingTypeParameterID || this.getWrappingTypeParameterIDFromSignatures(type.getCallSignatures(), typeParameterArgumentMap) || this.getWrappingTypeParameterIDFromSignatures(type.getConstructSignatures(), typeParameterArgumentMap) || this.getWrappingTypeParameterIDFromSignatures(type.getIndexSignatures(), typeParameterArgumentMap); - } - - if (!skipTypeArgumentCheck) { - type.inWrapCheck = false; - } - - return wrappingTypeParameterID; - }; - - PullTypeSymbol.prototype.wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference = function (enclosingType) { - TypeScript.Debug.assert(this.isNamedTypeSymbol()); - TypeScript.Debug.assert(TypeScript.PullHelpers.getRootType(enclosingType) == enclosingType); - var knownWrapMap = TypeScript.BitMatrix.getBitMatrix(true); - var wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap); - knownWrapMap.release(); - return wrapsIntoInfinitelyExpandingTypeReference; - }; - - PullTypeSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse = function (enclosingType, knownWrapMap) { - var wrapsIntoInfinitelyExpandingTypeReference = knownWrapMap.valueAt(this.pullSymbolID, enclosingType.pullSymbolID); - if (wrapsIntoInfinitelyExpandingTypeReference != undefined) { - return wrapsIntoInfinitelyExpandingTypeReference; - } - - if (this.inWrapInfiniteExpandingReferenceCheck) { - return false; - } - - this.inWrapInfiniteExpandingReferenceCheck = true; - wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker(enclosingType, knownWrapMap); - knownWrapMap.setValueAt(this.pullSymbolID, enclosingType.pullSymbolID, wrapsIntoInfinitelyExpandingTypeReference); - this.inWrapInfiniteExpandingReferenceCheck = false; - - return wrapsIntoInfinitelyExpandingTypeReference; - }; - - PullTypeSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceWorker = function (enclosingType, knownWrapMap) { - var thisRootType = TypeScript.PullHelpers.getRootType(this); - - if (thisRootType != enclosingType) { - var thisIsNamedType = this.isNamedTypeSymbol(); - - if (thisIsNamedType) { - if (thisRootType.inWrapInfiniteExpandingReferenceCheck) { - return false; - } - - thisRootType.inWrapInfiniteExpandingReferenceCheck = true; - } - - var wrapsIntoInfinitelyExpandingTypeReference = this._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceStructure(enclosingType, knownWrapMap); - - if (thisIsNamedType) { - thisRootType.inWrapInfiniteExpandingReferenceCheck = false; - } - - return wrapsIntoInfinitelyExpandingTypeReference; - } - - var enclosingTypeParameters = enclosingType.getTypeParameters(); - var typeArguments = this.getTypeArguments(); - for (var i = 0; i < typeArguments.length; i++) { - if (TypeScript.ArrayUtilities.contains(enclosingTypeParameters, typeArguments[i])) { - continue; - } - - if (typeArguments[i].wrapsSomeTypeParameter(this.getTypeParameterArgumentMap())) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceStructure = function (enclosingType, knownWrapMap) { - var members = this.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - for (var i = 0; i < members.length; i++) { - if (members[i].type && members[i].type._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse(enclosingType, knownWrapMap)) { - return true; - } - } - - var sigs = this.getCallSignatures(); - for (var i = 0; i < sigs.length; i++) { - if (sigs[i]._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType, knownWrapMap)) { - return true; - } - } - - sigs = this.getConstructSignatures(); - for (var i = 0; i < sigs.length; i++) { - if (sigs[i]._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType, knownWrapMap)) { - return true; - } - } - - sigs = this.getIndexSignatures(); - for (var i = 0; i < sigs.length; i++) { - if (sigs[i]._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType, knownWrapMap)) { - return true; - } - } - - return false; - }; - - PullTypeSymbol.prototype.widenedType = function (resolver, ast, context) { - if (!this._widenedType) { - this._widenedType = resolver.widenType(this, ast, context); - } - return this._widenedType; - }; - return PullTypeSymbol; - })(PullSymbol); - TypeScript.PullTypeSymbol = PullTypeSymbol; - - var PullPrimitiveTypeSymbol = (function (_super) { - __extends(PullPrimitiveTypeSymbol, _super); - function PullPrimitiveTypeSymbol(name) { - _super.call(this, name, 2 /* Primitive */); - - this.isResolved = true; - } - PullPrimitiveTypeSymbol.prototype.isAny = function () { - return !this.isStringConstant() && this.name === "any"; - }; - - PullPrimitiveTypeSymbol.prototype.isNull = function () { - return !this.isStringConstant() && this.name === "null"; - }; - - PullPrimitiveTypeSymbol.prototype.isUndefined = function () { - return !this.isStringConstant() && this.name === "undefined"; - }; - - PullPrimitiveTypeSymbol.prototype.isStringConstant = function () { - return false; - }; - - PullPrimitiveTypeSymbol.prototype.setUnresolved = function () { - }; - - PullPrimitiveTypeSymbol.prototype.getDisplayName = function () { - if (this.isNull() || this.isUndefined()) { - return "any"; - } else { - return _super.prototype.getDisplayName.call(this); - } - }; - return PullPrimitiveTypeSymbol; - })(PullTypeSymbol); - TypeScript.PullPrimitiveTypeSymbol = PullPrimitiveTypeSymbol; - - var PullStringConstantTypeSymbol = (function (_super) { - __extends(PullStringConstantTypeSymbol, _super); - function PullStringConstantTypeSymbol(name) { - _super.call(this, name); - } - PullStringConstantTypeSymbol.prototype.isStringConstant = function () { - return true; - }; - return PullStringConstantTypeSymbol; - })(PullPrimitiveTypeSymbol); - TypeScript.PullStringConstantTypeSymbol = PullStringConstantTypeSymbol; - - var PullErrorTypeSymbol = (function (_super) { - __extends(PullErrorTypeSymbol, _super); - function PullErrorTypeSymbol(_anyType, name) { - _super.call(this, name); - this._anyType = _anyType; - - TypeScript.Debug.assert(this._anyType); - this.isResolved = true; - } - PullErrorTypeSymbol.prototype.isError = function () { - return true; - }; - - PullErrorTypeSymbol.prototype._getResolver = function () { - return this._anyType._getResolver(); - }; - - PullErrorTypeSymbol.prototype.getName = function (scopeSymbol, useConstraintInName) { - return this._anyType.getName(scopeSymbol, useConstraintInName); - }; - - PullErrorTypeSymbol.prototype.getDisplayName = function (scopeSymbol, useConstraintInName, skipInternalAliasName) { - return this._anyType.getName(scopeSymbol, useConstraintInName); - }; - - PullErrorTypeSymbol.prototype.toString = function (scopeSymbol, useConstraintInName) { - return this._anyType.getName(scopeSymbol, useConstraintInName); - }; - return PullErrorTypeSymbol; - })(PullPrimitiveTypeSymbol); - TypeScript.PullErrorTypeSymbol = PullErrorTypeSymbol; - - var PullContainerSymbol = (function (_super) { - __extends(PullContainerSymbol, _super); - function PullContainerSymbol(name, kind) { - _super.call(this, name, kind); - this.instanceSymbol = null; - this.assignedValue = null; - this.assignedType = null; - this.assignedContainer = null; - } - PullContainerSymbol.prototype.isContainer = function () { - return true; - }; - - PullContainerSymbol.prototype.setInstanceSymbol = function (symbol) { - this.instanceSymbol = symbol; - }; - - PullContainerSymbol.prototype.getInstanceSymbol = function () { - return this.instanceSymbol; - }; - - PullContainerSymbol.prototype.setExportAssignedValueSymbol = function (symbol) { - this.assignedValue = symbol; - }; - - PullContainerSymbol.prototype.getExportAssignedValueSymbol = function () { - return this.assignedValue; - }; - - PullContainerSymbol.prototype.setExportAssignedTypeSymbol = function (type) { - this.assignedType = type; - }; - - PullContainerSymbol.prototype.getExportAssignedTypeSymbol = function () { - return this.assignedType; - }; - - PullContainerSymbol.prototype.setExportAssignedContainerSymbol = function (container) { - this.assignedContainer = container; - }; - - PullContainerSymbol.prototype.getExportAssignedContainerSymbol = function () { - return this.assignedContainer; - }; - - PullContainerSymbol.prototype.hasExportAssignment = function () { - return !!this.assignedValue || !!this.assignedType || !!this.assignedContainer; - }; - - PullContainerSymbol.usedAsSymbol = function (containerSymbol, symbol) { - if (!containerSymbol || !containerSymbol.isContainer()) { - return false; - } - - if (!containerSymbol.isAlias() && containerSymbol.type === symbol) { - return true; - } - - var moduleSymbol = containerSymbol; - var valueExportSymbol = moduleSymbol.getExportAssignedValueSymbol(); - var typeExportSymbol = moduleSymbol.getExportAssignedTypeSymbol(); - var containerExportSymbol = moduleSymbol.getExportAssignedContainerSymbol(); - if (valueExportSymbol || typeExportSymbol || containerExportSymbol) { - if (valueExportSymbol === symbol || typeExportSymbol == symbol || containerExportSymbol == symbol) { - return true; - } - - if (containerExportSymbol != containerSymbol) { - return PullContainerSymbol.usedAsSymbol(containerExportSymbol, symbol); - } - } - - return false; - }; - - PullContainerSymbol.prototype.getInstanceType = function () { - return this.instanceSymbol ? this.instanceSymbol.type : null; - }; - return PullContainerSymbol; - })(PullTypeSymbol); - TypeScript.PullContainerSymbol = PullContainerSymbol; - - var PullTypeAliasSymbol = (function (_super) { - __extends(PullTypeAliasSymbol, _super); - function PullTypeAliasSymbol(name) { - _super.call(this, name, 128 /* TypeAlias */); - this._assignedValue = null; - this._assignedType = null; - this._assignedContainer = null; - this._isUsedAsValue = false; - this._typeUsedExternally = false; - this._isUsedInExportAlias = false; - this.retrievingExportAssignment = false; - this.linkedAliasSymbols = null; - } - PullTypeAliasSymbol.prototype.isUsedInExportedAlias = function () { - this._resolveDeclaredSymbol(); - return this._isUsedInExportAlias; - }; - - PullTypeAliasSymbol.prototype.typeUsedExternally = function () { - this._resolveDeclaredSymbol(); - return this._typeUsedExternally; - }; - - PullTypeAliasSymbol.prototype.isUsedAsValue = function () { - this._resolveDeclaredSymbol(); - return this._isUsedAsValue; - }; - - PullTypeAliasSymbol.prototype.setTypeUsedExternally = function () { - this._typeUsedExternally = true; - }; - - PullTypeAliasSymbol.prototype.setIsUsedInExportedAlias = function () { - this._isUsedInExportAlias = true; - if (this.linkedAliasSymbols) { - this.linkedAliasSymbols.forEach(function (s) { - return s.setIsUsedInExportedAlias(); - }); - } - }; - - PullTypeAliasSymbol.prototype.addLinkedAliasSymbol = function (contingentValueSymbol) { - if (!this.linkedAliasSymbols) { - this.linkedAliasSymbols = [contingentValueSymbol]; - } else { - this.linkedAliasSymbols.push(contingentValueSymbol); - } - }; - - PullTypeAliasSymbol.prototype.setIsUsedAsValue = function () { - this._isUsedAsValue = true; - if (this.linkedAliasSymbols) { - this.linkedAliasSymbols.forEach(function (s) { - return s.setIsUsedAsValue(); - }); - } - }; - - PullTypeAliasSymbol.prototype.assignedValue = function () { - this._resolveDeclaredSymbol(); - return this._assignedValue; - }; - - PullTypeAliasSymbol.prototype.assignedType = function () { - this._resolveDeclaredSymbol(); - return this._assignedType; - }; - - PullTypeAliasSymbol.prototype.assignedContainer = function () { - this._resolveDeclaredSymbol(); - return this._assignedContainer; - }; - - PullTypeAliasSymbol.prototype.isAlias = function () { - return true; - }; - PullTypeAliasSymbol.prototype.isContainer = function () { - return true; - }; - - PullTypeAliasSymbol.prototype.setAssignedValueSymbol = function (symbol) { - this._assignedValue = symbol; - }; - - PullTypeAliasSymbol.prototype.getExportAssignedValueSymbol = function () { - if (this._assignedValue) { - return this._assignedValue; - } - - if (this.retrievingExportAssignment) { - return null; - } - - if (this._assignedContainer) { - if (this._assignedContainer.hasExportAssignment()) { - this.retrievingExportAssignment = true; - var sym = this._assignedContainer.getExportAssignedValueSymbol(); - this.retrievingExportAssignment = false; - return sym; - } - - return this._assignedContainer.getInstanceSymbol(); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.setAssignedTypeSymbol = function (type) { - this._assignedType = type; - }; - - PullTypeAliasSymbol.prototype.getExportAssignedTypeSymbol = function () { - if (this.retrievingExportAssignment) { - return null; - } - - if (this._assignedType) { - if (this._assignedType.isAlias()) { - this.retrievingExportAssignment = true; - var sym = this._assignedType.getExportAssignedTypeSymbol(); - this.retrievingExportAssignment = false; - } else if (this._assignedType !== this._assignedContainer) { - return this._assignedType; - } - } - - if (this._assignedContainer) { - this.retrievingExportAssignment = true; - var sym = this._assignedContainer.getExportAssignedTypeSymbol(); - this.retrievingExportAssignment = false; - if (sym) { - return sym; - } - } - - return this._assignedContainer; - }; - - PullTypeAliasSymbol.prototype.setAssignedContainerSymbol = function (container) { - this._assignedContainer = container; - }; - - PullTypeAliasSymbol.prototype.getExportAssignedContainerSymbol = function () { - if (this.retrievingExportAssignment) { - return null; - } - - if (this._assignedContainer) { - this.retrievingExportAssignment = true; - var sym = this._assignedContainer.getExportAssignedContainerSymbol(); - this.retrievingExportAssignment = false; - if (sym) { - return sym; - } - } - - return this._assignedContainer; - }; - - PullTypeAliasSymbol.prototype.getMembers = function () { - if (this._assignedType) { - return this._assignedType.getMembers(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.getCallSignatures = function () { - if (this._assignedType) { - return this._assignedType.getCallSignatures(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.getConstructSignatures = function () { - if (this._assignedType) { - return this._assignedType.getConstructSignatures(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.getIndexSignatures = function () { - if (this._assignedType) { - return this._assignedType.getIndexSignatures(); - } - - return TypeScript.sentinelEmptyArray; - }; - - PullTypeAliasSymbol.prototype.findMember = function (name) { - if (this._assignedType) { - return this._assignedType.findMember(name, true); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.findNestedType = function (name) { - if (this._assignedType) { - return this._assignedType.findNestedType(name); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.findNestedContainer = function (name) { - if (this._assignedType) { - return this._assignedType.findNestedContainer(name); - } - - return null; - }; - - PullTypeAliasSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisibility) { - if (this._assignedType) { - return this._assignedType.getAllMembers(searchDeclKind, memberVisibility); - } - - return TypeScript.sentinelEmptyArray; - }; - return PullTypeAliasSymbol; - })(PullTypeSymbol); - TypeScript.PullTypeAliasSymbol = PullTypeAliasSymbol; - - var PullTypeParameterSymbol = (function (_super) { - __extends(PullTypeParameterSymbol, _super); - function PullTypeParameterSymbol(name) { - _super.call(this, name, 8192 /* TypeParameter */); - this._constraint = null; - } - PullTypeParameterSymbol.prototype.isTypeParameter = function () { - return true; - }; - - PullTypeParameterSymbol.prototype.setConstraint = function (constraintType) { - this._constraint = constraintType; - }; - - PullTypeParameterSymbol.prototype.getConstraint = function () { - return this._constraint; - }; - - PullTypeParameterSymbol.prototype.getBaseConstraint = function (semanticInfoChain) { - var preBaseConstraint = this.getConstraintRecursively({}); - TypeScript.Debug.assert(preBaseConstraint === null || !preBaseConstraint.isTypeParameter()); - return preBaseConstraint || semanticInfoChain.emptyTypeSymbol; - }; - - PullTypeParameterSymbol.prototype.getConstraintRecursively = function (visitedTypeParameters) { - var constraint = this.getConstraint(); - - if (constraint) { - if (constraint.isTypeParameter()) { - var constraintAsTypeParameter = constraint; - if (!visitedTypeParameters[constraintAsTypeParameter.pullSymbolID]) { - visitedTypeParameters[constraintAsTypeParameter.pullSymbolID] = constraintAsTypeParameter; - return constraintAsTypeParameter.getConstraintRecursively(visitedTypeParameters); - } - } else { - return constraint; - } - } - - return null; - }; - - PullTypeParameterSymbol.prototype.getDefaultConstraint = function (semanticInfoChain) { - return this._constraint || semanticInfoChain.emptyTypeSymbol; - }; - - PullTypeParameterSymbol.prototype.getCallSignatures = function () { - if (this._constraint) { - return this._constraint.getCallSignatures(); - } - - return _super.prototype.getCallSignatures.call(this); - }; - - PullTypeParameterSymbol.prototype.getConstructSignatures = function () { - if (this._constraint) { - return this._constraint.getConstructSignatures(); - } - - return _super.prototype.getConstructSignatures.call(this); - }; - - PullTypeParameterSymbol.prototype.getIndexSignatures = function () { - if (this._constraint) { - return this._constraint.getIndexSignatures(); - } - - return _super.prototype.getIndexSignatures.call(this); - }; - - PullTypeParameterSymbol.prototype.isGeneric = function () { - return true; - }; - - PullTypeParameterSymbol.prototype.fullName = function (scopeSymbol) { - var name = this.getDisplayName(scopeSymbol); - var container = this.getContainer(); - if (container) { - var containerName = container.fullName(scopeSymbol); - name = name + " in " + containerName; - } - - return name; - }; - - PullTypeParameterSymbol.prototype.getName = function (scopeSymbol, useConstraintInName) { - var name = _super.prototype.getName.call(this, scopeSymbol); - - if (this.isPrinting) { - return name; - } - - this.isPrinting = true; - - if (useConstraintInName && this._constraint) { - name += " extends " + this._constraint.toString(scopeSymbol); - } - - this.isPrinting = false; - - return name; - }; - - PullTypeParameterSymbol.prototype.getDisplayName = function (scopeSymbol, useConstraintInName, skipInternalAliasName) { - var name = _super.prototype.getDisplayName.call(this, scopeSymbol, useConstraintInName, skipInternalAliasName); - - if (this.isPrinting) { - return name; - } - - this.isPrinting = true; - - if (useConstraintInName && this._constraint) { - name += " extends " + this._constraint.toString(scopeSymbol); - } - - this.isPrinting = false; - - return name; - }; - - PullTypeParameterSymbol.prototype.isExternallyVisible = function (inIsExternallyVisibleSymbols) { - return true; - }; - return PullTypeParameterSymbol; - })(PullTypeSymbol); - TypeScript.PullTypeParameterSymbol = PullTypeParameterSymbol; - - var PullAccessorSymbol = (function (_super) { - __extends(PullAccessorSymbol, _super); - function PullAccessorSymbol(name) { - _super.call(this, name, 4096 /* Property */); - this._getterSymbol = null; - this._setterSymbol = null; - } - PullAccessorSymbol.prototype.isAccessor = function () { - return true; - }; - - PullAccessorSymbol.prototype.setSetter = function (setter) { - if (!setter) { - return; - } - - this._setterSymbol = setter; - }; - - PullAccessorSymbol.prototype.getSetter = function () { - return this._setterSymbol; - }; - - PullAccessorSymbol.prototype.setGetter = function (getter) { - if (!getter) { - return; - } - - this._getterSymbol = getter; - }; - - PullAccessorSymbol.prototype.getGetter = function () { - return this._getterSymbol; - }; - return PullAccessorSymbol; - })(PullSymbol); - TypeScript.PullAccessorSymbol = PullAccessorSymbol; - - function getIDForTypeSubstitutions(instantiatingTypeOrSignature, typeArgumentMap) { - var substitution = ""; - var members = null; - - var allowedToReferenceTypeParameters = instantiatingTypeOrSignature.getAllowedToReferenceTypeParameters(); - for (var i = 0; i < allowedToReferenceTypeParameters.length; i++) { - var typeParameter = allowedToReferenceTypeParameters[i]; - var typeParameterID = typeParameter.pullSymbolID; - var typeArg = typeArgumentMap[typeParameterID]; - if (!typeArg) { - typeArg = typeParameter; - } - substitution += typeParameterID + ":" + getIDForTypeSubstitutionsOfType(typeArg); - } - - return substitution; - } - TypeScript.getIDForTypeSubstitutions = getIDForTypeSubstitutions; - - function getIDForTypeSubstitutionsOfType(type) { - var structure; - if (type.isError()) { - structure = "E" + getIDForTypeSubstitutionsOfType(type._anyType); - } else if (!type.isNamedTypeSymbol()) { - structure = getIDForTypeSubstitutionsFromObjectType(type); - } - - if (!structure) { - structure = type.pullSymbolID + "#"; - } - - return structure; - } - - function getIDForTypeSubstitutionsFromObjectType(type) { - if (type.isResolved) { - var getIDForTypeSubStitutionWalker = new GetIDForTypeSubStitutionWalker(); - TypeScript.PullHelpers.walkPullTypeSymbolStructure(type, getIDForTypeSubStitutionWalker); - } - - return null; - } - - var GetIDForTypeSubStitutionWalker = (function () { - function GetIDForTypeSubStitutionWalker() { - this.structure = ""; - } - GetIDForTypeSubStitutionWalker.prototype.memberSymbolWalk = function (memberSymbol) { - this.structure += memberSymbol.name + "@" + getIDForTypeSubstitutionsOfType(memberSymbol.type); - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.callSignatureWalk = function (signatureSymbol) { - this.structure += "("; - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.constructSignatureWalk = function (signatureSymbol) { - this.structure += "new("; - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.indexSignatureWalk = function (signatureSymbol) { - this.structure += "[]("; - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.signatureParameterWalk = function (parameterSymbol) { - this.structure += parameterSymbol.name + "@" + getIDForTypeSubstitutionsOfType(parameterSymbol.type); - return true; - }; - GetIDForTypeSubStitutionWalker.prototype.signatureReturnTypeWalk = function (returnType) { - this.structure += ")" + getIDForTypeSubstitutionsOfType(returnType); - return true; - }; - return GetIDForTypeSubStitutionWalker; - })(); - - (function (GetAllMembersVisiblity) { - GetAllMembersVisiblity[GetAllMembersVisiblity["all"] = 0] = "all"; - - GetAllMembersVisiblity[GetAllMembersVisiblity["internallyVisible"] = 1] = "internallyVisible"; - - GetAllMembersVisiblity[GetAllMembersVisiblity["externallyVisible"] = 2] = "externallyVisible"; - })(TypeScript.GetAllMembersVisiblity || (TypeScript.GetAllMembersVisiblity = {})); - var GetAllMembersVisiblity = TypeScript.GetAllMembersVisiblity; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var EnclosingTypeWalkerState = (function () { - function EnclosingTypeWalkerState() { - } - EnclosingTypeWalkerState.getDefaultEnclosingTypeWalkerState = function () { - var defaultEnclosingTypeWalkerState = new EnclosingTypeWalkerState(); - defaultEnclosingTypeWalkerState._hasSetEnclosingType = false; - return defaultEnclosingTypeWalkerState; - }; - - EnclosingTypeWalkerState.getNonGenericEnclosingTypeWalkerState = function () { - var defaultEnclosingTypeWalkerState = new EnclosingTypeWalkerState(); - defaultEnclosingTypeWalkerState._hasSetEnclosingType = true; - return defaultEnclosingTypeWalkerState; - }; - - EnclosingTypeWalkerState.getGenericEnclosingTypeWalkerState = function (genericEnclosingType) { - var defaultEnclosingTypeWalkerState = new EnclosingTypeWalkerState(); - defaultEnclosingTypeWalkerState._hasSetEnclosingType = true; - defaultEnclosingTypeWalkerState._currentSymbols = [TypeScript.PullHelpers.getRootType(genericEnclosingType)]; - return defaultEnclosingTypeWalkerState; - }; - return EnclosingTypeWalkerState; - })(); - TypeScript.EnclosingTypeWalkerState = EnclosingTypeWalkerState; - - var PullTypeEnclosingTypeWalker = (function () { - function PullTypeEnclosingTypeWalker() { - this.setDefaultTypeWalkerState(); - } - PullTypeEnclosingTypeWalker.prototype.setDefaultTypeWalkerState = function () { - this.enclosingTypeWalkerState = PullTypeEnclosingTypeWalker._defaultEnclosingTypeWalkerState; - }; - - PullTypeEnclosingTypeWalker.prototype.setNonGenericEnclosingTypeWalkerState = function () { - this.enclosingTypeWalkerState = PullTypeEnclosingTypeWalker._nonGenericEnclosingTypeWalkerState; - }; - - PullTypeEnclosingTypeWalker.prototype.canSymbolOrDeclBeUsedAsEnclosingTypeHelper = function (name, kind) { - return name && (kind === 8 /* Class */ || kind === 16 /* Interface */); - }; - - PullTypeEnclosingTypeWalker.prototype.canDeclBeUsedAsEnclosingType = function (decl) { - return this.canSymbolOrDeclBeUsedAsEnclosingTypeHelper(decl.name, decl.kind); - }; - - PullTypeEnclosingTypeWalker.prototype.canSymbolBeUsedAsEnclosingType = function (symbol) { - return this.canSymbolOrDeclBeUsedAsEnclosingTypeHelper(symbol.name, symbol.kind); - }; - - PullTypeEnclosingTypeWalker.prototype.getEnclosingType = function () { - var currentSymbols = this.enclosingTypeWalkerState._currentSymbols; - if (currentSymbols) { - TypeScript.Debug.assert(currentSymbols.length > 0); - return currentSymbols[0]; - } - - return null; - }; - - PullTypeEnclosingTypeWalker.prototype._canWalkStructure = function () { - var enclosingType = this.getEnclosingType(); - TypeScript.Debug.assert(!enclosingType || enclosingType.isGeneric()); - return !!enclosingType; - }; - - PullTypeEnclosingTypeWalker.prototype._getCurrentSymbol = function () { - var currentSymbols = this.enclosingTypeWalkerState._currentSymbols; - if (currentSymbols && currentSymbols.length) { - return currentSymbols[currentSymbols.length - 1]; - } - - return null; - }; - - PullTypeEnclosingTypeWalker.prototype.getGenerativeClassification = function () { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - if (!currentType) { - return 0 /* Unknown */; - } - - var variableNeededToFixNodeJitterBug = this.getEnclosingType(); - - return currentType.getGenerativeTypeClassification(variableNeededToFixNodeJitterBug); - } - - return 2 /* Closed */; - }; - - PullTypeEnclosingTypeWalker.prototype._pushSymbol = function (symbol) { - return this.enclosingTypeWalkerState._currentSymbols.push(symbol); - }; - - PullTypeEnclosingTypeWalker.prototype._popSymbol = function () { - return this.enclosingTypeWalkerState._currentSymbols.pop(); - }; - - PullTypeEnclosingTypeWalker.prototype.setSymbolAsEnclosingType = function (type) { - if (type.isGeneric()) { - this.enclosingTypeWalkerState = EnclosingTypeWalkerState.getGenericEnclosingTypeWalkerState(type); - } else { - this.setNonGenericEnclosingTypeWalkerState(); - } - }; - - PullTypeEnclosingTypeWalker.prototype._setEnclosingTypeOfParentDecl = function (decl, setSignature) { - var parentDecl = decl.getParentDecl(); - - if (parentDecl && !(parentDecl.kind & (164 /* SomeContainer */ | 1 /* Script */))) { - if (this.canDeclBeUsedAsEnclosingType(parentDecl)) { - this.setSymbolAsEnclosingType(parentDecl.getSymbol()); - } else { - this._setEnclosingTypeOfParentDecl(parentDecl, true); - } - - if (this._canWalkStructure()) { - var symbol = decl.getSymbol(); - if (symbol) { - if (!symbol.isType() && !symbol.isSignature()) { - symbol = symbol.type; - } - - this._pushSymbol(symbol); - } - - if (setSignature) { - var signature = decl.getSignatureSymbol(); - if (signature) { - this._pushSymbol(signature); - } - } - } - } - }; - - PullTypeEnclosingTypeWalker.prototype.setEnclosingTypeForSymbol = function (symbol) { - var currentEnclosingTypeWalkerState = this.enclosingTypeWalkerState; - if (this.canSymbolBeUsedAsEnclosingType(symbol)) { - this.setSymbolAsEnclosingType(symbol); - } else { - this.setDefaultTypeWalkerState(); - - var decls = symbol.getDeclarations(); - for (var i = 0; i < decls.length; i++) { - var decl = decls[i]; - this._setEnclosingTypeOfParentDecl(decl, symbol.isSignature()); - - if (this.enclosingTypeWalkerState._hasSetEnclosingType) { - break; - } - } - - if (!this.enclosingTypeWalkerState._hasSetEnclosingType) { - this.setNonGenericEnclosingTypeWalkerState(); - } - } - return currentEnclosingTypeWalkerState; - }; - - PullTypeEnclosingTypeWalker.prototype.startWalkingType = function (symbol) { - var currentState = this.enclosingTypeWalkerState; - - var setEnclosingTypeForSymbol = !this.enclosingTypeWalkerState._hasSetEnclosingType || this.canSymbolBeUsedAsEnclosingType(symbol); - if (setEnclosingTypeForSymbol) { - this.setEnclosingTypeForSymbol(symbol); - } - return currentState; - }; - - PullTypeEnclosingTypeWalker.prototype.endWalkingType = function (stateWhenStartedWalkingTypes) { - this.enclosingTypeWalkerState = stateWhenStartedWalkingTypes; - }; - - PullTypeEnclosingTypeWalker.prototype.walkMemberType = function (memberName, resolver) { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - var memberSymbol = currentType ? resolver._getNamedPropertySymbolOfAugmentedType(memberName, currentType) : null; - this._pushSymbol(memberSymbol ? memberSymbol.type : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkMemberType = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkSignature = function (kind, index) { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - var signatures; - if (currentType) { - if (kind == 1048576 /* CallSignature */) { - signatures = currentType.getCallSignatures(); - } else if (kind == 2097152 /* ConstructSignature */) { - signatures = currentType.getConstructSignatures(); - } else { - signatures = currentType.getIndexSignatures(); - } - } - - this._pushSymbol(signatures ? signatures[index] : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkSignature = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkTypeArgument = function (index) { - if (this._canWalkStructure()) { - var typeArgument = null; - var currentType = this._getCurrentSymbol(); - if (currentType) { - var typeArguments = currentType.getTypeArguments(); - typeArgument = typeArguments ? typeArguments[index] : null; - } - this._pushSymbol(typeArgument); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkTypeArgument = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkTypeParameterConstraint = function (index) { - if (this._canWalkStructure()) { - var typeParameters; - var currentSymbol = this._getCurrentSymbol(); - if (currentSymbol) { - if (currentSymbol.isSignature()) { - typeParameters = currentSymbol.getTypeParameters(); - } else { - TypeScript.Debug.assert(currentSymbol.isType()); - typeParameters = currentSymbol.getTypeParameters(); - } - } - this._pushSymbol(typeParameters ? typeParameters[index].getConstraint() : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkTypeParameterConstraint = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkReturnType = function () { - if (this._canWalkStructure()) { - var currentSignature = this._getCurrentSymbol(); - this._pushSymbol(currentSignature ? currentSignature.returnType : null); - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkReturnType = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.walkParameterType = function (iParam) { - if (this._canWalkStructure()) { - var currentSignature = this._getCurrentSymbol(); - this._pushSymbol(currentSignature ? currentSignature.getParameterTypeAtIndex(iParam) : null); - } - }; - PullTypeEnclosingTypeWalker.prototype.postWalkParameterType = function () { - if (this._canWalkStructure()) { - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.getBothKindOfIndexSignatures = function (resolver, context, includeAugmentedType) { - if (this._canWalkStructure()) { - var currentType = this._getCurrentSymbol(); - if (currentType) { - return resolver._getBothKindsOfIndexSignatures(currentType, context, includeAugmentedType); - } - } - return null; - }; - - PullTypeEnclosingTypeWalker.prototype.walkIndexSignatureReturnType = function (indexSigInfo, useStringIndexSignature, onlySignature) { - if (this._canWalkStructure()) { - var indexSig = indexSigInfo ? (useStringIndexSignature ? indexSigInfo.stringSignature : indexSigInfo.numericSignature) : null; - this._pushSymbol(indexSig); - if (!onlySignature) { - this._pushSymbol(indexSig ? indexSig.returnType : null); - } - } - }; - - PullTypeEnclosingTypeWalker.prototype.postWalkIndexSignatureReturnType = function (onlySignature) { - if (this._canWalkStructure()) { - if (!onlySignature) { - this._popSymbol(); - } - this._popSymbol(); - } - }; - - PullTypeEnclosingTypeWalker.prototype.resetEnclosingTypeWalkerState = function () { - var currentState = this.enclosingTypeWalkerState; - this.setDefaultTypeWalkerState(); - return currentState; - }; - - PullTypeEnclosingTypeWalker.prototype.setEnclosingTypeWalkerState = function (enclosingTypeWalkerState) { - if (enclosingTypeWalkerState) { - this.enclosingTypeWalkerState = enclosingTypeWalkerState; - } else { - this.setDefaultTypeWalkerState(); - } - }; - PullTypeEnclosingTypeWalker._defaultEnclosingTypeWalkerState = EnclosingTypeWalkerState.getDefaultEnclosingTypeWalkerState(); - - PullTypeEnclosingTypeWalker._nonGenericEnclosingTypeWalkerState = EnclosingTypeWalkerState.getNonGenericEnclosingTypeWalkerState(); - return PullTypeEnclosingTypeWalker; - })(); - TypeScript.PullTypeEnclosingTypeWalker = PullTypeEnclosingTypeWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CandidateInferenceInfo = (function () { - function CandidateInferenceInfo() { - this.typeParameter = null; - this._inferredTypeAfterFixing = null; - this.inferenceCandidates = []; - } - CandidateInferenceInfo.prototype.addCandidate = function (candidate) { - if (!this._inferredTypeAfterFixing) { - this.inferenceCandidates[this.inferenceCandidates.length] = candidate; - } - }; - - CandidateInferenceInfo.prototype.isFixed = function () { - return !!this._inferredTypeAfterFixing; - }; - - CandidateInferenceInfo.prototype.fixTypeParameter = function (resolver, context) { - var _this = this; - if (!this._inferredTypeAfterFixing) { - var collection = { - getLength: function () { - return _this.inferenceCandidates.length; - }, - getTypeAtIndex: function (index) { - return _this.inferenceCandidates[index].type; - } - }; - - var bestCommonType = resolver.findBestCommonType(collection, context, new TypeScript.TypeComparisonInfo()); - this._inferredTypeAfterFixing = bestCommonType.widenedType(resolver, null, context); - } - }; - return CandidateInferenceInfo; - })(); - TypeScript.CandidateInferenceInfo = CandidateInferenceInfo; - - var TypeArgumentInferenceContext = (function () { - function TypeArgumentInferenceContext(resolver, context, signatureBeingInferred) { - this.resolver = resolver; - this.context = context; - this.signatureBeingInferred = signatureBeingInferred; - this.inferenceCache = TypeScript.BitMatrix.getBitMatrix(false); - this.candidateCache = []; - var typeParameters = signatureBeingInferred.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - this.addInferenceRoot(typeParameters[i]); - } - } - TypeArgumentInferenceContext.prototype.alreadyRelatingTypes = function (objectType, parameterType) { - if (this.inferenceCache.valueAt(objectType.pullSymbolID, parameterType.pullSymbolID)) { - return true; - } else { - this.inferenceCache.setValueAt(objectType.pullSymbolID, parameterType.pullSymbolID, true); - return false; - } - }; - - TypeArgumentInferenceContext.prototype.resetRelationshipCache = function () { - this.inferenceCache.release(); - this.inferenceCache = TypeScript.BitMatrix.getBitMatrix(false); - }; - - TypeArgumentInferenceContext.prototype.addInferenceRoot = function (param) { - var info = this.candidateCache[param.pullSymbolID]; - - if (!info) { - info = new CandidateInferenceInfo(); - info.typeParameter = param; - this.candidateCache[param.pullSymbolID] = info; - } - }; - - TypeArgumentInferenceContext.prototype.getInferenceInfo = function (param) { - return this.candidateCache[param.pullSymbolID]; - }; - - TypeArgumentInferenceContext.prototype.addCandidateForInference = function (param, candidate) { - var info = this.getInferenceInfo(param); - - if (info && candidate && info.inferenceCandidates.indexOf(candidate) < 0) { - info.addCandidate(candidate); - } - }; - - TypeArgumentInferenceContext.prototype.inferTypeArguments = function () { - throw TypeScript.Errors.abstract(); - }; - - TypeArgumentInferenceContext.prototype.fixTypeParameter = function (typeParameter) { - var candidateInfo = this.candidateCache[typeParameter.pullSymbolID]; - if (candidateInfo) { - candidateInfo.fixTypeParameter(this.resolver, this.context); - } - }; - - TypeArgumentInferenceContext.prototype._finalizeInferredTypeArguments = function () { - var results = []; - var typeParameters = this.signatureBeingInferred.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - var info = this.candidateCache[typeParameters[i].pullSymbolID]; - - info.fixTypeParameter(this.resolver, this.context); - - for (var i = 0; i < results.length; i++) { - if (results[i].type === info.typeParameter) { - results[i].type = info._inferredTypeAfterFixing; - } - } - - results.push(info._inferredTypeAfterFixing); - } - - return results; - }; - - TypeArgumentInferenceContext.prototype.isInvocationInferenceContext = function () { - throw TypeScript.Errors.abstract(); - }; - return TypeArgumentInferenceContext; - })(); - TypeScript.TypeArgumentInferenceContext = TypeArgumentInferenceContext; - - var InvocationTypeArgumentInferenceContext = (function (_super) { - __extends(InvocationTypeArgumentInferenceContext, _super); - function InvocationTypeArgumentInferenceContext(resolver, context, signatureBeingInferred, argumentASTs) { - _super.call(this, resolver, context, signatureBeingInferred); - this.argumentASTs = argumentASTs; - } - InvocationTypeArgumentInferenceContext.prototype.isInvocationInferenceContext = function () { - return true; - }; - - InvocationTypeArgumentInferenceContext.prototype.inferTypeArguments = function () { - var _this = this; - this.signatureBeingInferred.forAllParameterTypes(this.argumentASTs.nonSeparatorCount(), function (parameterType, argumentIndex) { - var argumentAST = _this.argumentASTs.nonSeparatorAt(argumentIndex); - - _this.context.pushInferentialType(parameterType, _this); - var argumentType = _this.resolver.resolveAST(argumentAST, true, _this.context).type; - _this.resolver.relateTypeToTypeParametersWithNewEnclosingTypes(argumentType, parameterType, _this, _this.context); - _this.context.popAnyContextualType(); - - return true; - }); - - return this._finalizeInferredTypeArguments(); - }; - return InvocationTypeArgumentInferenceContext; - })(TypeArgumentInferenceContext); - TypeScript.InvocationTypeArgumentInferenceContext = InvocationTypeArgumentInferenceContext; - - var ContextualSignatureInstantiationTypeArgumentInferenceContext = (function (_super) { - __extends(ContextualSignatureInstantiationTypeArgumentInferenceContext, _super); - function ContextualSignatureInstantiationTypeArgumentInferenceContext(resolver, context, signatureBeingInferred, contextualSignature, shouldFixContextualSignatureParameterTypes) { - _super.call(this, resolver, context, signatureBeingInferred); - this.contextualSignature = contextualSignature; - this.shouldFixContextualSignatureParameterTypes = shouldFixContextualSignatureParameterTypes; - } - ContextualSignatureInstantiationTypeArgumentInferenceContext.prototype.isInvocationInferenceContext = function () { - return false; - }; - - ContextualSignatureInstantiationTypeArgumentInferenceContext.prototype.inferTypeArguments = function () { - var _this = this; - var relateTypesCallback = function (parameterTypeBeingInferred, contextualParameterType) { - if (_this.shouldFixContextualSignatureParameterTypes) { - contextualParameterType = _this.context.fixAllTypeParametersReferencedByType(contextualParameterType, _this.resolver, _this); - } - _this.resolver.relateTypeToTypeParametersWithNewEnclosingTypes(contextualParameterType, parameterTypeBeingInferred, _this, _this.context); - - return true; - }; - - this.signatureBeingInferred.forAllCorrespondingParameterTypesInThisAndOtherSignature(this.contextualSignature, relateTypesCallback); - - return this._finalizeInferredTypeArguments(); - }; - return ContextualSignatureInstantiationTypeArgumentInferenceContext; - })(TypeArgumentInferenceContext); - TypeScript.ContextualSignatureInstantiationTypeArgumentInferenceContext = ContextualSignatureInstantiationTypeArgumentInferenceContext; - - var PullContextualTypeContext = (function () { - function PullContextualTypeContext(contextualType, provisional, isInferentiallyTyping, typeArgumentInferenceContext) { - this.contextualType = contextualType; - this.provisional = provisional; - this.isInferentiallyTyping = isInferentiallyTyping; - this.typeArgumentInferenceContext = typeArgumentInferenceContext; - this.provisionallyTypedSymbols = []; - this.hasProvisionalErrors = false; - this.astSymbolMap = []; - } - PullContextualTypeContext.prototype.recordProvisionallyTypedSymbol = function (symbol) { - this.provisionallyTypedSymbols[this.provisionallyTypedSymbols.length] = symbol; - }; - - PullContextualTypeContext.prototype.invalidateProvisionallyTypedSymbols = function () { - for (var i = 0; i < this.provisionallyTypedSymbols.length; i++) { - this.provisionallyTypedSymbols[i].setUnresolved(); - } - }; - - PullContextualTypeContext.prototype.setSymbolForAST = function (ast, symbol) { - this.astSymbolMap[ast.syntaxID()] = symbol; - }; - - PullContextualTypeContext.prototype.getSymbolForAST = function (ast) { - return this.astSymbolMap[ast.syntaxID()]; - }; - return PullContextualTypeContext; - })(); - TypeScript.PullContextualTypeContext = PullContextualTypeContext; - - var PullTypeResolutionContext = (function () { - function PullTypeResolutionContext(resolver, inTypeCheck, fileName) { - if (typeof inTypeCheck === "undefined") { inTypeCheck = false; } - if (typeof fileName === "undefined") { fileName = null; } - this.resolver = resolver; - this.inTypeCheck = inTypeCheck; - this.fileName = fileName; - this.contextStack = []; - this.typeCheckedNodes = null; - this.enclosingTypeWalker1 = null; - this.enclosingTypeWalker2 = null; - this.inBaseTypeResolution = false; - if (inTypeCheck) { - TypeScript.Debug.assert(fileName, "A file name must be provided if you are typechecking"); - this.typeCheckedNodes = TypeScript.BitVector.getBitVector(false); - } - } - PullTypeResolutionContext.prototype.setTypeChecked = function (ast) { - if (!this.inProvisionalResolution()) { - this.typeCheckedNodes.setValueAt(ast.syntaxID(), true); - } - }; - - PullTypeResolutionContext.prototype.canTypeCheckAST = function (ast) { - return this.typeCheck() && !this.typeCheckedNodes.valueAt(ast.syntaxID()) && this.fileName === ast.fileName(); - }; - - PullTypeResolutionContext.prototype._pushAnyContextualType = function (type, provisional, isInferentiallyTyping, argContext) { - this.contextStack.push(new PullContextualTypeContext(type, provisional, isInferentiallyTyping, argContext)); - }; - - PullTypeResolutionContext.prototype.pushNewContextualType = function (type) { - this._pushAnyContextualType(type, this.inProvisionalResolution(), false, null); - }; - - PullTypeResolutionContext.prototype.propagateContextualType = function (type) { - this._pushAnyContextualType(type, this.inProvisionalResolution(), this.isInferentiallyTyping(), this.getCurrentTypeArgumentInferenceContext()); - }; - - PullTypeResolutionContext.prototype.pushInferentialType = function (type, typeArgumentInferenceContext) { - this._pushAnyContextualType(type, true, true, typeArgumentInferenceContext); - }; - - PullTypeResolutionContext.prototype.pushProvisionalType = function (type) { - this._pushAnyContextualType(type, true, false, null); - }; - - PullTypeResolutionContext.prototype.popAnyContextualType = function () { - var tc = this.contextStack.pop(); - - tc.invalidateProvisionallyTypedSymbols(); - - if (tc.hasProvisionalErrors && this.inProvisionalResolution()) { - this.contextStack[this.contextStack.length - 1].hasProvisionalErrors = true; - } - - return tc; - }; - - PullTypeResolutionContext.prototype.hasProvisionalErrors = function () { - return this.contextStack.length ? this.contextStack[this.contextStack.length - 1].hasProvisionalErrors : false; - }; - - PullTypeResolutionContext.prototype.getContextualType = function () { - var context = !this.contextStack.length ? null : this.contextStack[this.contextStack.length - 1]; - - if (context) { - var type = context.contextualType; - - if (!type) { - return null; - } - - return type; - } - - return null; - }; - - PullTypeResolutionContext.prototype.fixAllTypeParametersReferencedByType = function (type, resolver, argContext) { - var argContext = this.getCurrentTypeArgumentInferenceContext(); - if (type.wrapsSomeTypeParameter(argContext.candidateCache)) { - var typeParameterArgumentMap = []; - - for (var n in argContext.candidateCache) { - var typeParameter = argContext.candidateCache[n] && argContext.candidateCache[n].typeParameter; - if (typeParameter) { - var dummyMap = []; - dummyMap[typeParameter.pullSymbolID] = typeParameter; - if (type.wrapsSomeTypeParameter(dummyMap)) { - argContext.fixTypeParameter(typeParameter); - TypeScript.Debug.assert(argContext.candidateCache[n]._inferredTypeAfterFixing); - typeParameterArgumentMap[typeParameter.pullSymbolID] = argContext.candidateCache[n]._inferredTypeAfterFixing; - } - } - } - - return resolver.instantiateType(type, typeParameterArgumentMap); - } - - return type; - }; - - PullTypeResolutionContext.prototype.getCurrentTypeArgumentInferenceContext = function () { - return this.contextStack.length ? this.contextStack[this.contextStack.length - 1].typeArgumentInferenceContext : null; - }; - - PullTypeResolutionContext.prototype.isInferentiallyTyping = function () { - return this.contextStack.length > 0 && this.contextStack[this.contextStack.length - 1].isInferentiallyTyping; - }; - - PullTypeResolutionContext.prototype.inProvisionalResolution = function () { - return (!this.contextStack.length ? false : this.contextStack[this.contextStack.length - 1].provisional); - }; - - PullTypeResolutionContext.prototype.isInBaseTypeResolution = function () { - return this.inBaseTypeResolution; - }; - - PullTypeResolutionContext.prototype.startBaseTypeResolution = function () { - var wasInBaseTypeResoltion = this.inBaseTypeResolution; - this.inBaseTypeResolution = true; - return wasInBaseTypeResoltion; - }; - - PullTypeResolutionContext.prototype.doneBaseTypeResolution = function (wasInBaseTypeResolution) { - this.inBaseTypeResolution = wasInBaseTypeResolution; - }; - - PullTypeResolutionContext.prototype.setTypeInContext = function (symbol, type) { - if (symbol.type && symbol.type.isError() && !type.isError()) { - return; - } - symbol.type = type; - - if (this.contextStack.length && this.inProvisionalResolution()) { - this.contextStack[this.contextStack.length - 1].recordProvisionallyTypedSymbol(symbol); - } - }; - - PullTypeResolutionContext.prototype.postDiagnostic = function (diagnostic) { - if (diagnostic) { - if (this.inProvisionalResolution()) { - (this.contextStack[this.contextStack.length - 1]).hasProvisionalErrors = true; - } else if (this.inTypeCheck && this.resolver) { - this.resolver.semanticInfoChain.addDiagnostic(diagnostic); - } - } - }; - - PullTypeResolutionContext.prototype.typeCheck = function () { - return this.inTypeCheck && !this.inProvisionalResolution(); - }; - - PullTypeResolutionContext.prototype.setSymbolForAST = function (ast, symbol) { - this.contextStack[this.contextStack.length - 1].setSymbolForAST(ast, symbol); - }; - - PullTypeResolutionContext.prototype.getSymbolForAST = function (ast) { - for (var i = this.contextStack.length - 1; i >= 0; i--) { - var typeContext = this.contextStack[i]; - if (!typeContext.provisional) { - break; - } - - var symbol = typeContext.getSymbolForAST(ast); - if (symbol) { - return symbol; - } - } - - return null; - }; - - PullTypeResolutionContext.prototype.startWalkingTypes = function (symbol1, symbol2) { - if (!this.enclosingTypeWalker1) { - this.enclosingTypeWalker1 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var stateWhenStartedWalkingTypes1 = this.enclosingTypeWalker1.startWalkingType(symbol1); - if (!this.enclosingTypeWalker2) { - this.enclosingTypeWalker2 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var stateWhenStartedWalkingTypes2 = this.enclosingTypeWalker2.startWalkingType(symbol2); - return { - stateWhenStartedWalkingTypes1: stateWhenStartedWalkingTypes1, - stateWhenStartedWalkingTypes2: stateWhenStartedWalkingTypes2 - }; - }; - - PullTypeResolutionContext.prototype.endWalkingTypes = function (statesWhenStartedWalkingTypes) { - this.enclosingTypeWalker1.endWalkingType(statesWhenStartedWalkingTypes.stateWhenStartedWalkingTypes1); - this.enclosingTypeWalker2.endWalkingType(statesWhenStartedWalkingTypes.stateWhenStartedWalkingTypes2); - }; - - PullTypeResolutionContext.prototype.setEnclosingTypeForSymbols = function (symbol1, symbol2) { - if (!this.enclosingTypeWalker1) { - this.enclosingTypeWalker1 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var enclosingTypeWalkerState1 = this.enclosingTypeWalker1.setEnclosingTypeForSymbol(symbol1); - if (!this.enclosingTypeWalker2) { - this.enclosingTypeWalker2 = new TypeScript.PullTypeEnclosingTypeWalker(); - } - var enclosingTypeWalkerState2 = this.enclosingTypeWalker2.setEnclosingTypeForSymbol(symbol2); - return { - enclosingTypeWalkerState1: enclosingTypeWalkerState1, - enclosingTypeWalkerState2: enclosingTypeWalkerState2 - }; - }; - - PullTypeResolutionContext.prototype.walkMemberTypes = function (memberName) { - this.enclosingTypeWalker1.walkMemberType(memberName, this.resolver); - this.enclosingTypeWalker2.walkMemberType(memberName, this.resolver); - }; - - PullTypeResolutionContext.prototype.postWalkMemberTypes = function () { - this.enclosingTypeWalker1.postWalkMemberType(); - this.enclosingTypeWalker2.postWalkMemberType(); - }; - - PullTypeResolutionContext.prototype.walkSignatures = function (kind, index, index2) { - this.enclosingTypeWalker1.walkSignature(kind, index); - this.enclosingTypeWalker2.walkSignature(kind, index2 == undefined ? index : index2); - }; - - PullTypeResolutionContext.prototype.postWalkSignatures = function () { - this.enclosingTypeWalker1.postWalkSignature(); - this.enclosingTypeWalker2.postWalkSignature(); - }; - - PullTypeResolutionContext.prototype.walkTypeParameterConstraints = function (index) { - this.enclosingTypeWalker1.walkTypeParameterConstraint(index); - this.enclosingTypeWalker2.walkTypeParameterConstraint(index); - }; - - PullTypeResolutionContext.prototype.postWalkTypeParameterConstraints = function () { - this.enclosingTypeWalker1.postWalkTypeParameterConstraint(); - this.enclosingTypeWalker2.postWalkTypeParameterConstraint(); - }; - - PullTypeResolutionContext.prototype.walkTypeArgument = function (index) { - this.enclosingTypeWalker1.walkTypeArgument(index); - this.enclosingTypeWalker2.walkTypeArgument(index); - }; - - PullTypeResolutionContext.prototype.postWalkTypeArgument = function () { - this.enclosingTypeWalker1.postWalkTypeArgument(); - this.enclosingTypeWalker2.postWalkTypeArgument(); - }; - - PullTypeResolutionContext.prototype.walkReturnTypes = function () { - this.enclosingTypeWalker1.walkReturnType(); - this.enclosingTypeWalker2.walkReturnType(); - }; - - PullTypeResolutionContext.prototype.postWalkReturnTypes = function () { - this.enclosingTypeWalker1.postWalkReturnType(); - this.enclosingTypeWalker2.postWalkReturnType(); - }; - - PullTypeResolutionContext.prototype.walkParameterTypes = function (iParam) { - this.enclosingTypeWalker1.walkParameterType(iParam); - this.enclosingTypeWalker2.walkParameterType(iParam); - }; - - PullTypeResolutionContext.prototype.postWalkParameterTypes = function () { - this.enclosingTypeWalker1.postWalkParameterType(); - this.enclosingTypeWalker2.postWalkParameterType(); - }; - - PullTypeResolutionContext.prototype.getBothKindOfIndexSignatures = function (includeAugmentedType1, includeAugmentedType2) { - var indexSigs1 = this.enclosingTypeWalker1.getBothKindOfIndexSignatures(this.resolver, this, includeAugmentedType1); - var indexSigs2 = this.enclosingTypeWalker2.getBothKindOfIndexSignatures(this.resolver, this, includeAugmentedType2); - return { indexSigs1: indexSigs1, indexSigs2: indexSigs2 }; - }; - - PullTypeResolutionContext.prototype.walkIndexSignatureReturnTypes = function (indexSigs, useStringIndexSignature1, useStringIndexSignature2, onlySignature) { - this.enclosingTypeWalker1.walkIndexSignatureReturnType(indexSigs.indexSigs1, useStringIndexSignature1, onlySignature); - this.enclosingTypeWalker2.walkIndexSignatureReturnType(indexSigs.indexSigs2, useStringIndexSignature2, onlySignature); - }; - - PullTypeResolutionContext.prototype.postWalkIndexSignatureReturnTypes = function (onlySignature) { - this.enclosingTypeWalker1.postWalkIndexSignatureReturnType(onlySignature); - this.enclosingTypeWalker2.postWalkIndexSignatureReturnType(onlySignature); - }; - - PullTypeResolutionContext.prototype.swapEnclosingTypeWalkers = function () { - var tempEnclosingWalker1 = this.enclosingTypeWalker1; - this.enclosingTypeWalker1 = this.enclosingTypeWalker2; - this.enclosingTypeWalker2 = tempEnclosingWalker1; - }; - - PullTypeResolutionContext.prototype.oneOfClassificationsIsInfinitelyExpanding = function () { - var generativeClassification1 = this.enclosingTypeWalker1.getGenerativeClassification(); - if (generativeClassification1 === 3 /* InfinitelyExpanding */) { - return true; - } - var generativeClassification2 = this.enclosingTypeWalker2.getGenerativeClassification(); - if (generativeClassification2 === 3 /* InfinitelyExpanding */) { - return true; - } - - return false; - }; - - PullTypeResolutionContext.prototype.resetEnclosingTypeWalkerStates = function () { - var enclosingTypeWalkerState1 = this.enclosingTypeWalker1 ? this.enclosingTypeWalker1.resetEnclosingTypeWalkerState() : null; - var enclosingTypeWalkerState2 = this.enclosingTypeWalker2 ? this.enclosingTypeWalker2.resetEnclosingTypeWalkerState() : null; - return { - enclosingTypeWalkerState1: enclosingTypeWalkerState1, - enclosingTypeWalkerState2: enclosingTypeWalkerState2 - }; - }; - - PullTypeResolutionContext.prototype.setEnclosingTypeWalkerStates = function (enclosingTypeWalkerStates) { - TypeScript.Debug.assert(this.enclosingTypeWalker1 || !enclosingTypeWalkerStates.enclosingTypeWalkerState1); - if (this.enclosingTypeWalker1) { - this.enclosingTypeWalker1.setEnclosingTypeWalkerState(enclosingTypeWalkerStates.enclosingTypeWalkerState1); - } - TypeScript.Debug.assert(this.enclosingTypeWalker2 || !enclosingTypeWalkerStates.enclosingTypeWalkerState2); - if (this.enclosingTypeWalker2) { - this.enclosingTypeWalker2.setEnclosingTypeWalkerState(enclosingTypeWalkerStates.enclosingTypeWalkerState2); - } - }; - return PullTypeResolutionContext; - })(); - TypeScript.PullTypeResolutionContext = PullTypeResolutionContext; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var OverloadApplicabilityStatus; - (function (OverloadApplicabilityStatus) { - OverloadApplicabilityStatus[OverloadApplicabilityStatus["NotAssignable"] = 0] = "NotAssignable"; - OverloadApplicabilityStatus[OverloadApplicabilityStatus["AssignableButWithProvisionalErrors"] = 1] = "AssignableButWithProvisionalErrors"; - OverloadApplicabilityStatus[OverloadApplicabilityStatus["AssignableWithNoProvisionalErrors"] = 2] = "AssignableWithNoProvisionalErrors"; - OverloadApplicabilityStatus[OverloadApplicabilityStatus["Subtype"] = 3] = "Subtype"; - })(OverloadApplicabilityStatus || (OverloadApplicabilityStatus = {})); - - var PullAdditionalCallResolutionData = (function () { - function PullAdditionalCallResolutionData() { - this.targetSymbol = null; - this.resolvedSignatures = null; - this.candidateSignature = null; - this.actualParametersContextTypeSymbols = null; - this.diagnosticsFromOverloadResolution = []; - } - return PullAdditionalCallResolutionData; - })(); - TypeScript.PullAdditionalCallResolutionData = PullAdditionalCallResolutionData; - - var PullAdditionalObjectLiteralResolutionData = (function () { - function PullAdditionalObjectLiteralResolutionData() { - this.membersContextTypeSymbols = null; - } - return PullAdditionalObjectLiteralResolutionData; - })(); - TypeScript.PullAdditionalObjectLiteralResolutionData = PullAdditionalObjectLiteralResolutionData; - - var MemberWithBaseOrigin = (function () { - function MemberWithBaseOrigin(memberSymbol, baseOrigin) { - this.memberSymbol = memberSymbol; - this.baseOrigin = baseOrigin; - } - return MemberWithBaseOrigin; - })(); - - var SignatureWithBaseOrigin = (function () { - function SignatureWithBaseOrigin(signature, baseOrigin) { - this.signature = signature; - this.baseOrigin = baseOrigin; - } - return SignatureWithBaseOrigin; - })(); - - var InheritedIndexSignatureInfo = (function () { - function InheritedIndexSignatureInfo() { - } - return InheritedIndexSignatureInfo; - })(); - - var CompilerReservedName; - (function (CompilerReservedName) { - CompilerReservedName[CompilerReservedName["_this"] = 1] = "_this"; - CompilerReservedName[CompilerReservedName["_super"] = 2] = "_super"; - CompilerReservedName[CompilerReservedName["arguments"] = 3] = "arguments"; - CompilerReservedName[CompilerReservedName["_i"] = 4] = "_i"; - CompilerReservedName[CompilerReservedName["require"] = 5] = "require"; - CompilerReservedName[CompilerReservedName["exports"] = 6] = "exports"; - })(CompilerReservedName || (CompilerReservedName = {})); - - function getCompilerReservedName(name) { - var nameText = name.valueText(); - return CompilerReservedName[nameText]; - } - - var PullTypeResolver = (function () { - function PullTypeResolver(compilationSettings, semanticInfoChain) { - this.compilationSettings = compilationSettings; - this.semanticInfoChain = semanticInfoChain; - this._cachedArrayInterfaceType = null; - this._cachedNumberInterfaceType = null; - this._cachedStringInterfaceType = null; - this._cachedBooleanInterfaceType = null; - this._cachedObjectInterfaceType = null; - this._cachedFunctionInterfaceType = null; - this._cachedIArgumentsInterfaceType = null; - this._cachedRegExpInterfaceType = null; - this._cachedAnyTypeArgs = null; - this.typeCheckCallBacks = []; - this.postTypeCheckWorkitems = []; - this._cachedFunctionArgumentsSymbol = null; - this.assignableCache = TypeScript.BitMatrix.getBitMatrix(true); - this.subtypeCache = TypeScript.BitMatrix.getBitMatrix(true); - this.identicalCache = TypeScript.BitMatrix.getBitMatrix(true); - this.inResolvingOtherDeclsWalker = new TypeScript.PullHelpers.OtherPullDeclsWalker(); - } - PullTypeResolver.prototype.cachedArrayInterfaceType = function () { - if (!this._cachedArrayInterfaceType) { - this._cachedArrayInterfaceType = this.getSymbolFromDeclPath("Array", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (!this._cachedArrayInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedArrayInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedArrayInterfaceType; - }; - - PullTypeResolver.prototype.getArrayNamedType = function () { - return this.cachedArrayInterfaceType(); - }; - - PullTypeResolver.prototype.cachedNumberInterfaceType = function () { - if (!this._cachedNumberInterfaceType) { - this._cachedNumberInterfaceType = this.getSymbolFromDeclPath("Number", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedNumberInterfaceType && !this._cachedNumberInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedNumberInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedNumberInterfaceType; - }; - - PullTypeResolver.prototype.cachedStringInterfaceType = function () { - if (!this._cachedStringInterfaceType) { - this._cachedStringInterfaceType = this.getSymbolFromDeclPath("String", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedStringInterfaceType && !this._cachedStringInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedStringInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedStringInterfaceType; - }; - - PullTypeResolver.prototype.cachedBooleanInterfaceType = function () { - if (!this._cachedBooleanInterfaceType) { - this._cachedBooleanInterfaceType = this.getSymbolFromDeclPath("Boolean", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedBooleanInterfaceType && !this._cachedBooleanInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedBooleanInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedBooleanInterfaceType; - }; - - PullTypeResolver.prototype.cachedObjectInterfaceType = function () { - if (!this._cachedObjectInterfaceType) { - this._cachedObjectInterfaceType = this.getSymbolFromDeclPath("Object", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (!this._cachedObjectInterfaceType) { - this._cachedObjectInterfaceType = this.semanticInfoChain.anyTypeSymbol; - } - - if (!this._cachedObjectInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedObjectInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedObjectInterfaceType; - }; - - PullTypeResolver.prototype.cachedFunctionInterfaceType = function () { - if (!this._cachedFunctionInterfaceType) { - this._cachedFunctionInterfaceType = this.getSymbolFromDeclPath("Function", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedFunctionInterfaceType && !this._cachedFunctionInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedFunctionInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedFunctionInterfaceType; - }; - - PullTypeResolver.prototype.cachedIArgumentsInterfaceType = function () { - if (!this._cachedIArgumentsInterfaceType) { - this._cachedIArgumentsInterfaceType = this.getSymbolFromDeclPath("IArguments", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedIArgumentsInterfaceType && !this._cachedIArgumentsInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedIArgumentsInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedIArgumentsInterfaceType; - }; - - PullTypeResolver.prototype.cachedRegExpInterfaceType = function () { - if (!this._cachedRegExpInterfaceType) { - this._cachedRegExpInterfaceType = this.getSymbolFromDeclPath("RegExp", [], 16 /* Interface */) || this.semanticInfoChain.emptyTypeSymbol; - } - - if (this._cachedRegExpInterfaceType && !this._cachedRegExpInterfaceType.isResolved) { - this.resolveDeclaredSymbol(this._cachedRegExpInterfaceType, new TypeScript.PullTypeResolutionContext(this)); - } - - return this._cachedRegExpInterfaceType; - }; - - PullTypeResolver.prototype.cachedFunctionArgumentsSymbol = function () { - if (!this._cachedFunctionArgumentsSymbol) { - this._cachedFunctionArgumentsSymbol = new TypeScript.PullSymbol("arguments", 512 /* Variable */); - this._cachedFunctionArgumentsSymbol.type = this.cachedIArgumentsInterfaceType() || this.semanticInfoChain.anyTypeSymbol; - this._cachedFunctionArgumentsSymbol.setResolved(); - - var functionArgumentsDecl = new TypeScript.PullSynthesizedDecl("arguments", "arguments", 2048 /* Parameter */, 0 /* None */, null, this.semanticInfoChain); - functionArgumentsDecl.setSymbol(this._cachedFunctionArgumentsSymbol); - this._cachedFunctionArgumentsSymbol.addDeclaration(functionArgumentsDecl); - } - - return this._cachedFunctionArgumentsSymbol; - }; - - PullTypeResolver.prototype.getApparentType = function (type) { - if (type.isTypeParameter()) { - var baseConstraint = type.getBaseConstraint(this.semanticInfoChain); - if (baseConstraint === this.semanticInfoChain.anyTypeSymbol) { - return this.semanticInfoChain.emptyTypeSymbol; - } else { - type = baseConstraint; - } - } - if (type.isPrimitive()) { - if (type === this.semanticInfoChain.numberTypeSymbol) { - return this.cachedNumberInterfaceType(); - } - if (type === this.semanticInfoChain.booleanTypeSymbol) { - return this.cachedBooleanInterfaceType(); - } - if (type === this.semanticInfoChain.stringTypeSymbol) { - return this.cachedStringInterfaceType(); - } - return type; - } - if (type.isEnum()) { - return this.cachedNumberInterfaceType(); - } - return type; - }; - - PullTypeResolver.prototype.setTypeChecked = function (ast, context) { - context.setTypeChecked(ast); - }; - - PullTypeResolver.prototype.canTypeCheckAST = function (ast, context) { - return context.canTypeCheckAST(ast); - }; - - PullTypeResolver.prototype.setSymbolForAST = function (ast, symbol, context) { - if (context && context.inProvisionalResolution()) { - context.setSymbolForAST(ast, symbol); - } else { - this.semanticInfoChain.setSymbolForAST(ast, symbol); - } - }; - - PullTypeResolver.prototype.getSymbolForAST = function (ast, context) { - var symbol = this.semanticInfoChain.getSymbolForAST(ast); - - if (!symbol) { - if (context && context.inProvisionalResolution()) { - symbol = context.getSymbolForAST(ast); - } - } - - return symbol; - }; - - PullTypeResolver.prototype.getASTForDecl = function (decl) { - return this.semanticInfoChain.getASTForDecl(decl); - }; - - PullTypeResolver.prototype.getNewErrorTypeSymbol = function (name) { - if (typeof name === "undefined") { name = null; } - return new TypeScript.PullErrorTypeSymbol(this.semanticInfoChain.anyTypeSymbol, name); - }; - - PullTypeResolver.prototype.getEnclosingDecl = function (decl) { - var declPath = decl.getParentPath(); - - if (declPath.length > 1 && declPath[declPath.length - 1] === decl) { - return declPath[declPath.length - 2]; - } else { - return declPath[declPath.length - 1]; - } - }; - - PullTypeResolver.prototype.getExportedMemberSymbol = function (symbol, parent) { - if (!(symbol.kind & (65536 /* Method */ | 4096 /* Property */))) { - var isContainer = (parent.kind & (4 /* Container */ | 32 /* DynamicModule */)) !== 0; - var containerType = !isContainer ? parent.getAssociatedContainerType() : parent; - - if (isContainer && containerType) { - if (symbol.anyDeclHasFlag(1 /* Exported */)) { - return symbol; - } - - return null; - } - } - - return symbol; - }; - - PullTypeResolver.prototype._getNamedPropertySymbolOfAugmentedType = function (symbolName, parent) { - var memberSymbol = this.getNamedPropertySymbol(symbolName, 68147712 /* SomeValue */, parent); - if (memberSymbol) { - return memberSymbol; - } - - if (this.cachedFunctionInterfaceType() && parent.isFunctionType()) { - memberSymbol = this.cachedFunctionInterfaceType().findMember(symbolName, true); - if (memberSymbol) { - return memberSymbol; - } - } - - if (this.cachedObjectInterfaceType()) { - return this.cachedObjectInterfaceType().findMember(symbolName, true); - } - - return null; - }; - - PullTypeResolver.prototype.getNamedPropertySymbol = function (symbolName, declSearchKind, parent) { - var member = null; - - if (declSearchKind & 68147712 /* SomeValue */) { - member = parent.findMember(symbolName, true); - } else if (declSearchKind & 58728795 /* SomeType */) { - member = parent.findNestedType(symbolName); - } else if (declSearchKind & 164 /* SomeContainer */) { - member = parent.findNestedContainer(symbolName); - } - - if (member) { - return this.getExportedMemberSymbol(member, parent); - } - - var containerType = parent.getAssociatedContainerType(); - - if (containerType) { - if (containerType.isClass()) { - return null; - } - - parent = containerType; - - if (declSearchKind & 68147712 /* SomeValue */) { - member = parent.findMember(symbolName, true); - } else if (declSearchKind & 58728795 /* SomeType */) { - member = parent.findNestedType(symbolName); - } else if (declSearchKind & 164 /* SomeContainer */) { - member = parent.findNestedContainer(symbolName); - } - - if (member) { - return this.getExportedMemberSymbol(member, parent); - } - } - - if (parent.kind & 164 /* SomeContainer */) { - var typeDeclarations = parent.getDeclarations(); - var childDecls = null; - - for (var j = 0; j < typeDeclarations.length; j++) { - childDecls = typeDeclarations[j].searchChildDecls(symbolName, declSearchKind); - - if (childDecls.length) { - member = childDecls[0].getSymbol(); - - if (!member) { - member = childDecls[0].getSignatureSymbol(); - } - return this.getExportedMemberSymbol(member, parent); - } - - if ((declSearchKind & 58728795 /* SomeType */) !== 0 || (declSearchKind & 68147712 /* SomeValue */) !== 0) { - childDecls = typeDeclarations[j].searchChildDecls(symbolName, 128 /* TypeAlias */); - if (childDecls.length && childDecls[0].kind === 128 /* TypeAlias */) { - var aliasSymbol = this.getExportedMemberSymbol(childDecls[0].getSymbol(), parent); - if (aliasSymbol) { - if ((declSearchKind & 58728795 /* SomeType */) !== 0) { - var typeSymbol = aliasSymbol.getExportAssignedTypeSymbol(); - if (typeSymbol) { - return typeSymbol; - } - } else { - var valueSymbol = aliasSymbol.getExportAssignedValueSymbol(); - if (valueSymbol) { - aliasSymbol.setIsUsedAsValue(); - return valueSymbol; - } - } - - return aliasSymbol; - } - } - } - } - } - }; - - PullTypeResolver.prototype.getSymbolFromDeclPath = function (symbolName, declPath, declSearchKind) { - var _this = this; - var symbol = null; - - var decl = null; - var childDecls; - var declSymbol = null; - var declMembers; - var pathDeclKind; - var valDecl = null; - var kind; - var instanceSymbol = null; - var instanceType = null; - var childSymbol = null; - - var allowedContainerDeclKind = 4 /* Container */ | 32 /* DynamicModule */; - if (TypeScript.hasFlag(declSearchKind, 67108864 /* EnumMember */)) { - allowedContainerDeclKind |= 64 /* Enum */; - } - - var isAcceptableAlias = function (symbol) { - if (symbol.isAlias()) { - _this.resolveDeclaredSymbol(symbol); - if (TypeScript.hasFlag(declSearchKind, 164 /* SomeContainer */)) { - if (symbol.assignedContainer() || symbol.getExportAssignedContainerSymbol()) { - return true; - } - } else if (TypeScript.hasFlag(declSearchKind, 58728795 /* SomeType */)) { - var type = symbol.getExportAssignedTypeSymbol(); - if (type && type.kind !== 32 /* DynamicModule */) { - return true; - } - - var type = symbol.assignedType(); - if (type && type.kind !== 32 /* DynamicModule */) { - return true; - } - } else if (TypeScript.hasFlag(declSearchKind, 68147712 /* SomeValue */ & ~67108864 /* EnumMember */)) { - if (symbol.assignedType() && symbol.assignedType().isError()) { - return true; - } else if (symbol.assignedValue() || symbol.getExportAssignedValueSymbol()) { - return true; - } else { - var assignedType = symbol.assignedType(); - if (assignedType && assignedType.isContainer() && assignedType.getInstanceType()) { - return true; - } - - var decls = symbol.getDeclarations(); - var ast = decls[0].ast(); - return ast.moduleReference.kind() === 245 /* ExternalModuleReference */; - } - } - } - - return false; - }; - - var tryFindAlias = function (decl) { - var childDecls = decl.searchChildDecls(symbolName, 128 /* TypeAlias */); - - if (childDecls.length) { - var sym = childDecls[0].getSymbol(); - if (isAcceptableAlias(sym)) { - return sym; - } - } - return null; - }; - - for (var i = declPath.length - 1; i >= 0; i--) { - decl = declPath[i]; - pathDeclKind = decl.kind; - - if (decl.flags & 2097152 /* DeclaredInAWithBlock */) { - return this.semanticInfoChain.anyTypeSymbol; - } - - if (pathDeclKind & allowedContainerDeclKind) { - childDecls = decl.searchChildDecls(symbolName, declSearchKind); - - if (childDecls.length) { - return childDecls[0].getSymbol(); - } - - var alias = tryFindAlias(decl); - if (alias) { - return alias; - } - - if (declSearchKind & 68147712 /* SomeValue */) { - instanceSymbol = decl.getSymbol().getInstanceSymbol(); - - if (instanceSymbol) { - instanceType = instanceSymbol.type; - - childSymbol = this.getNamedPropertySymbol(symbolName, declSearchKind, instanceType); - - if (childSymbol && (childSymbol.kind & declSearchKind) && !childSymbol.anyDeclHasFlag(16 /* Static */)) { - return childSymbol; - } - } - - valDecl = decl.getValueDecl(); - - if (valDecl) { - decl = valDecl; - } - } - - declSymbol = decl.getSymbol().type; - - var childSymbol = this.getNamedPropertySymbol(symbolName, declSearchKind, declSymbol); - - if (childSymbol && (childSymbol.kind & declSearchKind) && !childSymbol.anyDeclHasFlag(16 /* Static */)) { - return childSymbol; - } - } else if ((declSearchKind & (58728795 /* SomeType */ | 164 /* SomeContainer */)) || !(pathDeclKind & 8 /* Class */)) { - var candidateSymbol = null; - - if (pathDeclKind === 131072 /* FunctionExpression */ && symbolName === decl.getFunctionExpressionName()) { - candidateSymbol = decl.getSymbol(); - } - - childDecls = decl.searchChildDecls(symbolName, declSearchKind); - - if (childDecls.length) { - if (decl.kind & 1032192 /* SomeFunction */) { - decl.ensureSymbolIsBound(); - } - return childDecls[0].getSymbol(); - } - - if (candidateSymbol) { - return candidateSymbol; - } - - var alias = tryFindAlias(decl); - if (alias) { - return alias; - } - } - } - - symbol = this.semanticInfoChain.findSymbol([symbolName], declSearchKind); - if (symbol) { - return symbol; - } - - if (!TypeScript.hasFlag(declSearchKind, 128 /* TypeAlias */)) { - symbol = this.semanticInfoChain.findSymbol([symbolName], 128 /* TypeAlias */); - if (symbol && isAcceptableAlias(symbol)) { - return symbol; - } - } - - return null; - }; - - PullTypeResolver.prototype.getVisibleDeclsFromDeclPath = function (declPath, declSearchKind) { - var result = []; - var decl = null; - var childDecls; - var pathDeclKind; - - for (var i = declPath.length - 1; i >= 0; i--) { - decl = declPath[i]; - pathDeclKind = decl.kind; - - var declKind = decl.kind; - - if (declKind !== 8 /* Class */ && declKind !== 16 /* Interface */) { - this.addFilteredDecls(decl.getChildDecls(), declSearchKind, result); - } - - switch (declKind) { - case 4 /* Container */: - case 32 /* DynamicModule */: - var otherDecls = this.semanticInfoChain.findDeclsFromPath(declPath.slice(0, i + 1), 164 /* SomeContainer */); - for (var j = 0, m = otherDecls.length; j < m; j++) { - var otherDecl = otherDecls[j]; - if (otherDecl === decl) { - continue; - } - - var otherDeclChildren = otherDecl.getChildDecls(); - for (var k = 0, s = otherDeclChildren.length; k < s; k++) { - var otherDeclChild = otherDeclChildren[k]; - if ((otherDeclChild.flags & 1 /* Exported */) && (otherDeclChild.kind & declSearchKind)) { - result.push(otherDeclChild); - } - } - } - - break; - - case 8 /* Class */: - case 16 /* Interface */: - var parameters = decl.getTypeParameters(); - if (parameters && parameters.length) { - this.addFilteredDecls(parameters, declSearchKind, result); - } - - break; - - case 131072 /* FunctionExpression */: - var functionExpressionName = decl.getFunctionExpressionName(); - if (functionExpressionName) { - result.push(decl); - } - - case 16384 /* Function */: - case 32768 /* ConstructorMethod */: - case 65536 /* Method */: - var parameters = decl.getTypeParameters(); - if (parameters && parameters.length) { - this.addFilteredDecls(parameters, declSearchKind, result); - } - - break; - } - } - - var topLevelDecls = this.semanticInfoChain.topLevelDecls(); - for (var i = 0, n = topLevelDecls.length; i < n; i++) { - var topLevelDecl = topLevelDecls[i]; - if (declPath.length > 0 && topLevelDecl.fileName() === declPath[0].fileName()) { - continue; - } - - if (!topLevelDecl.isExternalModule()) { - this.addFilteredDecls(topLevelDecl.getChildDecls(), declSearchKind, result); - } - } - - return result; - }; - - PullTypeResolver.prototype.addFilteredDecls = function (decls, declSearchKind, result) { - if (decls.length) { - for (var i = 0, n = decls.length; i < n; i++) { - var decl = decls[i]; - if (decl.kind & declSearchKind) { - result.push(decl); - } - } - } - }; - - PullTypeResolver.prototype.getVisibleDecls = function (enclosingDecl) { - var declPath = enclosingDecl.getParentPath(); - - var declSearchKind = 58728795 /* SomeType */ | 164 /* SomeContainer */ | 68147712 /* SomeValue */; - - return this.getVisibleDeclsFromDeclPath(declPath, declSearchKind); - }; - - PullTypeResolver.prototype.getVisibleContextSymbols = function (enclosingDecl, context) { - var contextualTypeSymbol = context.getContextualType(); - if (!contextualTypeSymbol || this.isAnyOrEquivalent(contextualTypeSymbol)) { - return null; - } - - var declSearchKind = 58728795 /* SomeType */ | 164 /* SomeContainer */ | 68147712 /* SomeValue */; - var members = contextualTypeSymbol.getAllMembers(declSearchKind, 2 /* externallyVisible */); - - for (var i = 0; i < members.length; i++) { - members[i].setUnresolved(); - } - - return members; - }; - - PullTypeResolver.prototype.getVisibleMembersFromExpression = function (expression, enclosingDecl, context) { - var lhs = this.resolveAST(expression, false, context); - - if (isTypesOnlyLocation(expression) && (lhs.kind === 8 /* Class */ || lhs.kind === 16 /* Interface */ || lhs.kind === 64 /* Enum */)) { - return null; - } - - var lhsType = lhs.type; - if (!lhsType) { - return null; - } - - this.resolveDeclaredSymbol(lhsType, context); - - if (lhsType.isContainer() && lhsType.isAlias()) { - lhsType = lhsType.getExportAssignedTypeSymbol(); - } - - if (this.isAnyOrEquivalent(lhsType)) { - return null; - } - - var memberVisibilty = 2 /* externallyVisible */; - var containerSymbol = lhsType; - if (containerSymbol.kind === 33554432 /* ConstructorType */) { - containerSymbol = containerSymbol.getConstructSignatures()[0].returnType; - } - - if (containerSymbol && containerSymbol.isClass()) { - var declPath = enclosingDecl.getParentPath(); - if (declPath && declPath.length) { - var declarations = containerSymbol.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - if (TypeScript.ArrayUtilities.contains(declPath, declaration)) { - memberVisibilty = 1 /* internallyVisible */; - break; - } - } - } - } - - var declSearchKind = 58728795 /* SomeType */ | 164 /* SomeContainer */ | 68147712 /* SomeValue */; - - var members = []; - - if (lhsType.isContainer()) { - var exportedAssignedContainerSymbol = lhsType.getExportAssignedContainerSymbol(); - if (exportedAssignedContainerSymbol) { - lhsType = exportedAssignedContainerSymbol; - } - } - - lhsType = this.getApparentType(lhsType); - - if (!lhsType.isResolved) { - var potentiallySpecializedType = this.resolveDeclaredSymbol(lhsType, context); - - if (potentiallySpecializedType !== lhsType) { - if (!lhs.isType()) { - context.setTypeInContext(lhs, potentiallySpecializedType); - } - - lhsType = potentiallySpecializedType; - } - } - - members = lhsType.getAllMembers(declSearchKind, memberVisibilty); - - if (lhsType.isContainer()) { - var associatedInstance = lhsType.getInstanceSymbol(); - if (associatedInstance) { - var instanceType = associatedInstance.type; - this.resolveDeclaredSymbol(instanceType, context); - var instanceMembers = instanceType.getAllMembers(declSearchKind, memberVisibilty); - members = members.concat(instanceMembers); - } - - var exportedContainer = lhsType.getExportAssignedContainerSymbol(); - if (exportedContainer) { - var exportedContainerMembers = exportedContainer.getAllMembers(declSearchKind, memberVisibilty); - members = members.concat(exportedContainerMembers); - } - } else if (!lhsType.isConstructor() && !lhsType.isEnum()) { - var associatedContainerSymbol = lhsType.getAssociatedContainerType(); - if (associatedContainerSymbol) { - var containerType = associatedContainerSymbol.type; - this.resolveDeclaredSymbol(containerType, context); - var containerMembers = containerType.getAllMembers(declSearchKind, memberVisibilty); - members = members.concat(containerMembers); - } - } - - if (lhsType.isFunctionType() && this.cachedFunctionInterfaceType()) { - members = members.concat(this.cachedFunctionInterfaceType().getAllMembers(declSearchKind, 2 /* externallyVisible */)); - } - - return members; - }; - - PullTypeResolver.prototype.isAnyOrEquivalent = function (type) { - return (type === this.semanticInfoChain.anyTypeSymbol) || type.isError(); - }; - - PullTypeResolver.prototype.resolveExternalModuleReference = function (idText, currentFileName) { - var originalIdText = idText; - var symbol = null; - - if (TypeScript.isRelative(originalIdText)) { - var path = TypeScript.getRootFilePath(TypeScript.switchToForwardSlashes(currentFileName)); - symbol = this.semanticInfoChain.findExternalModule(path + idText); - } else { - idText = originalIdText; - - symbol = this.semanticInfoChain.findAmbientExternalModuleInGlobalContext(TypeScript.quoteStr(originalIdText)); - - if (!symbol) { - var path = TypeScript.getRootFilePath(TypeScript.switchToForwardSlashes(currentFileName)); - - while (symbol === null && path != "") { - symbol = this.semanticInfoChain.findExternalModule(path + idText); - if (symbol === null) { - if (path === '/') { - path = ''; - } else { - path = TypeScript.normalizePath(path + ".."); - path = path && path != '/' ? path + '/' : path; - } - } - } - } - } - - return symbol; - }; - - PullTypeResolver.prototype.resolveDeclaredSymbol = function (symbol, context) { - if (!symbol || symbol.isResolved || symbol.isTypeReference()) { - return symbol; - } - - if (!context) { - context = new TypeScript.PullTypeResolutionContext(this); - } - - return this.resolveDeclaredSymbolWorker(symbol, context); - }; - - PullTypeResolver.prototype.resolveDeclaredSymbolWorker = function (symbol, context) { - if (!symbol || symbol.isResolved) { - return symbol; - } - - if (symbol.inResolution) { - if (!symbol.type && !symbol.isType()) { - symbol.type = this.semanticInfoChain.anyTypeSymbol; - } - - return symbol; - } - - var decls = symbol.getDeclarations(); - - for (var i = 0; i < decls.length; i++) { - var decl = decls[i]; - - var ast = this.semanticInfoChain.getASTForDecl(decl); - - if (!ast || (ast.kind() === 139 /* GetAccessor */ && ast.parent.parent.kind() === 215 /* ObjectLiteralExpression */) || (ast.kind() === 140 /* SetAccessor */ && ast.parent.parent.kind() === 215 /* ObjectLiteralExpression */)) { - return symbol; - } - - if (ast.parent && ast.parent.kind() === 236 /* CatchClause */ && ast.parent.identifier === ast) { - return symbol; - } - - if (ast.parent && ast.parent.kind() === 219 /* SimpleArrowFunctionExpression */ && ast.parent.identifier === ast) { - return symbol; - } - - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(ast); - var resolvedSymbol; - if (enclosingModule) { - resolvedSymbol = this.resolveSingleModuleDeclaration(enclosingModule, ast, context); - } else if (ast.kind() === 120 /* SourceUnit */ && decl.kind === 32 /* DynamicModule */) { - resolvedSymbol = this.resolveModuleSymbol(decl.getSymbol(), context, null, null, ast); - } else { - TypeScript.Debug.assert(ast.kind() !== 11 /* IdentifierName */ && ast.kind() !== 212 /* MemberAccessExpression */); - resolvedSymbol = this.resolveAST(ast, false, context); - } - - if (decl.kind === 2048 /* Parameter */ && !symbol.isResolved && !symbol.type && resolvedSymbol && symbol.anyDeclHasFlag(8388608 /* PropertyParameter */ | 67108864 /* ConstructorParameter */)) { - symbol.type = resolvedSymbol.type; - symbol.setResolved(); - } - } - - if (!symbol.isResolved) { - TypeScript.Debug.assert(!symbol.inResolution); - - symbol.setResolved(); - } - - return symbol; - }; - - PullTypeResolver.prototype.resolveOtherDecl = function (otherDecl, context) { - var astForOtherDecl = this.getASTForDecl(otherDecl); - var moduleDecl = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(astForOtherDecl); - if (moduleDecl) { - this.resolveSingleModuleDeclaration(moduleDecl, astForOtherDecl, context); - } else { - this.resolveAST(astForOtherDecl, false, context); - } - }; - - PullTypeResolver.prototype.resolveOtherDeclarations = function (astName, context) { - var _this = this; - var resolvedDecl = this.semanticInfoChain.getDeclForAST(astName); - var symbol = resolvedDecl.getSymbol(); - - var allDecls = symbol.getDeclarations(); - this.inResolvingOtherDeclsWalker.walkOtherPullDecls(resolvedDecl, symbol.getDeclarations(), function (otherDecl) { - return _this.resolveOtherDecl(otherDecl, context); - }); - }; - - PullTypeResolver.prototype.resolveSourceUnit = function (sourceUnit, context) { - var enclosingDecl = this.getEnclosingDeclForAST(sourceUnit); - var moduleSymbol = enclosingDecl.getSymbol(); - this.ensureAllSymbolsAreBound(moduleSymbol); - - this.resolveFirstExportAssignmentStatement(sourceUnit.moduleElements, context); - this.resolveAST(sourceUnit.moduleElements, false, context); - - if (this.canTypeCheckAST(sourceUnit, context)) { - this.typeCheckSourceUnit(sourceUnit, context); - } - - return moduleSymbol; - }; - - PullTypeResolver.prototype.typeCheckSourceUnit = function (sourceUnit, context) { - var _this = this; - this.setTypeChecked(sourceUnit, context); - - this.resolveAST(sourceUnit.moduleElements, false, context); - - this.typeCheckCallBacks.push(function (context) { - return _this.verifyUniquenessOfImportNamesInSourceUnit(sourceUnit); - }); - }; - - PullTypeResolver.prototype.verifyUniquenessOfImportNamesInSourceUnit = function (sourceUnit) { - var _this = this; - var enclosingDecl = this.semanticInfoChain.getDeclForAST(sourceUnit); - - var doesImportNameExistInOtherFiles = function (name) { - var importSymbol = _this.semanticInfoChain.findTopLevelSymbol(name, 128 /* TypeAlias */, null); - return importSymbol && importSymbol.isAlias(); - }; - - this.checkUniquenessOfImportNames([enclosingDecl], doesImportNameExistInOtherFiles); - }; - - PullTypeResolver.prototype.resolveEnumDeclaration = function (ast, context) { - var containerDecl = this.semanticInfoChain.getDeclForAST(ast); - var containerSymbol = containerDecl.getSymbol(); - - if (containerSymbol.isResolved || containerSymbol.inResolution) { - return containerSymbol; - } - - containerSymbol.inResolution = true; - - var containerDecls = containerSymbol.getDeclarations(); - - for (var i = 0; i < containerDecls.length; i++) { - var childDecls = containerDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - - containerSymbol.setResolved(); - - this.resolveOtherDeclarations(ast, context); - - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckEnumDeclaration(ast, context); - } - - return containerSymbol; - }; - - PullTypeResolver.prototype.typeCheckEnumDeclaration = function (ast, context) { - var _this = this; - this.setTypeChecked(ast, context); - - this.resolveAST(ast.enumElements, false, context); - var containerDecl = this.semanticInfoChain.getDeclForAST(ast); - this.validateVariableDeclarationGroups(containerDecl, context); - - this.typeCheckCallBacks.push(function (context) { - return _this.checkInitializersInEnumDeclarations(containerDecl, context); - }); - - if (!TypeScript.ASTHelpers.enumIsElided(ast)) { - this.checkNameForCompilerGeneratedDeclarationCollision(ast, true, ast.identifier, context); - } - }; - - PullTypeResolver.prototype.postTypeCheckEnumDeclaration = function (ast, context) { - this.checkThisCaptureVariableCollides(ast, true, context); - }; - - PullTypeResolver.prototype.checkInitializersInEnumDeclarations = function (decl, context) { - var symbol = decl.getSymbol(); - - var declarations = symbol.getDeclarations(); - if (decl !== declarations[0]) { - return; - } - - var seenEnumDeclWithNoFirstMember = false; - for (var i = 0; i < declarations.length; ++i) { - var currentDecl = declarations[i]; - - var ast = currentDecl.ast(); - if (ast.enumElements.nonSeparatorCount() === 0) { - continue; - } - - var firstVariable = ast.enumElements.nonSeparatorAt(0); - if (!firstVariable.equalsValueClause) { - if (!seenEnumDeclWithNoFirstMember) { - seenEnumDeclWithNoFirstMember = true; - } else { - this.semanticInfoChain.addDiagnosticFromAST(firstVariable, TypeScript.DiagnosticCode.In_enums_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_the_first_enum_element); - } - } - } - }; - - PullTypeResolver.prototype.resolveModuleDeclaration = function (ast, context) { - var result; - - if (ast.stringLiteral) { - result = this.resolveSingleModuleDeclaration(ast, ast.stringLiteral, context); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(ast.name); - for (var i = 0, n = moduleNames.length; i < n; i++) { - result = this.resolveSingleModuleDeclaration(ast, moduleNames[i], context); - } - } - - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckModuleDeclaration(ast, context); - } - - return result; - }; - - PullTypeResolver.prototype.ensureAllSymbolsAreBound = function (containerSymbol) { - if (containerSymbol) { - var containerDecls = containerSymbol.getDeclarations(); - - for (var i = 0; i < containerDecls.length; i++) { - var childDecls = containerDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - } - }; - - PullTypeResolver.prototype.resolveModuleSymbol = function (containerSymbol, context, moduleDeclAST, moduleDeclNameAST, sourceUnitAST) { - if (containerSymbol.isResolved || containerSymbol.inResolution) { - return containerSymbol; - } - - containerSymbol.inResolution = true; - this.ensureAllSymbolsAreBound(containerSymbol); - - var instanceSymbol = containerSymbol.getInstanceSymbol(); - - if (instanceSymbol) { - this.resolveDeclaredSymbol(instanceSymbol, context); - } - - var isLastName = TypeScript.ASTHelpers.isLastNameOfModule(moduleDeclAST, moduleDeclNameAST); - if (isLastName) { - this.resolveFirstExportAssignmentStatement(moduleDeclAST.moduleElements, context); - } else if (sourceUnitAST) { - this.resolveFirstExportAssignmentStatement(sourceUnitAST.moduleElements, context); - } - - containerSymbol.setResolved(); - - if (moduleDeclNameAST) { - this.resolveOtherDeclarations(moduleDeclNameAST, context); - } - - return containerSymbol; - }; - - PullTypeResolver.prototype.resolveFirstExportAssignmentStatement = function (moduleElements, context) { - for (var i = 0, n = moduleElements.childCount(); i < n; i++) { - var moduleElement = moduleElements.childAt(i); - if (moduleElement.kind() === 134 /* ExportAssignment */) { - this.resolveExportAssignmentStatement(moduleElement, context); - return; - } - } - }; - - PullTypeResolver.prototype.resolveSingleModuleDeclaration = function (ast, astName, context) { - var containerDecl = this.semanticInfoChain.getDeclForAST(astName); - var containerSymbol = containerDecl.getSymbol(); - - return this.resolveModuleSymbol(containerSymbol, context, ast, astName, null); - }; - - PullTypeResolver.prototype.typeCheckModuleDeclaration = function (ast, context) { - if (ast.stringLiteral) { - this.typeCheckSingleModuleDeclaration(ast, ast.stringLiteral, context); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(ast.name); - for (var i = 0, n = moduleNames.length; i < n; i++) { - this.typeCheckSingleModuleDeclaration(ast, moduleNames[i], context); - } - } - }; - - PullTypeResolver.prototype.typeCheckSingleModuleDeclaration = function (ast, astName, context) { - var _this = this; - this.setTypeChecked(ast, context); - - if (TypeScript.ASTHelpers.isLastNameOfModule(ast, astName)) { - this.resolveAST(ast.moduleElements, false, context); - } - - var containerDecl = this.semanticInfoChain.getDeclForAST(astName); - this.validateVariableDeclarationGroups(containerDecl, context); - - if (ast.stringLiteral) { - if (TypeScript.isRelative(ast.stringLiteral.valueText())) { - this.semanticInfoChain.addDiagnosticFromAST(ast.stringLiteral, TypeScript.DiagnosticCode.Ambient_external_module_declaration_cannot_specify_relative_module_name); - } - } - - if (!TypeScript.ASTHelpers.moduleIsElided(ast) && !ast.stringLiteral) { - this.checkNameForCompilerGeneratedDeclarationCollision(astName, true, astName, context); - } - - this.typeCheckCallBacks.push(function (context) { - return _this.verifyUniquenessOfImportNamesInModule(containerDecl); - }); - }; - - PullTypeResolver.prototype.verifyUniquenessOfImportNamesInModule = function (decl) { - var symbol = decl.getSymbol(); - if (!symbol) { - return; - } - - var decls = symbol.getDeclarations(); - - if (decls[0] !== decl) { - return; - } - - this.checkUniquenessOfImportNames(decls); - }; - - PullTypeResolver.prototype.checkUniquenessOfImportNames = function (decls, doesNameExistOutside) { - var _this = this; - var importDeclarationNames; - - for (var i = 0; i < decls.length; ++i) { - var childDecls = decls[i].getChildDecls(); - for (var j = 0; j < childDecls.length; ++j) { - var childDecl = childDecls[j]; - if (childDecl.kind === 128 /* TypeAlias */) { - importDeclarationNames = importDeclarationNames || TypeScript.createIntrinsicsObject(); - importDeclarationNames[childDecl.name] = true; - } - } - } - - if (!importDeclarationNames && !doesNameExistOutside) { - return; - } - - for (var i = 0; i < decls.length; ++i) { - this.scanVariableDeclarationGroups(decls[i], function (firstDeclInGroup) { - var nameConflict = importDeclarationNames && importDeclarationNames[firstDeclInGroup.name]; - if (!nameConflict) { - nameConflict = doesNameExistOutside && doesNameExistOutside(firstDeclInGroup.name); - if (nameConflict) { - importDeclarationNames = importDeclarationNames || TypeScript.createIntrinsicsObject(); - importDeclarationNames[firstDeclInGroup.name] = true; - } - } - - if (nameConflict) { - _this.semanticInfoChain.addDiagnosticFromAST(firstDeclInGroup.ast(), TypeScript.DiagnosticCode.Variable_declaration_cannot_have_the_same_name_as_an_import_declaration); - } - }); - } - }; - - PullTypeResolver.prototype.scanVariableDeclarationGroups = function (enclosingDecl, firstDeclHandler, subsequentDeclHandler) { - var declGroups = enclosingDecl.getVariableDeclGroups(); - - for (var i = 0; i < declGroups.length; i++) { - var firstSymbol = null; - var enclosingDeclForFirstSymbol = null; - - if (enclosingDecl.kind === 1 /* Script */ && declGroups[i].length) { - var name = declGroups[i][0].name; - var candidateSymbol = this.semanticInfoChain.findTopLevelSymbol(name, 512 /* Variable */, enclosingDecl); - if (candidateSymbol) { - if (!candidateSymbol.anyDeclHasFlag(118784 /* ImplicitVariable */)) { - if (!candidateSymbol.isResolved) { - this.resolveDeclaredSymbol(candidateSymbol); - } - firstSymbol = candidateSymbol; - } - } - } - - for (var j = 0; j < declGroups[i].length; j++) { - var decl = declGroups[i][j]; - - var name = decl.name; - - var symbol = decl.getSymbol(); - - if (j === 0) { - firstDeclHandler(decl); - if (!subsequentDeclHandler) { - break; - } - - if (!firstSymbol || !firstSymbol.type) { - firstSymbol = symbol; - continue; - } - } - - subsequentDeclHandler(decl, firstSymbol); - } - } - }; - - PullTypeResolver.prototype.postTypeCheckModuleDeclaration = function (ast, context) { - this.checkThisCaptureVariableCollides(ast, true, context); - }; - - PullTypeResolver.prototype.isTypeRefWithoutTypeArgs = function (term) { - if (term.kind() === 11 /* IdentifierName */) { - return true; - } else if (term.kind() === 121 /* QualifiedName */) { - var binex = term; - - if (binex.right.kind() === 11 /* IdentifierName */) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.createInstantiatedType = function (type, typeArguments) { - if (!type.isGeneric()) { - return type; - } - - var typeParameters = type.getTypeArgumentsOrTypeParameters(); - - var typeParameterArgumentMap = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameterArgumentMap[typeParameters[i].pullSymbolID] = typeArguments[i] || new TypeScript.PullErrorTypeSymbol(this.semanticInfoChain.anyTypeSymbol, typeParameters[i].name); - } - - return TypeScript.PullInstantiatedTypeReferenceSymbol.create(this, type, typeParameterArgumentMap); - }; - - PullTypeResolver.prototype.resolveReferenceTypeDeclaration = function (classOrInterface, name, heritageClauses, context) { - var _this = this; - var typeDecl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var enclosingDecl = this.getEnclosingDecl(typeDecl); - var typeDeclSymbol = typeDecl.getSymbol(); - var typeDeclIsClass = classOrInterface.kind() === 131 /* ClassDeclaration */; - var hasVisited = this.getSymbolForAST(classOrInterface, context) !== null; - - if ((typeDeclSymbol.isResolved && hasVisited) || (typeDeclSymbol.inResolution && !context.isInBaseTypeResolution())) { - return typeDeclSymbol; - } - - var wasResolving = typeDeclSymbol.inResolution; - typeDeclSymbol.startResolving(); - - var typeRefDecls = typeDeclSymbol.getDeclarations(); - - for (var i = 0; i < typeRefDecls.length; i++) { - var childDecls = typeRefDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - - if (!typeDeclSymbol.isResolved) { - var typeDeclTypeParameters = typeDeclSymbol.getTypeParameters(); - for (var i = 0; i < typeDeclTypeParameters.length; i++) { - this.resolveDeclaredSymbol(typeDeclTypeParameters[i], context); - } - } - - var wasInBaseTypeResolution = context.startBaseTypeResolution(); - - if (!typeDeclIsClass && !hasVisited) { - typeDeclSymbol.resetKnownBaseTypeCount(); - } - - var extendsClause = TypeScript.ASTHelpers.getExtendsHeritageClause(heritageClauses); - if (extendsClause) { - for (var i = typeDeclSymbol.getKnownBaseTypeCount(); i < extendsClause.typeNames.nonSeparatorCount(); i = typeDeclSymbol.getKnownBaseTypeCount()) { - typeDeclSymbol.incrementKnownBaseCount(); - var parentType = this.resolveTypeReference(extendsClause.typeNames.nonSeparatorAt(i), context); - - if (typeDeclSymbol.isValidBaseKind(parentType, true)) { - this.setSymbolForAST(extendsClause.typeNames.nonSeparatorAt(i), parentType, null); - - if (!typeDeclSymbol.hasBase(parentType) && !parentType.hasBase(typeDeclSymbol)) { - typeDeclSymbol.addExtendedType(parentType); - - var specializations = typeDeclSymbol.getKnownSpecializations(); - - for (var j = 0; j < specializations.length; j++) { - specializations[j].addExtendedType(parentType); - } - } - } else if (parentType && !this.getSymbolForAST(extendsClause.typeNames.nonSeparatorAt(i), context)) { - this.setSymbolForAST(extendsClause.typeNames.nonSeparatorAt(i), parentType, null); - } - } - } - - var implementsClause = TypeScript.ASTHelpers.getImplementsHeritageClause(heritageClauses); - if (implementsClause && typeDeclIsClass) { - var extendsCount = extendsClause ? extendsClause.typeNames.nonSeparatorCount() : 0; - for (var i = typeDeclSymbol.getKnownBaseTypeCount(); ((i - extendsCount) >= 0) && ((i - extendsCount) < implementsClause.typeNames.nonSeparatorCount()); i = typeDeclSymbol.getKnownBaseTypeCount()) { - typeDeclSymbol.incrementKnownBaseCount(); - var implementedTypeAST = implementsClause.typeNames.nonSeparatorAt(i - extendsCount); - var implementedType = this.resolveTypeReference(implementedTypeAST, context); - - if (typeDeclSymbol.isValidBaseKind(implementedType, false)) { - this.setSymbolForAST(implementsClause.typeNames.nonSeparatorAt(i - extendsCount), implementedType, null); - - if (!typeDeclSymbol.hasBase(implementedType) && !implementedType.hasBase(typeDeclSymbol)) { - typeDeclSymbol.addImplementedType(implementedType); - } - } else if (implementedType && !this.getSymbolForAST(implementsClause.typeNames.nonSeparatorAt(i - extendsCount), context)) { - this.setSymbolForAST(implementsClause.typeNames.nonSeparatorAt(i - extendsCount), implementedType, null); - } - } - } - - context.doneBaseTypeResolution(wasInBaseTypeResolution); - - if (wasInBaseTypeResolution) { - typeDeclSymbol.inResolution = false; - - this.typeCheckCallBacks.push(function (context) { - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - _this.resolveClassDeclaration(classOrInterface, context); - } else { - _this.resolveInterfaceDeclaration(classOrInterface, context); - } - }); - - return typeDeclSymbol; - } - - this.setSymbolForAST(name, typeDeclSymbol, context); - this.setSymbolForAST(classOrInterface, typeDeclSymbol, context); - - typeDeclSymbol.setResolved(); - - return typeDeclSymbol; - }; - - PullTypeResolver.prototype.resolveClassDeclaration = function (classDeclAST, context) { - var classDecl = this.semanticInfoChain.getDeclForAST(classDeclAST); - var classDeclSymbol = classDecl.getSymbol(); - - if (!classDeclSymbol.isResolved) { - this.resolveReferenceTypeDeclaration(classDeclAST, classDeclAST.identifier, classDeclAST.heritageClauses, context); - - var constructorMethod = classDeclSymbol.getConstructorMethod(); - var extendedTypes = classDeclSymbol.getExtendedTypes(); - var parentType = extendedTypes.length ? extendedTypes[0] : null; - - if (constructorMethod) { - if (parentType) { - var parentConstructorSymbol = parentType.getConstructorMethod(); - - if (parentConstructorSymbol) { - var parentConstructorTypeSymbol = parentConstructorSymbol.type; - var constructorTypeSymbol = constructorMethod.type; - if (!constructorTypeSymbol.hasBase(parentConstructorTypeSymbol)) { - constructorTypeSymbol.addExtendedType(parentConstructorTypeSymbol); - } - } - } - - if (!classDeclSymbol.isResolved) { - return classDeclSymbol; - } - } - - this.resolveOtherDeclarations(classDeclAST, context); - } - - if (this.canTypeCheckAST(classDeclAST, context)) { - this.typeCheckClassDeclaration(classDeclAST, context); - } - - return classDeclSymbol; - }; - - PullTypeResolver.prototype.typeCheckTypeParametersOfTypeDeclaration = function (classOrInterface, context) { - var _this = this; - var typeParametersList = classOrInterface.kind() == 131 /* ClassDeclaration */ ? classOrInterface.typeParameterList : classOrInterface.typeParameterList; - - if (typeParametersList) { - var typeDecl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var typeDeclSymbol = typeDecl.getSymbol(); - - for (var i = 0; i < typeParametersList.typeParameters.nonSeparatorCount(); i++) { - var typeParameterAST = typeParametersList.typeParameters.nonSeparatorAt(i); - this.resolveTypeParameterDeclaration(typeParameterAST, context); - - var typeParameterDecl = this.semanticInfoChain.getDeclForAST(typeParameterAST); - var typeParameterSymbol = typeParameterDecl.getSymbol(); - - this.checkSymbolPrivacy(typeDeclSymbol, typeParameterSymbol, function (symbol) { - return _this.typeParameterOfTypeDeclarationPrivacyErrorReporter(classOrInterface, typeParameterAST, typeParameterSymbol, symbol, context); - }); - } - } - }; - - PullTypeResolver.prototype.typeCheckClassDeclaration = function (classDeclAST, context) { - this.setTypeChecked(classDeclAST, context); - - var classDecl = this.semanticInfoChain.getDeclForAST(classDeclAST); - var classDeclSymbol = classDecl.getSymbol(); - - this.checkNameForCompilerGeneratedDeclarationCollision(classDeclAST, true, classDeclAST.identifier, context); - this.resolveAST(classDeclAST.classElements, false, context); - - this.typeCheckTypeParametersOfTypeDeclaration(classDeclAST, context); - this.typeCheckBases(classDeclAST, classDeclAST.identifier, classDeclAST.heritageClauses, classDeclSymbol, this.getEnclosingDecl(classDecl), context); - - if (!classDeclSymbol.hasBaseTypeConflict()) { - this.typeCheckMembersAgainstIndexer(classDeclSymbol, classDecl, context); - } - - this.checkTypeForDuplicateIndexSignatures(classDeclSymbol); - }; - - PullTypeResolver.prototype.postTypeCheckClassDeclaration = function (classDeclAST, context) { - this.checkThisCaptureVariableCollides(classDeclAST, true, context); - }; - - PullTypeResolver.prototype.resolveTypeSymbolSignatures = function (typeSymbol, context) { - var callSignatures = typeSymbol.getCallSignatures(); - for (var i = 0; i < callSignatures.length; i++) { - this.resolveDeclaredSymbol(callSignatures[i], context); - } - - var constructSignatures = typeSymbol.getConstructSignatures(); - for (var i = 0; i < constructSignatures.length; i++) { - this.resolveDeclaredSymbol(constructSignatures[i], context); - } - - var indexSignatures = typeSymbol.getIndexSignatures(); - for (var i = 0; i < indexSignatures.length; i++) { - this.resolveDeclaredSymbol(indexSignatures[i], context); - } - }; - - PullTypeResolver.prototype.resolveInterfaceDeclaration = function (interfaceDeclAST, context) { - this.resolveReferenceTypeDeclaration(interfaceDeclAST, interfaceDeclAST.identifier, interfaceDeclAST.heritageClauses, context); - - var interfaceDecl = this.semanticInfoChain.getDeclForAST(interfaceDeclAST); - var interfaceDeclSymbol = interfaceDecl.getSymbol(); - - this.resolveTypeSymbolSignatures(interfaceDeclSymbol, context); - - if (interfaceDeclSymbol.isResolved) { - this.resolveOtherDeclarations(interfaceDeclAST, context); - - if (this.canTypeCheckAST(interfaceDeclAST, context)) { - this.typeCheckInterfaceDeclaration(interfaceDeclAST, context); - } - } - - return interfaceDeclSymbol; - }; - - PullTypeResolver.prototype.typeCheckInterfaceDeclaration = function (interfaceDeclAST, context) { - this.setTypeChecked(interfaceDeclAST, context); - - var interfaceDecl = this.semanticInfoChain.getDeclForAST(interfaceDeclAST); - var interfaceDeclSymbol = interfaceDecl.getSymbol(); - - this.resolveAST(interfaceDeclAST.body.typeMembers, false, context); - - this.typeCheckTypeParametersOfTypeDeclaration(interfaceDeclAST, context); - this.typeCheckBases(interfaceDeclAST, interfaceDeclAST.identifier, interfaceDeclAST.heritageClauses, interfaceDeclSymbol, this.getEnclosingDecl(interfaceDecl), context); - - if (!interfaceDeclSymbol.hasBaseTypeConflict()) { - this.typeCheckMembersAgainstIndexer(interfaceDeclSymbol, interfaceDecl, context); - } - - var allInterfaceDecls = interfaceDeclSymbol.getDeclarations(); - if (interfaceDecl === allInterfaceDecls[allInterfaceDecls.length - 1]) { - this.checkTypeForDuplicateIndexSignatures(interfaceDeclSymbol); - } - - if (!this.checkInterfaceDeclForIdenticalTypeParameters(interfaceDeclAST, context)) { - this.semanticInfoChain.addDiagnosticFromAST(interfaceDeclAST.identifier, TypeScript.DiagnosticCode.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - }; - - PullTypeResolver.prototype.checkInterfaceDeclForIdenticalTypeParameters = function (interfaceDeclAST, context) { - var interfaceDecl = this.semanticInfoChain.getDeclForAST(interfaceDeclAST); - var interfaceDeclSymbol = interfaceDecl.getSymbol(); - - if (!interfaceDeclSymbol.isGeneric()) { - return true; - } - - var firstInterfaceDecl = interfaceDeclSymbol.getDeclarations()[0]; - if (firstInterfaceDecl == interfaceDecl) { - return true; - } - - var typeParameters = interfaceDecl.getTypeParameters(); - var firstInterfaceDeclTypeParameters = firstInterfaceDecl.getTypeParameters(); - - if (typeParameters.length != firstInterfaceDeclTypeParameters.length) { - return false; - } - - for (var i = 0; i < typeParameters.length; i++) { - var typeParameter = typeParameters[i]; - var firstInterfaceDeclTypeParameter = firstInterfaceDeclTypeParameters[i]; - - if (typeParameter.name != firstInterfaceDeclTypeParameter.name) { - return false; - } - - var typeParameterSymbol = typeParameter.getSymbol(); - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter); - var firstInterfaceDeclTypeParameterAST = this.semanticInfoChain.getASTForDecl(firstInterfaceDeclTypeParameter); - - if (!!typeParameterAST.constraint != !!firstInterfaceDeclTypeParameterAST.constraint) { - return false; - } - - if (typeParameterAST.constraint) { - var typeParameterConstraint = this.resolveAST(typeParameterAST.constraint, false, context); - if (!this.typesAreIdenticalWithNewEnclosingTypes(typeParameterConstraint, typeParameterSymbol.getConstraint(), context)) { - return false; - } - } - } - - return true; - }; - - PullTypeResolver.prototype.checkTypeForDuplicateIndexSignatures = function (enclosingTypeSymbol) { - var indexSignatures = enclosingTypeSymbol.getOwnIndexSignatures(); - var firstStringIndexer = null; - var firstNumberIndexer = null; - for (var i = 0; i < indexSignatures.length; i++) { - var currentIndexer = indexSignatures[i]; - var currentParameterType = currentIndexer.parameters[0].type; - TypeScript.Debug.assert(currentParameterType); - if (currentParameterType === this.semanticInfoChain.stringTypeSymbol) { - if (firstStringIndexer) { - this.semanticInfoChain.addDiagnosticFromAST(currentIndexer.getDeclarations()[0].ast(), TypeScript.DiagnosticCode.Duplicate_string_index_signature, null, [this.semanticInfoChain.locationFromAST(firstStringIndexer.getDeclarations()[0].ast())]); - return; - } else { - firstStringIndexer = currentIndexer; - } - } else if (currentParameterType === this.semanticInfoChain.numberTypeSymbol) { - if (firstNumberIndexer) { - this.semanticInfoChain.addDiagnosticFromAST(currentIndexer.getDeclarations()[0].ast(), TypeScript.DiagnosticCode.Duplicate_number_index_signature, null, [this.semanticInfoChain.locationFromAST(firstNumberIndexer.getDeclarations()[0].ast())]); - return; - } else { - firstNumberIndexer = currentIndexer; - } - } - } - }; - - PullTypeResolver.prototype.filterSymbol = function (symbol, kind, enclosingDecl, context) { - if (symbol) { - if (symbol.kind & kind) { - return symbol; - } - - if (symbol.isAlias()) { - this.resolveDeclaredSymbol(symbol, context); - - var alias = symbol; - if (kind & 164 /* SomeContainer */) { - return alias.getExportAssignedContainerSymbol(); - } else if (kind & 58728795 /* SomeType */) { - return alias.getExportAssignedTypeSymbol(); - } else if (kind & 68147712 /* SomeValue */) { - return alias.getExportAssignedValueSymbol(); - } - } - } - return null; - }; - - PullTypeResolver.prototype.getMemberSymbolOfKind = function (symbolName, kind, pullTypeSymbol, enclosingDecl, context) { - var memberSymbol = this.getNamedPropertySymbol(symbolName, kind, pullTypeSymbol); - - return { - symbol: this.filterSymbol(memberSymbol, kind, enclosingDecl, context), - aliasSymbol: memberSymbol && memberSymbol.isAlias() ? memberSymbol : null - }; - }; - - PullTypeResolver.prototype.resolveIdentifierOfInternalModuleReference = function (importDecl, identifier, moduleSymbol, enclosingDecl, context) { - var rhsName = identifier.valueText(); - if (rhsName.length === 0) { - return null; - } - - var moduleTypeSymbol = moduleSymbol.type; - var memberSymbol = this.getMemberSymbolOfKind(rhsName, 164 /* SomeContainer */, moduleTypeSymbol, enclosingDecl, context); - var containerSymbol = memberSymbol.symbol; - var valueSymbol = null; - var typeSymbol = null; - var aliasSymbol = null; - - var acceptableAlias = true; - - if (containerSymbol) { - acceptableAlias = (containerSymbol.kind & 59753052 /* AcceptableAlias */) !== 0; - aliasSymbol = memberSymbol.aliasSymbol; - } - - if (!acceptableAlias && containerSymbol && containerSymbol.kind === 128 /* TypeAlias */) { - this.resolveDeclaredSymbol(containerSymbol, context); - var aliasedAssignedValue = containerSymbol.getExportAssignedValueSymbol(); - var aliasedAssignedType = containerSymbol.getExportAssignedTypeSymbol(); - var aliasedAssignedContainer = containerSymbol.getExportAssignedContainerSymbol(); - - if (aliasedAssignedValue || aliasedAssignedType || aliasedAssignedContainer) { - aliasSymbol = containerSymbol; - valueSymbol = aliasedAssignedValue; - typeSymbol = aliasedAssignedType; - containerSymbol = aliasedAssignedContainer; - acceptableAlias = true; - } - } - - if (!acceptableAlias) { - this.semanticInfoChain.addDiagnosticFromAST(identifier, TypeScript.DiagnosticCode.Import_declaration_referencing_identifier_from_internal_module_can_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules); - return null; - } - - if (!valueSymbol) { - if (moduleTypeSymbol.getInstanceSymbol()) { - memberSymbol = this.getMemberSymbolOfKind(rhsName, 68147712 /* SomeValue */, moduleTypeSymbol.getInstanceSymbol().type, enclosingDecl, context); - valueSymbol = memberSymbol.symbol; - if (valueSymbol && memberSymbol.aliasSymbol) { - aliasSymbol = memberSymbol.aliasSymbol; - } - } - } - - if (!typeSymbol) { - memberSymbol = this.getMemberSymbolOfKind(rhsName, 58728795 /* SomeType */, moduleTypeSymbol, enclosingDecl, context); - typeSymbol = memberSymbol.symbol; - if (typeSymbol && memberSymbol.aliasSymbol) { - aliasSymbol = memberSymbol.aliasSymbol; - } - } - - if (!valueSymbol && !typeSymbol && !containerSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(identifier, TypeScript.DiagnosticCode.Could_not_find_symbol_0_in_module_1, [rhsName, moduleSymbol.toString()]); - return null; - } - - if (!typeSymbol && containerSymbol) { - typeSymbol = containerSymbol; - } - - return { - valueSymbol: valueSymbol, - typeSymbol: typeSymbol, - containerSymbol: containerSymbol, - aliasSymbol: aliasSymbol - }; - }; - - PullTypeResolver.prototype.resolveModuleReference = function (importDecl, moduleNameExpr, enclosingDecl, context, declPath) { - TypeScript.Debug.assert(moduleNameExpr.kind() === 121 /* QualifiedName */ || moduleNameExpr.kind() === 11 /* IdentifierName */ || moduleNameExpr.kind() === 14 /* StringLiteral */, "resolving module reference should always be either name or member reference"); - - var moduleSymbol = null; - var moduleName; - - if (moduleNameExpr.kind() === 121 /* QualifiedName */) { - var dottedNameAST = moduleNameExpr; - var moduleContainer = this.resolveModuleReference(importDecl, dottedNameAST.left, enclosingDecl, context, declPath); - if (moduleContainer) { - moduleName = dottedNameAST.right.valueText(); - - moduleSymbol = this.getMemberSymbolOfKind(moduleName, 4 /* Container */, moduleContainer.type, enclosingDecl, context).symbol; - if (!moduleSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(dottedNameAST.right, TypeScript.DiagnosticCode.Could_not_find_module_0_in_module_1, [moduleName, moduleContainer.toString()]); - } - } - } else { - var valueText = moduleNameExpr.kind() === 11 /* IdentifierName */ ? moduleNameExpr.valueText() : moduleNameExpr.valueText(); - var text = moduleNameExpr.kind() === 11 /* IdentifierName */ ? moduleNameExpr.text() : moduleNameExpr.text(); - - if (text.length > 0) { - var resolvedModuleNameSymbol = this.getSymbolFromDeclPath(valueText, declPath, 4 /* Container */); - moduleSymbol = this.filterSymbol(resolvedModuleNameSymbol, 4 /* Container */, enclosingDecl, context); - if (moduleSymbol) { - this.semanticInfoChain.setSymbolForAST(moduleNameExpr, moduleSymbol); - if (resolvedModuleNameSymbol.isAlias()) { - this.semanticInfoChain.setAliasSymbolForAST(moduleNameExpr, resolvedModuleNameSymbol); - var importDeclSymbol = importDecl.getSymbol(); - importDeclSymbol.addLinkedAliasSymbol(resolvedModuleNameSymbol); - } - } else { - this.semanticInfoChain.addDiagnosticFromAST(moduleNameExpr, TypeScript.DiagnosticCode.Unable_to_resolve_module_reference_0, [valueText]); - } - } - } - - return moduleSymbol; - }; - - PullTypeResolver.prototype.resolveInternalModuleReference = function (importStatementAST, context) { - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var enclosingDecl = this.getEnclosingDecl(importDecl); - - var moduleReference = importStatementAST.moduleReference; - - var aliasExpr = moduleReference.kind() === 245 /* ExternalModuleReference */ ? moduleReference.stringLiteral : moduleReference.moduleName; - - var declPath = enclosingDecl.getParentPath(); - var aliasedType = null; - var importDeclSymbol = importDecl.getSymbol(); - - if (aliasExpr.kind() === 11 /* IdentifierName */ || aliasExpr.kind() === 14 /* StringLiteral */) { - var moduleSymbol = this.resolveModuleReference(importDecl, aliasExpr, enclosingDecl, context, declPath); - if (moduleSymbol) { - aliasedType = moduleSymbol.type; - this.semanticInfoChain.setAliasSymbolForAST(moduleReference, this.semanticInfoChain.getAliasSymbolForAST(aliasExpr)); - if (aliasedType.anyDeclHasFlag(32768 /* InitializedModule */)) { - var moduleName = aliasExpr.kind() === 11 /* IdentifierName */ ? aliasExpr.valueText() : aliasExpr.valueText(); - var valueSymbol = this.getSymbolFromDeclPath(moduleName, declPath, 68147712 /* SomeValue */); - var instanceSymbol = aliasedType.getInstanceSymbol(); - - if (valueSymbol && (instanceSymbol != valueSymbol || valueSymbol.type === aliasedType)) { - var text = aliasExpr.kind() === 11 /* IdentifierName */ ? aliasExpr.text() : aliasExpr.text(); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(aliasExpr, TypeScript.DiagnosticCode.Internal_module_reference_0_in_import_declaration_does_not_reference_module_instance_for_1, [text, moduleSymbol.type.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - } else { - importDeclSymbol.setAssignedValueSymbol(valueSymbol); - } - } - } else { - aliasedType = this.getNewErrorTypeSymbol(); - } - } else if (aliasExpr.kind() === 121 /* QualifiedName */) { - var dottedNameAST = aliasExpr; - var moduleSymbol = this.resolveModuleReference(importDecl, dottedNameAST.left, enclosingDecl, context, declPath); - if (moduleSymbol) { - var identifierResolution = this.resolveIdentifierOfInternalModuleReference(importDecl, dottedNameAST.right, moduleSymbol, enclosingDecl, context); - if (identifierResolution) { - importDeclSymbol.setAssignedValueSymbol(identifierResolution.valueSymbol); - importDeclSymbol.setAssignedTypeSymbol(identifierResolution.typeSymbol); - importDeclSymbol.setAssignedContainerSymbol(identifierResolution.containerSymbol); - this.semanticInfoChain.setAliasSymbolForAST(moduleReference, identifierResolution.aliasSymbol); - return null; - } - } - } - - if (!aliasedType) { - importDeclSymbol.setAssignedTypeSymbol(this.getNewErrorTypeSymbol()); - } - - return aliasedType; - }; - - PullTypeResolver.prototype.resolveImportDeclaration = function (importStatementAST, context) { - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var enclosingDecl = this.getEnclosingDecl(importDecl); - var importDeclSymbol = importDecl.getSymbol(); - - var aliasedType = null; - - if (importDeclSymbol.isResolved) { - return importDeclSymbol; - } - - importDeclSymbol.startResolving(); - - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - var modPath = importStatementAST.moduleReference.stringLiteral.valueText(); - var declPath = enclosingDecl.getParentPath(); - - aliasedType = this.resolveExternalModuleReference(modPath, importDecl.fileName()); - - if (!aliasedType) { - var path = importStatementAST.moduleReference.stringLiteral.text(); - this.semanticInfoChain.addDiagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Unable_to_resolve_external_module_0, [path]); - aliasedType = this.getNewErrorTypeSymbol(); - } - } else { - aliasedType = this.resolveInternalModuleReference(importStatementAST, context); - } - - if (aliasedType) { - if (!aliasedType.isContainer()) { - this.semanticInfoChain.addDiagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Module_cannot_be_aliased_to_a_non_module_type); - if (!aliasedType.isError()) { - aliasedType = this.getNewErrorTypeSymbol(); - } - } - - if (aliasedType.isContainer()) { - importDeclSymbol.setAssignedContainerSymbol(aliasedType); - } - importDeclSymbol.setAssignedTypeSymbol(aliasedType); - - this.setSymbolForAST(importStatementAST.moduleReference, aliasedType, null); - } - - importDeclSymbol.setResolved(); - - this.resolveDeclaredSymbol(importDeclSymbol.assignedValue(), context); - this.resolveDeclaredSymbol(importDeclSymbol.assignedType(), context); - this.resolveDeclaredSymbol(importDeclSymbol.assignedContainer(), context); - - if (aliasedType && importDeclSymbol.anyDeclHasFlag(1 /* Exported */)) { - importDeclSymbol.setIsUsedInExportedAlias(); - - if (aliasedType.isContainer() && aliasedType.getExportAssignedValueSymbol()) { - importDeclSymbol.setIsUsedAsValue(); - } - } - - if (this.canTypeCheckAST(importStatementAST, context)) { - this.typeCheckImportDeclaration(importStatementAST, context); - } - - return importDeclSymbol; - }; - - PullTypeResolver.prototype.typeCheckImportDeclaration = function (importStatementAST, context) { - var _this = this; - this.setTypeChecked(importStatementAST, context); - - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var enclosingDecl = this.getEnclosingDecl(importDecl); - var importDeclSymbol = importDecl.getSymbol(); - - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - if (this.compilationSettings.noResolve()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Import_declaration_cannot_refer_to_external_module_reference_when_noResolve_option_is_set, null)); - } - - var modPath = importStatementAST.moduleReference.stringLiteral.valueText(); - if (enclosingDecl.kind === 32 /* DynamicModule */) { - var ast = TypeScript.ASTHelpers.getEnclosingModuleDeclaration(this.getASTForDecl(enclosingDecl)); - if (ast && ast.kind() === 130 /* ModuleDeclaration */) { - if (TypeScript.isRelative(modPath)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(importStatementAST, TypeScript.DiagnosticCode.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name)); - } - } - } - } - - var checkPrivacy; - if (importStatementAST.moduleReference.kind() === 245 /* ExternalModuleReference */) { - var containerSymbol = importDeclSymbol.getExportAssignedContainerSymbol(); - var container = containerSymbol ? containerSymbol.getContainer() : null; - if (container && container.kind === 32 /* DynamicModule */) { - checkPrivacy = true; - } - } else { - checkPrivacy = true; - } - - if (checkPrivacy) { - var typeSymbol = importDeclSymbol.getExportAssignedTypeSymbol(); - var containerSymbol = importDeclSymbol.getExportAssignedContainerSymbol(); - var valueSymbol = importDeclSymbol.getExportAssignedValueSymbol(); - - this.checkSymbolPrivacy(importDeclSymbol, containerSymbol, function (symbol) { - var messageCode = TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_container_that_is_or_is_using_inaccessible_module_1; - var messageArguments = [importDeclSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null), symbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null, false, false, true)]; - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(importStatementAST, messageCode, messageArguments)); - }); - - if (typeSymbol !== containerSymbol) { - this.checkSymbolPrivacy(importDeclSymbol, typeSymbol, function (symbol) { - var messageCode = symbol.isContainer() && !symbol.isEnum() ? TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_type_that_is_using_inaccessible_module_1 : TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_type_that_has_or_is_using_private_type_1; - - var messageArguments = [importDeclSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null), symbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null, false, false, true)]; - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(importStatementAST, messageCode, messageArguments)); - }); - } - - if (valueSymbol) { - this.checkSymbolPrivacy(importDeclSymbol, valueSymbol.type, function (symbol) { - var messageCode = symbol.isContainer() && !symbol.isEnum() ? TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_value_with_type_that_is_using_inaccessible_module_1 : TypeScript.DiagnosticCode.Exported_import_declaration_0_is_assigned_value_with_type_that_has_or_is_using_private_type_1; - var messageArguments = [importDeclSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null), symbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null, false, false, true)]; - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(importStatementAST, messageCode, messageArguments)); - }); - } - } - - this.checkNameForCompilerGeneratedDeclarationCollision(importStatementAST, true, importStatementAST.identifier, context); - }; - - PullTypeResolver.prototype.postTypeCheckImportDeclaration = function (importStatementAST, context) { - var importDecl = this.semanticInfoChain.getDeclForAST(importStatementAST); - var importSymbol = importDecl.getSymbol(); - - var isUsedAsValue = importSymbol.isUsedAsValue(); - var hasAssignedValue = importStatementAST.moduleReference.kind() !== 245 /* ExternalModuleReference */ && importSymbol.getExportAssignedValueSymbol() !== null; - - if (isUsedAsValue || hasAssignedValue) { - this.checkThisCaptureVariableCollides(importStatementAST, true, context); - } - }; - - PullTypeResolver.prototype.resolveExportAssignmentStatement = function (exportAssignmentAST, context) { - var id = exportAssignmentAST.identifier.valueText(); - if (id.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var valueSymbol = null; - var typeSymbol = null; - var containerSymbol = null; - - var enclosingDecl = this.getEnclosingDeclForAST(exportAssignmentAST); - var parentSymbol = enclosingDecl.getSymbol(); - - if (!parentSymbol.isType() && parentSymbol.isContainer()) { - this.semanticInfoChain.addDiagnosticFromAST(exportAssignmentAST, TypeScript.DiagnosticCode.Export_assignments_may_only_be_used_at_the_top_level_of_external_modules); - return this.semanticInfoChain.anyTypeSymbol; - } - - var declPath = enclosingDecl !== null ? [enclosingDecl] : []; - - containerSymbol = this.getSymbolFromDeclPath(id, declPath, 164 /* SomeContainer */); - - var acceptableAlias = true; - - if (containerSymbol) { - acceptableAlias = (containerSymbol.kind & 59753052 /* AcceptableAlias */) !== 0; - } - - if (!acceptableAlias && containerSymbol && containerSymbol.kind === 128 /* TypeAlias */) { - this.resolveDeclaredSymbol(containerSymbol, context); - - var aliasSymbol = containerSymbol; - var aliasedAssignedValue = aliasSymbol.getExportAssignedValueSymbol(); - var aliasedAssignedType = aliasSymbol.getExportAssignedTypeSymbol(); - var aliasedAssignedContainer = aliasSymbol.getExportAssignedContainerSymbol(); - - if (aliasedAssignedValue || aliasedAssignedType || aliasedAssignedContainer) { - valueSymbol = aliasedAssignedValue; - typeSymbol = aliasedAssignedType; - containerSymbol = aliasedAssignedContainer; - aliasSymbol.setTypeUsedExternally(); - if (valueSymbol) { - aliasSymbol.setIsUsedAsValue(); - } - acceptableAlias = true; - } - } - - if (!acceptableAlias) { - this.semanticInfoChain.addDiagnosticFromAST(exportAssignmentAST, TypeScript.DiagnosticCode.Export_assignments_may_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules); - return this.semanticInfoChain.voidTypeSymbol; - } - - if (!valueSymbol) { - valueSymbol = this.getSymbolFromDeclPath(id, declPath, 68147712 /* SomeValue */); - } - if (!typeSymbol) { - typeSymbol = this.getSymbolFromDeclPath(id, declPath, 58728795 /* SomeType */); - } - - if (!valueSymbol && !typeSymbol && !containerSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(exportAssignmentAST, TypeScript.DiagnosticCode.Could_not_find_symbol_0, [id])); - return this.semanticInfoChain.voidTypeSymbol; - } - - if (valueSymbol) { - parentSymbol.setExportAssignedValueSymbol(valueSymbol); - } - if (typeSymbol) { - parentSymbol.setExportAssignedTypeSymbol(typeSymbol); - } - if (containerSymbol) { - parentSymbol.setExportAssignedContainerSymbol(containerSymbol); - } - - this.resolveDeclaredSymbol(valueSymbol, context); - this.resolveDeclaredSymbol(typeSymbol, context); - this.resolveDeclaredSymbol(containerSymbol, context); - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveAnyFunctionTypeSignature = function (funcDeclAST, typeParameters, parameterList, returnTypeAnnotation, context) { - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - TypeScript.Debug.assert(functionDecl); - - var funcDeclSymbol = functionDecl.getSymbol(); - - var signature = funcDeclSymbol.kind === 33554432 /* ConstructorType */ ? funcDeclSymbol.getConstructSignatures()[0] : funcDeclSymbol.getCallSignatures()[0]; - - if (returnTypeAnnotation) { - signature.returnType = this.resolveTypeReference(returnTypeAnnotation, context); - } - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - if (parameterList) { - for (var i = 0; i < parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveFunctionTypeSignatureParameter(parameterList.parameters.nonSeparatorAt(i), signature, functionDecl, context); - } - } - - funcDeclSymbol.setResolved(); - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.setTypeChecked(funcDeclAST, context); - this.typeCheckFunctionOverloads(funcDeclAST, context); - } - - return funcDeclSymbol; - }; - - PullTypeResolver.prototype.resolveFunctionTypeSignatureParameter = function (argDeclAST, signature, enclosingDecl, context) { - var paramDecl = this.semanticInfoChain.getDeclForAST(argDeclAST); - var paramSymbol = paramDecl.getSymbol(); - - if (argDeclAST.typeAnnotation) { - var typeRef = this.resolveTypeReference(TypeScript.ASTHelpers.getType(argDeclAST), context); - - if (paramSymbol.isVarArg && !typeRef.isArrayNamedTypeReference()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Rest_parameters_must_be_array_types)); - typeRef = this.getNewErrorTypeSymbol(); - } - - context.setTypeInContext(paramSymbol, typeRef); - } else { - if (paramSymbol.isVarArg) { - if (this.cachedArrayInterfaceType()) { - context.setTypeInContext(paramSymbol, this.createInstantiatedType(this.cachedArrayInterfaceType(), [this.semanticInfoChain.anyTypeSymbol])); - } else { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - } - } else { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - } - - if (this.compilationSettings.noImplicitAny()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Parameter_0_of_function_type_implicitly_has_an_any_type, [argDeclAST.identifier.text()])); - } - } - - if (TypeScript.hasFlag(paramDecl.flags, 128 /* Optional */) && argDeclAST.equalsValueClause && isTypesOnlyLocation(argDeclAST)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Default_arguments_are_only_allowed_in_implementation)); - } - - paramSymbol.setResolved(); - }; - - PullTypeResolver.prototype.resolveFunctionExpressionParameter = function (argDeclAST, id, typeExpr, equalsValueClause, contextParam, enclosingDecl, context) { - var paramDecl = this.semanticInfoChain.getDeclForAST(argDeclAST); - var paramSymbol = paramDecl.getSymbol(); - var contextualType = contextParam && contextParam.type; - var isImplicitAny = false; - - if (typeExpr) { - var typeRef = this.resolveTypeReference(typeExpr, context); - - if (paramSymbol.isVarArg && !typeRef.isArrayNamedTypeReference()) { - var diagnostic = context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Rest_parameters_must_be_array_types)); - typeRef = this.getNewErrorTypeSymbol(); - } - - contextualType = typeRef || contextualType; - } - if (contextualType) { - if (context.isInferentiallyTyping()) { - contextualType = context.fixAllTypeParametersReferencedByType(contextualType, this); - } - context.setTypeInContext(paramSymbol, contextualType); - } else if (paramSymbol.isVarArg) { - if (this.cachedArrayInterfaceType()) { - context.setTypeInContext(paramSymbol, this.createInstantiatedType(this.cachedArrayInterfaceType(), [this.semanticInfoChain.anyTypeSymbol])); - } else { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - } - isImplicitAny = true; - } - - var canTypeCheckAST = this.canTypeCheckAST(argDeclAST, context); - if (equalsValueClause && (canTypeCheckAST || !contextualType)) { - if (contextualType) { - context.propagateContextualType(contextualType); - } - - var initExprSymbol = this.resolveAST(equalsValueClause, contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - } - - if (!initExprSymbol || !initExprSymbol.type) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Unable_to_resolve_type_of_0, [id.text()])); - - if (!contextualType) { - context.setTypeInContext(paramSymbol, this.getNewErrorTypeSymbol(paramSymbol.name)); - } - } else { - var initTypeSymbol = this.getInstanceTypeForAssignment(argDeclAST, initExprSymbol.type, context); - if (!contextualType) { - context.setTypeInContext(paramSymbol, initTypeSymbol.widenedType(this, equalsValueClause, context)); - isImplicitAny = initTypeSymbol !== paramSymbol.type; - } else { - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(initTypeSymbol, contextualType, argDeclAST, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(argDeclAST); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [initTypeSymbol.toString(enclosingSymbol), contextualType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [initTypeSymbol.toString(enclosingSymbol), contextualType.toString(enclosingSymbol)])); - } - } - } - } - } - - if (!contextualType && !paramSymbol.isVarArg && !initTypeSymbol) { - context.setTypeInContext(paramSymbol, this.semanticInfoChain.anyTypeSymbol); - isImplicitAny = true; - } - - if (isImplicitAny && this.compilationSettings.noImplicitAny()) { - var functionExpressionName = paramDecl.getParentDecl().getFunctionExpressionName(); - if (functionExpressionName) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Parameter_0_of_1_implicitly_has_an_any_type, [id.text(), functionExpressionName])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(argDeclAST, TypeScript.DiagnosticCode.Parameter_0_of_lambda_function_implicitly_has_an_any_type, [id.text()])); - } - } - - if (canTypeCheckAST) { - this.checkNameForCompilerGeneratedDeclarationCollision(argDeclAST, true, id, context); - } - - paramSymbol.setResolved(); - }; - - PullTypeResolver.prototype.checkNameForCompilerGeneratedDeclarationCollision = function (astWithName, isDeclaration, name, context) { - var compilerReservedName = getCompilerReservedName(name); - switch (compilerReservedName) { - case 1 /* _this */: - this.postTypeCheckWorkitems.push(astWithName); - return; - - case 2 /* _super */: - this.checkSuperCaptureVariableCollides(astWithName, isDeclaration, context); - return; - - case 3 /* arguments */: - this.checkArgumentsCollides(astWithName, context); - return; - - case 4 /* _i */: - this.checkIndexOfRestArgumentInitializationCollides(astWithName, isDeclaration, context); - return; - - case 5 /* require */: - case 6 /* exports */: - if (isDeclaration) { - this.checkExternalModuleRequireExportsCollides(astWithName, name, context); - } - return; - } - }; - - PullTypeResolver.prototype.hasRestParameterCodeGen = function (someFunctionDecl) { - var enclosingAST = this.getASTForDecl(someFunctionDecl); - var nodeType = enclosingAST.kind(); - - if (nodeType === 129 /* FunctionDeclaration */) { - var functionDeclaration = enclosingAST; - return !TypeScript.hasFlag(someFunctionDecl.kind === 65536 /* Method */ ? someFunctionDecl.getParentDecl().flags : someFunctionDecl.flags, 8 /* Ambient */) && functionDeclaration.block && TypeScript.lastParameterIsRest(functionDeclaration.callSignature.parameterList); - } else if (nodeType === 135 /* MemberFunctionDeclaration */) { - var memberFunction = enclosingAST; - return !TypeScript.hasFlag(someFunctionDecl.kind === 65536 /* Method */ ? someFunctionDecl.getParentDecl().flags : someFunctionDecl.flags, 8 /* Ambient */) && memberFunction.block && TypeScript.lastParameterIsRest(memberFunction.callSignature.parameterList); - } else if (nodeType === 137 /* ConstructorDeclaration */) { - var constructorDeclaration = enclosingAST; - return !TypeScript.hasFlag(someFunctionDecl.getParentDecl().flags, 8 /* Ambient */) && constructorDeclaration.block && TypeScript.lastParameterIsRest(constructorDeclaration.callSignature.parameterList); - } else if (nodeType === 218 /* ParenthesizedArrowFunctionExpression */) { - var arrowFunctionExpression = enclosingAST; - return TypeScript.lastParameterIsRest(arrowFunctionExpression.callSignature.parameterList); - } else if (nodeType === 222 /* FunctionExpression */) { - var functionExpression = enclosingAST; - return TypeScript.lastParameterIsRest(functionExpression.callSignature.parameterList); - } - - return false; - }; - - PullTypeResolver.prototype.checkArgumentsCollides = function (ast, context) { - if (ast.kind() === 242 /* Parameter */) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - if (TypeScript.hasFlag(enclosingDecl.kind, 1032192 /* SomeFunction */)) { - if (this.hasRestParameterCodeGen(enclosingDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters)); - } - } - } - }; - - PullTypeResolver.prototype.checkIndexOfRestArgumentInitializationCollides = function (ast, isDeclaration, context) { - if (!isDeclaration || ast.kind() === 242 /* Parameter */) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - var declPath = isDeclaration ? [enclosingDecl] : (enclosingDecl ? enclosingDecl.getParentPath() : []); - var resolvedSymbol = null; - var resolvedSymbolContainer; - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - if (!isDeclaration) { - if (!resolvedSymbol) { - resolvedSymbol = this.resolveNameExpression(ast, context); - if (resolvedSymbol.isError()) { - return; - } - - resolvedSymbolContainer = resolvedSymbol.getContainer(); - } - - if (resolvedSymbolContainer && TypeScript.ArrayUtilities.contains(resolvedSymbolContainer.getDeclarations(), decl)) { - break; - } - } - - if (TypeScript.hasFlag(decl.kind, 1032192 /* SomeFunction */)) { - if (this.hasRestParameterCodeGen(decl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, isDeclaration ? TypeScript.DiagnosticCode.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter : TypeScript.DiagnosticCode.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter)); - } - } - } - } - }; - - PullTypeResolver.prototype.checkExternalModuleRequireExportsCollides = function (ast, name, context) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(name); - if (enclosingModule) { - enclosingDecl = this.getEnclosingDeclForAST(enclosingModule); - } - - if (enclosingDecl && enclosingDecl.kind === 32 /* DynamicModule */) { - var decl = this.semanticInfoChain.getDeclForAST(ast); - - if (!TypeScript.hasFlag(decl.flags, 8 /* Ambient */)) { - var nameText = name.valueText(); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, [nameText, nameText])); - } - } - }; - - PullTypeResolver.prototype.resolveObjectTypeTypeReference = function (objectType, context) { - var interfaceDecl = this.semanticInfoChain.getDeclForAST(objectType); - TypeScript.Debug.assert(interfaceDecl); - - var interfaceSymbol = interfaceDecl.getSymbol(); - TypeScript.Debug.assert(interfaceSymbol); - - if (objectType.typeMembers) { - var memberDecl = null; - var memberSymbol = null; - var memberType = null; - var typeMembers = objectType.typeMembers; - - for (var i = 0; i < typeMembers.nonSeparatorCount(); i++) { - memberDecl = this.semanticInfoChain.getDeclForAST(typeMembers.nonSeparatorAt(i)); - memberSymbol = (memberDecl.kind & 7340032 /* SomeSignature */) ? memberDecl.getSignatureSymbol() : memberDecl.getSymbol(); - - this.resolveAST(typeMembers.nonSeparatorAt(i), false, context); - - memberType = memberSymbol.type; - - if ((memberType && memberType.isGeneric()) || (memberSymbol.isSignature() && memberSymbol.isGeneric())) { - interfaceSymbol.setHasGenericMember(); - } - } - } - - interfaceSymbol.setResolved(); - - if (this.canTypeCheckAST(objectType, context)) { - this.typeCheckObjectTypeTypeReference(objectType, context); - } - - return interfaceSymbol; - }; - - PullTypeResolver.prototype.typeCheckObjectTypeTypeReference = function (objectType, context) { - this.setTypeChecked(objectType, context); - var objectTypeDecl = this.semanticInfoChain.getDeclForAST(objectType); - var objectTypeSymbol = objectTypeDecl.getSymbol(); - - this.typeCheckMembersAgainstIndexer(objectTypeSymbol, objectTypeDecl, context); - this.checkTypeForDuplicateIndexSignatures(objectTypeSymbol); - }; - - PullTypeResolver.prototype.resolveTypeAnnotation = function (typeAnnotation, context) { - return this.resolveTypeReference(typeAnnotation.type, context); - }; - - PullTypeResolver.prototype.resolveTypeReference = function (typeRef, context) { - if (typeRef === null) { - return null; - } - - TypeScript.Debug.assert(typeRef.kind() !== 244 /* TypeAnnotation */); - - var aliasType = null; - var type = this.computeTypeReferenceSymbol(typeRef, context); - - if (type.kind === 4 /* Container */) { - var container = type; - var instanceSymbol = container.getInstanceSymbol(); - - if (instanceSymbol && (instanceSymbol.anyDeclHasFlag(16384 /* ClassConstructorVariable */) || instanceSymbol.kind === 32768 /* ConstructorMethod */)) { - type = instanceSymbol.type.getAssociatedContainerType(); - } - } - - if (type && type.isAlias()) { - aliasType = type; - type = aliasType.getExportAssignedTypeSymbol(); - } - - if (type && !type.isGeneric()) { - if (aliasType) { - this.semanticInfoChain.setAliasSymbolForAST(typeRef, aliasType); - } - } - - if (type && !type.isError()) { - if ((type.kind & 58728795 /* SomeType */) === 0) { - if (type.kind & 164 /* SomeContainer */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeRef, TypeScript.DiagnosticCode.Type_reference_cannot_refer_to_container_0, [aliasType ? aliasType.toString() : type.toString()])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeRef, TypeScript.DiagnosticCode.Type_reference_must_refer_to_type)); - } - } - } - - if (this.canTypeCheckAST(typeRef, context)) { - this.setTypeChecked(typeRef, context); - } - - return type; - }; - - PullTypeResolver.prototype.getArrayType = function (elementType) { - var arraySymbol = elementType.getArrayType(); - - if (!arraySymbol) { - arraySymbol = this.createInstantiatedType(this.cachedArrayInterfaceType(), [elementType]); - - if (!arraySymbol) { - arraySymbol = this.semanticInfoChain.anyTypeSymbol; - } - - elementType.setArrayType(arraySymbol); - } - - return arraySymbol; - }; - - PullTypeResolver.prototype.computeTypeReferenceSymbol = function (term, context) { - switch (term.kind()) { - case 60 /* AnyKeyword */: - return this.semanticInfoChain.anyTypeSymbol; - case 61 /* BooleanKeyword */: - return this.semanticInfoChain.booleanTypeSymbol; - case 67 /* NumberKeyword */: - return this.semanticInfoChain.numberTypeSymbol; - case 69 /* StringKeyword */: - return this.semanticInfoChain.stringTypeSymbol; - case 41 /* VoidKeyword */: - return this.semanticInfoChain.voidTypeSymbol; - } - - var typeDeclSymbol = null; - - if (term.kind() === 11 /* IdentifierName */) { - typeDeclSymbol = this.resolveTypeNameExpression(term, context); - } else if (term.kind() === 123 /* FunctionType */) { - var functionType = term; - typeDeclSymbol = this.resolveAnyFunctionTypeSignature(functionType, functionType.typeParameterList, functionType.parameterList, functionType.type, context); - } else if (term.kind() === 125 /* ConstructorType */) { - var constructorType = term; - typeDeclSymbol = this.resolveAnyFunctionTypeSignature(constructorType, constructorType.typeParameterList, constructorType.parameterList, constructorType.type, context); - } else if (term.kind() === 122 /* ObjectType */) { - typeDeclSymbol = this.resolveObjectTypeTypeReference(term, context); - } else if (term.kind() === 126 /* GenericType */) { - typeDeclSymbol = this.resolveGenericTypeReference(term, context); - } else if (term.kind() === 121 /* QualifiedName */) { - typeDeclSymbol = this.resolveQualifiedName(term, context); - } else if (term.kind() === 14 /* StringLiteral */) { - var stringConstantAST = term; - var enclosingDecl = this.getEnclosingDeclForAST(term); - typeDeclSymbol = new TypeScript.PullStringConstantTypeSymbol(stringConstantAST.text()); - var decl = new TypeScript.PullSynthesizedDecl(stringConstantAST.text(), stringConstantAST.text(), typeDeclSymbol.kind, null, enclosingDecl, enclosingDecl.semanticInfoChain); - typeDeclSymbol.addDeclaration(decl); - } else if (term.kind() === 127 /* TypeQuery */) { - var typeQuery = term; - - var typeQueryTerm = typeQuery.name; - - var valueSymbol = this.resolveAST(typeQueryTerm, false, context); - - if (valueSymbol && valueSymbol.isAlias()) { - if (valueSymbol.assignedValue()) { - valueSymbol = valueSymbol.assignedValue(); - } else { - var containerSymbol = valueSymbol.getExportAssignedContainerSymbol(); - valueSymbol = (containerSymbol && containerSymbol.isContainer() && !containerSymbol.isEnum()) ? containerSymbol.getInstanceSymbol() : null; - } - } - - if (valueSymbol) { - typeDeclSymbol = valueSymbol.type.widenedType(this, typeQueryTerm, context); - } else { - typeDeclSymbol = this.getNewErrorTypeSymbol(); - } - } else if (term.kind() === 124 /* ArrayType */) { - var arrayType = term; - var underlying = this.resolveTypeReference(arrayType.type, context); - typeDeclSymbol = this.getArrayType(underlying); - } else { - throw TypeScript.Errors.invalidOperation("unknown type"); - } - - if (!typeDeclSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(term, TypeScript.DiagnosticCode.Unable_to_resolve_type)); - return this.getNewErrorTypeSymbol(); - } - - if (typeDeclSymbol.isError()) { - return typeDeclSymbol; - } - - if (this.genericTypeIsUsedWithoutRequiredTypeArguments(typeDeclSymbol, term, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(term, TypeScript.DiagnosticCode.Generic_type_references_must_include_all_type_arguments)); - typeDeclSymbol = this.instantiateTypeToAny(typeDeclSymbol, context); - } - - return typeDeclSymbol; - }; - - PullTypeResolver.prototype.genericTypeIsUsedWithoutRequiredTypeArguments = function (typeSymbol, term, context) { - if (!typeSymbol) { - return false; - } - - if (typeSymbol.isAlias()) { - return this.genericTypeIsUsedWithoutRequiredTypeArguments(typeSymbol.getExportAssignedTypeSymbol(), term, context); - } - - return typeSymbol.isNamedTypeSymbol() && typeSymbol.isGeneric() && !typeSymbol.isTypeParameter() && (typeSymbol.isResolved || typeSymbol.inResolution) && !typeSymbol.getIsSpecialized() && typeSymbol.getTypeParameters().length && typeSymbol.getTypeArguments() === null && this.isTypeRefWithoutTypeArgs(term); - }; - - PullTypeResolver.prototype.resolveMemberVariableDeclaration = function (varDecl, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(varDecl, varDecl.modifiers, varDecl.variableDeclarator.propertyName, TypeScript.ASTHelpers.getType(varDecl.variableDeclarator), varDecl.variableDeclarator.equalsValueClause, context); - }; - - PullTypeResolver.prototype.resolvePropertySignature = function (varDecl, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.sentinelEmptyArray, varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), null, context); - }; - - PullTypeResolver.prototype.resolveVariableDeclarator = function (varDecl, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl), varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), varDecl.equalsValueClause, context); - }; - - PullTypeResolver.prototype.resolveParameterList = function (list, context) { - return this.resolveSeparatedList(list.parameters, context); - }; - - PullTypeResolver.prototype.resolveParameter = function (parameter, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(parameter, parameter.modifiers, parameter.identifier, TypeScript.ASTHelpers.getType(parameter), parameter.equalsValueClause, context); - }; - - PullTypeResolver.prototype.getEnumTypeSymbol = function (enumElement, context) { - var enumDeclaration = enumElement.parent.parent; - var decl = this.semanticInfoChain.getDeclForAST(enumDeclaration); - var symbol = decl.getSymbol(); - this.resolveDeclaredSymbol(symbol, context); - - return symbol; - }; - - PullTypeResolver.prototype.resolveEnumElement = function (enumElement, context) { - return this.resolveVariableDeclaratorOrParameterOrEnumElement(enumElement, TypeScript.sentinelEmptyArray, enumElement.propertyName, null, enumElement.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckEnumElement = function (enumElement, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(enumElement, TypeScript.sentinelEmptyArray, enumElement.propertyName, null, enumElement.equalsValueClause, context); - }; - - PullTypeResolver.prototype.resolveEqualsValueClause = function (clause, isContextuallyTyped, context) { - if (this.canTypeCheckAST(clause, context)) { - this.setTypeChecked(clause, context); - } - - return this.resolveAST(clause.value, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveVariableDeclaratorOrParameterOrEnumElement = function (varDeclOrParameter, modifiers, name, typeExpr, init, context) { - var hasTypeExpr = typeExpr !== null || varDeclOrParameter.kind() === 243 /* EnumElement */; - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - - if (enclosingDecl && decl.kind === 2048 /* Parameter */) { - enclosingDecl.ensureSymbolIsBound(); - } - - var declSymbol = decl.getSymbol(); - var declParameterSymbol = decl.getValueDecl() ? decl.getValueDecl().getSymbol() : null; - - if (declSymbol.isResolved) { - var declType = declSymbol.type; - var valDecl = decl.getValueDecl(); - - if (valDecl) { - var valSymbol = valDecl.getSymbol(); - - if (valSymbol && !valSymbol.isResolved) { - valSymbol.type = declType; - valSymbol.setResolved(); - } - } - } else { - if (declSymbol.inResolution) { - declSymbol.type = this.semanticInfoChain.anyTypeSymbol; - declSymbol.setResolved(); - return declSymbol; - } - - if (!declSymbol.type || !declSymbol.type.isError()) { - declSymbol.startResolving(); - - var typeExprSymbol = this.resolveAndTypeCheckVariableDeclarationTypeExpr(varDeclOrParameter, name, typeExpr, context); - - if (!hasTypeExpr) { - this.resolveAndTypeCheckVariableDeclaratorOrParameterInitExpr(varDeclOrParameter, name, typeExpr, init, context, typeExprSymbol); - } - - if (!(hasTypeExpr || init)) { - var defaultType = this.semanticInfoChain.anyTypeSymbol; - - if (declSymbol.isVarArg && this.cachedArrayInterfaceType()) { - defaultType = this.createInstantiatedType(this.cachedArrayInterfaceType(), [defaultType]); - } - - context.setTypeInContext(declSymbol, defaultType); - - if (declParameterSymbol) { - declParameterSymbol.type = defaultType; - } - } - declSymbol.setResolved(); - - if (declParameterSymbol) { - declParameterSymbol.setResolved(); - } - } - } - - if (this.canTypeCheckAST(varDeclOrParameter, context)) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDeclOrParameter, modifiers, name, typeExpr, init, context); - } - - return declSymbol; - }; - - PullTypeResolver.prototype.resolveAndTypeCheckVariableDeclarationTypeExpr = function (varDeclOrParameter, name, typeExpr, context) { - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - var declSymbol = decl.getSymbol(); - var declParameterSymbol = decl.getValueDecl() ? decl.getValueDecl().getSymbol() : null; - - if (varDeclOrParameter.kind() === 243 /* EnumElement */) { - var result = this.getEnumTypeSymbol(varDeclOrParameter, context); - declSymbol.type = result; - return result; - } - - if (!typeExpr) { - return null; - } - - var wrapperDecl = this.getEnclosingDecl(decl); - wrapperDecl = wrapperDecl || enclosingDecl; - - var typeExprSymbol = this.resolveTypeReference(typeExpr, context); - - if (!typeExprSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Unable_to_resolve_type_of_0, [name.text()])); - declSymbol.type = this.getNewErrorTypeSymbol(); - - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, this.semanticInfoChain.anyTypeSymbol); - } - } else if (typeExprSymbol.isError()) { - context.setTypeInContext(declSymbol, typeExprSymbol); - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, typeExprSymbol); - } - } else { - if (typeExprSymbol === this.semanticInfoChain.anyTypeSymbol) { - decl.setFlag(16777216 /* IsAnnotatedWithAny */); - } - - if (typeExprSymbol.isContainer()) { - var exportedTypeSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - - if (exportedTypeSymbol) { - typeExprSymbol = exportedTypeSymbol; - } else { - typeExprSymbol = typeExprSymbol.type; - - if (typeExprSymbol.isAlias()) { - typeExprSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - } - - if (typeExprSymbol && typeExprSymbol.isContainer() && !typeExprSymbol.isEnum()) { - var instanceSymbol = typeExprSymbol.getInstanceSymbol(); - - if (!instanceSymbol || !TypeScript.PullHelpers.symbolIsEnum(instanceSymbol)) { - typeExprSymbol = this.getNewErrorTypeSymbol(); - } else { - typeExprSymbol = instanceSymbol.type; - } - } - } - } else if (declSymbol.isVarArg && !(typeExprSymbol.isArrayNamedTypeReference() || typeExprSymbol === this.cachedArrayInterfaceType())) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Rest_parameters_must_be_array_types)); - typeExprSymbol = this.getNewErrorTypeSymbol(); - } - - context.setTypeInContext(declSymbol, typeExprSymbol); - - if (declParameterSymbol) { - declParameterSymbol.type = typeExprSymbol; - } - - if (typeExprSymbol.kind === 16777216 /* FunctionType */ && !typeExprSymbol.getFunctionSymbol()) { - typeExprSymbol.setFunctionSymbol(declSymbol); - } - } - - return typeExprSymbol; - }; - - PullTypeResolver.prototype.resolveAndTypeCheckVariableDeclaratorOrParameterInitExpr = function (varDeclOrParameter, name, typeExpr, init, context, typeExprSymbol) { - if (!init) { - return null; - } - - var hasTypeExpr = typeExpr !== null || varDeclOrParameter.kind() === 243 /* EnumElement */; - if (typeExprSymbol) { - context.pushNewContextualType(typeExprSymbol); - } - - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - var declSymbol = decl.getSymbol(); - var declParameterSymbol = decl.getValueDecl() ? decl.getValueDecl().getSymbol() : null; - - var wrapperDecl = this.getEnclosingDecl(decl); - wrapperDecl = wrapperDecl || enclosingDecl; - - var initExprSymbol = this.resolveAST(init, typeExprSymbol !== null, context); - - if (typeExprSymbol) { - context.popAnyContextualType(); - } - - if (!initExprSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Unable_to_resolve_type_of_0, [name.text()])); - - if (!hasTypeExpr) { - context.setTypeInContext(declSymbol, this.getNewErrorTypeSymbol()); - - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, this.semanticInfoChain.anyTypeSymbol); - } - } - } else { - var initTypeSymbol = initExprSymbol.type; - - if (!hasTypeExpr) { - var widenedInitTypeSymbol = initTypeSymbol.widenedType(this, init.value, context); - context.setTypeInContext(declSymbol, widenedInitTypeSymbol); - - if (declParameterSymbol) { - context.setTypeInContext(declParameterSymbol, widenedInitTypeSymbol); - } - - if (this.compilationSettings.noImplicitAny()) { - if ((widenedInitTypeSymbol !== initTypeSymbol) && (widenedInitTypeSymbol === this.semanticInfoChain.anyTypeSymbol)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Variable_0_implicitly_has_an_any_type, [name.text()])); - } - } - - return widenedInitTypeSymbol; - } - } - - return initTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckPropertySignature = function (varDecl, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.sentinelEmptyArray, varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckMemberVariableDeclaration = function (varDecl, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDecl, varDecl.modifiers, varDecl.variableDeclarator.propertyName, TypeScript.ASTHelpers.getType(varDecl), varDecl.variableDeclarator.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckVariableDeclarator = function (varDecl, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(varDecl, TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl), varDecl.propertyName, TypeScript.ASTHelpers.getType(varDecl), varDecl.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckParameter = function (parameter, context) { - this.typeCheckVariableDeclaratorOrParameterOrEnumElement(parameter, parameter.modifiers, parameter.identifier, TypeScript.ASTHelpers.getType(parameter), parameter.equalsValueClause, context); - }; - - PullTypeResolver.prototype.typeCheckVariableDeclaratorOrParameterOrEnumElement = function (varDeclOrParameter, modifiers, name, typeExpr, init, context) { - var _this = this; - this.setTypeChecked(varDeclOrParameter, context); - - var hasTypeExpr = typeExpr !== null || varDeclOrParameter.kind() === 243 /* EnumElement */; - var enclosingDecl = this.getEnclosingDeclForAST(varDeclOrParameter); - var decl = this.semanticInfoChain.getDeclForAST(varDeclOrParameter); - var declSymbol = decl.getSymbol(); - - var typeExprSymbol = this.resolveAndTypeCheckVariableDeclarationTypeExpr(varDeclOrParameter, name, typeExpr, context); - - var initTypeSymbol = this.resolveAndTypeCheckVariableDeclaratorOrParameterInitExpr(varDeclOrParameter, name, typeExpr, init, context, typeExprSymbol); - - if (hasTypeExpr || init) { - if (typeExprSymbol && typeExprSymbol.isAlias()) { - typeExprSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - } - - if (typeExprSymbol && typeExprSymbol.kind === 32 /* DynamicModule */) { - var exportedTypeSymbol = typeExprSymbol.getExportAssignedTypeSymbol(); - - if (exportedTypeSymbol) { - typeExprSymbol = exportedTypeSymbol; - } else { - var instanceTypeSymbol = typeExprSymbol.getInstanceType(); - - if (!instanceTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Tried_to_set_variable_type_to_uninitialized_module_type_0, [typeExprSymbol.toString()])); - typeExprSymbol = null; - } else { - typeExprSymbol = instanceTypeSymbol; - } - } - } - - initTypeSymbol = this.getInstanceTypeForAssignment(varDeclOrParameter, initTypeSymbol, context); - - if (initTypeSymbol && typeExprSymbol) { - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(initTypeSymbol, typeExprSymbol, varDeclOrParameter, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(varDeclOrParameter); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [initTypeSymbol.toString(enclosingSymbol), typeExprSymbol.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [initTypeSymbol.toString(enclosingSymbol), typeExprSymbol.toString(enclosingSymbol)])); - } - } - } - } else if (varDeclOrParameter.kind() !== 243 /* EnumElement */ && this.compilationSettings.noImplicitAny() && !this.isForInVariableDeclarator(varDeclOrParameter)) { - var wrapperDecl = this.getEnclosingDecl(decl); - wrapperDecl = wrapperDecl || enclosingDecl; - - var needReportError = function (containerDecl, selfDecl) { - if (!TypeScript.hasFlag(containerDecl.flags, 8 /* Ambient */)) { - return true; - } - - return selfDecl && !TypeScript.hasFlag(selfDecl.flags, 2 /* Private */); - }; - - if ((wrapperDecl.kind === 16384 /* Function */ || wrapperDecl.kind === 32768 /* ConstructorMethod */ || wrapperDecl.kind === 2097152 /* ConstructSignature */)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Parameter_0_of_1_implicitly_has_an_any_type, [name.text(), enclosingDecl.name])); - } else if (wrapperDecl.kind === 65536 /* Method */) { - var parentDecl = wrapperDecl.getParentDecl(); - - if (needReportError(parentDecl, wrapperDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Parameter_0_of_1_implicitly_has_an_any_type, [name.text(), enclosingDecl.name])); - } - } else if (decl.kind === 4096 /* Property */ && !declSymbol.getContainer().isNamedTypeSymbol()) { - if (needReportError(wrapperDecl, decl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Member_0_of_object_type_implicitly_has_an_any_type, [name.text()])); - } - } else if (wrapperDecl.kind !== 268435456 /* CatchBlock */) { - if (needReportError(wrapperDecl) || !TypeScript.hasModifier(modifiers, 2 /* Private */)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Variable_0_implicitly_has_an_any_type, [name.text()])); - } - } - } - - if (init && varDeclOrParameter.kind() === 242 /* Parameter */) { - var containerSignature = enclosingDecl.getSignatureSymbol(); - if (containerSignature && !containerSignature.isDefinition()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(varDeclOrParameter, TypeScript.DiagnosticCode.Default_arguments_are_only_allowed_in_implementation)); - } - } - if (declSymbol.kind !== 2048 /* Parameter */ && (declSymbol.kind !== 4096 /* Property */ || declSymbol.getContainer().isNamedTypeSymbol())) { - this.checkSymbolPrivacy(declSymbol, declSymbol.type, function (symbol) { - return _this.variablePrivacyErrorReporter(varDeclOrParameter, declSymbol, symbol, context); - }); - } - - if ((declSymbol.kind !== 4096 /* Property */ && declSymbol.kind !== 67108864 /* EnumMember */) || declSymbol.anyDeclHasFlag(8388608 /* PropertyParameter */)) { - this.checkNameForCompilerGeneratedDeclarationCollision(varDeclOrParameter, true, name, context); - } - }; - - PullTypeResolver.prototype.isForInVariableDeclarator = function (ast) { - return ast.kind() === 225 /* VariableDeclarator */ && ast.parent && ast.parent.parent && ast.parent.parent.parent && ast.parent.kind() === 2 /* SeparatedList */ && ast.parent.parent.kind() === 224 /* VariableDeclaration */ && ast.parent.parent.parent.kind() === 155 /* ForInStatement */ && ast.parent.parent.parent.variableDeclaration === ast.parent.parent; - }; - - PullTypeResolver.prototype.checkSuperCaptureVariableCollides = function (superAST, isDeclaration, context) { - var enclosingDecl = this.getEnclosingDeclForAST(superAST); - - var classSymbol = this.getContextualClassSymbolForEnclosingDecl(superAST, enclosingDecl); - - if (classSymbol && !classSymbol.anyDeclHasFlag(8 /* Ambient */)) { - if (superAST.kind() === 242 /* Parameter */) { - var enclosingAST = this.getASTForDecl(enclosingDecl); - if (enclosingAST.kind() !== 218 /* ParenthesizedArrowFunctionExpression */ && enclosingAST.kind() !== 219 /* SimpleArrowFunctionExpression */) { - var block = enclosingDecl.kind === 65536 /* Method */ ? enclosingAST.block : enclosingAST.block; - if (!block) { - return; - } - } - } - - this.resolveDeclaredSymbol(classSymbol, context); - - var parents = classSymbol.getExtendedTypes(); - if (parents.length) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(superAST, isDeclaration ? TypeScript.DiagnosticCode.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference : TypeScript.DiagnosticCode.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference)); - } - } - }; - - PullTypeResolver.prototype.checkThisCaptureVariableCollides = function (_thisAST, isDeclaration, context) { - if (isDeclaration) { - var decl = this.semanticInfoChain.getDeclForAST(_thisAST); - if (TypeScript.hasFlag(decl.flags, 8 /* Ambient */)) { - return; - } - } - - var enclosingDecl = this.getEnclosingDeclForAST(_thisAST); - - var enclosingModule = TypeScript.ASTHelpers.getModuleDeclarationFromNameAST(_thisAST); - if (enclosingModule) { - enclosingDecl = this.getEnclosingDeclForAST(enclosingModule); - } - - var declPath = enclosingDecl.getParentPath(); - - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - var declKind = decl.kind; - if (declKind === 131072 /* FunctionExpression */ && TypeScript.hasFlag(decl.flags, 8192 /* ArrowFunction */)) { - continue; - } - - if (declKind === 16384 /* Function */ || declKind === 65536 /* Method */ || declKind === 32768 /* ConstructorMethod */ || declKind === 262144 /* GetAccessor */ || declKind === 524288 /* SetAccessor */ || declKind === 131072 /* FunctionExpression */ || declKind === 8 /* Class */ || declKind === 4 /* Container */ || declKind === 32 /* DynamicModule */ || declKind === 1 /* Script */) { - if (TypeScript.hasFlag(decl.flags, 262144 /* MustCaptureThis */)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(_thisAST, isDeclaration ? TypeScript.DiagnosticCode.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference : TypeScript.DiagnosticCode.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference)); - } - break; - } - } - }; - - PullTypeResolver.prototype.postTypeCheckVariableDeclaratorOrParameter = function (varDeclOrParameter, context) { - this.checkThisCaptureVariableCollides(varDeclOrParameter, true, context); - }; - - PullTypeResolver.prototype.resolveTypeParameterDeclaration = function (typeParameterAST, context) { - var typeParameterDecl = this.semanticInfoChain.getDeclForAST(typeParameterAST); - var typeParameterSymbol = typeParameterDecl.getSymbol(); - - this.resolveFirstTypeParameterDeclaration(typeParameterSymbol, context); - - if (typeParameterSymbol.isResolved && this.canTypeCheckAST(typeParameterAST, context)) { - this.typeCheckTypeParameterDeclaration(typeParameterAST, context); - } - - return typeParameterSymbol; - }; - - PullTypeResolver.prototype.resolveFirstTypeParameterDeclaration = function (typeParameterSymbol, context) { - var typeParameterDecl = typeParameterSymbol.getDeclarations()[0]; - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameterDecl); - - if (typeParameterSymbol.isResolved || typeParameterSymbol.inResolution) { - return; - } - - typeParameterSymbol.startResolving(); - - if (typeParameterAST.constraint) { - var constraintTypeSymbol = this.resolveTypeReference(typeParameterAST.constraint.type, context); - - if (constraintTypeSymbol) { - typeParameterSymbol.setConstraint(constraintTypeSymbol); - } - } - - typeParameterSymbol.setResolved(); - }; - - PullTypeResolver.prototype.typeCheckTypeParameterDeclaration = function (typeParameterAST, context) { - this.setTypeChecked(typeParameterAST, context); - - var constraint = this.resolveAST(typeParameterAST.constraint, false, context); - - if (constraint) { - var typeParametersAST = typeParameterAST.parent; - var typeParameters = []; - for (var i = 0; i < typeParametersAST.nonSeparatorCount(); i++) { - var currentTypeParameterAST = typeParametersAST.nonSeparatorAt(i); - var currentTypeParameterDecl = this.semanticInfoChain.getDeclForAST(currentTypeParameterAST); - var currentTypeParameter = this.semanticInfoChain.getSymbolForDecl(currentTypeParameterDecl); - typeParameters[currentTypeParameter.pullSymbolID] = currentTypeParameter; - } - - if (constraint.wrapsSomeTypeParameter(typeParameters)) { - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); - } - } - }; - - PullTypeResolver.prototype.resolveConstraint = function (constraint, context) { - if (this.canTypeCheckAST(constraint, context)) { - this.setTypeChecked(constraint, context); - } - - return this.resolveTypeReference(constraint.type, context); - }; - - PullTypeResolver.prototype.resolveFunctionBodyReturnTypes = function (funcDeclAST, block, bodyExpression, signature, useContextualType, enclosingDecl, context) { - var _this = this; - var returnStatementsExpressions = []; - - var enclosingDeclStack = [enclosingDecl]; - - var preFindReturnExpressionTypes = function (ast, walker) { - var go = true; - - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 215 /* ObjectLiteralExpression */: - go = false; - break; - - case 150 /* ReturnStatement */: - var returnStatement = ast; - enclosingDecl.setFlag(4194304 /* HasReturnStatement */); - returnStatementsExpressions.push({ expression: returnStatement.expression, enclosingDecl: enclosingDeclStack[enclosingDeclStack.length - 1] }); - go = false; - break; - - case 236 /* CatchClause */: - case 163 /* WithStatement */: - enclosingDeclStack[enclosingDeclStack.length] = _this.semanticInfoChain.getDeclForAST(ast); - break; - - default: - break; - } - - walker.options.goChildren = go; - - return ast; - }; - - var postFindReturnExpressionEnclosingDecls = function (ast, walker) { - switch (ast.kind()) { - case 236 /* CatchClause */: - case 163 /* WithStatement */: - enclosingDeclStack.length--; - break; - default: - break; - } - - walker.options.goChildren = true; - - return ast; - }; - - if (block) { - TypeScript.getAstWalkerFactory().walk(block, preFindReturnExpressionTypes, postFindReturnExpressionEnclosingDecls); - } else { - returnStatementsExpressions.push({ expression: bodyExpression, enclosingDecl: enclosingDecl }); - enclosingDecl.setFlag(4194304 /* HasReturnStatement */); - } - - if (!returnStatementsExpressions.length) { - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - } else { - var returnExpressionSymbols = []; - var returnExpressions = []; - - for (var i = 0; i < returnStatementsExpressions.length; i++) { - var returnExpression = returnStatementsExpressions[i].expression; - if (returnExpression) { - var returnType = this.resolveAST(returnExpression, useContextualType, context).type; - - if (returnType.isError()) { - signature.returnType = returnType; - return; - } else { - if (returnExpression.parent.kind() === 150 /* ReturnStatement */) { - this.setSymbolForAST(returnExpression.parent, returnType, context); - } - } - - returnExpressionSymbols.push(returnType); - returnExpressions.push(returnExpression); - } - } - - if (!returnExpressionSymbols.length) { - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - } else { - var collection = { - getLength: function () { - return returnExpressionSymbols.length; - }, - getTypeAtIndex: function (index) { - return returnExpressionSymbols[index].type; - } - }; - - var bestCommonReturnType = this.findBestCommonType(collection, context, new TypeComparisonInfo()); - var returnType = bestCommonReturnType; - var returnExpression = returnExpressions[returnExpressionSymbols.indexOf(returnType)]; - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var functionSymbol = functionDecl.getSymbol(); - - if (returnType) { - var previousReturnType = returnType; - var newReturnType = returnType.widenedType(this, returnExpression, context); - signature.returnType = newReturnType; - - if (!TypeScript.ArrayUtilities.contains(returnExpressionSymbols, bestCommonReturnType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Could_not_find_the_best_common_type_of_types_of_all_return_statement_expressions)); - } - - if (this.compilationSettings.noImplicitAny()) { - if (previousReturnType !== newReturnType && newReturnType === this.semanticInfoChain.anyTypeSymbol) { - var functionName = enclosingDecl.name; - if (functionName === "") { - functionName = enclosingDecl.getFunctionExpressionName(); - } - - if (functionName != "") { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type, [functionName])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - } - } - - if (!functionSymbol.type && functionSymbol.isAccessor()) { - functionSymbol.type = signature.returnType; - } - } - } - }; - - PullTypeResolver.prototype.typeCheckConstructorDeclaration = function (funcDeclAST, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - for (var i = 0; i < funcDeclAST.callSignature.parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveAST(funcDeclAST.callSignature.parameterList.parameters.nonSeparatorAt(i), false, context); - } - - this.resolveAST(funcDeclAST.block, false, context); - - if (funcDecl.getSignatureSymbol() && funcDecl.getSignatureSymbol().isDefinition() && this.enclosingClassIsDerived(funcDecl.getParentDecl())) { - if (!this.constructorHasSuperCall(funcDeclAST)) { - context.postDiagnostic(new TypeScript.Diagnostic(funcDeclAST.fileName(), this.semanticInfoChain.lineMap(funcDeclAST.fileName()), funcDeclAST.start(), "constructor".length, TypeScript.DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call)); - } else if (this.superCallMustBeFirstStatementInConstructor(funcDecl)) { - var firstStatement = this.getFirstStatementOfBlockOrNull(funcDeclAST.block); - if (!firstStatement || !this.isSuperInvocationExpressionStatement(firstStatement)) { - context.postDiagnostic(new TypeScript.Diagnostic(funcDeclAST.fileName(), this.semanticInfoChain.lineMap(funcDeclAST.fileName()), funcDeclAST.start(), "constructor".length, TypeScript.DiagnosticCode.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties)); - } - } - } - - this.validateVariableDeclarationGroups(funcDecl, context); - - this.checkFunctionTypePrivacy(funcDeclAST, false, null, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.callSignature.parameterList), null, funcDeclAST.block, context); - - this.typeCheckCallBacks.push(function (context) { - _this.typeCheckFunctionOverloads(funcDeclAST, context); - }); - }; - - PullTypeResolver.prototype.constructorHasSuperCall = function (constructorDecl) { - var _this = this; - if (constructorDecl.block) { - var foundSuperCall = false; - var pre = function (ast, walker) { - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 215 /* ObjectLiteralExpression */: - walker.options.goChildren = false; - default: - if (_this.isSuperInvocationExpression(ast)) { - foundSuperCall = true; - walker.options.stopWalking = true; - } - } - }; - - TypeScript.getAstWalkerFactory().walk(constructorDecl.block, pre); - return foundSuperCall; - } - - return false; - }; - - PullTypeResolver.prototype.typeCheckFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - this.typeCheckAnyFunctionExpression(funcDecl, funcDecl.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), funcDecl.callSignature.typeAnnotation, funcDecl.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckCallSignature = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, false, null, funcDecl.typeParameterList, funcDecl.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckConstructSignature = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, false, null, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckMethodSignature = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, false, funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.typeCheckMemberFunctionDeclaration = function (funcDecl, context) { - this.typeCheckAnyFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - }; - - PullTypeResolver.prototype.containsSingleThrowStatement = function (block) { - return block !== null && block.statements.childCount() === 1 && block.statements.childAt(0).kind() === 157 /* ThrowStatement */; - }; - - PullTypeResolver.prototype.typeCheckAnyFunctionDeclaration = function (funcDeclAST, isStatic, name, typeParameters, parameters, returnTypeAnnotation, block, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - this.resolveAST(parameters, false, context); - - this.resolveAST(block, false, context); - var enclosingDecl = this.getEnclosingDecl(funcDecl); - - this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, returnTypeAnnotation, context); - this.validateVariableDeclarationGroups(funcDecl, context); - - this.checkFunctionTypePrivacy(funcDeclAST, isStatic, typeParameters, TypeScript.ASTHelpers.parametersFromParameterList(parameters), returnTypeAnnotation, block, context); - - this.checkThatNonVoidFunctionHasReturnExpressionOrThrowStatement(funcDecl, returnTypeAnnotation, funcDecl.getSignatureSymbol().returnType, block, context); - - if (funcDecl.kind === 16384 /* Function */) { - this.checkNameForCompilerGeneratedDeclarationCollision(funcDeclAST, true, name, context); - } - - this.typeCheckCallBacks.push(function (context) { - _this.typeCheckFunctionOverloads(funcDeclAST, context); - }); - }; - - PullTypeResolver.prototype.checkThatNonVoidFunctionHasReturnExpressionOrThrowStatement = function (functionDecl, returnTypeAnnotation, returnTypeSymbol, block, context) { - var hasReturn = TypeScript.hasFlag(functionDecl.flags, 4194304 /* HasReturnStatement */); - - if (block !== null && returnTypeAnnotation !== null && !hasReturn) { - var isVoidOrAny = this.isAnyOrEquivalent(returnTypeSymbol) || returnTypeSymbol === this.semanticInfoChain.voidTypeSymbol; - - if (!isVoidOrAny && !this.containsSingleThrowStatement(block)) { - var funcName = functionDecl.getDisplayName() || TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, TypeScript.DiagnosticCode.Function_declared_a_non_void_return_type_but_has_no_return_expression)); - } - } - }; - - PullTypeResolver.prototype.typeCheckIndexSignature = function (funcDeclAST, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - this.resolveAST(funcDeclAST.parameter, false, context); - - var enclosingDecl = this.getEnclosingDecl(funcDecl); - - this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, TypeScript.ASTHelpers.getType(funcDeclAST), context); - this.validateVariableDeclarationGroups(funcDecl, context); - - this.checkFunctionTypePrivacy(funcDeclAST, false, null, TypeScript.ASTHelpers.parametersFromParameter(funcDeclAST.parameter), TypeScript.ASTHelpers.getType(funcDeclAST), null, context); - - var signature = funcDecl.getSignatureSymbol(); - - this.typeCheckCallBacks.push(function (context) { - var parentSymbol = funcDecl.getSignatureSymbol().getContainer(); - var allIndexSignatures = _this.getBothKindsOfIndexSignaturesExcludingAugmentedType(parentSymbol, context); - var stringIndexSignature = allIndexSignatures.stringSignature; - var numberIndexSignature = allIndexSignatures.numericSignature; - var isNumericIndexer = numberIndexSignature === signature; - - if (numberIndexSignature && stringIndexSignature && (isNumericIndexer || stringIndexSignature.getDeclarations()[0].getParentDecl() !== numberIndexSignature.getDeclarations()[0].getParentDecl())) { - var comparisonInfo = new TypeComparisonInfo(); - - if (!_this.sourceIsAssignableToTarget(numberIndexSignature.returnType, stringIndexSignature.returnType, funcDeclAST, context, comparisonInfo)) { - var enclosingSymbol = _this.getEnclosingSymbolForAST(funcDeclAST); - if (comparisonInfo.message) { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1_NL_2, [numberIndexSignature.returnType.toString(enclosingSymbol), stringIndexSignature.returnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1, [numberIndexSignature.returnType.toString(enclosingSymbol), stringIndexSignature.returnType.toString(enclosingSymbol)])); - } - } - } - - var allMembers = parentSymbol.type.getAllMembers(536869887 /* All */, 0 /* all */); - for (var i = 0; i < allMembers.length; i++) { - var member = allMembers[i]; - var name = member.name; - if (name || (member.kind === 4096 /* Property */ && name === "")) { - if (!allMembers[i].isResolved) { - _this.resolveDeclaredSymbol(allMembers[i], context); - } - - if (parentSymbol !== allMembers[i].getContainer()) { - var isMemberNumeric = TypeScript.PullHelpers.isNameNumeric(name); - var indexerKindMatchesMemberNameKind = isNumericIndexer === isMemberNumeric; - var onlyStringIndexerIsPresent = !numberIndexSignature; - - if (indexerKindMatchesMemberNameKind || onlyStringIndexerIsPresent) { - var comparisonInfo = new TypeComparisonInfo(); - if (!_this.sourceIsAssignableToTarget(allMembers[i].type, signature.returnType, funcDeclAST, context, comparisonInfo, false)) { - _this.reportErrorThatMemberIsNotSubtypeOfIndexer(allMembers[i], signature, funcDeclAST, context, comparisonInfo); - } - } - } - } - } - }); - }; - - PullTypeResolver.prototype.postTypeCheckFunctionDeclaration = function (funcDeclAST, context) { - this.checkThisCaptureVariableCollides(funcDeclAST, true, context); - }; - - PullTypeResolver.prototype.resolveReturnTypeAnnotationOfFunctionDeclaration = function (funcDeclAST, returnTypeAnnotation, context) { - var returnTypeSymbol = null; - - if (returnTypeAnnotation) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - returnTypeSymbol = this.resolveTypeReference(returnTypeAnnotation, context); - - if (!returnTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, TypeScript.DiagnosticCode.Cannot_resolve_return_type_reference)); - } else { - var isConstructor = funcDeclAST.kind() === 137 /* ConstructorDeclaration */ || funcDeclAST.kind() === 143 /* ConstructSignature */; - if (isConstructor && returnTypeSymbol === this.semanticInfoChain.voidTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Constructors_cannot_have_a_return_type_of_void)); - } - } - } - - return returnTypeSymbol; - }; - - PullTypeResolver.prototype.resolveMemberFunctionDeclaration = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - }; - - PullTypeResolver.prototype.resolveCallSignature = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, false, null, funcDecl.typeParameterList, funcDecl.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.resolveConstructSignature = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, false, null, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.resolveMethodSignature = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, false, funcDecl.propertyName, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), null, context); - }; - - PullTypeResolver.prototype.resolveAnyFunctionDeclaration = function (funcDecl, context) { - return this.resolveFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.identifier, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - }; - - PullTypeResolver.prototype.resolveFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcDecl, funcDecl.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveSimpleArrowFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcDecl, null, TypeScript.ASTHelpers.parametersFromIdentifier(funcDecl.identifier), null, funcDecl.block, funcDecl.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveParenthesizedArrowFunctionExpression = function (funcDecl, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcDecl, funcDecl.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, funcDecl.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.getEnclosingClassDeclaration = function (ast) { - while (ast) { - if (ast.kind() === 131 /* ClassDeclaration */) { - return ast; - } - - ast = ast.parent; - } - - return null; - }; - - PullTypeResolver.prototype.resolveConstructorDeclaration = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcSymbol = funcDecl.getSymbol(); - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckConstructorDeclaration(funcDeclAST, context); - } - return funcSymbol; - } - - if (!signature.inResolution) { - var classAST = this.getEnclosingClassDeclaration(funcDeclAST); - - if (classAST) { - var classDecl = this.semanticInfoChain.getDeclForAST(classAST); - var classSymbol = classDecl.getSymbol(); - - if (!classSymbol.isResolved && !classSymbol.inResolution) { - this.resolveDeclaredSymbol(classSymbol, context); - } - } - } - - var functionTypeSymbol = funcSymbol && funcSymbol.type; - - if (signature.inResolution) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - return funcSymbol; - } - - if (funcSymbol) { - funcSymbol.startResolving(); - } - signature.startResolving(); - - var prevInTypeCheck = context.inTypeCheck; - - context.inTypeCheck = false; - - for (var i = 0; i < funcDeclAST.callSignature.parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(funcDeclAST.callSignature.parameterList.parameters.nonSeparatorAt(i), context); - } - - context.inTypeCheck = prevInTypeCheck; - - if (signature.isGeneric()) { - if (funcSymbol) { - funcSymbol.type.setHasGenericSignature(); - } - } - - if (!hadError) { - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - } - } - - if (funcSymbol) { - this.resolveOtherDeclarations(funcDeclAST, context); - } - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckConstructorDeclaration(funcDeclAST, context); - } - - return funcSymbol; - }; - - PullTypeResolver.prototype.resolveIndexMemberDeclaration = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - } - - return this.resolveIndexSignature(ast.indexSignature, context); - }; - - PullTypeResolver.prototype.resolveIndexSignature = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcSymbol = funcDecl.getSymbol(); - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckIndexSignature(funcDeclAST, context); - } - return funcSymbol; - } - - var functionTypeSymbol = funcSymbol && funcSymbol.type; - - if (signature.inResolution) { - if (funcDeclAST.typeAnnotation) { - var returnTypeSymbol = this.resolveTypeReference(TypeScript.ASTHelpers.getType(funcDeclAST), context); - if (!returnTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(TypeScript.ASTHelpers.getType(funcDeclAST), TypeScript.DiagnosticCode.Cannot_resolve_return_type_reference)); - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - } - - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - return funcSymbol; - } - - if (funcSymbol) { - funcSymbol.startResolving(); - } - signature.startResolving(); - - if (funcDeclAST.parameter) { - var prevInTypeCheck = context.inTypeCheck; - - context.inTypeCheck = false; - this.resolveParameter(funcDeclAST.parameter, context); - context.inTypeCheck = prevInTypeCheck; - } - - if (funcDeclAST.typeAnnotation) { - returnTypeSymbol = this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, TypeScript.ASTHelpers.getType(funcDeclAST), context); - - if (!returnTypeSymbol) { - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - } - - if (!hadError) { - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - } - } - - if (funcSymbol) { - this.resolveOtherDeclarations(funcDeclAST, context); - } - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckIndexSignature(funcDeclAST, context); - } - - return funcSymbol; - }; - - PullTypeResolver.prototype.resolveFunctionDeclaration = function (funcDeclAST, isStatic, name, typeParameters, parameterList, returnTypeAnnotation, block, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcSymbol = funcDecl.getSymbol(); - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - var isConstructor = funcDeclAST.kind() === 143 /* ConstructSignature */; - - if (signature) { - if (signature.isResolved) { - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckAnyFunctionDeclaration(funcDeclAST, isStatic, name, typeParameters, parameterList, returnTypeAnnotation, block, context); - } - return funcSymbol; - } - - if (isConstructor && !signature.inResolution) { - var classAST = this.getEnclosingClassDeclaration(funcDeclAST); - - if (classAST) { - var classDecl = this.semanticInfoChain.getDeclForAST(classAST); - var classSymbol = classDecl.getSymbol(); - - if (!classSymbol.isResolved && !classSymbol.inResolution) { - this.resolveDeclaredSymbol(classSymbol, context); - } - } - } - - var functionTypeSymbol = funcSymbol && funcSymbol.type; - - if (signature.inResolution) { - if (returnTypeAnnotation) { - var returnTypeSymbol = this.resolveTypeReference(returnTypeAnnotation, context); - if (!returnTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, TypeScript.DiagnosticCode.Cannot_resolve_return_type_reference)); - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - - if (isConstructor && returnTypeSymbol === this.semanticInfoChain.voidTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Constructors_cannot_have_a_return_type_of_void)); - } - } - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - } - - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - return funcSymbol; - } - - if (funcSymbol) { - funcSymbol.startResolving(); - } - signature.startResolving(); - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - if (parameterList) { - var prevInTypeCheck = context.inTypeCheck; - - context.inTypeCheck = false; - - for (var i = 0; i < parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(parameterList.parameters.nonSeparatorAt(i), context); - } - - context.inTypeCheck = prevInTypeCheck; - } - - if (returnTypeAnnotation) { - returnTypeSymbol = this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, returnTypeAnnotation, context); - - if (!returnTypeSymbol) { - signature.returnType = this.getNewErrorTypeSymbol(); - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else if (funcDecl.kind !== 2097152 /* ConstructSignature */) { - if (TypeScript.hasFlag(funcDecl.flags, 2048 /* Signature */)) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - var parentDeclFlags = 0 /* None */; - if (TypeScript.hasFlag(funcDecl.kind, 65536 /* Method */) || TypeScript.hasFlag(funcDecl.kind, 32768 /* ConstructorMethod */)) { - var parentDecl = funcDecl.getParentDecl(); - parentDeclFlags = parentDecl.flags; - } - - if (this.compilationSettings.noImplicitAny() && (!TypeScript.hasFlag(parentDeclFlags, 8 /* Ambient */) || (TypeScript.hasFlag(parentDeclFlags, 8 /* Ambient */) && !TypeScript.hasFlag(funcDecl.flags, 2 /* Private */)))) { - var funcDeclASTName = name; - if (funcDeclASTName) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type, [funcDeclASTName.text()])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Lambda_Function_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - } else { - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, null, signature, false, funcDecl, context); - } - } else if (funcDecl.kind === 2097152 /* ConstructSignature */) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - - if (this.compilationSettings.noImplicitAny()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Constructor_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - - if (!hadError) { - if (funcSymbol) { - funcSymbol.setUnresolved(); - if (funcSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - funcSymbol.type = functionTypeSymbol; - } - } - signature.setResolved(); - } - } - - if (funcSymbol) { - this.resolveOtherDeclarations(funcDeclAST, context); - } - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckAnyFunctionDeclaration(funcDeclAST, isStatic, name, typeParameters, parameterList, returnTypeAnnotation, block, context); - } - - return funcSymbol; - }; - - PullTypeResolver.prototype.resolveGetterReturnTypeAnnotation = function (getterFunctionDeclarationAst, enclosingDecl, context) { - if (getterFunctionDeclarationAst && getterFunctionDeclarationAst.typeAnnotation) { - return this.resolveTypeReference(TypeScript.ASTHelpers.getType(getterFunctionDeclarationAst), context); - } - - return null; - }; - - PullTypeResolver.prototype.resolveSetterArgumentTypeAnnotation = function (setterFunctionDeclarationAst, enclosingDecl, context) { - if (setterFunctionDeclarationAst && setterFunctionDeclarationAst.parameterList && setterFunctionDeclarationAst.parameterList.parameters.nonSeparatorCount() > 0) { - var parameter = setterFunctionDeclarationAst.parameterList.parameters.nonSeparatorAt(0); - return this.resolveTypeReference(TypeScript.ASTHelpers.getType(parameter), context); - } - - return null; - }; - - PullTypeResolver.prototype.resolveAccessorDeclaration = function (funcDeclAst, context) { - var functionDeclaration = this.semanticInfoChain.getDeclForAST(funcDeclAst); - var accessorSymbol = functionDeclaration.getSymbol(); - - if (accessorSymbol.inResolution) { - accessorSymbol.type = this.semanticInfoChain.anyTypeSymbol; - accessorSymbol.setResolved(); - - return accessorSymbol; - } - - if (accessorSymbol.isResolved) { - if (!accessorSymbol.type) { - accessorSymbol.type = this.semanticInfoChain.anyTypeSymbol; - } - } else { - var getterSymbol = accessorSymbol.getGetter(); - var getterFunctionDeclarationAst = getterSymbol ? getterSymbol.getDeclarations()[0].ast() : null; - var hasGetter = getterSymbol !== null; - - var setterSymbol = accessorSymbol.getSetter(); - var setterFunctionDeclarationAst = setterSymbol ? setterSymbol.getDeclarations()[0].ast() : null; - var hasSetter = setterSymbol !== null; - - var getterAnnotatedType = this.resolveGetterReturnTypeAnnotation(getterFunctionDeclarationAst, functionDeclaration, context); - var getterHasTypeAnnotation = getterAnnotatedType !== null; - - var setterAnnotatedType = this.resolveSetterArgumentTypeAnnotation(setterFunctionDeclarationAst, functionDeclaration, context); - var setterHasTypeAnnotation = setterAnnotatedType !== null; - - accessorSymbol.startResolving(); - - if (hasGetter) { - getterSymbol = this.resolveGetAccessorDeclaration(getterFunctionDeclarationAst, getterFunctionDeclarationAst.parameterList, TypeScript.ASTHelpers.getType(getterFunctionDeclarationAst), getterFunctionDeclarationAst.block, setterAnnotatedType, context); - } - - if (hasSetter) { - setterSymbol = this.resolveSetAccessorDeclaration(setterFunctionDeclarationAst, setterFunctionDeclarationAst.parameterList, context); - } - - if (hasGetter && hasSetter) { - var setterSig = setterSymbol.type.getCallSignatures()[0]; - var setterParameters = setterSig.parameters; - var setterHasParameters = setterParameters.length > 0; - var getterSig = getterSymbol.type.getCallSignatures()[0]; - - var setterSuppliedTypeSymbol = setterHasParameters ? setterParameters[0].type : null; - var getterSuppliedTypeSymbol = getterSig.returnType; - - if (setterHasTypeAnnotation && !getterHasTypeAnnotation) { - getterSuppliedTypeSymbol = setterSuppliedTypeSymbol; - getterSig.returnType = setterSuppliedTypeSymbol; - } else if ((getterHasTypeAnnotation && !setterHasTypeAnnotation) || (!getterHasTypeAnnotation && !setterHasTypeAnnotation)) { - setterSuppliedTypeSymbol = getterSuppliedTypeSymbol; - - if (setterHasParameters) { - setterParameters[0].type = getterSuppliedTypeSymbol; - } - } - - if (!this.typesAreIdentical(setterSuppliedTypeSymbol, getterSuppliedTypeSymbol, context)) { - accessorSymbol.type = this.getNewErrorTypeSymbol(); - } else { - accessorSymbol.type = getterSuppliedTypeSymbol; - } - } else if (hasSetter) { - var setterSig = setterSymbol.type.getCallSignatures()[0]; - var setterParameters = setterSig.parameters; - var setterHasParameters = setterParameters.length > 0; - - accessorSymbol.type = setterHasParameters ? setterParameters[0].type : this.semanticInfoChain.anyTypeSymbol; - } else { - var getterSig = getterSymbol.type.getCallSignatures()[0]; - accessorSymbol.type = getterSig.returnType; - } - - accessorSymbol.setResolved(); - } - - if (this.canTypeCheckAST(funcDeclAst, context)) { - this.typeCheckAccessorDeclaration(funcDeclAst, context); - } - - return accessorSymbol; - }; - - PullTypeResolver.prototype.typeCheckAccessorDeclaration = function (funcDeclAst, context) { - this.setTypeChecked(funcDeclAst, context); - var functionDeclaration = this.semanticInfoChain.getDeclForAST(funcDeclAst); - var accessorSymbol = functionDeclaration.getSymbol(); - var getterSymbol = accessorSymbol.getGetter(); - var setterSymbol = accessorSymbol.getSetter(); - - var isGetter = funcDeclAst.kind() === 139 /* GetAccessor */; - if (isGetter) { - var getterFunctionDeclarationAst = funcDeclAst; - context.pushNewContextualType(getterSymbol.type); - this.typeCheckGetAccessorDeclaration(getterFunctionDeclarationAst, context); - context.popAnyContextualType(); - } else { - var setterFunctionDeclarationAst = funcDeclAst; - this.typeCheckSetAccessorDeclaration(setterFunctionDeclarationAst, context); - } - }; - - PullTypeResolver.prototype.resolveGetAccessorDeclaration = function (funcDeclAST, parameters, returnTypeAnnotation, block, setterAnnotatedType, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - var getterSymbol = accessorSymbol.getGetter(); - var getterTypeSymbol = getterSymbol.type; - - var signature = getterTypeSymbol.getCallSignatures()[0]; - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - return getterSymbol; - } - - if (signature.inResolution) { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - signature.setResolved(); - - return getterSymbol; - } - - signature.startResolving(); - - if (returnTypeAnnotation) { - var returnTypeSymbol = this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, returnTypeAnnotation, context); - - if (!returnTypeSymbol) { - signature.returnType = this.getNewErrorTypeSymbol(); - - hadError = true; - } else { - signature.returnType = returnTypeSymbol; - } - } else { - if (!setterAnnotatedType) { - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, null, signature, false, funcDecl, context); - } else { - signature.returnType = setterAnnotatedType; - } - } - - if (!hadError) { - signature.setResolved(); - } - } - - return getterSymbol; - }; - - PullTypeResolver.prototype.checkIfGetterAndSetterTypeMatch = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - var getter = accessorSymbol.getGetter(); - var setter = accessorSymbol.getSetter(); - - if (getter && setter) { - var getterAST = getter.getDeclarations()[0].ast(); - var setterAST = setter.getDeclarations()[0].ast(); - - if (getterAST.typeAnnotation && PullTypeResolver.hasSetAccessorParameterTypeAnnotation(setterAST)) { - var setterSig = setter.type.getCallSignatures()[0]; - var setterParameters = setterSig.parameters; - - var getter = accessorSymbol.getGetter(); - var getterSig = getter.type.getCallSignatures()[0]; - - var setterSuppliedTypeSymbol = setterParameters[0].type; - var getterSuppliedTypeSymbol = getterSig.returnType; - - if (!this.typesAreIdentical(setterSuppliedTypeSymbol, getterSuppliedTypeSymbol, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.get_and_set_accessor_must_have_the_same_type)); - } - } - } - }; - - PullTypeResolver.prototype.typeCheckGetAccessorDeclaration = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - this.resolveReturnTypeAnnotationOfFunctionDeclaration(funcDeclAST, TypeScript.ASTHelpers.getType(funcDeclAST), context); - - this.resolveAST(funcDeclAST.block, false, context); - - this.validateVariableDeclarationGroups(funcDecl, context); - - var enclosingDecl = this.getEnclosingDecl(funcDecl); - - var hasReturn = (funcDecl.flags & (2048 /* Signature */ | 4194304 /* HasReturnStatement */)) !== 0; - var funcNameAST = funcDeclAST.propertyName; - - if (!hasReturn && !this.containsSingleThrowStatement(funcDeclAST.block)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcNameAST, TypeScript.DiagnosticCode.Getters_must_return_a_value)); - } - - var setter = accessorSymbol.getSetter(); - if (setter) { - var setterDecl = setter.getDeclarations()[0]; - var setterIsPrivate = TypeScript.hasFlag(setterDecl.flags, 2 /* Private */); - var getterIsPrivate = TypeScript.hasModifier(funcDeclAST.modifiers, 2 /* Private */); - - if (getterIsPrivate !== setterIsPrivate) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcNameAST, TypeScript.DiagnosticCode.Getter_and_setter_accessors_do_not_agree_in_visibility)); - } - - this.checkIfGetterAndSetterTypeMatch(funcDeclAST, context); - } - - this.checkFunctionTypePrivacy(funcDeclAST, TypeScript.hasModifier(funcDeclAST.modifiers, 16 /* Static */), null, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), TypeScript.ASTHelpers.getType(funcDeclAST), funcDeclAST.block, context); - }; - - PullTypeResolver.hasSetAccessorParameterTypeAnnotation = function (setAccessor) { - return setAccessor.parameterList && setAccessor.parameterList.parameters.nonSeparatorCount() > 0 && setAccessor.parameterList.parameters.nonSeparatorAt(0).typeAnnotation !== null; - }; - - PullTypeResolver.prototype.resolveSetAccessorDeclaration = function (funcDeclAST, parameterList, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - var setterSymbol = accessorSymbol.getSetter(); - var setterTypeSymbol = setterSymbol.type; - - var signature = funcDecl.getSignatureSymbol(); - - var hadError = false; - - if (signature) { - if (signature.isResolved) { - return setterSymbol; - } - - if (signature.inResolution) { - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - signature.setResolved(); - return setterSymbol; - } - - signature.startResolving(); - - if (parameterList) { - for (var i = 0; i < parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(parameterList.parameters.nonSeparatorAt(i), context); - } - } - - signature.returnType = this.semanticInfoChain.voidTypeSymbol; - - if (!hadError) { - signature.setResolved(); - } - } - - return setterSymbol; - }; - - PullTypeResolver.prototype.typeCheckSetAccessorDeclaration = function (funcDeclAST, context) { - var funcDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var accessorSymbol = funcDecl.getSymbol(); - - if (funcDeclAST.parameterList) { - for (var i = 0; i < funcDeclAST.parameterList.parameters.nonSeparatorCount(); i++) { - this.resolveParameter(funcDeclAST.parameterList.parameters.nonSeparatorAt(i), context); - } - } - - this.resolveAST(funcDeclAST.block, false, context); - - this.validateVariableDeclarationGroups(funcDecl, context); - - var hasReturn = (funcDecl.flags & (2048 /* Signature */ | 4194304 /* HasReturnStatement */)) !== 0; - - var getter = accessorSymbol.getGetter(); - - var funcNameAST = funcDeclAST.propertyName; - - if (getter) { - var getterDecl = getter.getDeclarations()[0]; - var getterIsPrivate = TypeScript.hasFlag(getterDecl.flags, 2 /* Private */); - var setterIsPrivate = TypeScript.hasModifier(funcDeclAST.modifiers, 2 /* Private */); - - if (getterIsPrivate !== setterIsPrivate) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcNameAST, TypeScript.DiagnosticCode.Getter_and_setter_accessors_do_not_agree_in_visibility)); - } - - this.checkIfGetterAndSetterTypeMatch(funcDeclAST, context); - } else { - if (this.compilationSettings.noImplicitAny()) { - var setterFunctionDeclarationAst = funcDeclAST; - if (!PullTypeResolver.hasSetAccessorParameterTypeAnnotation(setterFunctionDeclarationAst) && accessorSymbol.type === this.semanticInfoChain.anyTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_get_accessor_and_parameter_type_annotation_on_set_accessor_implicitly_has_an_any_type, [setterFunctionDeclarationAst.propertyName.text()])); - } - } - } - - this.checkFunctionTypePrivacy(funcDeclAST, TypeScript.hasModifier(funcDeclAST.modifiers, 16 /* Static */), null, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), null, funcDeclAST.block, context); - }; - - PullTypeResolver.prototype.resolveList = function (list, context) { - if (this.canTypeCheckAST(list, context)) { - this.setTypeChecked(list, context); - - for (var i = 0, n = list.childCount(); i < n; i++) { - this.resolveAST(list.childAt(i), false, context); - } - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveSeparatedList = function (list, context) { - if (this.canTypeCheckAST(list, context)) { - this.setTypeChecked(list, context); - - for (var i = 0, n = list.nonSeparatorCount(); i < n; i++) { - this.resolveAST(list.nonSeparatorAt(i), false, context); - } - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveVoidExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.undefinedTypeSymbol; - }; - - PullTypeResolver.prototype.resolveLogicalOperation = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckLogicalOperation(ast, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckLogicalOperation = function (binex, context) { - this.setTypeChecked(binex, context); - - var leftType = this.resolveAST(binex.left, false, context).type; - var rightType = this.resolveAST(binex.right, false, context).type; - - var comparisonInfo = new TypeComparisonInfo(); - if (!this.sourceIsAssignableToTarget(leftType, rightType, binex, context, comparisonInfo) && !this.sourceIsAssignableToTarget(rightType, leftType, binex, context, comparisonInfo)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(binex); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binex, TypeScript.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2, [ - TypeScript.SyntaxFacts.getText(TypeScript.SyntaxFacts.getOperatorTokenFromBinaryExpression(binex.kind())), - leftType.toString(enclosingSymbol), rightType.toString(enclosingSymbol)])); - } - }; - - PullTypeResolver.prototype.resolveLogicalNotExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.operand, false, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.resolveUnaryArithmeticOperation = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckUnaryArithmeticOperation(ast, context); - } - - return this.semanticInfoChain.numberTypeSymbol; - }; - - PullTypeResolver.prototype.resolvePostfixUnaryExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckPostfixUnaryExpression(ast, context); - } - - return this.semanticInfoChain.numberTypeSymbol; - }; - - PullTypeResolver.prototype.isAnyOrNumberOrEnum = function (type) { - return this.isAnyOrEquivalent(type) || type === this.semanticInfoChain.numberTypeSymbol || TypeScript.PullHelpers.symbolIsEnum(type); - }; - - PullTypeResolver.prototype.typeCheckUnaryArithmeticOperation = function (unaryExpression, context) { - this.setTypeChecked(unaryExpression, context); - - var nodeType = unaryExpression.kind(); - var expression = this.resolveAST(unaryExpression.operand, false, context); - - if (nodeType === 164 /* PlusExpression */ || nodeType == 165 /* NegateExpression */ || nodeType == 166 /* BitwiseNotExpression */) { - return; - } - - TypeScript.Debug.assert(nodeType === 168 /* PreIncrementExpression */ || nodeType === 169 /* PreDecrementExpression */); - - var operandType = expression.type; - if (!this.isAnyOrNumberOrEnum(operandType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_type_of_a_unary_arithmetic_operation_operand_must_be_of_type_any_number_or_an_enum_type)); - } - - if (!this.isReference(unaryExpression.operand, expression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer)); - } - }; - - PullTypeResolver.prototype.typeCheckPostfixUnaryExpression = function (unaryExpression, context) { - this.setTypeChecked(unaryExpression, context); - - var nodeType = unaryExpression.kind(); - var expression = this.resolveAST(unaryExpression.operand, false, context); - - TypeScript.Debug.assert(nodeType === 210 /* PostIncrementExpression */ || nodeType === 211 /* PostDecrementExpression */); - - var operandType = expression.type; - if (!this.isAnyOrNumberOrEnum(operandType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_type_of_a_unary_arithmetic_operation_operand_must_be_of_type_any_number_or_an_enum_type)); - } - - if (!this.isReference(unaryExpression.operand, expression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(unaryExpression.operand, TypeScript.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer)); - } - }; - - PullTypeResolver.prototype.resolveBinaryArithmeticExpression = function (binaryExpression, context) { - if (this.canTypeCheckAST(binaryExpression, context)) { - this.typeCheckBinaryArithmeticExpression(binaryExpression, context); - } - - return this.semanticInfoChain.numberTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckBinaryArithmeticExpression = function (binaryExpression, context) { - this.setTypeChecked(binaryExpression, context); - - var lhsSymbol = this.resolveAST(binaryExpression.left, false, context); - - var lhsType = lhsSymbol.type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - if (lhsType === this.semanticInfoChain.nullTypeSymbol || lhsType === this.semanticInfoChain.undefinedTypeSymbol) { - lhsType = rhsType; - } - - if (rhsType === this.semanticInfoChain.nullTypeSymbol || rhsType === this.semanticInfoChain.undefinedTypeSymbol) { - rhsType = lhsType; - } - - var lhsIsFit = this.isAnyOrNumberOrEnum(lhsType); - var rhsIsFit = this.isAnyOrNumberOrEnum(rhsType); - - if (!rhsIsFit) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.right, TypeScript.DiagnosticCode.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type)); - } - - if (!lhsIsFit) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type)); - } - - if (lhsIsFit && rhsIsFit) { - switch (binaryExpression.kind()) { - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - if (!this.isReference(binaryExpression.left, lhsSymbol)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_of_assignment_expression)); - } - - this.checkAssignability(binaryExpression.left, rhsType, lhsType, context); - } - } - }; - - PullTypeResolver.prototype.resolveTypeOfExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.stringTypeSymbol; - }; - - PullTypeResolver.prototype.resolveThrowStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveDeleteExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.resolveInstanceOfExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckInstanceOfExpression(ast, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckInstanceOfExpression = function (binaryExpression, context) { - this.setTypeChecked(binaryExpression, context); - - var lhsType = this.resolveAST(binaryExpression.left, false, context).type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - var enclosingSymbol = this.getEnclosingSymbolForAST(binaryExpression); - var isValidLHS = this.isAnyOrEquivalent(lhsType) || lhsType.isObject() || lhsType.isTypeParameter(); - var isValidRHS = this.isAnyOrEquivalent(rhsType) || this.typeIsAssignableToFunction(rhsType, binaryExpression, context); - - if (!isValidLHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter)); - } - - if (!isValidRHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.right, TypeScript.DiagnosticCode.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type)); - } - }; - - PullTypeResolver.prototype.resolveCommaExpression = function (commaExpression, context) { - if (this.canTypeCheckAST(commaExpression, context)) { - this.setTypeChecked(commaExpression, context); - - this.resolveAST(commaExpression.left, false, context); - } - - return this.resolveAST(commaExpression.right, false, context).type; - }; - - PullTypeResolver.prototype.resolveInExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckInExpression(ast, context); - } - - return this.semanticInfoChain.booleanTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckInExpression = function (binaryExpression, context) { - this.setTypeChecked(binaryExpression, context); - - var lhsType = this.resolveAST(binaryExpression.left, false, context).type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - var isValidLHS = this.isAnyOrEquivalent(lhsType.type) || lhsType.type === this.semanticInfoChain.stringTypeSymbol || lhsType.type === this.semanticInfoChain.numberTypeSymbol; - - var isValidRHS = this.isAnyOrEquivalent(rhsType) || rhsType.isObject() || rhsType.isTypeParameter(); - - if (!isValidLHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number)); - } - - if (!isValidRHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.right, TypeScript.DiagnosticCode.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter)); - } - }; - - PullTypeResolver.prototype.resolveForStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.variableDeclaration, false, context); - this.resolveAST(ast.initializer, false, context); - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.incrementor, false, context); - this.resolveAST(ast.statement, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveForInStatement = function (forInStatement, context) { - if (this.canTypeCheckAST(forInStatement, context)) { - this.typeCheckForInStatement(forInStatement, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckForInStatement = function (forInStatement, context) { - this.setTypeChecked(forInStatement, context); - - if (forInStatement.variableDeclaration) { - var declaration = forInStatement.variableDeclaration; - - if (declaration.declarators.nonSeparatorCount() === 1) { - var varDecl = declaration.declarators.nonSeparatorAt(0); - - if (varDecl.typeAnnotation) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(declaration, TypeScript.DiagnosticCode.Variable_declarations_of_a_for_statement_cannot_use_a_type_annotation)); - } - } - } else { - var varSym = this.resolveAST(forInStatement.left, false, context); - var isStringOrNumber = varSym.type === this.semanticInfoChain.stringTypeSymbol || this.isAnyOrEquivalent(varSym.type); - - if (!isStringOrNumber) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(forInStatement.left, TypeScript.DiagnosticCode.Variable_declarations_of_a_for_statement_must_be_of_types_string_or_any)); - } - } - - var rhsType = this.resolveAST(forInStatement.expression, false, context).type; - var isValidRHS = rhsType && (this.isAnyOrEquivalent(rhsType) || rhsType.isObject() || rhsType.isTypeParameter()); - - if (!isValidRHS) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(forInStatement.expression, TypeScript.DiagnosticCode.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter)); - } - - this.resolveAST(forInStatement.statement, false, context); - }; - - PullTypeResolver.prototype.resolveWhileStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckWhileStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckWhileStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.resolveDoStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckDoStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckDoStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.resolveIfStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckIfStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckIfStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.condition, false, context); - this.resolveAST(ast.statement, false, context); - this.resolveAST(ast.elseClause, false, context); - }; - - PullTypeResolver.prototype.resolveElseClause = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckElseClause(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckElseClause = function (ast, context) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.resolveBlock = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.statements, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveVariableStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.declaration, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveVariableDeclarationList = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.declarators, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveWithStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckWithStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckWithStatement = function (ast, context) { - this.setTypeChecked(ast, context); - var withStatement = ast; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(withStatement.condition, TypeScript.DiagnosticCode.All_symbols_within_a_with_block_will_be_resolved_to_any)); - }; - - PullTypeResolver.prototype.resolveTryStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckTryStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckTryStatement = function (ast, context) { - this.setTypeChecked(ast, context); - var tryStatement = ast; - - this.resolveAST(tryStatement.block, false, context); - this.resolveAST(tryStatement.catchClause, false, context); - this.resolveAST(tryStatement.finallyClause, false, context); - }; - - PullTypeResolver.prototype.resolveCatchClause = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckCatchClause(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckCatchClause = function (ast, context) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.block, false, context); - - var catchDecl = this.semanticInfoChain.getDeclForAST(ast); - this.validateVariableDeclarationGroups(catchDecl, context); - }; - - PullTypeResolver.prototype.resolveFinallyClause = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckFinallyClause(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckFinallyClause = function (ast, context) { - this.setTypeChecked(ast, context); - this.resolveAST(ast.block, false, context); - }; - - PullTypeResolver.prototype.getEnclosingFunctionDeclaration = function (ast) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - - while (enclosingDecl) { - if (enclosingDecl.kind & 1032192 /* SomeFunction */) { - return enclosingDecl; - } - - enclosingDecl = enclosingDecl.getParentDecl(); - } - - return null; - }; - - PullTypeResolver.prototype.resolveReturnExpression = function (expression, enclosingFunction, context) { - if (enclosingFunction) { - enclosingFunction.setFlag(4194304 /* HasReturnStatement */); - } - - var isContextuallyTyped = false; - - if (enclosingFunction) { - var enclosingDeclAST = this.getASTForDecl(enclosingFunction); - var typeAnnotation = TypeScript.ASTHelpers.getType(enclosingDeclAST); - if (typeAnnotation) { - var returnTypeAnnotationSymbol = this.resolveTypeReference(typeAnnotation, context); - if (returnTypeAnnotationSymbol) { - isContextuallyTyped = true; - context.pushNewContextualType(returnTypeAnnotationSymbol); - } - } else { - var currentContextualType = context.getContextualType(); - if (currentContextualType && currentContextualType.isFunction()) { - var contextualSignatures = currentContextualType.kind == 33554432 /* ConstructorType */ ? currentContextualType.getConstructSignatures() : currentContextualType.getCallSignatures(); - var currentContextualTypeSignatureSymbol = contextualSignatures[0]; - - var currentContextualTypeReturnTypeSymbol = currentContextualTypeSignatureSymbol.returnType; - if (currentContextualTypeReturnTypeSymbol) { - isContextuallyTyped = true; - context.propagateContextualType(currentContextualTypeReturnTypeSymbol); - } - } - } - } - - var result = this.resolveAST(expression, isContextuallyTyped, context).type; - if (isContextuallyTyped) { - context.popAnyContextualType(); - } - - return result; - }; - - PullTypeResolver.prototype.typeCheckReturnExpression = function (expression, expressionType, enclosingFunction, context) { - if (enclosingFunction && enclosingFunction.kind === 32768 /* ConstructorMethod */) { - var classDecl = enclosingFunction.getParentDecl(); - if (classDecl) { - var classSymbol = classDecl.getSymbol(); - this.resolveDeclaredSymbol(classSymbol, context); - - var comparisonInfo = new TypeComparisonInfo(); - var isAssignable = this.sourceIsAssignableToTarget(expressionType, classSymbol.type, expression, context, comparisonInfo); - if (!isAssignable) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class)); - } - } - } - - if (enclosingFunction && enclosingFunction.kind === 524288 /* SetAccessor */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Setters_cannot_return_a_value)); - } - - if (enclosingFunction) { - var enclosingDeclAST = this.getASTForDecl(enclosingFunction); - var typeAnnotation = TypeScript.ASTHelpers.getType(enclosingDeclAST); - if (typeAnnotation || enclosingFunction.kind === 262144 /* GetAccessor */) { - var signatureSymbol = enclosingFunction.getSignatureSymbol(); - var sigReturnType = signatureSymbol.returnType; - - if (expressionType && sigReturnType) { - var comparisonInfo = new TypeComparisonInfo(); - var upperBound = null; - - this.resolveDeclaredSymbol(expressionType, context); - this.resolveDeclaredSymbol(sigReturnType, context); - - var isAssignable = this.sourceIsAssignableToTarget(expressionType, sigReturnType, expression, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(expression); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [expressionType.toString(enclosingSymbol), sigReturnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [expressionType.toString(enclosingSymbol), sigReturnType.toString(enclosingSymbol)])); - } - } - } - } - } - }; - - PullTypeResolver.prototype.resolveReturnStatement = function (returnAST, context) { - var enclosingFunction = this.getEnclosingFunctionDeclaration(returnAST); - if (enclosingFunction) { - enclosingFunction.setFlag(4194304 /* HasReturnStatement */); - } - - var returnType = this.getSymbolForAST(returnAST, context); - var canTypeCheckAST = this.canTypeCheckAST(returnAST, context); - if (!returnType || canTypeCheckAST) { - var returnExpr = returnAST.expression; - - var resolvedReturnType = returnExpr === null ? this.semanticInfoChain.voidTypeSymbol : this.resolveReturnExpression(returnExpr, enclosingFunction, context); - - if (!returnType) { - returnType = resolvedReturnType; - this.setSymbolForAST(returnAST, resolvedReturnType, context); - } - - if (returnExpr && canTypeCheckAST) { - this.setTypeChecked(returnExpr, context); - this.typeCheckReturnExpression(returnExpr, resolvedReturnType, enclosingFunction, context); - } - } - - return returnType; - }; - - PullTypeResolver.prototype.resolveSwitchStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckSwitchStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckSwitchStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - var expressionType = this.resolveAST(ast.expression, false, context).type; - - for (var i = 0, n = ast.switchClauses.childCount(); i < n; i++) { - var switchClause = ast.switchClauses.childAt(i); - if (switchClause.kind() === 233 /* CaseSwitchClause */) { - var caseSwitchClause = switchClause; - - var caseClauseExpressionType = this.resolveAST(caseSwitchClause.expression, false, context).type; - this.resolveAST(caseSwitchClause.statements, false, context); - - var comparisonInfo = new TypeComparisonInfo(); - if (!this.sourceIsAssignableToTarget(expressionType, caseClauseExpressionType, caseSwitchClause.expression, context, comparisonInfo) && !this.sourceIsAssignableToTarget(caseClauseExpressionType, expressionType, caseSwitchClause.expression, context, comparisonInfo)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(caseSwitchClause.expression); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(caseSwitchClause.expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [caseClauseExpressionType.toString(enclosingSymbol), expressionType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(caseSwitchClause.expression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [caseClauseExpressionType.toString(enclosingSymbol), expressionType.toString(enclosingSymbol)])); - } - } - } else { - var defaultSwitchClause = switchClause; - this.resolveAST(defaultSwitchClause.statements, false, context); - } - } - }; - - PullTypeResolver.prototype.resolveLabeledStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckLabeledStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckLabeledStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - var labelIdentifier = ast.identifier.valueText(); - - var breakableLabels = this.getEnclosingLabels(ast, true, false); - - var matchingLabel = TypeScript.ArrayUtilities.firstOrDefault(breakableLabels, function (s) { - return s.identifier.valueText() === labelIdentifier; - }); - if (matchingLabel) { - context.postDiagnostic(this.semanticInfoChain.duplicateIdentifierDiagnosticFromAST(ast.identifier, labelIdentifier, matchingLabel)); - } - - this.resolveAST(ast.statement, false, context); - }; - - PullTypeResolver.prototype.labelIsOnContinuableConstruct = function (statement) { - switch (statement.kind()) { - case 160 /* LabeledStatement */: - return this.labelIsOnContinuableConstruct(statement.statement); - - case 158 /* WhileStatement */: - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 161 /* DoStatement */: - return true; - - default: - return false; - } - }; - - PullTypeResolver.prototype.resolveContinueStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckContinueStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.isIterationStatement = function (ast) { - switch (ast.kind()) { - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 158 /* WhileStatement */: - case 161 /* DoStatement */: - return true; - } - - return false; - }; - - PullTypeResolver.prototype.isAnyFunctionExpressionOrDeclaration = function (ast) { - switch (ast.kind()) { - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 129 /* FunctionDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 241 /* FunctionPropertyAssignment */: - case 137 /* ConstructorDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - return true; - } - - return false; - }; - - PullTypeResolver.prototype.inSwitchStatement = function (ast) { - while (ast) { - if (ast.kind() === 151 /* SwitchStatement */) { - return true; - } - - if (this.isAnyFunctionExpressionOrDeclaration(ast)) { - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inIterationStatement = function (ast, crossFunctions) { - while (ast) { - if (this.isIterationStatement(ast)) { - return true; - } - - if (!crossFunctions && this.isAnyFunctionExpressionOrDeclaration(ast)) { - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.getEnclosingLabels = function (ast, breakable, crossFunctions) { - var result = []; - - ast = ast.parent; - while (ast) { - if (ast.kind() === 160 /* LabeledStatement */) { - var labeledStatement = ast; - if (breakable) { - result.push(labeledStatement); - } else { - if (this.labelIsOnContinuableConstruct(labeledStatement.statement)) { - result.push(labeledStatement); - } - } - } - - if (!crossFunctions && this.isAnyFunctionExpressionOrDeclaration(ast)) { - break; - } - - ast = ast.parent; - } - - return result; - }; - - PullTypeResolver.prototype.typeCheckContinueStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - if (!this.inIterationStatement(ast, false)) { - if (this.inIterationStatement(ast, true)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.continue_statement_can_only_be_used_within_an_enclosing_iteration_statement)); - } - } else if (ast.identifier) { - var continuableLabels = this.getEnclosingLabels(ast, false, false); - - if (!TypeScript.ArrayUtilities.any(continuableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - var continuableLabels = this.getEnclosingLabels(ast, false, true); - - if (TypeScript.ArrayUtilities.any(continuableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_not_found)); - } - } - } - }; - - PullTypeResolver.prototype.resolveBreakStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckBreakStatement(ast, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.typeCheckBreakStatement = function (ast, context) { - this.setTypeChecked(ast, context); - - if (ast.identifier) { - var breakableLabels = this.getEnclosingLabels(ast, true, false); - - if (!TypeScript.ArrayUtilities.any(breakableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - var breakableLabels = this.getEnclosingLabels(ast, true, true); - if (TypeScript.ArrayUtilities.any(breakableLabels, function (s) { - return s.identifier.valueText() === ast.identifier.valueText(); - })) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_not_found)); - } - } - } else if (!this.inIterationStatement(ast, false) && !this.inSwitchStatement(ast)) { - if (this.inIterationStatement(ast, true)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement)); - } - } - }; - - PullTypeResolver.prototype.resolveAST = function (ast, isContextuallyTyped, context) { - if (!ast) { - return; - } - - var symbol = this.getSymbolForAST(ast, context); - if (symbol && symbol.isResolved) { - this.typeCheckAST(ast, isContextuallyTyped, context); - return symbol; - } - - if (ast.isExpression() && !isTypesOnlyLocation(ast)) { - return this.resolveExpressionAST(ast, isContextuallyTyped, context); - } - - var nodeType = ast.kind(); - - switch (nodeType) { - case 124 /* ArrayType */: - case 126 /* GenericType */: - case 122 /* ObjectType */: - case 127 /* TypeQuery */: - case 125 /* ConstructorType */: - case 123 /* FunctionType */: - return this.resolveTypeReference(ast, context); - - case 1 /* List */: - return this.resolveList(ast, context); - - case 2 /* SeparatedList */: - return this.resolveSeparatedList(ast, context); - - case 120 /* SourceUnit */: - return this.resolveSourceUnit(ast, context); - - case 132 /* EnumDeclaration */: - return this.resolveEnumDeclaration(ast, context); - - case 130 /* ModuleDeclaration */: - return this.resolveModuleDeclaration(ast, context); - - case 128 /* InterfaceDeclaration */: - return this.resolveInterfaceDeclaration(ast, context); - - case 131 /* ClassDeclaration */: - return this.resolveClassDeclaration(ast, context); - - case 224 /* VariableDeclaration */: - return this.resolveVariableDeclarationList(ast, context); - - case 136 /* MemberVariableDeclaration */: - return this.resolveMemberVariableDeclaration(ast, context); - - case 225 /* VariableDeclarator */: - return this.resolveVariableDeclarator(ast, context); - - case 141 /* PropertySignature */: - return this.resolvePropertySignature(ast, context); - - case 227 /* ParameterList */: - return this.resolveParameterList(ast, context); - - case 242 /* Parameter */: - return this.resolveParameter(ast, context); - - case 243 /* EnumElement */: - return this.resolveEnumElement(ast, context); - - case 232 /* EqualsValueClause */: - return this.resolveEqualsValueClause(ast, isContextuallyTyped, context); - - case 238 /* TypeParameter */: - return this.resolveTypeParameterDeclaration(ast, context); - - case 239 /* Constraint */: - return this.resolveConstraint(ast, context); - - case 133 /* ImportDeclaration */: - return this.resolveImportDeclaration(ast, context); - - case 240 /* SimplePropertyAssignment */: - return this.resolveSimplePropertyAssignment(ast, isContextuallyTyped, context); - - case 241 /* FunctionPropertyAssignment */: - return this.resolveFunctionPropertyAssignment(ast, isContextuallyTyped, context); - - case 11 /* IdentifierName */: - TypeScript.Debug.assert(isTypesOnlyLocation(ast)); - return this.resolveTypeNameExpression(ast, context); - - case 121 /* QualifiedName */: - return this.resolveQualifiedName(ast, context); - - case 137 /* ConstructorDeclaration */: - return this.resolveConstructorDeclaration(ast, context); - - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - return this.resolveAccessorDeclaration(ast, context); - - case 138 /* IndexMemberDeclaration */: - return this.resolveIndexMemberDeclaration(ast, context); - - case 144 /* IndexSignature */: - return this.resolveIndexSignature(ast, context); - - case 135 /* MemberFunctionDeclaration */: - return this.resolveMemberFunctionDeclaration(ast, context); - - case 142 /* CallSignature */: - return this.resolveCallSignature(ast, context); - - case 143 /* ConstructSignature */: - return this.resolveConstructSignature(ast, context); - - case 145 /* MethodSignature */: - return this.resolveMethodSignature(ast, context); - - case 129 /* FunctionDeclaration */: - return this.resolveAnyFunctionDeclaration(ast, context); - - case 244 /* TypeAnnotation */: - return this.resolveTypeAnnotation(ast, context); - - case 134 /* ExportAssignment */: - return this.resolveExportAssignmentStatement(ast, context); - - case 157 /* ThrowStatement */: - return this.resolveThrowStatement(ast, context); - - case 149 /* ExpressionStatement */: - return this.resolveExpressionStatement(ast, context); - - case 154 /* ForStatement */: - return this.resolveForStatement(ast, context); - - case 155 /* ForInStatement */: - return this.resolveForInStatement(ast, context); - - case 158 /* WhileStatement */: - return this.resolveWhileStatement(ast, context); - - case 161 /* DoStatement */: - return this.resolveDoStatement(ast, context); - - case 147 /* IfStatement */: - return this.resolveIfStatement(ast, context); - - case 235 /* ElseClause */: - return this.resolveElseClause(ast, context); - - case 146 /* Block */: - return this.resolveBlock(ast, context); - - case 148 /* VariableStatement */: - return this.resolveVariableStatement(ast, context); - - case 163 /* WithStatement */: - return this.resolveWithStatement(ast, context); - - case 159 /* TryStatement */: - return this.resolveTryStatement(ast, context); - - case 236 /* CatchClause */: - return this.resolveCatchClause(ast, context); - - case 237 /* FinallyClause */: - return this.resolveFinallyClause(ast, context); - - case 150 /* ReturnStatement */: - return this.resolveReturnStatement(ast, context); - - case 151 /* SwitchStatement */: - return this.resolveSwitchStatement(ast, context); - - case 153 /* ContinueStatement */: - return this.resolveContinueStatement(ast, context); - - case 152 /* BreakStatement */: - return this.resolveBreakStatement(ast, context); - - case 160 /* LabeledStatement */: - return this.resolveLabeledStatement(ast, context); - } - - return this.semanticInfoChain.anyTypeSymbol; - }; - - PullTypeResolver.prototype.resolveExpressionAST = function (ast, isContextuallyOrInferentiallyTyped, context) { - var expressionSymbol = this.resolveExpressionWorker(ast, isContextuallyOrInferentiallyTyped, context); - - if (isContextuallyOrInferentiallyTyped && context.isInferentiallyTyping()) { - return this.alterPotentialGenericFunctionTypeToInstantiatedFunctionTypeForTypeArgumentInference(expressionSymbol, context); - } else { - return expressionSymbol; - } - }; - - PullTypeResolver.prototype.resolveExpressionWorker = function (ast, isContextuallyTyped, context) { - switch (ast.kind()) { - case 215 /* ObjectLiteralExpression */: - return this.resolveObjectLiteralExpression(ast, isContextuallyTyped, context); - - case 11 /* IdentifierName */: - return this.resolveNameExpression(ast, context); - - case 212 /* MemberAccessExpression */: - return this.resolveMemberAccessExpression(ast, context); - - case 222 /* FunctionExpression */: - return this.resolveFunctionExpression(ast, isContextuallyTyped, context); - - case 219 /* SimpleArrowFunctionExpression */: - return this.resolveSimpleArrowFunctionExpression(ast, isContextuallyTyped, context); - - case 218 /* ParenthesizedArrowFunctionExpression */: - return this.resolveParenthesizedArrowFunctionExpression(ast, isContextuallyTyped, context); - - case 214 /* ArrayLiteralExpression */: - return this.resolveArrayLiteralExpression(ast, isContextuallyTyped, context); - - case 35 /* ThisKeyword */: - return this.resolveThisExpression(ast, context); - - case 50 /* SuperKeyword */: - return this.resolveSuperExpression(ast, context); - - case 213 /* InvocationExpression */: - return this.resolveInvocationExpression(ast, context); - - case 216 /* ObjectCreationExpression */: - return this.resolveObjectCreationExpression(ast, context); - - case 220 /* CastExpression */: - return this.resolveCastExpression(ast, context); - - case 13 /* NumericLiteral */: - return this.semanticInfoChain.numberTypeSymbol; - - case 14 /* StringLiteral */: - return this.semanticInfoChain.stringTypeSymbol; - - case 32 /* NullKeyword */: - return this.semanticInfoChain.nullTypeSymbol; - - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - return this.semanticInfoChain.booleanTypeSymbol; - - case 172 /* VoidExpression */: - return this.resolveVoidExpression(ast, context); - - case 174 /* AssignmentExpression */: - return this.resolveAssignmentExpression(ast, context); - - case 167 /* LogicalNotExpression */: - return this.resolveLogicalNotExpression(ast, context); - - case 193 /* NotEqualsWithTypeConversionExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 196 /* LessThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 197 /* GreaterThanExpression */: - return this.resolveLogicalOperation(ast, context); - - case 208 /* AddExpression */: - case 175 /* AddAssignmentExpression */: - return this.resolveBinaryAdditionOperation(ast, context); - - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - case 166 /* BitwiseNotExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - return this.resolveUnaryArithmeticOperation(ast, context); - - case 210 /* PostIncrementExpression */: - case 211 /* PostDecrementExpression */: - return this.resolvePostfixUnaryExpression(ast, context); - - case 209 /* SubtractExpression */: - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 189 /* BitwiseOrExpression */: - case 191 /* BitwiseAndExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - return this.resolveBinaryArithmeticExpression(ast, context); - - case 221 /* ElementAccessExpression */: - return this.resolveElementAccessExpression(ast, context); - - case 187 /* LogicalOrExpression */: - return this.resolveLogicalOrExpression(ast, isContextuallyTyped, context); - - case 188 /* LogicalAndExpression */: - return this.resolveLogicalAndExpression(ast, context); - - case 171 /* TypeOfExpression */: - return this.resolveTypeOfExpression(ast, context); - - case 170 /* DeleteExpression */: - return this.resolveDeleteExpression(ast, context); - - case 186 /* ConditionalExpression */: - return this.resolveConditionalExpression(ast, isContextuallyTyped, context); - - case 12 /* RegularExpressionLiteral */: - return this.resolveRegularExpressionLiteral(); - - case 217 /* ParenthesizedExpression */: - return this.resolveParenthesizedExpression(ast, context); - - case 200 /* InstanceOfExpression */: - return this.resolveInstanceOfExpression(ast, context); - - case 173 /* CommaExpression */: - return this.resolveCommaExpression(ast, context); - - case 201 /* InExpression */: - return this.resolveInExpression(ast, context); - - case 223 /* OmittedExpression */: - return this.semanticInfoChain.undefinedTypeSymbol; - } - - TypeScript.Debug.fail("resolveExpressionASTWorker: Missing expression kind: " + TypeScript.SyntaxKind[ast.kind()]); - }; - - PullTypeResolver.prototype.typeCheckAST = function (ast, isContextuallyTyped, context) { - if (!this.canTypeCheckAST(ast, context)) { - return; - } - - var nodeType = ast.kind(); - switch (nodeType) { - case 120 /* SourceUnit */: - this.typeCheckSourceUnit(ast, context); - return; - - case 132 /* EnumDeclaration */: - this.typeCheckEnumDeclaration(ast, context); - return; - - case 130 /* ModuleDeclaration */: - this.typeCheckModuleDeclaration(ast, context); - return; - - case 128 /* InterfaceDeclaration */: - this.typeCheckInterfaceDeclaration(ast, context); - return; - - case 131 /* ClassDeclaration */: - this.typeCheckClassDeclaration(ast, context); - return; - - case 243 /* EnumElement */: - this.typeCheckEnumElement(ast, context); - return; - - case 136 /* MemberVariableDeclaration */: - this.typeCheckMemberVariableDeclaration(ast, context); - return; - - case 225 /* VariableDeclarator */: - this.typeCheckVariableDeclarator(ast, context); - return; - - case 141 /* PropertySignature */: - this.typeCheckPropertySignature(ast, context); - return; - - case 242 /* Parameter */: - this.typeCheckParameter(ast, context); - return; - - case 133 /* ImportDeclaration */: - this.typeCheckImportDeclaration(ast, context); - return; - - case 215 /* ObjectLiteralExpression */: - this.resolveObjectLiteralExpression(ast, isContextuallyTyped, context); - return; - - case 241 /* FunctionPropertyAssignment */: - this.typeCheckFunctionPropertyAssignment(ast, isContextuallyTyped, context); - return; - - case 11 /* IdentifierName */: - if (isTypesOnlyLocation(ast)) { - this.resolveTypeNameExpression(ast, context); - } else { - this.resolveNameExpression(ast, context); - } - return; - - case 212 /* MemberAccessExpression */: - this.resolveMemberAccessExpression(ast, context); - return; - - case 121 /* QualifiedName */: - this.resolveQualifiedName(ast, context); - return; - - case 222 /* FunctionExpression */: - this.typeCheckFunctionExpression(ast, isContextuallyTyped, context); - return; - - case 137 /* ConstructorDeclaration */: - this.typeCheckConstructorDeclaration(ast, context); - return; - - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - this.typeCheckAccessorDeclaration(ast, context); - return; - - case 135 /* MemberFunctionDeclaration */: - this.typeCheckMemberFunctionDeclaration(ast, context); - return; - - case 145 /* MethodSignature */: - this.typeCheckMethodSignature(ast, context); - return; - - case 144 /* IndexSignature */: - this.typeCheckIndexSignature(ast, context); - break; - - case 142 /* CallSignature */: - this.typeCheckCallSignature(ast, context); - return; - - case 143 /* ConstructSignature */: - this.typeCheckConstructSignature(ast, context); - return; - - case 129 /* FunctionDeclaration */: { - var funcDecl = ast; - this.typeCheckAnyFunctionDeclaration(funcDecl, TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */), funcDecl.identifier, funcDecl.callSignature.typeParameterList, funcDecl.callSignature.parameterList, TypeScript.ASTHelpers.getType(funcDecl), funcDecl.block, context); - return; - } - - case 219 /* SimpleArrowFunctionExpression */: - this.typeCheckSimpleArrowFunctionExpression(ast, isContextuallyTyped, context); - return; - - case 218 /* ParenthesizedArrowFunctionExpression */: - this.typeCheckParenthesizedArrowFunctionExpression(ast, isContextuallyTyped, context); - return; - - case 214 /* ArrayLiteralExpression */: - this.resolveArrayLiteralExpression(ast, isContextuallyTyped, context); - return; - - case 213 /* InvocationExpression */: - this.typeCheckInvocationExpression(ast, context); - return; - - case 216 /* ObjectCreationExpression */: - this.typeCheckObjectCreationExpression(ast, context); - return; - - case 150 /* ReturnStatement */: - this.resolveReturnStatement(ast, context); - return; - - default: - TypeScript.Debug.assert(false, "Failure nodeType: " + TypeScript.SyntaxKind[ast.kind()] + ". Implement typeCheck when symbol is set for the ast as part of resolution."); - } - }; - - PullTypeResolver.prototype.processPostTypeCheckWorkItems = function (context) { - while (this.postTypeCheckWorkitems.length) { - var ast = this.postTypeCheckWorkitems.pop(); - this.postTypeCheck(ast, context); - } - }; - - PullTypeResolver.prototype.postTypeCheck = function (ast, context) { - var nodeType = ast.kind(); - - switch (nodeType) { - case 242 /* Parameter */: - case 225 /* VariableDeclarator */: - this.postTypeCheckVariableDeclaratorOrParameter(ast, context); - return; - - case 131 /* ClassDeclaration */: - this.postTypeCheckClassDeclaration(ast, context); - return; - - case 129 /* FunctionDeclaration */: - this.postTypeCheckFunctionDeclaration(ast, context); - return; - - case 130 /* ModuleDeclaration */: - this.postTypeCheckModuleDeclaration(ast, context); - return; - - case 132 /* EnumDeclaration */: - this.postTypeCheckEnumDeclaration(ast, context); - return; - - case 133 /* ImportDeclaration */: - this.postTypeCheckImportDeclaration(ast, context); - return; - - case 11 /* IdentifierName */: - this.postTypeCheckNameExpression(ast, context); - return; - - default: - TypeScript.Debug.assert(false, "Implement postTypeCheck clause to handle the postTypeCheck work, nodeType: " + TypeScript.SyntaxKind[ast.kind()]); - } - }; - - PullTypeResolver.prototype.resolveRegularExpressionLiteral = function () { - if (this.cachedRegExpInterfaceType()) { - return this.cachedRegExpInterfaceType(); - } else { - return this.semanticInfoChain.anyTypeSymbol; - } - }; - - PullTypeResolver.prototype.postTypeCheckNameExpression = function (nameAST, context) { - this.checkThisCaptureVariableCollides(nameAST, false, context); - }; - - PullTypeResolver.prototype.typeCheckNameExpression = function (nameAST, context) { - this.setTypeChecked(nameAST, context); - this.checkNameForCompilerGeneratedDeclarationCollision(nameAST, false, nameAST, context); - }; - - PullTypeResolver.prototype.resolveNameExpression = function (nameAST, context) { - var nameSymbol = this.getSymbolForAST(nameAST, context); - var foundCached = nameSymbol !== null; - - if (!foundCached || this.canTypeCheckAST(nameAST, context)) { - if (this.canTypeCheckAST(nameAST, context)) { - this.typeCheckNameExpression(nameAST, context); - } - nameSymbol = this.computeNameExpression(nameAST, context); - } - - this.resolveDeclaredSymbol(nameSymbol, context); - - if (nameSymbol && (nameSymbol.type !== this.semanticInfoChain.anyTypeSymbol || nameSymbol.anyDeclHasFlag(16777216 /* IsAnnotatedWithAny */ | 1 /* Exported */))) { - this.setSymbolForAST(nameAST, nameSymbol, context); - } - - return nameSymbol; - }; - - PullTypeResolver.prototype.isInEnumDecl = function (decl) { - if (decl.kind & 64 /* Enum */) { - return true; - } - - var declPath = decl.getParentPath(); - - var disallowedKinds = 164 /* SomeContainer */ | 58728795 /* SomeType */; - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - - if (decl.kind & 64 /* Enum */) { - return true; - } - - if (decl.kind & disallowedKinds) { - return false; - } - } - return false; - }; - - PullTypeResolver.prototype.getSomeInnermostFunctionScopeDecl = function (declPath) { - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - if (decl.kind & 1032192 /* SomeFunction */) { - return decl; - } - } - - return null; - }; - - PullTypeResolver.prototype.isFromFunctionScope = function (nameSymbol, functionScopeDecl) { - var _this = this; - return TypeScript.ArrayUtilities.any(nameSymbol.getDeclarations(), function (nameSymbolDecl) { - return _this.getSomeInnermostFunctionScopeDecl(nameSymbolDecl.getParentPath()) === functionScopeDecl; - }); - }; - - PullTypeResolver.prototype.findConstructorDeclOfEnclosingType = function (decl) { - var current = decl; - while (current) { - if (TypeScript.hasFlag(current.kind, 4096 /* Property */)) { - var parentDecl = current.getParentDecl(); - if (TypeScript.hasFlag(parentDecl.kind, 8 /* Class */)) { - return TypeScript.ArrayUtilities.lastOrDefault(parentDecl.getChildDecls(), function (decl) { - return TypeScript.hasFlag(decl.kind, 32768 /* ConstructorMethod */); - }); - } - } - - if (TypeScript.hasFlag(current.kind, 164 /* SomeContainer */)) { - return null; - } - - current = current.getParentDecl(); - } - return null; - }; - - PullTypeResolver.prototype.checkNameAsPartOfInitializerExpressionForInstanceMemberVariable = function (nameAST, nameSymbol, context) { - var id = nameAST.valueText(); - if (id.length === 0) { - return false; - } - - var memberVariableDeclarationAST = TypeScript.ASTHelpers.getEnclosingMemberVariableDeclaration(nameAST); - if (memberVariableDeclarationAST) { - var memberVariableDecl = this.semanticInfoChain.getDeclForAST(memberVariableDeclarationAST); - if (!TypeScript.hasFlag(memberVariableDecl.flags, 16 /* Static */)) { - var constructorDecl = this.findConstructorDeclOfEnclosingType(memberVariableDecl); - - if (constructorDecl) { - var childDecls = constructorDecl.searchChildDecls(id, 68147712 /* SomeValue */); - if (childDecls.length) { - if (TypeScript.PullHelpers.isSymbolDeclaredInScopeChain(nameSymbol, constructorDecl.getSymbol().getContainer())) { - var memberVariableSymbol = memberVariableDecl.getSymbol(); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, [memberVariableSymbol.getScopedName(constructorDecl.getSymbol()), nameAST.text()])); - return true; - } - } - } - } - } - return false; - }; - - PullTypeResolver.prototype.computeNameExpression = function (nameAST, context) { - var id = nameAST.valueText(); - if (id.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var nameSymbol = null; - var enclosingDecl = this.getEnclosingDeclForAST(nameAST); - - if (TypeScript.hasFlag(enclosingDecl.flags, 8388608 /* PropertyParameter */)) { - var valueDecl = enclosingDecl.getValueDecl(); - if (valueDecl && TypeScript.hasFlag(valueDecl.kind, 2048 /* Parameter */)) { - enclosingDecl = valueDecl; - } - } - - var isDeclarationASTOrDeclarationNameAST = TypeScript.ASTHelpers.isDeclarationASTOrDeclarationNameAST(nameAST); - if (isDeclarationASTOrDeclarationNameAST) { - nameSymbol = this.semanticInfoChain.getDeclForAST(nameAST.parent).getSymbol(); - } - - var declPath = enclosingDecl.getParentPath(); - - if (!nameSymbol) { - var searchKind = 68147712 /* SomeValue */; - - if (!this.isInEnumDecl(enclosingDecl)) { - searchKind = searchKind & ~(67108864 /* EnumMember */); - } - - var nameSymbol = this.getSymbolFromDeclPath(id, declPath, searchKind); - } - - if (id === "arguments") { - var functionScopeDecl = this.getSomeInnermostFunctionScopeDecl(declPath); - if (functionScopeDecl) { - if (!nameSymbol || !this.isFromFunctionScope(nameSymbol, functionScopeDecl)) { - nameSymbol = this.cachedFunctionArgumentsSymbol(); - this.resolveDeclaredSymbol(this.cachedIArgumentsInterfaceType(), context); - } - } - } - - var aliasSymbol = null; - if (nameSymbol && nameSymbol.isAlias() && !isDeclarationASTOrDeclarationNameAST) { - aliasSymbol = nameSymbol; - if (!this.inTypeQuery(nameAST)) { - aliasSymbol.setIsUsedAsValue(); - } - - this.resolveDeclaredSymbol(nameSymbol, context); - - this.resolveDeclaredSymbol(aliasSymbol.assignedValue(), context); - this.resolveDeclaredSymbol(aliasSymbol.assignedContainer(), context); - - nameSymbol = aliasSymbol.getExportAssignedValueSymbol(); - if (!nameSymbol) { - aliasSymbol = null; - } - } - - if (!nameSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Could_not_find_symbol_0, [nameAST.text()])); - return this.getNewErrorTypeSymbol(id); - } else if (this.checkNameAsPartOfInitializerExpressionForInstanceMemberVariable(nameAST, nameSymbol, context)) { - return this.getNewErrorTypeSymbol(id); - } - - var nameDeclaration = nameSymbol.getDeclarations()[0]; - var nameParentDecl = nameDeclaration.getParentDecl(); - if (nameParentDecl && (nameParentDecl.kind & 1032192 /* SomeFunction */) && (nameParentDecl.flags & 33554432 /* HasDefaultArgs */)) { - var enclosingFunctionAST = this.semanticInfoChain.getASTForDecl(nameParentDecl); - var currentParameterIndex = this.getCurrentParameterIndexForFunction(nameAST, enclosingFunctionAST); - - var parameterList = TypeScript.ASTHelpers.getParameterList(enclosingFunctionAST); - - if (currentParameterIndex >= 0) { - var matchingParameter; - if (parameterList) { - for (var i = 0; i <= currentParameterIndex; i++) { - var candidateParameter = parameterList.parameters.nonSeparatorAt(i); - if (candidateParameter && candidateParameter.identifier.valueText() === id) { - matchingParameter = candidateParameter; - break; - } - } - } - - if (!matchingParameter) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, [parameterList.parameters.nonSeparatorAt(currentParameterIndex).identifier.text(), nameAST.text()])); - return this.getNewErrorTypeSymbol(id); - } else if (matchingParameter === TypeScript.ASTHelpers.getEnclosingParameterForInitializer(nameAST)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Parameter_0_cannot_be_referenced_in_its_initializer, [parameterList.parameters.nonSeparatorAt(currentParameterIndex).identifier.text()])); - return this.getNewErrorTypeSymbol(id); - } - } - } - - if (aliasSymbol) { - this.semanticInfoChain.setAliasSymbolForAST(nameAST, aliasSymbol); - } - - return nameSymbol; - }; - - PullTypeResolver.prototype.getCurrentParameterIndexForFunction = function (parameter, funcDecl) { - var parameterList = TypeScript.ASTHelpers.getParameterList(funcDecl); - if (parameterList) { - while (parameter && parameter.parent) { - if (parameter.parent.parent === parameterList) { - return parameterList.parameters.nonSeparatorIndexOf(parameter); - } - - parameter = parameter.parent; - } - } - - return -1; - }; - - PullTypeResolver.prototype.resolveMemberAccessExpression = function (dottedNameAST, context) { - return this.resolveDottedNameExpression(dottedNameAST, dottedNameAST.expression, dottedNameAST.name, context); - }; - - PullTypeResolver.prototype.resolveDottedNameExpression = function (dottedNameAST, expression, name, context) { - var symbol = this.getSymbolForAST(dottedNameAST, context); - var foundCached = symbol !== null; - - if (!foundCached || this.canTypeCheckAST(dottedNameAST, context)) { - var canTypeCheckDottedNameAST = this.canTypeCheckAST(dottedNameAST, context); - if (canTypeCheckDottedNameAST) { - this.setTypeChecked(dottedNameAST, context); - } - - symbol = this.computeDottedNameExpression(expression, name, context, canTypeCheckDottedNameAST); - } - - this.resolveDeclaredSymbol(symbol, context); - - if (symbol && (symbol.type !== this.semanticInfoChain.anyTypeSymbol || symbol.anyDeclHasFlag(16777216 /* IsAnnotatedWithAny */ | 1 /* Exported */))) { - this.setSymbolForAST(dottedNameAST, symbol, context); - this.setSymbolForAST(name, symbol, context); - } - - return symbol; - }; - - PullTypeResolver.prototype.computeDottedNameExpression = function (expression, name, context, checkSuperPrivateAndStaticAccess) { - var rhsName = name.valueText(); - if (rhsName.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var lhs = this.resolveAST(expression, false, context); - return this.computeDottedNameExpressionFromLHS(lhs, expression, name, context, checkSuperPrivateAndStaticAccess); - }; - - PullTypeResolver.prototype.computeDottedNameExpressionFromLHS = function (lhs, expression, name, context, checkSuperPrivateAndStaticAccess) { - var rhsName = name.valueText(); - if (rhsName.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var lhsType = lhs.type; - - if (lhs.isAlias()) { - var lhsAlias = lhs; - if (!this.inTypeQuery(expression)) { - lhsAlias.setIsUsedAsValue(); - } - lhsType = lhsAlias.getExportAssignedTypeSymbol(); - } - - if (lhsType.isAlias()) { - lhsType = lhsType.getExportAssignedTypeSymbol(); - } - - if (!lhsType) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode.Could_not_find_enclosing_symbol_for_dotted_name_0, [name.text()])); - return this.getNewErrorTypeSymbol(); - } - - if (!lhsType.isResolved) { - var potentiallySpecializedType = this.resolveDeclaredSymbol(lhsType, context); - - if (potentiallySpecializedType !== lhsType) { - if (!lhs.isType()) { - context.setTypeInContext(lhs, potentiallySpecializedType); - } - - lhsType = potentiallySpecializedType; - } - } - - if (lhsType.isContainer() && !lhsType.isAlias() && !lhsType.isEnum()) { - var instanceSymbol = lhsType.getInstanceSymbol(); - - if (instanceSymbol) { - lhsType = instanceSymbol.type; - } - } - - var originalLhsTypeForErrorReporting = lhsType; - - lhsType = this.getApparentType(lhsType).widenedType(this, expression, context); - - if (this.isAnyOrEquivalent(lhsType)) { - return lhsType; - } - - var nameSymbol = this._getNamedPropertySymbolOfAugmentedType(rhsName, lhsType); - - if (!nameSymbol) { - if (lhsType.kind === 32 /* DynamicModule */) { - var container = lhsType; - var associatedInstance = container.getInstanceSymbol(); - - if (associatedInstance) { - var instanceType = associatedInstance.type; - - nameSymbol = this.getNamedPropertySymbol(rhsName, 68147712 /* SomeValue */, instanceType); - } - } else { - var associatedType = lhsType.getAssociatedContainerType(); - - if (associatedType && !associatedType.isClass()) { - nameSymbol = this.getNamedPropertySymbol(rhsName, 68147712 /* SomeValue */, associatedType); - } - } - - if (!nameSymbol) { - var enclosingDecl = this.getEnclosingDeclForAST(expression); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode.The_property_0_does_not_exist_on_value_of_type_1, [name.text(), originalLhsTypeForErrorReporting.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - return this.getNewErrorTypeSymbol(rhsName); - } - } - - if (checkSuperPrivateAndStaticAccess) { - this.checkForSuperMemberAccess(expression, name, nameSymbol, context) || this.checkForPrivateMemberAccess(name, lhsType, nameSymbol, context); - } - - return nameSymbol; - }; - - PullTypeResolver.prototype.resolveTypeNameExpression = function (nameAST, context) { - var typeNameSymbol = this.getSymbolForAST(nameAST, context); - - if (!typeNameSymbol || !typeNameSymbol.isType() || this.canTypeCheckAST(nameAST, context)) { - if (this.canTypeCheckAST(nameAST, context)) { - this.setTypeChecked(nameAST, context); - } - typeNameSymbol = this.computeTypeNameExpression(nameAST, context); - this.setSymbolForAST(nameAST, typeNameSymbol, context); - } - - this.resolveDeclaredSymbol(typeNameSymbol, context); - - return typeNameSymbol; - }; - - PullTypeResolver.prototype.computeTypeNameExpression = function (nameAST, context) { - var id = nameAST.valueText(); - if (id.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var enclosingDecl = this.getEnclosingDeclForAST(nameAST); - - var declPath = enclosingDecl.getParentPath(); - - var onLeftOfDot = this.isLeftSideOfQualifiedName(nameAST); - - var kindToCheckFirst = onLeftOfDot ? 164 /* SomeContainer */ : 58728795 /* SomeType */; - var kindToCheckSecond = onLeftOfDot ? 58728795 /* SomeType */ : 164 /* SomeContainer */; - - var typeNameSymbol = this.getSymbolFromDeclPath(id, declPath, kindToCheckFirst); - - if (!typeNameSymbol) { - typeNameSymbol = this.getSymbolFromDeclPath(id, declPath, kindToCheckSecond); - } - - if (!typeNameSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Could_not_find_symbol_0, [nameAST.text()])); - return this.getNewErrorTypeSymbol(id); - } - - var typeNameSymbolAlias = null; - if (typeNameSymbol.isAlias()) { - typeNameSymbolAlias = typeNameSymbol; - this.resolveDeclaredSymbol(typeNameSymbol, context); - - var aliasedType = typeNameSymbolAlias.getExportAssignedTypeSymbol(); - - this.resolveDeclaredSymbol(aliasedType, context); - } - - if (typeNameSymbol.isTypeParameter()) { - if (this.isInStaticMemberContext(enclosingDecl)) { - var parentDecl = typeNameSymbol.getDeclarations()[0].getParentDecl(); - - if (parentDecl.kind === 8 /* Class */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(nameAST, TypeScript.DiagnosticCode.Static_members_cannot_reference_class_type_parameters)); - return this.getNewErrorTypeSymbol(); - } - } - } - - if (!typeNameSymbol.isGeneric() && (typeNameSymbol.isClass() || typeNameSymbol.isInterface())) { - typeNameSymbol = TypeScript.PullTypeReferenceSymbol.createTypeReference(typeNameSymbol); - } - - return typeNameSymbol; - }; - - PullTypeResolver.prototype.isInStaticMemberContext = function (decl) { - while (decl) { - if (TypeScript.hasFlag(decl.kind, 1032192 /* SomeFunction */ | 4096 /* Property */) && TypeScript.hasFlag(decl.flags, 16 /* Static */)) { - return true; - } - - if (TypeScript.hasFlag(decl.kind, 164 /* SomeContainer */)) { - return false; - } - - decl = decl.getParentDecl(); - } - - return false; - }; - - PullTypeResolver.prototype.isLeftSideOfQualifiedName = function (ast) { - return ast && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.left === ast; - }; - - PullTypeResolver.prototype.resolveGenericTypeReference = function (genericTypeAST, context) { - var _this = this; - var genericTypeSymbol = this.resolveAST(genericTypeAST.name, false, context).type; - - if (genericTypeSymbol.isError()) { - return genericTypeSymbol; - } - - if (!genericTypeSymbol.inResolution && !genericTypeSymbol.isResolved) { - this.resolveDeclaredSymbol(genericTypeSymbol, context); - } - - if (genericTypeSymbol.isAlias()) { - if (this.inClassExtendsHeritageClause(genericTypeAST) && !this.inTypeArgumentList(genericTypeAST)) { - genericTypeSymbol.setIsUsedAsValue(); - } - genericTypeSymbol = genericTypeSymbol.getExportAssignedTypeSymbol(); - } - - var typeParameters = genericTypeSymbol.getTypeParameters(); - if (typeParameters.length === 0) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(genericTypeAST, TypeScript.DiagnosticCode.Type_0_does_not_have_type_parameters, [genericTypeSymbol.toString()])); - return this.getNewErrorTypeSymbol(); - } - - var typeArgs = []; - - if (genericTypeAST.typeArgumentList && genericTypeAST.typeArgumentList.typeArguments.nonSeparatorCount()) { - for (var i = 0; i < genericTypeAST.typeArgumentList.typeArguments.nonSeparatorCount(); i++) { - typeArgs[i] = this.resolveTypeReference(genericTypeAST.typeArgumentList.typeArguments.nonSeparatorAt(i), context); - - if (typeArgs[i].isError()) { - typeArgs[i] = this.semanticInfoChain.anyTypeSymbol; - } - } - } - - if (typeArgs.length && typeArgs.length !== typeParameters.length) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(genericTypeAST, TypeScript.DiagnosticCode.Generic_type_0_requires_1_type_argument_s, [genericTypeSymbol.toString(), genericTypeSymbol.getTypeParameters().length])); - return this.getNewErrorTypeSymbol(); - } - - if (!genericTypeSymbol.isResolved) { - var typeDecls = genericTypeSymbol.getDeclarations(); - var childDecls = null; - - for (var i = 0; i < typeDecls.length; i++) { - childDecls = typeDecls[i].getChildDecls(); - - for (var j = 0; j < childDecls.length; j++) { - childDecls[j].ensureSymbolIsBound(); - } - } - } - - var specializedSymbol = this.createInstantiatedType(genericTypeSymbol, typeArgs); - - var upperBound = null; - - typeParameters = specializedSymbol.getTypeParameters(); - - var typeConstraintSubstitutionMap = []; - - var instantiatedSubstitutionMap = specializedSymbol.getTypeParameterArgumentMap(); - - for (var i = 0; i < typeParameters.length; i++) { - typeConstraintSubstitutionMap[typeParameters[i].pullSymbolID] = typeParameters[i]; - } - - for (var id in instantiatedSubstitutionMap) { - typeConstraintSubstitutionMap[id] = instantiatedSubstitutionMap[id]; - } - - for (var iArg = 0; (iArg < typeArgs.length) && (iArg < typeParameters.length); iArg++) { - var typeArg = typeArgs[iArg]; - var typeParameter = typeParameters[iArg]; - var typeConstraint = typeParameter.getConstraint(); - - typeConstraintSubstitutionMap[typeParameter.pullSymbolID] = typeArg; - - if (typeConstraint) { - if (typeConstraint.isTypeParameter()) { - for (var j = 0; j < typeParameters.length && j < typeArgs.length; j++) { - if (typeParameters[j] === typeConstraint) { - typeConstraint = typeArgs[j]; - } - } - } else if (typeConstraint.isGeneric()) { - typeConstraint = this.instantiateType(typeConstraint, typeConstraintSubstitutionMap); - } - - if (typeArg.isTypeParameter()) { - upperBound = typeArg.getConstraint(); - - if (upperBound) { - typeArg = upperBound; - } - } - - if (typeArg.inResolution || (typeArg.isTypeReference() && typeArg.referencedTypeSymbol.inResolution)) { - return specializedSymbol; - } - - if (context.canTypeCheckAST(genericTypeAST)) { - this.typeCheckCallBacks.push(function (context) { - if (!_this.sourceIsAssignableToTarget(typeArg, typeConstraint, genericTypeAST, context)) { - var enclosingSymbol = _this.getEnclosingSymbolForAST(genericTypeAST); - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(genericTypeAST, TypeScript.DiagnosticCode.Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2, [typeArg.toString(enclosingSymbol, true), typeConstraint.toString(enclosingSymbol, true), typeParameter.toString(enclosingSymbol, true)])); - } - }); - } - } - } - - return specializedSymbol; - }; - - PullTypeResolver.prototype.resolveQualifiedName = function (dottedNameAST, context) { - if (this.inTypeQuery(dottedNameAST)) { - return this.resolveDottedNameExpression(dottedNameAST, dottedNameAST.left, dottedNameAST.right, context).type; - } - - var symbol = this.getSymbolForAST(dottedNameAST, context); - if (!symbol || this.canTypeCheckAST(dottedNameAST, context)) { - var canTypeCheck = this.canTypeCheckAST(dottedNameAST, context); - if (canTypeCheck) { - this.setTypeChecked(dottedNameAST, context); - } - - symbol = this.computeQualifiedName(dottedNameAST, context); - this.setSymbolForAST(dottedNameAST, symbol, context); - } - - this.resolveDeclaredSymbol(symbol, context); - - return symbol; - }; - - PullTypeResolver.prototype.isLastNameOfModuleNameModuleReference = function (ast) { - return ast.kind() === 11 /* IdentifierName */ && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.right === ast && ast.parent.parent && ast.parent.parent.kind() === 246 /* ModuleNameModuleReference */; - }; - - PullTypeResolver.prototype.computeQualifiedName = function (dottedNameAST, context) { - var rhsName = dottedNameAST.right.valueText(); - if (rhsName.length === 0) { - return this.semanticInfoChain.anyTypeSymbol; - } - - var enclosingDecl = this.getEnclosingDeclForAST(dottedNameAST); - var lhs = this.resolveAST(dottedNameAST.left, false, context); - - var lhsType = lhs.isAlias() ? lhs.getExportAssignedContainerSymbol() : lhs.type; - - if (this.inClassExtendsHeritageClause(dottedNameAST) && !this.inTypeArgumentList(dottedNameAST)) { - if (lhs.isAlias()) { - lhs.setIsUsedAsValue(); - } - } - - if (!lhsType) { - return this.getNewErrorTypeSymbol(); - } - - if (this.isAnyOrEquivalent(lhsType)) { - return lhsType; - } - - var onLeftOfDot = this.isLeftSideOfQualifiedName(dottedNameAST); - var isNameOfModule = dottedNameAST.parent.kind() === 130 /* ModuleDeclaration */ && dottedNameAST.parent.name === dottedNameAST; - - var memberKind = (onLeftOfDot || isNameOfModule) ? 164 /* SomeContainer */ : 58728795 /* SomeType */; - - var childTypeSymbol = this.getNamedPropertySymbol(rhsName, memberKind, lhsType); - - if (!childTypeSymbol && !isNameOfModule && this.isLastNameOfModuleNameModuleReference(dottedNameAST.right)) { - childTypeSymbol = this.getNamedPropertySymbol(rhsName, 68147712 /* SomeValue */, lhsType); - } - - if (!childTypeSymbol && lhsType.isContainer()) { - var exportedContainer = lhsType.getExportAssignedContainerSymbol(); - - if (exportedContainer) { - childTypeSymbol = this.getNamedPropertySymbol(rhsName, memberKind, exportedContainer); - } - } - - if (!childTypeSymbol && enclosingDecl) { - var parentDecl = enclosingDecl; - - while (parentDecl) { - if (parentDecl.kind & 164 /* SomeContainer */) { - break; - } - - parentDecl = parentDecl.getParentDecl(); - } - - if (parentDecl) { - var enclosingSymbolType = parentDecl.getSymbol().type; - - if (enclosingSymbolType === lhsType) { - childTypeSymbol = this.getNamedPropertySymbol(rhsName, memberKind, lhsType); - } - } - } - - if (!childTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(dottedNameAST.right, TypeScript.DiagnosticCode.The_property_0_does_not_exist_on_value_of_type_1, [dottedNameAST.right.text(), lhsType.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - return this.getNewErrorTypeSymbol(rhsName); - } - - return childTypeSymbol; - }; - - PullTypeResolver.prototype.shouldContextuallyTypeAnyFunctionExpression = function (functionExpressionAST, typeParameters, parameters, returnTypeAnnotation, context) { - if (typeParameters && typeParameters.typeParameters.nonSeparatorCount() > 0) { - return false; - } - - if (returnTypeAnnotation) { - return false; - } - - if (parameters) { - for (var i = 0, n = parameters.length; i < n; i++) { - if (parameters.typeAt(i)) { - return false; - } - } - } - - var contextualFunctionTypeSymbol = context.getContextualType(); - - if (contextualFunctionTypeSymbol) { - this.resolveDeclaredSymbol(contextualFunctionTypeSymbol, context); - var callSignatures = contextualFunctionTypeSymbol.getCallSignatures(); - var exactlyOneCallSignature = callSignatures && callSignatures.length === 1; - if (!exactlyOneCallSignature) { - return false; - } - - var callSignatureIsGeneric = callSignatures[0].getTypeParameters().length > 0; - return !callSignatureIsGeneric; - } - - return false; - }; - - PullTypeResolver.prototype.resolveAnyFunctionExpression = function (funcDeclAST, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, isContextuallyTyped, context) { - var funcDeclSymbol = null; - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - TypeScript.Debug.assert(functionDecl); - - if (functionDecl && functionDecl.hasSymbol()) { - funcDeclSymbol = functionDecl.getSymbol(); - if (funcDeclSymbol.isResolved || funcDeclSymbol.inResolution) { - return funcDeclSymbol; - } - } - - funcDeclSymbol = functionDecl.getSymbol(); - TypeScript.Debug.assert(funcDeclSymbol); - - var funcDeclType = funcDeclSymbol.type; - var signature = funcDeclType.getCallSignatures()[0]; - funcDeclSymbol.startResolving(); - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - var assigningFunctionSignature = null; - if (isContextuallyTyped && this.shouldContextuallyTypeAnyFunctionExpression(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, context)) { - assigningFunctionSignature = context.getContextualType().getCallSignatures()[0]; - } - - this.resolveAnyFunctionExpressionParameters(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, isContextuallyTyped, context); - - if (returnTypeAnnotation) { - signature.returnType = this.resolveTypeReference(returnTypeAnnotation, context); - } else { - if (assigningFunctionSignature) { - var returnType = assigningFunctionSignature.returnType; - - if (returnType) { - context.propagateContextualType(returnType); - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, bodyExpression, signature, true, functionDecl, context); - context.popAnyContextualType(); - } else { - signature.returnType = this.semanticInfoChain.anyTypeSymbol; - - if (this.compilationSettings.noImplicitAny()) { - var functionExpressionName = functionDecl.getFunctionExpressionName(); - - if (functionExpressionName != "") { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode._0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type, [functionExpressionName])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)); - } - } - } - } else { - this.resolveFunctionBodyReturnTypes(funcDeclAST, block, bodyExpression, signature, false, functionDecl, context); - } - } - - context.setTypeInContext(funcDeclSymbol, funcDeclType); - funcDeclSymbol.setResolved(); - - if (this.canTypeCheckAST(funcDeclAST, context)) { - this.typeCheckAnyFunctionExpression(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, isContextuallyTyped, context); - } - - return funcDeclSymbol; - }; - - PullTypeResolver.prototype.resolveAnyFunctionExpressionParameters = function (funcDeclAST, typeParameters, parameters, returnTypeAnnotation, isContextuallyTyped, context) { - if (!parameters) { - return; - } - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var contextParams = []; - - var assigningFunctionSignature = null; - if (isContextuallyTyped && this.shouldContextuallyTypeAnyFunctionExpression(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, context)) { - assigningFunctionSignature = context.getContextualType().getCallSignatures()[0]; - } - - if (assigningFunctionSignature) { - contextParams = assigningFunctionSignature.parameters; - } - - var contextualParametersCount = contextParams.length; - for (var i = 0, n = parameters.length; i < n; i++) { - var actualParameterIsVarArgParameter = (i === (n - 1)) && parameters.lastParameterIsRest(); - var correspondingContextualParameter = null; - var contextualParameterType = null; - - if (i < contextualParametersCount) { - correspondingContextualParameter = contextParams[i]; - } else if (contextualParametersCount && contextParams[contextualParametersCount - 1].isVarArg) { - correspondingContextualParameter = contextParams[contextualParametersCount - 1]; - } - - if (correspondingContextualParameter) { - if (correspondingContextualParameter.isVarArg === actualParameterIsVarArgParameter) { - contextualParameterType = correspondingContextualParameter.type; - } else if (correspondingContextualParameter.isVarArg) { - contextualParameterType = correspondingContextualParameter.type.getElementType(); - } - } - - this.resolveFunctionExpressionParameter(parameters.astAt(i), parameters.identifierAt(i), parameters.typeAt(i), parameters.initializerAt(i), contextualParameterType, functionDecl, context); - } - }; - - PullTypeResolver.prototype.typeCheckSimpleArrowFunctionExpression = function (arrowFunction, isContextuallyTyped, context) { - return this.typeCheckAnyFunctionExpression(arrowFunction, null, TypeScript.ASTHelpers.parametersFromIdentifier(arrowFunction.identifier), null, arrowFunction.block, arrowFunction.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckParenthesizedArrowFunctionExpression = function (arrowFunction, isContextuallyTyped, context) { - return this.typeCheckAnyFunctionExpression(arrowFunction, arrowFunction.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(arrowFunction.callSignature.parameterList), TypeScript.ASTHelpers.getType(arrowFunction), arrowFunction.block, arrowFunction.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckAnyFunctionExpression = function (funcDeclAST, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, isContextuallyTyped, context) { - var _this = this; - this.setTypeChecked(funcDeclAST, context); - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - - var funcDeclSymbol = functionDecl.getSymbol(); - var funcDeclType = funcDeclSymbol.type; - var signature = funcDeclType.getCallSignatures()[0]; - var returnTypeSymbol = signature.returnType; - - if (typeParameters) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - this.resolveTypeParameterDeclaration(typeParameters.typeParameters.nonSeparatorAt(i), context); - } - } - - this.resolveAnyFunctionExpressionParameters(funcDeclAST, typeParameters, parameters, returnTypeAnnotation, isContextuallyTyped, context); - - context.pushNewContextualType(null); - if (block) { - this.resolveAST(block, false, context); - } else { - var bodyExpressionType = this.resolveReturnExpression(bodyExpression, functionDecl, context); - this.typeCheckReturnExpression(bodyExpression, bodyExpressionType, functionDecl, context); - } - - context.popAnyContextualType(); - - this.checkThatNonVoidFunctionHasReturnExpressionOrThrowStatement(functionDecl, returnTypeAnnotation, returnTypeSymbol, block, context); - - this.validateVariableDeclarationGroups(functionDecl, context); - - this.typeCheckCallBacks.push(function (context) { - _this.typeCheckFunctionOverloads(funcDeclAST, context); - }); - }; - - PullTypeResolver.prototype.resolveThisExpression = function (thisExpression, context) { - var enclosingDecl = this.getEnclosingDeclForAST(thisExpression); - var thisTypeSymbol = this.getContextualClassSymbolForEnclosingDecl(thisExpression, enclosingDecl) || this.semanticInfoChain.anyTypeSymbol; - - if (this.canTypeCheckAST(thisExpression, context)) { - this.typeCheckThisExpression(thisExpression, context, enclosingDecl); - } - - return thisTypeSymbol; - }; - - PullTypeResolver.prototype.inTypeArgumentList = function (ast) { - var previous = null; - var current = ast; - - while (current) { - switch (current.kind()) { - case 126 /* GenericType */: - var genericType = current; - if (genericType.typeArgumentList === previous) { - return true; - } - break; - - case 226 /* ArgumentList */: - var argumentList = current; - return argumentList.typeArgumentList === previous; - } - - previous = current; - current = current.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inClassExtendsHeritageClause = function (ast) { - while (ast) { - switch (ast.kind()) { - case 230 /* ExtendsHeritageClause */: - var heritageClause = ast; - - return heritageClause.parent.parent.kind() === 131 /* ClassDeclaration */; - - case 137 /* ConstructorDeclaration */: - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inTypeQuery = function (ast) { - while (ast) { - switch (ast.kind()) { - case 127 /* TypeQuery */: - return true; - case 129 /* FunctionDeclaration */: - case 213 /* InvocationExpression */: - case 137 /* ConstructorDeclaration */: - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inArgumentListOfSuperInvocation = function (ast) { - var previous = null; - var current = ast; - while (current) { - switch (current.kind()) { - case 213 /* InvocationExpression */: - var invocationExpression = current; - if (previous === invocationExpression.argumentList && invocationExpression.expression.kind() === 50 /* SuperKeyword */) { - return true; - } - break; - - case 137 /* ConstructorDeclaration */: - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - previous = current; - current = current.parent; - } - - return false; - }; - - PullTypeResolver.prototype.inConstructorParameterList = function (ast) { - var previous = null; - var current = ast; - while (current) { - switch (current.kind()) { - case 142 /* CallSignature */: - var callSignature = current; - if (previous === callSignature.parameterList && callSignature.parent.kind() === 137 /* ConstructorDeclaration */) { - return true; - } - - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - return false; - } - - previous = current; - current = current.parent; - } - - return false; - }; - PullTypeResolver.prototype.isFunctionAccessorOrNonArrowFunctionExpression = function (decl) { - if (decl.kind === 262144 /* GetAccessor */ || decl.kind === 524288 /* SetAccessor */) { - return true; - } - - return this.isFunctionOrNonArrowFunctionExpression(decl); - }; - - PullTypeResolver.prototype.isFunctionOrNonArrowFunctionExpression = function (decl) { - if (decl.kind === 16384 /* Function */) { - return true; - } else if (decl.kind === 131072 /* FunctionExpression */ && !TypeScript.hasFlag(decl.flags, 8192 /* ArrowFunction */)) { - return true; - } - - return false; - }; - - PullTypeResolver.prototype.typeCheckThisExpression = function (thisExpression, context, enclosingDecl) { - this.checkForThisCaptureInArrowFunction(thisExpression); - - if (this.inConstructorParameterList(thisExpression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_constructor_arguments)); - return; - } - - for (var currentDecl = enclosingDecl; currentDecl !== null; currentDecl = currentDecl.getParentDecl()) { - if (this.isFunctionAccessorOrNonArrowFunctionExpression(currentDecl)) { - return; - } else if (currentDecl.kind === 4 /* Container */ || currentDecl.kind === 32 /* DynamicModule */) { - if (currentDecl.getParentDecl() === null) { - return; - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_within_module_bodies)); - return; - } - } else if (currentDecl.kind === 64 /* Enum */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_current_location)); - return; - } else if (currentDecl.kind === 32768 /* ConstructorMethod */) { - if (this.inArgumentListOfSuperInvocation(thisExpression) && this.superCallMustBeFirstStatementInConstructor(currentDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_current_location)); - } - - return; - } else if (currentDecl.kind === 8 /* Class */) { - if (this.inStaticMemberVariableDeclaration(thisExpression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(thisExpression, TypeScript.DiagnosticCode.this_cannot_be_referenced_in_static_initializers_in_a_class_body)); - } - - return; - } - } - }; - - PullTypeResolver.prototype.getContextualClassSymbolForEnclosingDecl = function (ast, enclosingDecl) { - var declPath = enclosingDecl.getParentPath(); - - if (declPath.length) { - var isStaticContext = false; - - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - var declKind = decl.kind; - var declFlags = decl.flags; - - if (declFlags & 16 /* Static */) { - isStaticContext = true; - } else if (declKind === 131072 /* FunctionExpression */ && !TypeScript.hasFlag(declFlags, 8192 /* ArrowFunction */)) { - return null; - } else if (declKind === 16384 /* Function */) { - return null; - } else if (declKind === 8 /* Class */) { - if (this.inStaticMemberVariableDeclaration(ast)) { - return this.getNewErrorTypeSymbol(); - } else { - var classSymbol = decl.getSymbol(); - if (isStaticContext) { - var constructorSymbol = classSymbol.getConstructorMethod(); - return constructorSymbol.type; - } else { - return classSymbol; - } - } - } - } - } - - return null; - }; - - PullTypeResolver.prototype.inStaticMemberVariableDeclaration = function (ast) { - while (ast) { - if (ast.kind() === 136 /* MemberVariableDeclaration */ && TypeScript.hasModifier(ast.modifiers, 16 /* Static */)) { - return true; - } - - ast = ast.parent; - } - - return false; - }; - - PullTypeResolver.prototype.resolveSuperExpression = function (ast, context) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - var superType = this.semanticInfoChain.anyTypeSymbol; - - var classSymbol = this.getContextualClassSymbolForEnclosingDecl(ast, enclosingDecl); - - if (classSymbol) { - this.resolveDeclaredSymbol(classSymbol, context); - - var parents = classSymbol.getExtendedTypes(); - - if (parents.length) { - superType = parents[0]; - } - } - - if (this.canTypeCheckAST(ast, context)) { - this.typeCheckSuperExpression(ast, context, enclosingDecl); - } - - return superType; - }; - - PullTypeResolver.prototype.typeCheckSuperExpression = function (ast, context, enclosingDecl) { - this.setTypeChecked(ast, context); - - this.checkForThisCaptureInArrowFunction(ast); - - var isSuperCall = ast.parent.kind() === 213 /* InvocationExpression */; - var isSuperPropertyAccess = ast.parent.kind() === 212 /* MemberAccessExpression */; - TypeScript.Debug.assert(isSuperCall || isSuperPropertyAccess); - - if (isSuperPropertyAccess) { - for (var currentDecl = enclosingDecl; currentDecl !== null; currentDecl = currentDecl.getParentDecl()) { - if (this.isFunctionOrNonArrowFunctionExpression(currentDecl)) { - break; - } else if (currentDecl.kind === 8 /* Class */) { - if (!this.enclosingClassIsDerived(currentDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_non_derived_classes)); - return; - } else if (this.inConstructorParameterList(ast)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_constructor_arguments)); - return; - } else if (this.inStaticMemberVariableDeclaration(ast)) { - break; - } - - return; - } - } - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class)); - return; - } else { - if (enclosingDecl.kind === 32768 /* ConstructorMethod */) { - var classDecl = enclosingDecl.getParentDecl(); - - if (!this.enclosingClassIsDerived(classDecl)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_non_derived_classes)); - return; - } else if (this.inConstructorParameterList(ast)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.super_cannot_be_referenced_in_constructor_arguments)); - return; - } - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors)); - } - } - }; - - PullTypeResolver.prototype.resolveSimplePropertyAssignment = function (propertyAssignment, isContextuallyTyped, context) { - return this.resolveAST(propertyAssignment.expression, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveFunctionPropertyAssignment = function (funcProp, isContextuallyTyped, context) { - return this.resolveAnyFunctionExpression(funcProp, funcProp.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcProp.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcProp), funcProp.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.typeCheckFunctionPropertyAssignment = function (funcProp, isContextuallyTyped, context) { - this.typeCheckAnyFunctionExpression(funcProp, funcProp.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(funcProp.callSignature.parameterList), TypeScript.ASTHelpers.getType(funcProp), funcProp.block, null, isContextuallyTyped, context); - }; - - PullTypeResolver.prototype.resolveObjectLiteralExpression = function (expressionAST, isContextuallyTyped, context, additionalResults) { - var symbol = this.getSymbolForAST(expressionAST, context); - var hasResolvedSymbol = symbol && symbol.isResolved; - - if (!hasResolvedSymbol || additionalResults || this.canTypeCheckAST(expressionAST, context)) { - if (this.canTypeCheckAST(expressionAST, context)) { - this.setTypeChecked(expressionAST, context); - } - symbol = this.computeObjectLiteralExpression(expressionAST, isContextuallyTyped, context, additionalResults); - this.setSymbolForAST(expressionAST, symbol, context); - } - - return symbol; - }; - - PullTypeResolver.prototype.bindObjectLiteralMembers = function (objectLiteralDeclaration, objectLiteralTypeSymbol, objectLiteralMembers, isUsingExistingSymbol, pullTypeContext) { - var boundMemberSymbols = []; - var memberSymbol; - for (var i = 0, len = objectLiteralMembers.nonSeparatorCount(); i < len; i++) { - var propertyAssignment = objectLiteralMembers.nonSeparatorAt(i); - - var id = this.getPropertyAssignmentName(propertyAssignment); - var assignmentText = getPropertyAssignmentNameTextFromIdentifier(id); - - var isAccessor = propertyAssignment.kind() === 139 /* GetAccessor */ || propertyAssignment.kind() === 140 /* SetAccessor */; - var decl = this.semanticInfoChain.getDeclForAST(propertyAssignment); - TypeScript.Debug.assert(decl); - - if (propertyAssignment.kind() === 240 /* SimplePropertyAssignment */) { - if (!isUsingExistingSymbol) { - memberSymbol = new TypeScript.PullSymbol(assignmentText.memberName, 4096 /* Property */); - memberSymbol.addDeclaration(decl); - decl.setSymbol(memberSymbol); - } else { - memberSymbol = decl.getSymbol(); - } - } else if (propertyAssignment.kind() === 241 /* FunctionPropertyAssignment */) { - memberSymbol = decl.getSymbol(); - } else { - TypeScript.Debug.assert(isAccessor); - memberSymbol = decl.getSymbol(); - } - - if (!isUsingExistingSymbol && !isAccessor) { - var existingMember = objectLiteralTypeSymbol.findMember(memberSymbol.name, true); - if (existingMember) { - pullTypeContext.postDiagnostic(this.semanticInfoChain.duplicateIdentifierDiagnosticFromAST(propertyAssignment, assignmentText.actualText, existingMember.getDeclarations()[0].ast())); - } - - objectLiteralTypeSymbol.addMember(memberSymbol); - } - - boundMemberSymbols.push(memberSymbol); - } - - return boundMemberSymbols; - }; - - PullTypeResolver.prototype.resolveObjectLiteralMembers = function (objectLiteralDeclaration, objectLiteralTypeSymbol, objectLiteralContextualType, objectLiteralMembers, stringIndexerSignature, numericIndexerSignature, allMemberTypes, allNumericMemberTypes, boundMemberSymbols, isUsingExistingSymbol, pullTypeContext, additionalResults) { - for (var i = 0, len = objectLiteralMembers.nonSeparatorCount(); i < len; i++) { - var propertyAssignment = objectLiteralMembers.nonSeparatorAt(i); - - var acceptedContextualType = false; - var assigningSymbol = null; - - var id = this.getPropertyAssignmentName(propertyAssignment); - var memberSymbol = boundMemberSymbols[i]; - var contextualMemberType = null; - - if (objectLiteralContextualType) { - assigningSymbol = this.getNamedPropertySymbol(memberSymbol.name, 68147712 /* SomeValue */, objectLiteralContextualType); - - if (!assigningSymbol) { - if (numericIndexerSignature && TypeScript.PullHelpers.isNameNumeric(memberSymbol.name)) { - assigningSymbol = numericIndexerSignature; - } else if (stringIndexerSignature) { - assigningSymbol = stringIndexerSignature; - } - } - - if (assigningSymbol) { - this.resolveDeclaredSymbol(assigningSymbol, pullTypeContext); - - contextualMemberType = assigningSymbol.kind === 4194304 /* IndexSignature */ ? assigningSymbol.returnType : assigningSymbol.type; - pullTypeContext.propagateContextualType(contextualMemberType); - - acceptedContextualType = true; - - if (additionalResults) { - additionalResults.membersContextTypeSymbols[i] = contextualMemberType; - } - } - } - - var memberSymbolType = this.resolveAST(propertyAssignment, contextualMemberType !== null, pullTypeContext).type; - - if (memberSymbolType) { - if (memberSymbolType.isGeneric()) { - objectLiteralTypeSymbol.setHasGenericMember(); - } - - if (stringIndexerSignature) { - allMemberTypes.push(memberSymbolType); - } - if (numericIndexerSignature && TypeScript.PullHelpers.isNameNumeric(memberSymbol.name)) { - allNumericMemberTypes.push(memberSymbolType); - } - } - - if (acceptedContextualType) { - pullTypeContext.popAnyContextualType(); - } - - var isAccessor = propertyAssignment.kind() === 140 /* SetAccessor */ || propertyAssignment.kind() === 139 /* GetAccessor */; - if (!memberSymbol.isResolved) { - if (isAccessor) { - this.setSymbolForAST(id, memberSymbolType, pullTypeContext); - } else { - pullTypeContext.setTypeInContext(memberSymbol, memberSymbolType); - memberSymbol.setResolved(); - - this.setSymbolForAST(id, memberSymbol, pullTypeContext); - } - } - } - }; - - PullTypeResolver.prototype.computeObjectLiteralExpression = function (objectLitAST, isContextuallyTyped, context, additionalResults) { - var objectLitDecl = this.semanticInfoChain.getDeclForAST(objectLitAST); - TypeScript.Debug.assert(objectLitDecl); - - var typeSymbol = this.getSymbolForAST(objectLitAST, context); - var isUsingExistingSymbol = !!typeSymbol; - - if (!typeSymbol) { - typeSymbol = new TypeScript.PullTypeSymbol("", 256 /* ObjectLiteral */); - typeSymbol.addDeclaration(objectLitDecl); - this.setSymbolForAST(objectLitAST, typeSymbol, context); - objectLitDecl.setSymbol(typeSymbol); - } - - var propertyAssignments = objectLitAST.propertyAssignments; - var contextualType = null; - - if (isContextuallyTyped) { - contextualType = context.getContextualType(); - this.resolveDeclaredSymbol(contextualType, context); - } - - var stringIndexerSignature = null; - var numericIndexerSignature = null; - var allMemberTypes = null; - var allNumericMemberTypes = null; - - if (contextualType) { - var indexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(contextualType, context); - - stringIndexerSignature = indexSignatures.stringSignature; - numericIndexerSignature = indexSignatures.numericSignature; - - var inInferentialTyping = context.isInferentiallyTyping(); - if (stringIndexerSignature) { - allMemberTypes = inInferentialTyping ? [] : [stringIndexerSignature.returnType]; - } - - if (numericIndexerSignature) { - allNumericMemberTypes = inInferentialTyping ? [] : [numericIndexerSignature.returnType]; - } - } - - if (propertyAssignments) { - if (additionalResults) { - additionalResults.membersContextTypeSymbols = []; - } - - var boundMemberSymbols = this.bindObjectLiteralMembers(objectLitDecl, typeSymbol, propertyAssignments, isUsingExistingSymbol, context); - - this.resolveObjectLiteralMembers(objectLitDecl, typeSymbol, contextualType, propertyAssignments, stringIndexerSignature, numericIndexerSignature, allMemberTypes, allNumericMemberTypes, boundMemberSymbols, isUsingExistingSymbol, context, additionalResults); - - if (!isUsingExistingSymbol) { - this.stampObjectLiteralWithIndexSignature(typeSymbol, allMemberTypes, stringIndexerSignature, context); - this.stampObjectLiteralWithIndexSignature(typeSymbol, allNumericMemberTypes, numericIndexerSignature, context); - } - } - - typeSymbol.setResolved(); - return typeSymbol; - }; - - PullTypeResolver.prototype.getPropertyAssignmentName = function (propertyAssignment) { - if (propertyAssignment.kind() === 240 /* SimplePropertyAssignment */) { - return propertyAssignment.propertyName; - } else if (propertyAssignment.kind() === 241 /* FunctionPropertyAssignment */) { - return propertyAssignment.propertyName; - } else if (propertyAssignment.kind() === 139 /* GetAccessor */) { - return propertyAssignment.propertyName; - } else if (propertyAssignment.kind() === 140 /* SetAccessor */) { - return propertyAssignment.propertyName; - } else { - TypeScript.Debug.assert(false); - } - }; - - PullTypeResolver.prototype.stampObjectLiteralWithIndexSignature = function (objectLiteralSymbol, indexerTypeCandidates, contextualIndexSignature, context) { - if (contextualIndexSignature) { - var typeCollection = { - getLength: function () { - return indexerTypeCandidates.length; - }, - getTypeAtIndex: function (index) { - return indexerTypeCandidates[index]; - } - }; - var decl = objectLiteralSymbol.getDeclarations()[0]; - var indexerReturnType = this.findBestCommonType(typeCollection, context).widenedType(this, null, context); - if (indexerReturnType === contextualIndexSignature.returnType) { - objectLiteralSymbol.addIndexSignature(contextualIndexSignature); - } else { - this.semanticInfoChain.addSyntheticIndexSignature(decl, objectLiteralSymbol, this.getASTForDecl(decl), contextualIndexSignature.parameters[0].name, contextualIndexSignature.parameters[0].type, indexerReturnType); - } - } - }; - - PullTypeResolver.prototype.resolveArrayLiteralExpression = function (arrayLit, isContextuallyTyped, context) { - var symbol = this.getSymbolForAST(arrayLit, context); - if (!symbol || this.canTypeCheckAST(arrayLit, context)) { - if (this.canTypeCheckAST(arrayLit, context)) { - this.setTypeChecked(arrayLit, context); - } - symbol = this.computeArrayLiteralExpressionSymbol(arrayLit, isContextuallyTyped, context); - this.setSymbolForAST(arrayLit, symbol, context); - } - - return symbol; - }; - - PullTypeResolver.prototype.computeArrayLiteralExpressionSymbol = function (arrayLit, isContextuallyTyped, context) { - var elements = arrayLit.expressions; - var elementType = null; - var elementTypes = []; - var comparisonInfo = new TypeComparisonInfo(); - var contextualElementType = null; - comparisonInfo.onlyCaptureFirstError = true; - - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - - this.resolveDeclaredSymbol(contextualType, context); - - if (contextualType) { - var indexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(contextualType, context); - if (indexSignatures.numericSignature) { - contextualElementType = indexSignatures.numericSignature.returnType; - } - } - } - - if (elements) { - if (contextualElementType) { - context.propagateContextualType(contextualElementType); - } - - for (var i = 0, n = elements.nonSeparatorCount(); i < n; i++) { - elementTypes.push(this.resolveAST(elements.nonSeparatorAt(i), contextualElementType !== null, context).type); - } - - if (contextualElementType) { - context.popAnyContextualType(); - } - } - - if (elementTypes.length) { - elementType = elementTypes[0]; - } - var collection; - - if (contextualElementType && !context.isInferentiallyTyping()) { - if (!elementType) { - elementType = contextualElementType; - } - - collection = { - getLength: function () { - return elements.nonSeparatorCount() + 1; - }, - getTypeAtIndex: function (index) { - return index === 0 ? contextualElementType : elementTypes[index - 1]; - } - }; - } else { - collection = { - getLength: function () { - return elements.nonSeparatorCount(); - }, - getTypeAtIndex: function (index) { - return elementTypes[index]; - } - }; - } - - elementType = elementType ? this.findBestCommonType(collection, context, comparisonInfo) : elementType; - - if (!elementType) { - elementType = this.semanticInfoChain.undefinedTypeSymbol; - } - - return this.getArrayType(elementType); - }; - - PullTypeResolver.prototype.resolveElementAccessExpression = function (callEx, context) { - var symbolAndDiagnostic = this.computeElementAccessExpressionSymbolAndDiagnostic(callEx, context); - - if (this.canTypeCheckAST(callEx, context)) { - this.typeCheckElementAccessExpression(callEx, context, symbolAndDiagnostic); - } - - return symbolAndDiagnostic.symbol; - }; - - PullTypeResolver.prototype.typeCheckElementAccessExpression = function (callEx, context, symbolAndDiagnostic) { - this.setTypeChecked(callEx, context); - context.postDiagnostic(symbolAndDiagnostic.diagnostic); - }; - - PullTypeResolver.prototype.computeElementAccessExpressionSymbolAndDiagnostic = function (callEx, context) { - var targetSymbol = this.resolveAST(callEx.expression, false, context); - var indexType = this.resolveAST(callEx.argumentExpression, false, context).type; - - var targetTypeSymbol = targetSymbol.type; - - targetTypeSymbol = this.getApparentType(targetTypeSymbol); - - if (this.isAnyOrEquivalent(targetTypeSymbol)) { - return { symbol: targetTypeSymbol }; - } - - var elementType = targetTypeSymbol.getElementType(); - - var isNumberIndex = indexType === this.semanticInfoChain.numberTypeSymbol || TypeScript.PullHelpers.symbolIsEnum(indexType); - - if (elementType && isNumberIndex) { - return { symbol: elementType }; - } - - if (callEx.argumentExpression.kind() === 14 /* StringLiteral */ || callEx.argumentExpression.kind() === 13 /* NumericLiteral */) { - var memberName = callEx.argumentExpression.kind() === 14 /* StringLiteral */ ? TypeScript.stripStartAndEndQuotes(callEx.argumentExpression.text()) : callEx.argumentExpression.valueText(); - - var member = this._getNamedPropertySymbolOfAugmentedType(memberName, targetTypeSymbol); - - if (member) { - this.resolveDeclaredSymbol(member, context); - - return { symbol: member.type }; - } - } - - var signatures = this.getBothKindsOfIndexSignaturesIncludingAugmentedType(targetTypeSymbol, context); - - var stringSignature = signatures.stringSignature; - var numberSignature = signatures.numericSignature; - - if (numberSignature && (isNumberIndex || indexType === this.semanticInfoChain.anyTypeSymbol)) { - return { symbol: numberSignature.returnType || this.semanticInfoChain.anyTypeSymbol }; - } else if (stringSignature && (isNumberIndex || indexType === this.semanticInfoChain.anyTypeSymbol || indexType === this.semanticInfoChain.stringTypeSymbol)) { - return { symbol: stringSignature.returnType || this.semanticInfoChain.anyTypeSymbol }; - } else if (isNumberIndex || indexType === this.semanticInfoChain.anyTypeSymbol || indexType === this.semanticInfoChain.stringTypeSymbol) { - if (this.compilationSettings.noImplicitAny()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(callEx.argumentExpression, TypeScript.DiagnosticCode.Index_signature_of_object_type_implicitly_has_an_any_type)); - } - return { symbol: this.semanticInfoChain.anyTypeSymbol }; - } else { - return { - symbol: this.getNewErrorTypeSymbol(), - diagnostic: this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.Value_of_type_0_is_not_indexable_by_type_1, [targetTypeSymbol.toString(), indexType.toString()]) - }; - } - }; - - PullTypeResolver.prototype.getBothKindsOfIndexSignaturesIncludingAugmentedType = function (enclosingType, context) { - return this._getBothKindsOfIndexSignatures(enclosingType, context, true); - }; - - PullTypeResolver.prototype.getBothKindsOfIndexSignaturesExcludingAugmentedType = function (enclosingType, context) { - return this._getBothKindsOfIndexSignatures(enclosingType, context, false); - }; - - PullTypeResolver.prototype._getBothKindsOfIndexSignatures = function (enclosingType, context, includeAugmentedType) { - var signatures = includeAugmentedType ? enclosingType.getIndexSignaturesOfAugmentedType(this, this.cachedFunctionInterfaceType(), this.cachedObjectInterfaceType()) : enclosingType.getIndexSignatures(); - - var stringSignature = null; - var numberSignature = null; - var signature = null; - var paramSymbols; - var paramType; - - for (var i = 0; i < signatures.length; i++) { - if (stringSignature && numberSignature) { - break; - } - - signature = signatures[i]; - if (!signature.isResolved) { - this.resolveDeclaredSymbol(signature, context); - } - - paramSymbols = signature.parameters; - - if (paramSymbols.length) { - paramType = paramSymbols[0].type; - - if (!stringSignature && paramType === this.semanticInfoChain.stringTypeSymbol) { - stringSignature = signature; - continue; - } else if (!numberSignature && paramType === this.semanticInfoChain.numberTypeSymbol) { - numberSignature = signature; - continue; - } - } - } - - return { - numericSignature: numberSignature, - stringSignature: stringSignature - }; - }; - - PullTypeResolver.prototype._addUnhiddenSignaturesFromBaseType = function (derivedTypeSignatures, baseTypeSignatures, signaturesBeingAggregated) { - var _this = this; - if (!derivedTypeSignatures) { - signaturesBeingAggregated.push.apply(signaturesBeingAggregated, baseTypeSignatures); - return; - } - - var context = new TypeScript.PullTypeResolutionContext(this); - for (var i = 0; i < baseTypeSignatures.length; i++) { - var baseSignature = baseTypeSignatures[i]; - - var signatureIsHidden = TypeScript.ArrayUtilities.any(derivedTypeSignatures, function (sig) { - return _this.signaturesAreIdenticalWithNewEnclosingTypes(baseSignature, sig, context, false); - }); - - if (!signatureIsHidden) { - signaturesBeingAggregated.push(baseSignature); - } - } - }; - - PullTypeResolver.prototype.resolveBinaryAdditionOperation = function (binaryExpression, context) { - var lhsExpression = this.resolveAST(binaryExpression.left, false, context); - var lhsType = lhsExpression.type; - var rhsType = this.resolveAST(binaryExpression.right, false, context).type; - - if (TypeScript.PullHelpers.symbolIsEnum(lhsType)) { - lhsType = this.semanticInfoChain.numberTypeSymbol; - } - - if (TypeScript.PullHelpers.symbolIsEnum(rhsType)) { - rhsType = this.semanticInfoChain.numberTypeSymbol; - } - - var isLhsTypeNullOrUndefined = lhsType === this.semanticInfoChain.nullTypeSymbol || lhsType === this.semanticInfoChain.undefinedTypeSymbol; - var isRhsTypeNullOrUndefined = rhsType === this.semanticInfoChain.nullTypeSymbol || rhsType === this.semanticInfoChain.undefinedTypeSymbol; - - if (isLhsTypeNullOrUndefined) { - if (isRhsTypeNullOrUndefined) { - lhsType = rhsType = this.semanticInfoChain.anyTypeSymbol; - } else { - lhsType = rhsType; - } - } else if (isRhsTypeNullOrUndefined) { - rhsType = lhsType; - } - - var exprType = null; - - if (lhsType === this.semanticInfoChain.stringTypeSymbol || rhsType === this.semanticInfoChain.stringTypeSymbol) { - exprType = this.semanticInfoChain.stringTypeSymbol; - } else if (this.isAnyOrEquivalent(lhsType) || this.isAnyOrEquivalent(rhsType)) { - exprType = this.semanticInfoChain.anyTypeSymbol; - } else if (rhsType === this.semanticInfoChain.numberTypeSymbol && lhsType === this.semanticInfoChain.numberTypeSymbol) { - exprType = this.semanticInfoChain.numberTypeSymbol; - } - - if (this.canTypeCheckAST(binaryExpression, context)) { - this.setTypeChecked(binaryExpression, context); - - if (exprType) { - if (binaryExpression.kind() === 175 /* AddAssignmentExpression */) { - if (!this.isReference(binaryExpression.left, lhsExpression)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_of_assignment_expression)); - } - - this.checkAssignability(binaryExpression.left, exprType, lhsType, context); - } - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_expression_types_not_known_to_support_the_addition_operator)); - } - } - - if (!exprType) { - exprType = this.semanticInfoChain.anyTypeSymbol; - } - - return exprType; - }; - - PullTypeResolver.prototype.bestCommonTypeOfTwoTypes = function (type1, type2, context) { - return this.findBestCommonType({ - getLength: function () { - return 2; - }, - getTypeAtIndex: function (index) { - switch (index) { - case 0: - return type1; - case 1: - return type2; - } - } - }, context); - }; - - PullTypeResolver.prototype.bestCommonTypeOfThreeTypes = function (type1, type2, type3, context) { - return this.findBestCommonType({ - getLength: function () { - return 3; - }, - getTypeAtIndex: function (index) { - switch (index) { - case 0: - return type1; - case 1: - return type2; - case 2: - return type3; - } - } - }, context); - }; - - PullTypeResolver.prototype.resolveLogicalOrExpression = function (binex, isContextuallyTyped, context) { - if (this.canTypeCheckAST(binex, context)) { - this.setTypeChecked(binex, context); - } - - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - var leftType = this.resolveAST(binex.left, isContextuallyTyped, context).type; - var rightType = this.resolveAST(binex.right, isContextuallyTyped, context).type; - - return context.isInferentiallyTyping() ? this.bestCommonTypeOfTwoTypes(leftType, rightType, context) : this.bestCommonTypeOfThreeTypes(contextualType, leftType, rightType, context); - } else { - var leftType = this.resolveAST(binex.left, false, context).type; - - context.pushNewContextualType(leftType); - var rightType = this.resolveAST(binex.right, true, context).type; - context.popAnyContextualType(); - - return this.bestCommonTypeOfTwoTypes(leftType, rightType, context); - } - }; - - PullTypeResolver.prototype.resolveLogicalAndExpression = function (binex, context) { - if (this.canTypeCheckAST(binex, context)) { - this.setTypeChecked(binex, context); - - this.resolveAST(binex.left, false, context); - } - - return this.resolveAST(binex.right, false, context).type; - }; - - PullTypeResolver.prototype.computeTypeOfConditionalExpression = function (leftType, rightType, isContextuallyTyped, context) { - if (isContextuallyTyped && !context.isInferentiallyTyping()) { - var contextualType = context.getContextualType(); - return this.bestCommonTypeOfThreeTypes(contextualType, leftType, rightType, context); - } else { - return this.bestCommonTypeOfTwoTypes(leftType, rightType, context); - } - }; - - PullTypeResolver.prototype.resolveConditionalExpression = function (trinex, isContextuallyTyped, context) { - var leftType = this.resolveAST(trinex.whenTrue, isContextuallyTyped, context).type; - var rightType = this.resolveAST(trinex.whenFalse, isContextuallyTyped, context).type; - - var expressionType = this.computeTypeOfConditionalExpression(leftType, rightType, isContextuallyTyped, context); - - var conditionalTypesAreValid = this.conditionExpressionTypesAreValid(leftType, rightType, expressionType, isContextuallyTyped, context); - - if (this.canTypeCheckAST(trinex, context)) { - this.setTypeChecked(trinex, context); - this.resolveAST(trinex.condition, false, context); - - if (!this.conditionExpressionTypesAreValid(leftType, rightType, expressionType, isContextuallyTyped, context)) { - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(trinex, TypeScript.DiagnosticCode.Type_of_conditional_0_must_be_identical_to_1_2_or_3, [expressionType.toString(), leftType.toString(), rightType.toString(), contextualType.toString()])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(trinex, TypeScript.DiagnosticCode.Type_of_conditional_0_must_be_identical_to_1_or_2, [expressionType.toString(), leftType.toString(), rightType.toString()])); - } - } - } - - if (!conditionalTypesAreValid) { - return this.getNewErrorTypeSymbol(); - } - - return expressionType; - }; - - PullTypeResolver.prototype.conditionExpressionTypesAreValid = function (leftType, rightType, expressionType, isContextuallyTyped, context) { - if (isContextuallyTyped) { - var contextualType = context.getContextualType(); - if (this.typesAreIdentical(expressionType, leftType, context) || this.typesAreIdentical(expressionType, rightType, context) || this.typesAreIdentical(expressionType, contextualType, context)) { - return true; - } - } else { - if (this.typesAreIdentical(expressionType, leftType, context) || this.typesAreIdentical(expressionType, rightType, context)) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.resolveParenthesizedExpression = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - } - - return this.resolveAST(ast.expression, false, context); - }; - - PullTypeResolver.prototype.resolveExpressionStatement = function (ast, context) { - if (this.canTypeCheckAST(ast, context)) { - this.setTypeChecked(ast, context); - - this.resolveAST(ast.expression, false, context); - } - - return this.semanticInfoChain.voidTypeSymbol; - }; - - PullTypeResolver.prototype.resolveInvocationExpression = function (callEx, context, additionalResults) { - var symbol = this.getSymbolForAST(callEx, context); - - if (!symbol || !symbol.isResolved) { - if (!additionalResults) { - additionalResults = new PullAdditionalCallResolutionData(); - } - symbol = this.computeInvocationExpressionSymbol(callEx, context, additionalResults); - if (this.canTypeCheckAST(callEx, context)) { - this.setTypeChecked(callEx, context); - } - if (symbol !== this.semanticInfoChain.anyTypeSymbol) { - this.setSymbolForAST(callEx, symbol, context); - } - this.semanticInfoChain.setCallResolutionDataForAST(callEx, additionalResults); - } else { - if (this.canTypeCheckAST(callEx, context)) { - this.typeCheckInvocationExpression(callEx, context); - } - - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - if (additionalResults && (callResolutionData !== additionalResults)) { - additionalResults.actualParametersContextTypeSymbols = callResolutionData.actualParametersContextTypeSymbols; - additionalResults.candidateSignature = callResolutionData.candidateSignature; - additionalResults.resolvedSignatures = callResolutionData.resolvedSignatures; - additionalResults.targetSymbol = callResolutionData.targetSymbol; - } - } - - return symbol; - }; - - PullTypeResolver.prototype.typeCheckInvocationExpression = function (callEx, context) { - this.setTypeChecked(callEx, context); - var targetSymbol = this.resolveAST(callEx.expression, false, context); - - if (callEx.argumentList.arguments) { - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - - var len = callEx.argumentList.arguments.nonSeparatorCount(); - for (var i = 0; i < len; i++) { - var contextualType = callResolutionData.actualParametersContextTypeSymbols ? callResolutionData.actualParametersContextTypeSymbols[i] : null; - if (contextualType) { - context.pushNewContextualType(contextualType); - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - for (var i = 0; i < callResolutionData.diagnosticsFromOverloadResolution.length; i++) { - context.postDiagnostic(callResolutionData.diagnosticsFromOverloadResolution[i]); - } - }; - - PullTypeResolver.prototype.computeInvocationExpressionSymbol = function (callEx, context, additionalResults) { - var targetSymbol = this.resolveAST(callEx.expression, false, context); - var targetAST = this.getCallTargetErrorSpanAST(callEx); - - var targetTypeSymbol = targetSymbol.type; - if (this.isAnyOrEquivalent(targetTypeSymbol)) { - this.resolveAST(callEx.argumentList.arguments, false, context); - - if (callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()) { - if (targetTypeSymbol === this.semanticInfoChain.anyTypeSymbol) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Untyped_function_calls_may_not_accept_type_arguments), additionalResults, context); - return this.getNewErrorTypeSymbol(); - } - } - - return this.semanticInfoChain.anyTypeSymbol; - } - - var isSuperCall = false; - - if (callEx.expression.kind() === 50 /* SuperKeyword */) { - isSuperCall = true; - - if (targetTypeSymbol.isClass()) { - targetSymbol = targetTypeSymbol.getConstructorMethod(); - this.resolveDeclaredSymbol(targetSymbol, context); - targetTypeSymbol = targetSymbol.type; - } else { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Calls_to_super_are_only_valid_inside_a_class), additionalResults, context); - this.resolveAST(callEx.argumentList.arguments, false, context); - - return this.getNewErrorTypeSymbol(); - } - } - - var signatures = isSuperCall ? targetTypeSymbol.getConstructSignatures() : targetTypeSymbol.getCallSignatures(); - - if (!signatures.length && (targetTypeSymbol.kind === 33554432 /* ConstructorType */)) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, [targetTypeSymbol.toString()]), additionalResults, context); - } - - var explicitTypeArgs = null; - var couldNotFindGenericOverload = false; - var couldNotAssignToConstraint; - var constraintDiagnostic = null; - var typeArgumentCountDiagnostic = null; - var diagnostics = []; - - if (callEx.argumentList.typeArgumentList) { - explicitTypeArgs = []; - - if (callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()) { - for (var i = 0; i < callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount(); i++) { - explicitTypeArgs[i] = this.resolveTypeReference(callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorAt(i), context); - } - } - } - - var triedToInferTypeArgs = false; - - var resolvedSignatures = []; - var inferredOrExplicitTypeArgs; - var specializedSignature; - var typeParameters; - var typeConstraint = null; - var beforeResolutionSignatures = signatures; - var targetTypeReplacementMap = targetTypeSymbol.getTypeParameterArgumentMap(); - - for (var i = 0; i < signatures.length; i++) { - typeParameters = signatures[i].getTypeParameters(); - couldNotAssignToConstraint = false; - - if (signatures[i].isGeneric() && typeParameters.length) { - if (isSuperCall && targetTypeSymbol.isGeneric() && !callEx.argumentList.typeArgumentList) { - explicitTypeArgs = signatures[i].returnType.getTypeArguments(); - } - - if (explicitTypeArgs) { - if (explicitTypeArgs.length === typeParameters.length) { - inferredOrExplicitTypeArgs = explicitTypeArgs; - } else { - typeArgumentCountDiagnostic = typeArgumentCountDiagnostic || this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Signature_expected_0_type_arguments_got_1_instead, [typeParameters.length, explicitTypeArgs.length]); - continue; - } - } else { - TypeScript.Debug.assert(callEx.argumentList); - var typeArgumentInferenceContext = new TypeScript.InvocationTypeArgumentInferenceContext(this, context, signatures[i], callEx.argumentList.arguments); - inferredOrExplicitTypeArgs = this.inferArgumentTypesForSignature(typeArgumentInferenceContext, new TypeComparisonInfo(), context); - triedToInferTypeArgs = true; - } - - TypeScript.Debug.assert(inferredOrExplicitTypeArgs && inferredOrExplicitTypeArgs.length == typeParameters.length); - - var mutableTypeReplacementMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(targetTypeReplacementMap ? targetTypeReplacementMap : []); - TypeScript.PullInstantiationHelpers.updateMutableTypeParameterArgumentMap(typeParameters, inferredOrExplicitTypeArgs, mutableTypeReplacementMap); - var typeReplacementMap = mutableTypeReplacementMap.typeParameterArgumentMap; - - if (explicitTypeArgs) { - for (var j = 0; j < typeParameters.length; j++) { - typeConstraint = typeParameters[j].getConstraint(); - - if (typeConstraint) { - if (typeConstraint.isGeneric()) { - typeConstraint = this.instantiateType(typeConstraint, typeReplacementMap); - } - - if (!this.sourceIsAssignableToTarget(inferredOrExplicitTypeArgs[j], typeConstraint, targetAST, context, null, true)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(targetAST); - constraintDiagnostic = this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2, [inferredOrExplicitTypeArgs[j].toString(enclosingSymbol, true), typeConstraint.toString(enclosingSymbol, true), typeParameters[j].toString(enclosingSymbol, true)]); - couldNotAssignToConstraint = true; - } - - if (couldNotAssignToConstraint) { - break; - } - } - } - } - - if (couldNotAssignToConstraint) { - continue; - } - - specializedSignature = this.instantiateSignature(signatures[i], typeReplacementMap); - - if (specializedSignature) { - resolvedSignatures[resolvedSignatures.length] = specializedSignature; - } - } else { - if (!(callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount())) { - resolvedSignatures[resolvedSignatures.length] = signatures[i]; - } - } - } - - if (signatures.length && !resolvedSignatures.length) { - couldNotFindGenericOverload = true; - } - - signatures = resolvedSignatures; - - var errorCondition = null; - if (!signatures.length) { - additionalResults.targetSymbol = targetSymbol; - additionalResults.resolvedSignatures = beforeResolutionSignatures; - additionalResults.candidateSignature = beforeResolutionSignatures && beforeResolutionSignatures.length ? beforeResolutionSignatures[0] : null; - - additionalResults.actualParametersContextTypeSymbols = actualParametersContextTypeSymbols; - - this.resolveAST(callEx.argumentList.arguments, false, context); - - if (!couldNotFindGenericOverload) { - if (this.cachedFunctionInterfaceType() && this.sourceIsAssignableToTarget(targetTypeSymbol, this.cachedFunctionInterfaceType(), targetAST, context)) { - if (callEx.argumentList.typeArgumentList) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Non_generic_functions_may_not_accept_type_arguments), additionalResults, context); - } - return this.semanticInfoChain.anyTypeSymbol; - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature), additionalResults, context); - } else if (constraintDiagnostic) { - this.postOverloadResolutionDiagnostics(constraintDiagnostic, additionalResults, context); - } else if (typeArgumentCountDiagnostic) { - this.postOverloadResolutionDiagnostics(typeArgumentCountDiagnostic, additionalResults, context); - } else { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.Could_not_select_overload_for_call_expression), additionalResults, context); - } - - return this.getNewErrorTypeSymbol(); - } - - var signature = this.resolveOverloads(callEx, signatures, callEx.argumentList.typeArgumentList !== null, context, diagnostics); - var useBeforeResolutionSignatures = signature == null; - - if (!signature) { - for (var i = 0; i < diagnostics.length; i++) { - this.postOverloadResolutionDiagnostics(diagnostics[i], additionalResults, context); - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Could_not_select_overload_for_call_expression), additionalResults, context); - - errorCondition = this.getNewErrorTypeSymbol(); - - if (!signatures.length) { - return errorCondition; - } - - signature = signatures[0]; - } - - var rootSignature = signature.getRootSymbol(); - if (!rootSignature.isGeneric() && callEx.argumentList.typeArgumentList) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Non_generic_functions_may_not_accept_type_arguments), additionalResults, context); - } else if (rootSignature.isGeneric() && callEx.argumentList.typeArgumentList && rootSignature.getTypeParameters() && (callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount() !== rootSignature.getTypeParameters().length)) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Signature_expected_0_type_arguments_got_1_instead, [rootSignature.getTypeParameters().length, callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()]), additionalResults, context); - } - - var returnType = isSuperCall ? this.semanticInfoChain.voidTypeSymbol : signature.returnType; - - var actualParametersContextTypeSymbols = []; - if (callEx.argumentList.arguments) { - var len = callEx.argumentList.arguments.nonSeparatorCount(); - var params = signature.parameters; - var contextualType = null; - var signatureDecl = signature.getDeclarations()[0]; - - for (var i = 0; i < len; i++) { - if (params.length) { - if (i < params.length - 1 || (i < params.length && !signature.hasVarArgs)) { - this.resolveDeclaredSymbol(params[i], context); - contextualType = params[i].type; - } else if (signature.hasVarArgs) { - contextualType = params[params.length - 1].type; - if (contextualType.isArrayNamedTypeReference()) { - contextualType = contextualType.getElementType(); - } - } - } - - if (contextualType) { - context.pushNewContextualType(contextualType); - actualParametersContextTypeSymbols[i] = contextualType; - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - additionalResults.targetSymbol = targetSymbol; - if (useBeforeResolutionSignatures && beforeResolutionSignatures) { - additionalResults.resolvedSignatures = beforeResolutionSignatures; - additionalResults.candidateSignature = beforeResolutionSignatures[0]; - } else { - additionalResults.resolvedSignatures = signatures; - additionalResults.candidateSignature = signature; - } - additionalResults.actualParametersContextTypeSymbols = actualParametersContextTypeSymbols; - - if (errorCondition) { - return errorCondition; - } - - if (!returnType) { - returnType = this.semanticInfoChain.anyTypeSymbol; - } - - return returnType; - }; - - PullTypeResolver.prototype.resolveObjectCreationExpression = function (callEx, context, additionalResults) { - var symbol = this.getSymbolForAST(callEx, context); - - if (!symbol || !symbol.isResolved) { - if (!additionalResults) { - additionalResults = new PullAdditionalCallResolutionData(); - } - symbol = this.computeObjectCreationExpressionSymbol(callEx, context, additionalResults); - if (this.canTypeCheckAST(callEx, context)) { - this.setTypeChecked(callEx, context); - } - this.setSymbolForAST(callEx, symbol, context); - this.semanticInfoChain.setCallResolutionDataForAST(callEx, additionalResults); - } else { - if (this.canTypeCheckAST(callEx, context)) { - this.typeCheckObjectCreationExpression(callEx, context); - } - - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - if (additionalResults && (callResolutionData !== additionalResults)) { - additionalResults.actualParametersContextTypeSymbols = callResolutionData.actualParametersContextTypeSymbols; - additionalResults.candidateSignature = callResolutionData.candidateSignature; - additionalResults.resolvedSignatures = callResolutionData.resolvedSignatures; - additionalResults.targetSymbol = callResolutionData.targetSymbol; - } - } - - return symbol; - }; - - PullTypeResolver.prototype.typeCheckObjectCreationExpression = function (callEx, context) { - this.setTypeChecked(callEx, context); - this.resolveAST(callEx.expression, false, context); - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - if (callEx.argumentList) { - var callResolutionData = this.semanticInfoChain.getCallResolutionDataForAST(callEx); - var len = callEx.argumentList.arguments.nonSeparatorCount(); - - for (var i = 0; i < len; i++) { - var contextualType = callResolutionData.actualParametersContextTypeSymbols ? callResolutionData.actualParametersContextTypeSymbols[i] : null; - if (contextualType) { - context.pushNewContextualType(contextualType); - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - for (var i = 0; i < callResolutionData.diagnosticsFromOverloadResolution.length; i++) { - context.postDiagnostic(callResolutionData.diagnosticsFromOverloadResolution[i]); - } - }; - - PullTypeResolver.prototype.postOverloadResolutionDiagnostics = function (diagnostic, additionalResults, context) { - if (!context.inProvisionalResolution()) { - additionalResults.diagnosticsFromOverloadResolution.push(diagnostic); - } - context.postDiagnostic(diagnostic); - }; - - PullTypeResolver.prototype.computeObjectCreationExpressionSymbol = function (callEx, context, additionalResults) { - var _this = this; - var returnType = null; - - var targetSymbol = this.resolveAST(callEx.expression, false, context); - var targetTypeSymbol = targetSymbol.isType() ? targetSymbol : targetSymbol.type; - - var targetAST = this.getCallTargetErrorSpanAST(callEx); - - var constructSignatures = targetTypeSymbol.getConstructSignatures(); - - var explicitTypeArgs = null; - var usedCallSignaturesInstead = false; - var couldNotAssignToConstraint; - var constraintDiagnostic = null; - var typeArgumentCountDiagnostic = null; - var diagnostics = []; - - if (this.isAnyOrEquivalent(targetTypeSymbol)) { - if (callEx.argumentList) { - this.resolveAST(callEx.argumentList.arguments, false, context); - } - - return targetTypeSymbol; - } - - if (!constructSignatures.length) { - constructSignatures = targetTypeSymbol.getCallSignatures(); - usedCallSignaturesInstead = true; - - if (this.compilationSettings.noImplicitAny()) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(callEx, TypeScript.DiagnosticCode.new_expression_which_lacks_a_constructor_signature_implicitly_has_an_any_type), additionalResults, context); - } - } - - if (constructSignatures.length) { - if (callEx.argumentList && callEx.argumentList.typeArgumentList) { - explicitTypeArgs = []; - - if (callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount()) { - for (var i = 0; i < callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount(); i++) { - explicitTypeArgs[i] = this.resolveTypeReference(callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorAt(i), context); - } - } - } - - if (targetTypeSymbol.isGeneric()) { - var resolvedSignatures = []; - var inferredOrExplicitTypeArgs; - var specializedSignature; - var typeParameters; - var typeConstraint = null; - var triedToInferTypeArgs; - var targetTypeReplacementMap = targetTypeSymbol.getTypeParameterArgumentMap(); - - for (var i = 0; i < constructSignatures.length; i++) { - couldNotAssignToConstraint = false; - - if (constructSignatures[i].isGeneric()) { - typeParameters = constructSignatures[i].getTypeParameters(); - - if (explicitTypeArgs) { - if (explicitTypeArgs.length === typeParameters.length) { - inferredOrExplicitTypeArgs = explicitTypeArgs; - } else { - typeArgumentCountDiagnostic = typeArgumentCountDiagnostic || this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Signature_expected_0_type_arguments_got_1_instead, [typeParameters.length, explicitTypeArgs.length]); - continue; - } - } else if (callEx.argumentList) { - var typeArgumentInferenceContext = new TypeScript.InvocationTypeArgumentInferenceContext(this, context, constructSignatures[i], callEx.argumentList.arguments); - inferredOrExplicitTypeArgs = this.inferArgumentTypesForSignature(typeArgumentInferenceContext, new TypeComparisonInfo(), context); - triedToInferTypeArgs = true; - } else { - inferredOrExplicitTypeArgs = TypeScript.ArrayUtilities.select(typeParameters, function (typeParameter) { - return typeParameter.getDefaultConstraint(_this.semanticInfoChain); - }); - } - - TypeScript.Debug.assert(inferredOrExplicitTypeArgs && inferredOrExplicitTypeArgs.length == typeParameters.length); - - var mutableTypeReplacementMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(targetTypeReplacementMap ? targetTypeReplacementMap : []); - TypeScript.PullInstantiationHelpers.updateMutableTypeParameterArgumentMap(typeParameters, inferredOrExplicitTypeArgs, mutableTypeReplacementMap); - var typeReplacementMap = mutableTypeReplacementMap.typeParameterArgumentMap; - - if (explicitTypeArgs) { - for (var j = 0; j < typeParameters.length; j++) { - typeConstraint = typeParameters[j].getConstraint(); - - if (typeConstraint) { - if (typeConstraint.isGeneric()) { - typeConstraint = this.instantiateType(typeConstraint, typeReplacementMap); - } - - if (!this.sourceIsAssignableToTarget(inferredOrExplicitTypeArgs[j], typeConstraint, targetAST, context, null, true)) { - var enclosingSymbol = this.getEnclosingSymbolForAST(targetAST); - constraintDiagnostic = this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Type_0_does_not_satisfy_the_constraint_1_for_type_parameter_2, [inferredOrExplicitTypeArgs[j].toString(enclosingSymbol, true), typeConstraint.toString(enclosingSymbol, true), typeParameters[j].toString(enclosingSymbol, true)]); - couldNotAssignToConstraint = true; - } - - if (couldNotAssignToConstraint) { - break; - } - } - } - } - - if (couldNotAssignToConstraint) { - continue; - } - - specializedSignature = this.instantiateSignature(constructSignatures[i], typeReplacementMap); - - if (specializedSignature) { - resolvedSignatures[resolvedSignatures.length] = specializedSignature; - } - } else { - if (!(callEx.argumentList && callEx.argumentList.typeArgumentList && callEx.argumentList.typeArgumentList.typeArguments.nonSeparatorCount())) { - resolvedSignatures[resolvedSignatures.length] = constructSignatures[i]; - } - } - } - - constructSignatures = resolvedSignatures; - } - - var signature = this.resolveOverloads(callEx, constructSignatures, callEx.argumentList && callEx.argumentList.typeArgumentList !== null, context, diagnostics); - - additionalResults.targetSymbol = targetSymbol; - additionalResults.resolvedSignatures = constructSignatures; - additionalResults.candidateSignature = signature; - additionalResults.actualParametersContextTypeSymbols = []; - - if (!constructSignatures.length) { - if (constraintDiagnostic) { - this.postOverloadResolutionDiagnostics(constraintDiagnostic, additionalResults, context); - } else if (typeArgumentCountDiagnostic) { - this.postOverloadResolutionDiagnostics(typeArgumentCountDiagnostic, additionalResults, context); - } - - return this.getNewErrorTypeSymbol(); - } - - var errorCondition = null; - - if (!signature) { - for (var i = 0; i < diagnostics.length; i++) { - this.postOverloadResolutionDiagnostics(diagnostics[i], additionalResults, context); - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Could_not_select_overload_for_new_expression), additionalResults, context); - - errorCondition = this.getNewErrorTypeSymbol(); - - if (!constructSignatures.length) { - return errorCondition; - } - - signature = constructSignatures[0]; - } - - returnType = signature.returnType; - - if (returnType && !signature.isGeneric() && returnType.isGeneric() && !returnType.getIsSpecialized()) { - if (explicitTypeArgs && explicitTypeArgs.length) { - returnType = this.createInstantiatedType(returnType, explicitTypeArgs); - } else { - returnType = this.instantiateTypeToAny(returnType, context); - } - } - - if (usedCallSignaturesInstead) { - if (returnType !== this.semanticInfoChain.voidTypeSymbol) { - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Call_signatures_used_in_a_new_expression_must_have_a_void_return_type), additionalResults, context); - - return this.getNewErrorTypeSymbol(); - } else { - returnType = this.semanticInfoChain.anyTypeSymbol; - } - } - - if (!returnType) { - returnType = signature.returnType; - - if (!returnType) { - returnType = targetTypeSymbol; - } - } - - var actualParametersContextTypeSymbols = []; - if (callEx.argumentList && callEx.argumentList.arguments) { - var len = callEx.argumentList.arguments.nonSeparatorCount(); - var params = signature.parameters; - var contextualType = null; - var signatureDecl = signature.getDeclarations()[0]; - - for (var i = 0; i < len; i++) { - if (params.length) { - if (i < params.length - 1 || (i < params.length && !signature.hasVarArgs)) { - this.resolveDeclaredSymbol(params[i], context); - contextualType = params[i].type; - } else if (signature.hasVarArgs) { - contextualType = params[params.length - 1].type; - if (contextualType.isArrayNamedTypeReference()) { - contextualType = contextualType.getElementType(); - } - } - } - - if (contextualType) { - context.pushNewContextualType(contextualType); - actualParametersContextTypeSymbols[i] = contextualType; - } - - this.resolveAST(callEx.argumentList.arguments.nonSeparatorAt(i), contextualType !== null, context); - - if (contextualType) { - context.popAnyContextualType(); - contextualType = null; - } - } - } - - additionalResults.targetSymbol = targetSymbol; - additionalResults.resolvedSignatures = constructSignatures; - additionalResults.candidateSignature = signature; - additionalResults.actualParametersContextTypeSymbols = actualParametersContextTypeSymbols; - - if (errorCondition) { - return errorCondition; - } - - if (!returnType) { - returnType = this.semanticInfoChain.anyTypeSymbol; - } - - return returnType; - } else if (callEx.argumentList) { - this.resolveAST(callEx.argumentList.arguments, false, context); - } - - this.postOverloadResolutionDiagnostics(this.semanticInfoChain.diagnosticFromAST(targetAST, TypeScript.DiagnosticCode.Invalid_new_expression), additionalResults, context); - - return this.getNewErrorTypeSymbol(); - }; - - PullTypeResolver.prototype.instantiateSignatureInContext = function (signatureAToInstantiate, contextualSignatureB, context, shouldFixContextualSignatureParameterTypes) { - var typeReplacementMap = []; - var inferredTypeArgs; - var specializedSignature; - var typeParameters = signatureAToInstantiate.getTypeParameters(); - var typeConstraint = null; - - var typeArgumentInferenceContext = new TypeScript.ContextualSignatureInstantiationTypeArgumentInferenceContext(this, context, signatureAToInstantiate, contextualSignatureB, shouldFixContextualSignatureParameterTypes); - inferredTypeArgs = this.inferArgumentTypesForSignature(typeArgumentInferenceContext, new TypeComparisonInfo(), context); - - var functionTypeA = signatureAToInstantiate.functionType; - var functionTypeB = contextualSignatureB.functionType; - var enclosingTypeParameterMap; - - if (functionTypeA) { - enclosingTypeParameterMap = functionTypeA.getTypeParameterArgumentMap(); - - for (var id in enclosingTypeParameterMap) { - typeReplacementMap[id] = enclosingTypeParameterMap[id]; - } - } - - if (functionTypeB) { - enclosingTypeParameterMap = functionTypeB.getTypeParameterArgumentMap(); - - for (var id in enclosingTypeParameterMap) { - typeReplacementMap[id] = enclosingTypeParameterMap[id]; - } - } - - TypeScript.PullInstantiationHelpers.updateTypeParameterArgumentMap(typeParameters, inferredTypeArgs, typeReplacementMap); - - return this.instantiateSignature(signatureAToInstantiate, typeReplacementMap); - }; - - PullTypeResolver.prototype.resolveCastExpression = function (assertionExpression, context) { - var typeAssertionType = this.resolveTypeReference(assertionExpression.type, context).type; - - if (this.canTypeCheckAST(assertionExpression, context)) { - this.typeCheckCastExpression(assertionExpression, context, typeAssertionType); - } - - return typeAssertionType; - }; - - PullTypeResolver.prototype.typeCheckCastExpression = function (assertionExpression, context, typeAssertionType) { - this.setTypeChecked(assertionExpression, context); - - context.pushNewContextualType(typeAssertionType); - var exprType = this.resolveAST(assertionExpression.expression, true, context).type; - context.popAnyContextualType(); - - this.resolveDeclaredSymbol(typeAssertionType, context); - this.resolveDeclaredSymbol(exprType, context); - - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(exprType, typeAssertionType, assertionExpression, context, comparisonInfo); - - if (!isAssignable) { - var widenedExprType = exprType.widenedType(this, assertionExpression.expression, context); - isAssignable = this.sourceIsAssignableToTarget(typeAssertionType, widenedExprType, assertionExpression, context, comparisonInfo); - } - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(assertionExpression); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(assertionExpression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [exprType.toString(enclosingSymbol), typeAssertionType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(assertionExpression, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [exprType.toString(enclosingSymbol), typeAssertionType.toString(enclosingSymbol)])); - } - } - }; - - PullTypeResolver.prototype.resolveAssignmentExpression = function (binaryExpression, context) { - var leftExpr = this.resolveAST(binaryExpression.left, false, context); - var leftType = leftExpr.type; - - context.pushNewContextualType(leftType); - var rightType = this.resolveAST(binaryExpression.right, true, context).type; - context.popAnyContextualType(); - - rightType = this.getInstanceTypeForAssignment(binaryExpression.left, rightType, context); - - if (this.canTypeCheckAST(binaryExpression, context)) { - this.setTypeChecked(binaryExpression, context); - - if (!this.isReference(binaryExpression.left, leftExpr)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(binaryExpression.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_of_assignment_expression)); - } else { - this.checkAssignability(binaryExpression.left, rightType, leftExpr.type, context); - } - } - - return rightType; - }; - - PullTypeResolver.prototype.getInstanceTypeForAssignment = function (lhs, type, context) { - var typeToReturn = type; - if (typeToReturn && typeToReturn.isAlias()) { - typeToReturn = typeToReturn.getExportAssignedTypeSymbol(); - } - - if (typeToReturn && typeToReturn.isContainer() && !typeToReturn.isEnum()) { - var instanceTypeSymbol = typeToReturn.getInstanceType(); - - if (!instanceTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(lhs, TypeScript.DiagnosticCode.Tried_to_set_variable_type_to_uninitialized_module_type_0, [type.toString()])); - typeToReturn = null; - } else { - typeToReturn = instanceTypeSymbol; - } - } - - return typeToReturn; - }; - - PullTypeResolver.prototype.widenType = function (type, ast, context) { - if (type === this.semanticInfoChain.undefinedTypeSymbol || type === this.semanticInfoChain.nullTypeSymbol || type.isError()) { - return this.semanticInfoChain.anyTypeSymbol; - } - - if (type.isArrayNamedTypeReference()) { - return this.widenArrayType(type, ast, context); - } else if (type.kind === 256 /* ObjectLiteral */) { - return this.widenObjectLiteralType(type, ast, context); - } - - return type; - }; - - PullTypeResolver.prototype.widenArrayType = function (type, ast, context) { - var elementType = type.getElementType().widenedType(this, ast, context); - - if (this.compilationSettings.noImplicitAny() && ast) { - if (elementType === this.semanticInfoChain.anyTypeSymbol && type.getElementType() !== this.semanticInfoChain.anyTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Array_Literal_implicitly_has_an_any_type_from_widening)); - } - } - - return this.getArrayType(elementType); - }; - - PullTypeResolver.prototype.widenObjectLiteralType = function (type, ast, context) { - if (!this.needsToWidenObjectLiteralType(type, ast, context)) { - return type; - } - - TypeScript.Debug.assert(type.name === ""); - var newObjectTypeSymbol = new TypeScript.PullTypeSymbol(type.name, type.kind); - var declsOfObjectType = type.getDeclarations(); - TypeScript.Debug.assert(declsOfObjectType.length === 1); - newObjectTypeSymbol.addDeclaration(declsOfObjectType[0]); - var members = type.getMembers(); - - for (var i = 0; i < members.length; i++) { - var memberType = members[i].type; - - var widenedMemberType = members[i].type.widenedType(this, ast, context); - var newMember = new TypeScript.PullSymbol(members[i].name, members[i].kind); - - var declsOfMember = members[i].getDeclarations(); - - newMember.addDeclaration(declsOfMember[0]); - newMember.type = widenedMemberType; - newObjectTypeSymbol.addMember(newMember); - newMember.setResolved(); - - if (this.compilationSettings.noImplicitAny() && ast && widenedMemberType === this.semanticInfoChain.anyTypeSymbol && memberType !== this.semanticInfoChain.anyTypeSymbol) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Object_literal_s_property_0_implicitly_has_an_any_type_from_widening, [members[i].name])); - } - } - - var indexers = type.getIndexSignatures(); - for (var i = 0; i < indexers.length; i++) { - var newIndexer = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - var parameter = indexers[i].parameters[0]; - var newParameter = new TypeScript.PullSymbol(parameter.name, parameter.kind); - newParameter.type = parameter.type; - newIndexer.addParameter(newParameter); - newIndexer.returnType = indexers[i].returnType; - newObjectTypeSymbol.addIndexSignature(newIndexer); - } - - return newObjectTypeSymbol; - }; - - PullTypeResolver.prototype.needsToWidenObjectLiteralType = function (type, ast, context) { - var members = type.getMembers(); - for (var i = 0; i < members.length; i++) { - var memberType = members[i].type; - if (memberType !== memberType.widenedType(this, ast, context)) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.findBestCommonType = function (collection, context, comparisonInfo) { - var len = collection.getLength(); - - for (var i = 0; i < len; i++) { - var candidateType = collection.getTypeAtIndex(i); - if (this.typeIsBestCommonTypeCandidate(candidateType, collection, context)) { - return candidateType; - } - } - - return this.semanticInfoChain.emptyTypeSymbol; - }; - - PullTypeResolver.prototype.typeIsBestCommonTypeCandidate = function (candidateType, collection, context) { - for (var i = 0; i < collection.getLength(); i++) { - var otherType = collection.getTypeAtIndex(i); - if (candidateType === otherType) { - continue; - } - - if (!this.sourceIsSubtypeOfTarget(otherType, candidateType, null, context)) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.typesAreIdenticalInEnclosingTypes = function (t1, t2, context) { - t1 = this.getSymbolForRelationshipCheck(t1); - t2 = this.getSymbolForRelationshipCheck(t2); - - if (t1 === t2) { - return true; - } - - if (t1 && t2) { - if (context.oneOfClassificationsIsInfinitelyExpanding()) { - return this.infinitelyExpandingTypesAreIdentical(t1, t2, context); - } - } - - return this.typesAreIdentical(t1, t2, context); - }; - - PullTypeResolver.prototype.typesAreIdenticalWithNewEnclosingTypes = function (t1, t2, context) { - var enclosingTypeWalkerStates = context.resetEnclosingTypeWalkerStates(); - var areTypesIdentical = this.typesAreIdentical(t1, t2, context); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areTypesIdentical; - }; - - PullTypeResolver.prototype.typesAreIdentical = function (t1, t2, context) { - t1 = this.getSymbolForRelationshipCheck(t1); - t2 = this.getSymbolForRelationshipCheck(t2); - - if (t1 === t2) { - return true; - } - - if (!t1 || !t2) { - return false; - } - - if (TypeScript.hasFlag(t1.kind, 64 /* Enum */) || TypeScript.hasFlag(t2.kind, 64 /* Enum */)) { - return false; - } - - if (t1.isPrimitive() && t1.isStringConstant() && t2.isPrimitive() && t2.isStringConstant()) { - return TypeScript.stripStartAndEndQuotes(t1.name) === TypeScript.stripStartAndEndQuotes(t2.name); - } - - if (t1.isPrimitive() || t2.isPrimitive()) { - return false; - } - - if (t1.isError() && t2.isError()) { - return true; - } - - var isIdentical = this.identicalCache.valueAt(t1.pullSymbolID, t2.pullSymbolID); - if (isIdentical != undefined) { - return isIdentical; - } - - if (t1.isTypeParameter() !== t2.isTypeParameter()) { - return false; - } else if (t1.isTypeParameter()) { - var t1ParentDeclaration = t1.getDeclarations()[0].getParentDecl(); - var t2ParentDeclaration = t2.getDeclarations()[0].getParentDecl(); - - if (t1ParentDeclaration === t2ParentDeclaration) { - return this.symbolsShareDeclaration(t1, t2); - } else { - return false; - } - } - - if (t1.isPrimitive() !== t2.isPrimitive()) { - return false; - } - - this.identicalCache.setValueAt(t1.pullSymbolID, t2.pullSymbolID, true); - var statesWhenStartedWalkingTypes = context.startWalkingTypes(t1, t2); - isIdentical = this.typesAreIdenticalWorker(t1, t2, context); - context.endWalkingTypes(statesWhenStartedWalkingTypes); - this.identicalCache.setValueAt(t1.pullSymbolID, t2.pullSymbolID, isIdentical); - - return isIdentical; - }; - - PullTypeResolver.prototype.typesAreIdenticalWorker = function (t1, t2, context) { - if (t1.getIsSpecialized() && t2.getIsSpecialized()) { - if (TypeScript.PullHelpers.getRootType(t1) === TypeScript.PullHelpers.getRootType(t2) && TypeScript.PullHelpers.getRootType(t1).isNamedTypeSymbol()) { - var t1TypeArguments = t1.getTypeArguments(); - var t2TypeArguments = t2.getTypeArguments(); - - if (t1TypeArguments && t2TypeArguments) { - for (var i = 0; i < t1TypeArguments.length; i++) { - if (!this.typesAreIdenticalWithNewEnclosingTypes(t1TypeArguments[i], t2TypeArguments[i], context)) { - return false; - } - } - } - - return true; - } - } - - if (t1.hasMembers() && t2.hasMembers()) { - var t1Members = t1.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - var t2Members = t2.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - - if (t1Members.length !== t2Members.length) { - return false; - } - - var t1MemberSymbol = null; - var t2MemberSymbol = null; - - var t1MemberType = null; - var t2MemberType = null; - - for (var iMember = 0; iMember < t1Members.length; iMember++) { - t1MemberSymbol = t1Members[iMember]; - t2MemberSymbol = this.getNamedPropertySymbol(t1MemberSymbol.name, 68147712 /* SomeValue */, t2); - - if (!this.propertiesAreIdentical(t1MemberSymbol, t2MemberSymbol, context)) { - return false; - } - } - } else if (t1.hasMembers() || t2.hasMembers()) { - return false; - } - - var t1CallSigs = t1.getCallSignatures(); - var t2CallSigs = t2.getCallSignatures(); - - var t1ConstructSigs = t1.getConstructSignatures(); - var t2ConstructSigs = t2.getConstructSignatures(); - - var t1IndexSigs = t1.getIndexSignatures(); - var t2IndexSigs = t2.getIndexSignatures(); - - if (!this.signatureGroupsAreIdentical(t1CallSigs, t2CallSigs, context)) { - return false; - } - - if (!this.signatureGroupsAreIdentical(t1ConstructSigs, t2ConstructSigs, context)) { - return false; - } - - if (!this.signatureGroupsAreIdentical(t1IndexSigs, t2IndexSigs, context)) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.propertiesAreIdentical = function (propertySymbol1, propertySymbol2, context) { - if (!propertySymbol2 || (propertySymbol1.isOptional !== propertySymbol2.isOptional)) { - return false; - } - - var t1MemberSymbolIsPrivate = propertySymbol1.anyDeclHasFlag(2 /* Private */); - var t2MemberSymbolIsPrivate = propertySymbol2.anyDeclHasFlag(2 /* Private */); - - if (t1MemberSymbolIsPrivate !== t2MemberSymbolIsPrivate) { - return false; - } else if (t2MemberSymbolIsPrivate && t1MemberSymbolIsPrivate) { - var t1MemberSymbolDecl = propertySymbol1.getDeclarations()[0]; - var sourceDecl = propertySymbol2.getDeclarations()[0]; - if (t1MemberSymbolDecl !== sourceDecl) { - return false; - } - } - - var t1MemberType = propertySymbol1.type; - var t2MemberType = propertySymbol2.type; - - context.walkMemberTypes(propertySymbol1.name); - var areMemberTypesIdentical = this.typesAreIdenticalInEnclosingTypes(t1MemberType, t2MemberType, context); - context.postWalkMemberTypes(); - return areMemberTypesIdentical; - }; - - PullTypeResolver.prototype.propertiesAreIdenticalWithNewEnclosingTypes = function (type1, type2, property1, property2, context) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(type1, type2); - var arePropertiesIdentical = this.propertiesAreIdentical(property1, property2, context); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return arePropertiesIdentical; - }; - - PullTypeResolver.prototype.signatureGroupsAreIdentical = function (sg1, sg2, context) { - if (sg1 === sg2) { - return true; - } - - if (!sg1 || !sg2) { - return false; - } - - if (sg1.length !== sg2.length) { - return false; - } - - for (var i = 0; i < sg1.length; i++) { - context.walkSignatures(sg1[i].kind, i); - var areSignaturesIdentical = this.signaturesAreIdentical(sg1[i], sg2[i], context, true); - context.postWalkSignatures(); - if (!areSignaturesIdentical) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.typeParametersAreIdentical = function (tp1, tp2, context) { - var typeParamsAreIdentical = this.typeParametersAreIdenticalWorker(tp1, tp2, context); - - this.setTypeParameterIdentity(tp1, tp2, undefined); - - return typeParamsAreIdentical; - }; - - PullTypeResolver.prototype.typeParametersAreIdenticalWorker = function (tp1, tp2, context) { - if (!!(tp1 && tp1.length) !== !!(tp2 && tp2.length)) { - return false; - } - - if (tp1 && tp2 && (tp1.length !== tp2.length)) { - return false; - } - - if (tp1 && tp2) { - for (var i = 0; i < tp1.length; i++) { - context.walkTypeParameterConstraints(i); - var areConstraintsIdentical = this.typesAreIdentical(tp1[i].getConstraint(), tp2[i].getConstraint(), context); - context.postWalkTypeParameterConstraints(); - if (!areConstraintsIdentical) { - return false; - } - } - } - - return true; - }; - - PullTypeResolver.prototype.setTypeParameterIdentity = function (tp1, tp2, val) { - if (tp1 && tp2 && tp1.length === tp2.length) { - for (var i = 0; i < tp1.length; i++) { - this.identicalCache.setValueAt(tp1[i].pullSymbolID, tp2[i].pullSymbolID, val); - } - } - }; - - PullTypeResolver.prototype.signaturesAreIdenticalWithNewEnclosingTypes = function (s1, s2, context, includingReturnType) { - if (typeof includingReturnType === "undefined") { includingReturnType = true; } - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(s1, s2); - var areSignaturesIdentical = this.signaturesAreIdentical(s1, s2, context, includingReturnType); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSignaturesIdentical; - }; - - PullTypeResolver.prototype.signaturesAreIdentical = function (s1, s2, context, includingReturnType) { - if (typeof includingReturnType === "undefined") { includingReturnType = true; } - if (s1 === s2) { - return true; - } - - var signaturesIdentical = this.identicalCache.valueAt(s1.pullSymbolID, s2.pullSymbolID); - if (signaturesIdentical || (signaturesIdentical != undefined && includingReturnType)) { - return signaturesIdentical; - } - - var oldValue = signaturesIdentical; - this.identicalCache.setValueAt(s1.pullSymbolID, s2.pullSymbolID, true); - - signaturesIdentical = this.signaturesAreIdenticalWorker(s1, s2, context, includingReturnType); - - if (includingReturnType) { - this.identicalCache.setValueAt(s1.pullSymbolID, s2.pullSymbolID, signaturesIdentical); - } else { - this.identicalCache.setValueAt(s1.pullSymbolID, s2.pullSymbolID, oldValue); - } - - return signaturesIdentical; - }; - - PullTypeResolver.prototype.signaturesAreIdenticalWorker = function (s1, s2, context, includingReturnType) { - if (typeof includingReturnType === "undefined") { includingReturnType = true; } - if (s1.hasVarArgs !== s2.hasVarArgs) { - return false; - } - - if (s1.nonOptionalParamCount !== s2.nonOptionalParamCount) { - return false; - } - - if (s1.parameters.length !== s2.parameters.length) { - return false; - } - - var s1TypeParameters = s1.getTypeParameters(); - var s2TypeParameters = s2.getTypeParameters(); - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, true); - - var typeParametersParametersAndReturnTypesAreIdentical = this.signatureTypeParametersParametersAndReturnTypesAreIdentical(s1, s2, context, includingReturnType); - - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, undefined); - return typeParametersParametersAndReturnTypesAreIdentical; - }; - - PullTypeResolver.prototype.signatureTypeParametersParametersAndReturnTypesAreIdentical = function (s1, s2, context, includingReturnType) { - if (!this.typeParametersAreIdenticalWorker(s1.getTypeParameters(), s2.getTypeParameters(), context)) { - return false; - } - - if (includingReturnType) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s1); - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s2); - context.walkReturnTypes(); - var areReturnTypesIdentical = this.typesAreIdenticalInEnclosingTypes(s1.returnType, s2.returnType, context); - context.postWalkReturnTypes(); - if (!areReturnTypesIdentical) { - return false; - } - } - - var s1Params = s1.parameters; - var s2Params = s2.parameters; - - for (var iParam = 0; iParam < s1Params.length; iParam++) { - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s1Params[iParam]); - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(s2Params[iParam]); - context.walkParameterTypes(iParam); - var areParameterTypesIdentical = this.typesAreIdenticalInEnclosingTypes(s1Params[iParam].type, s2Params[iParam].type, context); - context.postWalkParameterTypes(); - - if (!areParameterTypesIdentical) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.signatureReturnTypesAreIdentical = function (s1, s2, context) { - var s1TypeParameters = s1.getTypeParameters(); - var s2TypeParameters = s2.getTypeParameters(); - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, true); - - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(s1, s2); - context.walkReturnTypes(); - var returnTypeIsIdentical = this.typesAreIdenticalInEnclosingTypes(s1.returnType, s2.returnType, context); - - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - - this.setTypeParameterIdentity(s1TypeParameters, s2TypeParameters, undefined); - - return returnTypeIsIdentical; - }; - - PullTypeResolver.prototype.symbolsShareDeclaration = function (symbol1, symbol2) { - var decls1 = symbol1.getDeclarations(); - var decls2 = symbol2.getDeclarations(); - - if (decls1.length && decls2.length) { - return decls1[0] === decls2[0]; - } - - return false; - }; - - PullTypeResolver.prototype.sourceIsSubtypeOfTarget = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - return this.sourceIsRelatableToTarget(source, target, false, this.subtypeCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.sourceMembersAreAssignableToTargetMembers = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceMembersAreAssignableToTargetMembers = this.sourceMembersAreRelatableToTargetMembers(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceMembersAreAssignableToTargetMembers; - }; - - PullTypeResolver.prototype.sourcePropertyIsAssignableToTargetProperty = function (source, target, sourceProp, targetProp, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var isSourcePropertyIsAssignableToTargetProperty = this.sourcePropertyIsRelatableToTargetProperty(source, target, sourceProp, targetProp, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return isSourcePropertyIsAssignableToTargetProperty; - }; - - PullTypeResolver.prototype.sourceCallSignaturesAreAssignableToTargetCallSignatures = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceCallSignaturesAssignableToTargetCallSignatures = this.sourceCallSignaturesAreRelatableToTargetCallSignatures(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceCallSignaturesAssignableToTargetCallSignatures; - }; - - PullTypeResolver.prototype.sourceConstructSignaturesAreAssignableToTargetConstructSignatures = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceConstructSignaturesAssignableToTargetConstructSignatures = this.sourceConstructSignaturesAreRelatableToTargetConstructSignatures(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceConstructSignaturesAssignableToTargetConstructSignatures; - }; - - PullTypeResolver.prototype.sourceIndexSignaturesAreAssignableToTargetIndexSignatures = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(source, target); - var areSourceIndexSignaturesAssignableToTargetIndexSignatures = this.sourceIndexSignaturesAreRelatableToTargetIndexSignatures(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return areSourceIndexSignaturesAssignableToTargetIndexSignatures; - }; - - PullTypeResolver.prototype.typeIsAssignableToFunction = function (source, ast, context) { - if (source.isFunctionType()) { - return true; - } - - return this.cachedFunctionInterfaceType() && this.sourceIsAssignableToTarget(source, this.cachedFunctionInterfaceType(), ast, context); - }; - - PullTypeResolver.prototype.signatureIsAssignableToTarget = function (s1, s2, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.setEnclosingTypeForSymbols(s1, s2); - var isSignatureIsAssignableToTarget = this.signatureIsRelatableToTarget(s1, s2, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return isSignatureIsAssignableToTarget; - }; - - PullTypeResolver.prototype.sourceIsAssignableToTarget = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - return this.sourceIsRelatableToTarget(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.sourceIsAssignableToTargetWithNewEnclosingTypes = function (source, target, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - return this.sourceIsRelatableToTargetWithNewEnclosingTypes(source, target, true, this.assignableCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.getSymbolForRelationshipCheck = function (symbol) { - if (symbol && symbol.isTypeReference()) { - return symbol.getReferencedTypeSymbol(); - } - - return symbol; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetInEnclosingTypes = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - source = this.getSymbolForRelationshipCheck(source); - target = this.getSymbolForRelationshipCheck(target); - - if (source === target) { - return true; - } - - if (source && target) { - if (context.oneOfClassificationsIsInfinitelyExpanding()) { - return this.infinitelyExpandingSourceTypeIsRelatableToTargetType(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - } - } - - return this.sourceIsRelatableToTarget(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetWithNewEnclosingTypes = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var enclosingTypeWalkerStates = context.resetEnclosingTypeWalkerStates(); - var isSourceRelatable = this.sourceIsRelatableToTarget(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - return isSourceRelatable; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetInCache = function (source, target, comparisonCache, comparisonInfo) { - var isRelatable = comparisonCache.valueAt(source.pullSymbolID, target.pullSymbolID); - - if (isRelatable) { - return { isRelatable: isRelatable }; - } - - if (isRelatable != undefined && !comparisonInfo) { - return { isRelatable: isRelatable }; - } - - return null; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTarget = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - source = this.getSymbolForRelationshipCheck(source); - target = this.getSymbolForRelationshipCheck(target); - - if (source === target) { - return true; - } - - if (!(source && target)) { - return true; - } - - var sourceApparentType = this.getApparentType(source); - - var isRelatableInfo = this.sourceIsRelatableToTargetInCache(source, target, comparisonCache, comparisonInfo); - if (isRelatableInfo) { - return isRelatableInfo.isRelatable; - } - - if (source === this.semanticInfoChain.stringTypeSymbol && target.isPrimitive() && target.isStringConstant()) { - return comparisonInfo && comparisonInfo.stringConstantVal && (comparisonInfo.stringConstantVal.kind() === 14 /* StringLiteral */) && (TypeScript.stripStartAndEndQuotes(comparisonInfo.stringConstantVal.text()) === TypeScript.stripStartAndEndQuotes(target.name)); - } - - if (assignableTo) { - if (this.isAnyOrEquivalent(source) || this.isAnyOrEquivalent(target)) { - return true; - } - } else { - if (this.isAnyOrEquivalent(target)) { - return true; - } - } - - if (target === this.semanticInfoChain.stringTypeSymbol && source.isPrimitive() && source.isStringConstant()) { - return true; - } - - if (source.isPrimitive() && source.isStringConstant() && target.isPrimitive() && target.isStringConstant()) { - return TypeScript.stripStartAndEndQuotes(source.name) === TypeScript.stripStartAndEndQuotes(target.name); - } - - if (source === this.semanticInfoChain.undefinedTypeSymbol) { - return true; - } - - if ((source === this.semanticInfoChain.nullTypeSymbol) && (target !== this.semanticInfoChain.undefinedTypeSymbol && target != this.semanticInfoChain.voidTypeSymbol)) { - return true; - } - - if (target === this.semanticInfoChain.voidTypeSymbol) { - if (source === this.semanticInfoChain.undefinedTypeSymbol || source == this.semanticInfoChain.nullTypeSymbol) { - return true; - } - - return false; - } else if (source === this.semanticInfoChain.voidTypeSymbol) { - if (target === this.semanticInfoChain.anyTypeSymbol) { - return true; - } - - return false; - } - - if (target === this.semanticInfoChain.numberTypeSymbol && TypeScript.PullHelpers.symbolIsEnum(source)) { - return true; - } - - if (source === this.semanticInfoChain.numberTypeSymbol && TypeScript.PullHelpers.symbolIsEnum(target)) { - return assignableTo; - } - - if (TypeScript.PullHelpers.symbolIsEnum(target) && TypeScript.PullHelpers.symbolIsEnum(source)) { - return this.symbolsShareDeclaration(target, source); - } - - if ((source.kind & 64 /* Enum */) || (target.kind & 64 /* Enum */)) { - return false; - } - - if (source.getIsSpecialized() && target.getIsSpecialized()) { - if (TypeScript.PullHelpers.getRootType(source) === TypeScript.PullHelpers.getRootType(target) && TypeScript.PullHelpers.getRootType(source).isNamedTypeSymbol()) { - var sourceTypeArguments = source.getTypeArguments(); - var targetTypeArguments = target.getTypeArguments(); - - if (sourceTypeArguments && targetTypeArguments) { - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, true); - - for (var i = 0; i < sourceTypeArguments.length; i++) { - if (!this.sourceIsRelatableToTargetWithNewEnclosingTypes(sourceTypeArguments[i], targetTypeArguments[i], assignableTo, comparisonCache, ast, context, null, isComparingInstantiatedSignatures)) { - break; - } - } - - if (i === sourceTypeArguments.length) { - return true; - } else { - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, undefined); - } - } - } - } - - if (target.isTypeParameter()) { - if (source.isTypeParameter()) { - if (!source.getConstraint()) { - return this.typesAreIdentical(target, source, context); - } else { - return this.isSourceTypeParameterConstrainedToTargetTypeParameter(source, target); - } - } else { - if (isComparingInstantiatedSignatures) { - target = target.getBaseConstraint(this.semanticInfoChain); - } else { - return this.typesAreIdentical(target, sourceApparentType, context); - } - } - } - - if (sourceApparentType.isPrimitive() || target.isPrimitive()) { - return false; - } - - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, true); - - var symbolsWhenStartedWalkingTypes = context.startWalkingTypes(sourceApparentType, target); - var isRelatable = this.sourceIsRelatableToTargetWorker(sourceApparentType, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.endWalkingTypes(symbolsWhenStartedWalkingTypes); - - comparisonCache.setValueAt(source.pullSymbolID, target.pullSymbolID, isRelatable); - return isRelatable; - }; - - PullTypeResolver.prototype.isSourceTypeParameterConstrainedToTargetTypeParameter = function (source, target) { - var current = source; - while (current && current.isTypeParameter()) { - if (current === target) { - return true; - } - - current = current.getConstraint(); - } - return false; - }; - - PullTypeResolver.prototype.sourceIsRelatableToTargetWorker = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - if (target.hasMembers() && !this.sourceMembersAreRelatableToTargetMembers(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - if (!this.sourceCallSignaturesAreRelatableToTargetCallSignatures(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - if (!this.sourceConstructSignaturesAreRelatableToTargetConstructSignatures(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - if (!this.sourceIndexSignaturesAreRelatableToTargetIndexSignatures(source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.sourceMembersAreRelatableToTargetMembers = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetProps = target.getAllMembers(68147712 /* SomeValue */, 0 /* all */); - - for (var itargetProp = 0; itargetProp < targetProps.length; itargetProp++) { - var targetProp = targetProps[itargetProp]; - - var sourceProp = this._getNamedPropertySymbolOfAugmentedType(targetProp.name, source); - - this.resolveDeclaredSymbol(targetProp, context); - - var targetPropType = targetProp.type; - - if (!sourceProp) { - if (!(targetProp.isOptional)) { - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.flags |= 2 /* RequiredPropertyIsMissing */; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_0_is_missing_property_1_from_type_2, [source.toString(enclosingSymbol), targetProp.getScopedNameEx().toString(), target.toString(enclosingSymbol)])); - } - return false; - } - continue; - } - - if (!this.sourcePropertyIsRelatableToTargetProperty(source, target, sourceProp, targetProp, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures)) { - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.infinitelyExpandingSourceTypeIsRelatableToTargetType = function (sourceType, targetType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var widenedTargetType = targetType.widenedType(this, null, context); - var widenedSourceType = sourceType.widenedType(this, null, context); - - if ((widenedSourceType !== this.semanticInfoChain.anyTypeSymbol) && (widenedTargetType !== this.semanticInfoChain.anyTypeSymbol)) { - var sourceTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(sourceType); - var targetTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(targetType); - - if (sourceTypeNamedTypeReference !== targetTypeNamedTypeReference) { - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_do_not_refer_to_same_named_type, [sourceType.getScopedNameEx(enclosingSymbol).toString(), targetType.toString(enclosingSymbol)])); - } - return false; - } - - var sourceTypeArguments = sourceType.getTypeArguments(); - var targetTypeArguments = targetType.getTypeArguments(); - - if (!sourceTypeArguments && !targetTypeArguments) { - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, true); - return true; - } - - if (!(sourceTypeArguments && targetTypeArguments) || sourceTypeArguments.length !== targetTypeArguments.length) { - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments, [sourceType.toString(enclosingSymbol), targetType.toString(enclosingSymbol)])); - } - return false; - } - - var comparisonInfoTypeArgumentsCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoTypeArgumentsCheck = new TypeComparisonInfo(comparisonInfo); - } - var isRelatable = true; - for (var i = 0; i < sourceTypeArguments.length && isRelatable; i++) { - context.walkTypeArgument(i); - - if (!this.sourceIsRelatableToTargetInEnclosingTypes(sourceTypeArguments[i], targetTypeArguments[i], assignableTo, comparisonCache, ast, context, comparisonInfoTypeArgumentsCheck, isComparingInstantiatedSignatures)) { - isRelatable = false; - if (comparisonInfo) { - var message; - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - - if (comparisonInfoTypeArgumentsCheck && comparisonInfoTypeArgumentsCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments_NL_2, [sourceType.toString(enclosingSymbol), targetType.toString(enclosingSymbol), comparisonInfoTypeArgumentsCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments, [sourceType.toString(enclosingSymbol), targetType.toString(enclosingSymbol)]); - } - comparisonInfo.addMessage(message); - } - } - - context.postWalkTypeArgument(); - } - } - - comparisonCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, isRelatable); - return isRelatable; - }; - - PullTypeResolver.prototype.infinitelyExpandingTypesAreIdentical = function (sourceType, targetType, context) { - var widenedTargetType = targetType.widenedType(this, null, null); - var widenedSourceType = sourceType.widenedType(this, null, null); - - if ((widenedSourceType !== this.semanticInfoChain.anyTypeSymbol) && (widenedTargetType !== this.semanticInfoChain.anyTypeSymbol)) { - var sourceTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(sourceType); - var targetTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(targetType); - if (sourceTypeNamedTypeReference !== targetTypeNamedTypeReference) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - return false; - } - - var sourceTypeArguments = sourceType.getTypeArguments(); - var targetTypeArguments = targetType.getTypeArguments(); - - if (!sourceTypeArguments && !targetTypeArguments) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, true); - return true; - } - - if (!(sourceTypeArguments && targetTypeArguments) || sourceTypeArguments.length !== targetTypeArguments.length) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - return false; - } - - for (var i = 0; i < sourceTypeArguments.length; i++) { - context.walkTypeArgument(i); - var areIdentical = this.typesAreIdenticalInEnclosingTypes(sourceTypeArguments[i], targetTypeArguments[i], context); - context.postWalkTypeArgument(); - - if (!areIdentical) { - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, false); - return false; - } - } - } - - this.identicalCache.setValueAt(sourceType.pullSymbolID, targetType.pullSymbolID, true); - return true; - }; - - PullTypeResolver.prototype.sourcePropertyIsRelatableToTargetProperty = function (source, target, sourceProp, targetProp, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var _this = this; - var sourceAndTargetAreConstructors = source.isConstructor() && target.isConstructor(); - - var getNames = function (takeTypesFromPropertyContainers) { - var enclosingSymbol = _this.getEnclosingSymbolForAST(ast); - var sourceType = takeTypesFromPropertyContainers ? sourceProp.getContainer() : source; - var targetType = takeTypesFromPropertyContainers ? targetProp.getContainer() : target; - if (sourceAndTargetAreConstructors) { - sourceType = sourceType.getAssociatedContainerType(); - targetType = targetType.getAssociatedContainerType(); - } - return { - propertyName: targetProp.getScopedNameEx().toString(), - sourceTypeName: sourceType.toString(enclosingSymbol), - targetTypeName: targetType.toString(enclosingSymbol) - }; - }; - - var targetPropIsPrivate = targetProp.anyDeclHasFlag(2 /* Private */); - var sourcePropIsPrivate = sourceProp.anyDeclHasFlag(2 /* Private */); - - if (targetPropIsPrivate !== sourcePropIsPrivate) { - if (comparisonInfo) { - var names = getNames(true); - var code; - if (targetPropIsPrivate) { - code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Static_property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2 : TypeScript.DiagnosticCode.Property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2; - } else { - code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Static_property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2 : TypeScript.DiagnosticCode.Property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2; - } - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(code, [names.propertyName, names.sourceTypeName, names.targetTypeName])); - comparisonInfo.flags |= 128 /* InconsistantPropertyAccesibility */; - } - return false; - } else if (sourcePropIsPrivate && targetPropIsPrivate) { - var targetDecl = targetProp.getDeclarations()[0]; - var sourceDecl = sourceProp.getDeclarations()[0]; - - if (targetDecl !== sourceDecl) { - if (comparisonInfo) { - var names = getNames(true); - - comparisonInfo.flags |= 128 /* InconsistantPropertyAccesibility */; - var code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Types_0_and_1_define_static_property_2_as_private : TypeScript.DiagnosticCode.Types_0_and_1_define_property_2_as_private; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(code, [names.sourceTypeName, names.targetTypeName, names.propertyName])); - } - - return false; - } - } - - if (sourceProp.isOptional && !targetProp.isOptional) { - if (comparisonInfo) { - var names = getNames(true); - comparisonInfo.flags |= 2 /* RequiredPropertyIsMissing */; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Property_0_defined_as_optional_in_type_1_but_is_required_in_type_2, [names.propertyName, names.sourceTypeName, names.targetTypeName])); - } - return false; - } - - this.resolveDeclaredSymbol(sourceProp, context); - - var sourcePropType = sourceProp.type; - var targetPropType = targetProp.type; - - var isRelatableInfo = this.sourceIsRelatableToTargetInCache(sourcePropType, targetPropType, comparisonCache, comparisonInfo); - if (isRelatableInfo) { - return isRelatableInfo.isRelatable; - } - - var comparisonInfoPropertyTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoPropertyTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - context.walkMemberTypes(targetProp.name); - var isSourcePropertyRelatableToTargetProperty = this.sourceIsRelatableToTargetInEnclosingTypes(sourcePropType, targetPropType, assignableTo, comparisonCache, ast, context, comparisonInfoPropertyTypeCheck, isComparingInstantiatedSignatures); - context.postWalkMemberTypes(); - - if (!isSourcePropertyRelatableToTargetProperty && comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - comparisonInfo.flags |= 32 /* IncompatiblePropertyTypes */; - var message; - var names = getNames(false); - if (comparisonInfoPropertyTypeCheck && comparisonInfoPropertyTypeCheck.message) { - var code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Types_of_static_property_0_of_class_1_and_class_2_are_incompatible_NL_3 : TypeScript.DiagnosticCode.Types_of_property_0_of_types_1_and_2_are_incompatible_NL_3; - message = TypeScript.getDiagnosticMessage(code, [names.propertyName, names.sourceTypeName, names.targetTypeName, comparisonInfoPropertyTypeCheck.message]); - } else { - var code = sourceAndTargetAreConstructors ? TypeScript.DiagnosticCode.Types_of_static_property_0_of_class_1_and_class_2_are_incompatible : TypeScript.DiagnosticCode.Types_of_property_0_of_types_1_and_2_are_incompatible; - message = TypeScript.getDiagnosticMessage(code, [names.propertyName, names.sourceTypeName, names.targetTypeName]); - } - comparisonInfo.addMessage(message); - } - - return isSourcePropertyRelatableToTargetProperty; - }; - - PullTypeResolver.prototype.sourceCallSignaturesAreRelatableToTargetCallSignatures = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetCallSigs = target.getCallSignatures(); - - if (targetCallSigs.length) { - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - var sourceCallSigs = source.getCallSignatures(); - if (!this.signatureGroupIsRelatableToTarget(source, target, sourceCallSigs, targetCallSigs, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures)) { - if (comparisonInfo) { - var message; - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - if (sourceCallSigs.length && targetCallSigs.length) { - if (comparisonInfoSignatuesTypeCheck && comparisonInfoSignatuesTypeCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Call_signatures_of_types_0_and_1_are_incompatible_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfoSignatuesTypeCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Call_signatures_of_types_0_and_1_are_incompatible, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)]); - } - } else { - var hasSig = targetCallSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - var lacksSig = !targetCallSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_0_requires_a_call_signature_but_type_1_lacks_one, [hasSig, lacksSig]); - } - comparisonInfo.flags |= 4 /* IncompatibleSignatures */; - comparisonInfo.addMessage(message); - } - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.sourceConstructSignaturesAreRelatableToTargetConstructSignatures = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetConstructSigs = target.getConstructSignatures(); - if (targetConstructSigs.length) { - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - var sourceConstructSigs = source.getConstructSignatures(); - if (!this.signatureGroupIsRelatableToTarget(source, target, sourceConstructSigs, targetConstructSigs, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures)) { - if (comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - var message; - if (sourceConstructSigs.length && targetConstructSigs.length) { - if (comparisonInfoSignatuesTypeCheck && comparisonInfoSignatuesTypeCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Construct_signatures_of_types_0_and_1_are_incompatible_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfoSignatuesTypeCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Construct_signatures_of_types_0_and_1_are_incompatible, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)]); - } - } else { - var hasSig = targetConstructSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - var lacksSig = !targetConstructSigs.length ? target.toString(enclosingSymbol) : source.toString(enclosingSymbol); - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_0_requires_a_construct_signature_but_type_1_lacks_one, [hasSig, lacksSig]); - } - comparisonInfo.flags |= 4 /* IncompatibleSignatures */; - comparisonInfo.addMessage(message); - } - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.sourceIndexSignaturesAreRelatableToTargetIndexSignatures = function (source, target, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var targetIndexSigs = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(target, context); - var targetStringSig = targetIndexSigs.stringSignature; - var targetNumberSig = targetIndexSigs.numericSignature; - - if (targetStringSig || targetNumberSig) { - var sourceIndexSigs = this.getBothKindsOfIndexSignaturesIncludingAugmentedType(source, context); - var enclosingTypeIndexSigs = context.getBothKindOfIndexSignatures(true, false); - var sourceStringSig = sourceIndexSigs.stringSignature; - var sourceNumberSig = sourceIndexSigs.numericSignature; - - var comparable = true; - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo && !comparisonInfo.onlyCaptureFirstError) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo); - } - - if (targetStringSig) { - if (sourceStringSig) { - context.walkIndexSignatureReturnTypes(enclosingTypeIndexSigs, true, true); - comparable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceStringSig.returnType, targetStringSig.returnType, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures); - context.postWalkIndexSignatureReturnTypes(); - } else { - comparable = false; - } - } - - if (comparable && targetNumberSig) { - if (sourceNumberSig) { - context.walkIndexSignatureReturnTypes(enclosingTypeIndexSigs, false, false); - comparable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceNumberSig.returnType, targetNumberSig.returnType, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures); - context.postWalkIndexSignatureReturnTypes(); - } else if (sourceStringSig) { - context.walkIndexSignatureReturnTypes(enclosingTypeIndexSigs, true, false); - comparable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceStringSig.returnType, targetNumberSig.returnType, assignableTo, comparisonCache, ast, context, comparisonInfoSignatuesTypeCheck, isComparingInstantiatedSignatures); - context.postWalkIndexSignatureReturnTypes(); - } else { - comparable = false; - } - } - - if (!comparable) { - if (comparisonInfo) { - var message; - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - if (comparisonInfoSignatuesTypeCheck && comparisonInfoSignatuesTypeCheck.message) { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Index_signatures_of_types_0_and_1_are_incompatible_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfoSignatuesTypeCheck.message]); - } else { - message = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Index_signatures_of_types_0_and_1_are_incompatible, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)]); - } - comparisonInfo.flags |= 4 /* IncompatibleSignatures */; - comparisonInfo.addMessage(message); - } - return false; - } - } - - return true; - }; - - PullTypeResolver.prototype.signatureGroupIsRelatableToTarget = function (source, target, sourceSG, targetSG, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - if (sourceSG === targetSG) { - return true; - } - - if (!(sourceSG.length && targetSG.length)) { - return false; - } - - var foundMatch = false; - - var targetExcludeDefinition = targetSG.length > 1; - var sourceExcludeDefinition = sourceSG.length > 1; - var sigsCompared = 0; - var comparisonInfoSignatuesTypeCheck = null; - if (comparisonInfo) { - comparisonInfoSignatuesTypeCheck = new TypeComparisonInfo(comparisonInfo, true); - comparisonInfoSignatuesTypeCheck.message = comparisonInfo.message; - } - for (var iMSig = 0; iMSig < targetSG.length; iMSig++) { - var mSig = targetSG[iMSig]; - - if (mSig.isStringConstantOverloadSignature() || (targetExcludeDefinition && mSig.isDefinition())) { - continue; - } - - for (var iNSig = 0; iNSig < sourceSG.length; iNSig++) { - var nSig = sourceSG[iNSig]; - - if (nSig.isStringConstantOverloadSignature() || (sourceExcludeDefinition && nSig.isDefinition())) { - continue; - } - - context.walkSignatures(nSig.kind, iNSig, iMSig); - var isSignatureRelatableToTarget = this.signatureIsRelatableToTarget(nSig, mSig, assignableTo, comparisonCache, ast, context, sigsCompared == 0 ? comparisonInfoSignatuesTypeCheck : null, isComparingInstantiatedSignatures); - context.postWalkSignatures(); - - sigsCompared++; - - if (isSignatureRelatableToTarget) { - foundMatch = true; - break; - } - } - - if (foundMatch) { - foundMatch = false; - continue; - } - - if (comparisonInfo && sigsCompared == 1) { - comparisonInfo.message = comparisonInfoSignatuesTypeCheck.message; - } - - return false; - } - - return true; - }; - - PullTypeResolver.prototype.signatureIsRelatableToTarget = function (sourceSig, targetSig, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var isRelatableInfo = this.sourceIsRelatableToTargetInCache(sourceSig, targetSig, comparisonCache, comparisonInfo); - if (isRelatableInfo) { - return isRelatableInfo.isRelatable; - } - - comparisonCache.setValueAt(sourceSig.pullSymbolID, targetSig.pullSymbolID, true); - var isRelatable = this.signatureIsRelatableToTargetWorker(sourceSig, targetSig, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - comparisonCache.setValueAt(sourceSig.pullSymbolID, targetSig.pullSymbolID, isRelatable); - return isRelatable; - }; - - PullTypeResolver.prototype.signatureIsRelatableToTargetWorker = function (sourceSig, targetSig, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures) { - var _this = this; - var sourceParameters = sourceSig.parameters; - var targetParameters = targetSig.parameters; - - if (!sourceParameters || !targetParameters) { - return false; - } - - var targetNonOptionalParamCount = targetSig.nonOptionalParamCount; - var sourceNonOptionalParamCount = sourceSig.nonOptionalParamCount; - - if (!targetSig.hasVarArgs && sourceNonOptionalParamCount > targetParameters.length) { - if (comparisonInfo) { - comparisonInfo.flags |= 3 /* SourceSignatureHasTooManyParameters */; - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Call_signature_expects_0_or_fewer_parameters, [targetParameters.length])); - } - return false; - } - - if (this.signaturesAreIdentical(sourceSig, targetSig, context)) { - return true; - } - - if (targetSig.isGeneric()) { - targetSig = this.instantiateSignatureToAny(targetSig); - } - - if (sourceSig.isGeneric()) { - sourceSig = this.instantiateSignatureToAny(sourceSig); - } - - var sourceReturnType = sourceSig.returnType; - var targetReturnType = targetSig.returnType; - - if (targetReturnType !== this.semanticInfoChain.voidTypeSymbol) { - context.walkReturnTypes(); - var returnTypesAreRelatable = this.sourceIsRelatableToTargetInEnclosingTypes(sourceReturnType, targetReturnType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.postWalkReturnTypes(); - if (!returnTypesAreRelatable) { - if (comparisonInfo) { - comparisonInfo.flags |= 16 /* IncompatibleReturnTypes */; - } - - return false; - } - } - - return targetSig.forAllCorrespondingParameterTypesInThisAndOtherSignature(sourceSig, function (targetParamType, sourceParamType, iParam) { - context.walkParameterTypes(iParam); - var areParametersRelatable = _this.sourceIsRelatableToTargetInEnclosingTypes(sourceParamType, targetParamType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - if (!areParametersRelatable) { - context.swapEnclosingTypeWalkers(); - areParametersRelatable = _this.sourceIsRelatableToTargetInEnclosingTypes(targetParamType, sourceParamType, assignableTo, comparisonCache, ast, context, comparisonInfo, isComparingInstantiatedSignatures); - context.swapEnclosingTypeWalkers(); - } - context.postWalkParameterTypes(); - - if (!areParametersRelatable) { - if (comparisonInfo) { - comparisonInfo.flags |= 64 /* IncompatibleParameterTypes */; - } - } - - return areParametersRelatable; - }); - }; - - PullTypeResolver.prototype.resolveOverloads = function (application, group, haveTypeArgumentsAtCallSite, context, diagnostics) { - var _this = this; - var hasOverloads = group.length > 1; - var comparisonInfo = new TypeComparisonInfo(); - var args = application.argumentList ? application.argumentList.arguments : null; - - var initialCandidates = TypeScript.ArrayUtilities.where(group, function (signature) { - if (hasOverloads && signature.isDefinition()) { - return false; - } - - var rootSignature = signature.getRootSymbol(); - if (haveTypeArgumentsAtCallSite && !rootSignature.isGeneric()) { - return false; - } - - return _this.overloadHasCorrectArity(signature, args); - }); - - var firstAssignableButNotSupertypeSignature = null; - var firstAssignableWithProvisionalErrorsSignature = null; - - for (var i = 0; i < initialCandidates.length; i++) { - var applicability = this.overloadIsApplicable(initialCandidates[i], args, context, comparisonInfo); - if (applicability === 3 /* Subtype */) { - return initialCandidates[i]; - } else if (applicability === 2 /* AssignableWithNoProvisionalErrors */ && !firstAssignableButNotSupertypeSignature) { - firstAssignableButNotSupertypeSignature = initialCandidates[i]; - } else if (applicability === 1 /* AssignableButWithProvisionalErrors */ && !firstAssignableWithProvisionalErrorsSignature) { - firstAssignableWithProvisionalErrorsSignature = initialCandidates[i]; - } - } - - if (firstAssignableButNotSupertypeSignature || firstAssignableWithProvisionalErrorsSignature) { - return firstAssignableButNotSupertypeSignature || firstAssignableWithProvisionalErrorsSignature; - } else { - var target = this.getCallTargetErrorSpanAST(application); - if (comparisonInfo.message) { - diagnostics.push(this.semanticInfoChain.diagnosticFromAST(target, TypeScript.DiagnosticCode.Supplied_parameters_do_not_match_any_signature_of_call_target_NL_0, [comparisonInfo.message])); - } else { - diagnostics.push(this.semanticInfoChain.diagnosticFromAST(target, TypeScript.DiagnosticCode.Supplied_parameters_do_not_match_any_signature_of_call_target, null)); - } - } - - return null; - }; - - PullTypeResolver.prototype.getCallTargetErrorSpanAST = function (callEx) { - return (callEx.expression.kind() === 212 /* MemberAccessExpression */) ? callEx.expression.name : callEx.expression; - }; - - PullTypeResolver.prototype.overloadHasCorrectArity = function (signature, args) { - if (args == null) { - return signature.nonOptionalParamCount === 0; - } - - var numberOfArgs = (args.nonSeparatorCount() && args.nonSeparatorCount() === args.separatorCount()) ? args.separatorCount() + 1 : args.nonSeparatorCount(); - if (numberOfArgs < signature.nonOptionalParamCount) { - return false; - } - if (!signature.hasVarArgs && numberOfArgs > signature.parameters.length) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.overloadIsApplicable = function (signature, args, context, comparisonInfo) { - if (args === null) { - return 3 /* Subtype */; - } - - var isInVarArg = false; - var parameters = signature.parameters; - var paramType = null; - - var overloadApplicability = 3 /* Subtype */; - - for (var i = 0; i < args.nonSeparatorCount(); i++) { - if (!isInVarArg) { - this.resolveDeclaredSymbol(parameters[i], context); - - if (parameters[i].isVarArg) { - paramType = parameters[i].type.getElementType() || this.getNewErrorTypeSymbol(parameters[i].type.getName()); - isInVarArg = true; - } else { - paramType = parameters[i].type; - } - } - - var statusOfCurrentArgument = this.overloadIsApplicableForArgument(paramType, args.nonSeparatorAt(i), i, context, comparisonInfo); - - if (statusOfCurrentArgument === 0 /* NotAssignable */) { - return 0 /* NotAssignable */; - } else if (statusOfCurrentArgument === 1 /* AssignableButWithProvisionalErrors */) { - overloadApplicability = 1 /* AssignableButWithProvisionalErrors */; - } else if (overloadApplicability !== 1 /* AssignableButWithProvisionalErrors */ && statusOfCurrentArgument === 2 /* AssignableWithNoProvisionalErrors */) { - overloadApplicability = 2 /* AssignableWithNoProvisionalErrors */; - } - } - - return overloadApplicability; - }; - - PullTypeResolver.prototype.overloadIsApplicableForArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - if (paramType.isAny()) { - return 3 /* Subtype */; - } else if (paramType.isError()) { - return 1 /* AssignableButWithProvisionalErrors */; - } else if (arg.kind() === 219 /* SimpleArrowFunctionExpression */) { - var simpleArrowFunction = arg; - return this.overloadIsApplicableForAnyFunctionExpressionArgument(paramType, arg, null, TypeScript.ASTHelpers.parametersFromIdentifier(simpleArrowFunction.identifier), null, simpleArrowFunction.block, simpleArrowFunction.expression, argIndex, context, comparisonInfo); - } else if (arg.kind() === 218 /* ParenthesizedArrowFunctionExpression */) { - var arrowFunction = arg; - return this.overloadIsApplicableForAnyFunctionExpressionArgument(paramType, arg, arrowFunction.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(arrowFunction.callSignature.parameterList), TypeScript.ASTHelpers.getType(arrowFunction), arrowFunction.block, arrowFunction.expression, argIndex, context, comparisonInfo); - } else if (arg.kind() === 222 /* FunctionExpression */) { - var functionExpression = arg; - return this.overloadIsApplicableForAnyFunctionExpressionArgument(paramType, arg, functionExpression.callSignature.typeParameterList, TypeScript.ASTHelpers.parametersFromParameterList(functionExpression.callSignature.parameterList), TypeScript.ASTHelpers.getType(functionExpression), functionExpression.block, null, argIndex, context, comparisonInfo); - } else if (arg.kind() === 215 /* ObjectLiteralExpression */) { - return this.overloadIsApplicableForObjectLiteralArgument(paramType, arg, argIndex, context, comparisonInfo); - } else if (arg.kind() === 214 /* ArrayLiteralExpression */) { - return this.overloadIsApplicableForArrayLiteralArgument(paramType, arg, argIndex, context, comparisonInfo); - } else { - return this.overloadIsApplicableForOtherArgument(paramType, arg, argIndex, context, comparisonInfo); - } - }; - - PullTypeResolver.prototype.overloadIsApplicableForAnyFunctionExpressionArgument = function (paramType, arg, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, argIndex, context, comparisonInfo) { - if (this.cachedFunctionInterfaceType() && paramType === this.cachedFunctionInterfaceType()) { - return 2 /* AssignableWithNoProvisionalErrors */; - } - - context.pushProvisionalType(paramType); - - var argSym = this.resolveAnyFunctionExpression(arg, typeParameters, parameters, returnTypeAnnotation, block, bodyExpression, true, context); - - var applicabilityStatus = this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - - context.popAnyContextualType(); - - return applicabilityStatus; - }; - - PullTypeResolver.prototype.overloadIsApplicableForObjectLiteralArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - if (this.cachedObjectInterfaceType() && paramType === this.cachedObjectInterfaceType()) { - return 2 /* AssignableWithNoProvisionalErrors */; - } - - context.pushProvisionalType(paramType); - var argSym = this.resolveObjectLiteralExpression(arg, true, context); - - var applicabilityStatus = this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - - context.popAnyContextualType(); - - return applicabilityStatus; - }; - - PullTypeResolver.prototype.overloadIsApplicableForArrayLiteralArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - if (paramType === this.cachedArrayInterfaceType()) { - return 2 /* AssignableWithNoProvisionalErrors */; - } - - context.pushProvisionalType(paramType); - var argSym = this.resolveArrayLiteralExpression(arg, true, context); - - var applicabilityStatus = this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - - context.popAnyContextualType(); - - return applicabilityStatus; - }; - - PullTypeResolver.prototype.overloadIsApplicableForOtherArgument = function (paramType, arg, argIndex, context, comparisonInfo) { - var argSym = this.resolveAST(arg, false, context); - - if (argSym.type.isAlias()) { - var aliasSym = argSym.type; - argSym = aliasSym.getExportAssignedTypeSymbol(); - } - - comparisonInfo.stringConstantVal = arg; - return this.overloadIsApplicableForArgumentHelper(paramType, argSym.type, argIndex, comparisonInfo, arg, context); - }; - - PullTypeResolver.prototype.overloadIsApplicableForArgumentHelper = function (paramType, argSym, argumentIndex, comparisonInfo, arg, context) { - var tempComparisonInfo = new TypeComparisonInfo(); - tempComparisonInfo.stringConstantVal = comparisonInfo.stringConstantVal; - if (!context.hasProvisionalErrors() && this.sourceIsSubtypeOfTarget(argSym.type, paramType, arg, context, tempComparisonInfo)) { - return 3 /* Subtype */; - } - - if (this.sourceIsAssignableToTarget(argSym.type, paramType, arg, context, comparisonInfo.message ? tempComparisonInfo : comparisonInfo)) { - return context.hasProvisionalErrors() ? 1 /* AssignableButWithProvisionalErrors */ : 2 /* AssignableWithNoProvisionalErrors */; - } - - if (!comparisonInfo.message) { - var enclosingSymbol = this.getEnclosingSymbolForAST(arg); - comparisonInfo.addMessage(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Could_not_apply_type_0_to_argument_1_which_is_of_type_2, [paramType.toString(enclosingSymbol), (argumentIndex + 1), argSym.getTypeName(enclosingSymbol)])); - } - - return 0 /* NotAssignable */; - }; - - PullTypeResolver.prototype.inferArgumentTypesForSignature = function (argContext, comparisonInfo, context) { - var inferenceResultTypes = argContext.inferTypeArguments(); - var typeParameters = argContext.signatureBeingInferred.getTypeParameters(); - TypeScript.Debug.assert(typeParameters.length == inferenceResultTypes.length); - - var typeReplacementMapForConstraints = null; - for (var i = 0; i < inferenceResultTypes.length; i++) { - if (typeParameters[i].getConstraint()) { - typeReplacementMapForConstraints = typeReplacementMapForConstraints || TypeScript.PullInstantiationHelpers.createTypeParameterArgumentMap(typeParameters, inferenceResultTypes); - var associatedConstraint = this.instantiateType(typeParameters[i].getConstraint(), typeReplacementMapForConstraints); - if (!this.sourceIsAssignableToTargetWithNewEnclosingTypes(inferenceResultTypes[i], associatedConstraint, null, context, null, false)) { - inferenceResultTypes[i] = associatedConstraint; - } - } - } - - if (argContext.isInvocationInferenceContext()) { - var invocationContext = argContext; - if (!this.typeParametersAreInScopeAtArgumentList(typeParameters, invocationContext.argumentASTs)) { - for (var i = 0; i < inferenceResultTypes.length; i++) { - if (inferenceResultTypes[i].wrapsSomeTypeParameter(argContext.candidateCache)) { - inferenceResultTypes[i] = this.semanticInfoChain.anyTypeSymbol; - } - } - } - } - - return inferenceResultTypes; - }; - - PullTypeResolver.prototype.typeParametersAreInScopeAtArgumentList = function (typeParameters, args) { - var enclosingDecl = this.getEnclosingDeclForAST(args); - var typeParameterParentDecl = typeParameters[0].getDeclarations()[0].getParentDecl(); - return enclosingDecl.getParentPath().indexOf(typeParameterParentDecl) > -1; - }; - - PullTypeResolver.prototype.relateTypeToTypeParametersInEnclosingType = function (expressionType, parameterType, argContext, context) { - if (expressionType && parameterType) { - if (context.oneOfClassificationsIsInfinitelyExpanding()) { - this.relateInifinitelyExpandingTypeToTypeParameters(expressionType, parameterType, argContext, context); - return; - } - } - this.relateTypeToTypeParameters(expressionType, parameterType, argContext, context); - }; - - PullTypeResolver.prototype.relateTypeToTypeParametersWithNewEnclosingTypes = function (expressionType, parameterType, argContext, context) { - var enclosingTypeWalkerStates = context.resetEnclosingTypeWalkerStates(); - this.relateTypeToTypeParameters(expressionType, parameterType, argContext, context); - context.setEnclosingTypeWalkerStates(enclosingTypeWalkerStates); - }; - - PullTypeResolver.prototype.relateTypeToTypeParameters = function (expressionType, parameterType, argContext, context) { - if (!expressionType || !parameterType) { - return; - } - - if (expressionType.isError()) { - expressionType = this.semanticInfoChain.anyTypeSymbol; - } - - if (parameterType.isTypeParameter()) { - var typeParameter = parameterType; - argContext.addCandidateForInference(typeParameter, expressionType); - return; - } - - if (parameterType.isNamedTypeSymbol() && !parameterType.isGeneric() && !parameterType.getTypeArguments()) { - return; - } - - if (TypeScript.PullInstantiationHelpers.twoTypesAreInstantiationsOfSameNamedGenericType(expressionType, parameterType)) { - this.relateTypeArgumentsOfTypeToTypeParameters(expressionType, parameterType, argContext, context); - } else { - var symbolsWhenStartedWalkingTypes = context.startWalkingTypes(expressionType, parameterType); - this.relateObjectTypeToTypeParameters(expressionType, parameterType, argContext, context); - context.endWalkingTypes(symbolsWhenStartedWalkingTypes); - } - }; - - PullTypeResolver.prototype.relateTypeArgumentsOfTypeToTypeParameters = function (expressionType, parameterType, argContext, context) { - var parameterSideTypeArguments = parameterType.getTypeArguments(); - var argumentSideTypeArguments = expressionType.getTypeArguments(); - - TypeScript.Debug.assert(parameterSideTypeArguments && argumentSideTypeArguments && parameterSideTypeArguments.length === argumentSideTypeArguments.length); - for (var i = 0; i < parameterSideTypeArguments.length; i++) { - this.relateTypeToTypeParametersWithNewEnclosingTypes(argumentSideTypeArguments[i], parameterSideTypeArguments[i], argContext, context); - } - }; - - PullTypeResolver.prototype.relateInifinitelyExpandingTypeToTypeParameters = function (expressionType, parameterType, argContext, context) { - if (!expressionType || !parameterType) { - return; - } - - var expressionTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(expressionType); - var parameterTypeNamedTypeReference = TypeScript.PullHelpers.getRootType(parameterType); - if (expressionTypeNamedTypeReference !== parameterTypeNamedTypeReference) { - return; - } - - var expressionTypeTypeArguments = expressionType.getTypeArguments(); - var parameterTypeArguments = parameterType.getTypeArguments(); - - if (expressionTypeTypeArguments && parameterTypeArguments && expressionTypeTypeArguments.length === parameterTypeArguments.length) { - for (var i = 0; i < expressionTypeTypeArguments.length; i++) { - this.relateTypeArgumentsOfTypeToTypeParameters(expressionType, parameterType, argContext, context); - } - } - }; - - PullTypeResolver.prototype.relateFunctionSignatureToTypeParameters = function (expressionSignature, parameterSignature, argContext, context) { - var _this = this; - var expressionReturnType = expressionSignature.returnType; - var parameterReturnType = parameterSignature.returnType; - - parameterSignature.forAllCorrespondingParameterTypesInThisAndOtherSignature(expressionSignature, function (parameterSignatureParameterType, expressionSignatureParameterType, i) { - context.walkParameterTypes(i); - _this.relateTypeToTypeParametersInEnclosingType(expressionSignatureParameterType, parameterSignatureParameterType, argContext, context); - context.postWalkParameterTypes(); - return true; - }); - - context.walkReturnTypes(); - this.relateTypeToTypeParametersInEnclosingType(expressionReturnType, parameterReturnType, argContext, context); - context.postWalkReturnTypes(); - }; - - PullTypeResolver.prototype.relateObjectTypeToTypeParameters = function (objectType, parameterType, argContext, context) { - var parameterTypeMembers = parameterType.getMembers(); - var parameterSignatures; - - var objectMember; - var objectSignatures; - - if (argContext.alreadyRelatingTypes(objectType, parameterType)) { - return; - } - - for (var i = 0; i < parameterTypeMembers.length; i++) { - objectMember = this.getNamedPropertySymbol(parameterTypeMembers[i].name, 68147712 /* SomeValue */, objectType); - if (objectMember) { - this.resolveDeclaredSymbol(objectMember); - this.resolveDeclaredSymbol(parameterTypeMembers[i]); - context.walkMemberTypes(parameterTypeMembers[i].name); - this.relateTypeToTypeParametersInEnclosingType(objectMember.type, parameterTypeMembers[i].type, argContext, context); - context.postWalkMemberTypes(); - } - } - - this.relateSignatureGroupToTypeParameters(objectType.getCallSignatures(), parameterType.getCallSignatures(), 1048576 /* CallSignature */, argContext, context); - - this.relateSignatureGroupToTypeParameters(objectType.getConstructSignatures(), parameterType.getConstructSignatures(), 2097152 /* ConstructSignature */, argContext, context); - - var parameterIndexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(parameterType, context); - var objectIndexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(objectType, context); - var indexSigInfo = context.getBothKindOfIndexSignatures(false, false); - - if (parameterIndexSignatures.stringSignature && objectIndexSignatures.stringSignature) { - context.walkIndexSignatureReturnTypes(indexSigInfo, true, true, true); - this.relateFunctionSignatureToTypeParameters(objectIndexSignatures.stringSignature, parameterIndexSignatures.stringSignature, argContext, context); - context.postWalkIndexSignatureReturnTypes(true); - } - if (parameterIndexSignatures.numericSignature && objectIndexSignatures.numericSignature) { - context.walkIndexSignatureReturnTypes(indexSigInfo, false, false, true); - this.relateFunctionSignatureToTypeParameters(objectIndexSignatures.numericSignature, parameterIndexSignatures.numericSignature, argContext, context); - context.postWalkIndexSignatureReturnTypes(true); - } - }; - - PullTypeResolver.prototype.relateSignatureGroupToTypeParameters = function (argumentSignatures, parameterSignatures, signatureKind, argContext, context) { - for (var i = 0; i < parameterSignatures.length; i++) { - var paramSignature = parameterSignatures[i]; - if (argumentSignatures.length > 0 && paramSignature.isGeneric()) { - paramSignature = this.instantiateSignatureToAny(paramSignature); - } - for (var j = 0; j < argumentSignatures.length; j++) { - var argumentSignature = argumentSignatures[j]; - if (argumentSignature.nonOptionalParamCount > paramSignature.nonOptionalParamCount) { - continue; - } - - if (argumentSignature.isGeneric()) { - argumentSignature = this.instantiateSignatureToAny(argumentSignature); - } - - context.walkSignatures(signatureKind, j, i); - this.relateFunctionSignatureToTypeParameters(argumentSignature, paramSignature, argContext, context); - context.postWalkSignatures(); - } - } - }; - - PullTypeResolver.prototype.alterPotentialGenericFunctionTypeToInstantiatedFunctionTypeForTypeArgumentInference = function (expressionSymbol, context) { - var inferentialType = context.getContextualType(); - TypeScript.Debug.assert(inferentialType); - var expressionType = expressionSymbol.type; - if (this.isFunctionTypeWithExactlyOneCallSignatureAndNoOtherMembers(expressionType, true) && this.isFunctionTypeWithExactlyOneCallSignatureAndNoOtherMembers(inferentialType, false)) { - var genericExpressionSignature = expressionType.getCallSignatures()[0]; - var contextualSignature = inferentialType.getCallSignatures()[0]; - - var instantiatedSignature = this.instantiateSignatureInContext(genericExpressionSignature, contextualSignature, context, true); - if (instantiatedSignature === null) { - return expressionSymbol; - } - - var newType = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - newType.appendCallSignature(instantiatedSignature); - return newType; - } - - return expressionSymbol; - }; - - PullTypeResolver.prototype.isFunctionTypeWithExactlyOneCallSignatureAndNoOtherMembers = function (type, callSignatureShouldBeGeneric) { - TypeScript.Debug.assert(type); - if (type.getCallSignatures().length !== 1) { - return false; - } - - var callSignatureIsGeneric = type.getCallSignatures()[0].isGeneric(); - if (callSignatureIsGeneric !== callSignatureShouldBeGeneric) { - return false; - } - - var typeHasOtherMembers = type.getConstructSignatures().length || type.getIndexSignatures().length || type.getAllMembers(68147712 /* SomeValue */, 0 /* all */).length; - if (typeHasOtherMembers) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.instantiateTypeToAny = function (typeToSpecialize, context) { - var typeParameters = typeToSpecialize.getTypeParameters(); - - if (!typeParameters.length) { - return typeToSpecialize; - } - - var typeArguments = null; - - if (!this._cachedAnyTypeArgs) { - this._cachedAnyTypeArgs = [ - [this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol] - ]; - } - - if (typeParameters.length < this._cachedAnyTypeArgs.length) { - typeArguments = this._cachedAnyTypeArgs[typeParameters.length - 1]; - } else { - typeArguments = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeArguments[typeArguments.length] = this.semanticInfoChain.anyTypeSymbol; - } - } - - var type = this.createInstantiatedType(typeToSpecialize, typeArguments); - - return type; - }; - - PullTypeResolver.prototype.instantiateSignatureToAny = function (signature) { - var typeParameters = signature.getTypeParameters(); - if (!this._cachedAnyTypeArgs) { - this._cachedAnyTypeArgs = [ - [this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol], - [this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol, this.semanticInfoChain.anyTypeSymbol] - ]; - } - - if (typeParameters.length < this._cachedAnyTypeArgs.length) { - var typeArguments = this._cachedAnyTypeArgs[typeParameters.length - 1]; - } else { - var typeArguments = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeArguments[typeArguments.length] = this.semanticInfoChain.anyTypeSymbol; - } - } - - var typeParameterArgumentMap = TypeScript.PullInstantiationHelpers.createTypeParameterArgumentMap(typeParameters, typeArguments); - return this.instantiateSignature(signature, typeParameterArgumentMap); - }; - - PullTypeResolver.typeCheck = function (compilationSettings, semanticInfoChain, document) { - var sourceUnit = document.sourceUnit(); - - var resolver = semanticInfoChain.getResolver(); - var context = new TypeScript.PullTypeResolutionContext(resolver, true, sourceUnit.fileName()); - - if (resolver.canTypeCheckAST(sourceUnit, context)) { - resolver.resolveAST(sourceUnit, false, context); - resolver.validateVariableDeclarationGroups(semanticInfoChain.getDeclForAST(sourceUnit), context); - - while (resolver.typeCheckCallBacks.length) { - var callBack = resolver.typeCheckCallBacks.pop(); - callBack(context); - } - - resolver.processPostTypeCheckWorkItems(context); - } - }; - - PullTypeResolver.prototype.validateVariableDeclarationGroups = function (enclosingDecl, context) { - var _this = this; - this.scanVariableDeclarationGroups(enclosingDecl, function (_) { - }, function (subsequentDecl, firstSymbol) { - if (TypeScript.hasFlag(subsequentDecl.kind, 2048 /* Parameter */) || TypeScript.hasFlag(subsequentDecl.flags, 8388608 /* PropertyParameter */)) { - return; - } - - var boundDeclAST = _this.semanticInfoChain.getASTForDecl(subsequentDecl); - - var symbol = subsequentDecl.getSymbol(); - var symbolType = symbol.type; - var firstSymbolType = firstSymbol.type; - - if (symbolType && firstSymbolType && symbolType !== firstSymbolType && !_this.typesAreIdentical(symbolType, firstSymbolType, context)) { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(boundDeclAST, TypeScript.DiagnosticCode.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, [symbol.getScopedName(), firstSymbolType.toString(firstSymbol), symbolType.toString(symbol)])); - } - }); - }; - - PullTypeResolver.prototype.typeCheckFunctionOverloads = function (funcDecl, context, signature, allSignatures) { - if (!signature) { - var functionSignatureInfo = TypeScript.PullHelpers.getSignatureForFuncDecl(this.semanticInfoChain.getDeclForAST(funcDecl)); - signature = functionSignatureInfo.signature; - allSignatures = functionSignatureInfo.allSignatures; - } - var functionDeclaration = this.semanticInfoChain.getDeclForAST(funcDecl); - var funcSymbol = functionDeclaration.getSymbol(); - - var definitionSignature = null; - for (var i = allSignatures.length - 1; i >= 0; i--) { - if (allSignatures[i].isDefinition()) { - definitionSignature = allSignatures[i]; - break; - } - } - - if (!signature.isDefinition()) { - var signatureParentDecl = signature.getDeclarations()[0].getParentDecl(); - for (var i = 0; i < allSignatures.length; i++) { - if (allSignatures[i] === signature) { - break; - } - - var allSignaturesParentDecl = allSignatures[i].getDeclarations()[0].getParentDecl(); - if (allSignaturesParentDecl !== signatureParentDecl) { - continue; - } - - if (this.signaturesAreIdenticalWithNewEnclosingTypes(allSignatures[i], signature, context, false)) { - if (!this.signatureReturnTypesAreIdentical(allSignatures[i], signature, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overloads_cannot_differ_only_by_return_type)); - } else if (funcDecl.kind() === 137 /* ConstructorDeclaration */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_constructor_overload_signature)); - } else if (functionDeclaration.kind === 2097152 /* ConstructSignature */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_overload_construct_signature)); - } else if (functionDeclaration.kind === 1048576 /* CallSignature */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_overload_call_signature)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Duplicate_overload_signature_for_0, [funcSymbol.getScopedNameEx().toString()])); - } - - break; - } - } - } - - var isConstantOverloadSignature = signature.isStringConstantOverloadSignature(); - if (isConstantOverloadSignature) { - if (signature.isDefinition()) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overload_signature_implementation_cannot_use_specialized_type)); - } else { - var foundSubtypeSignature = false; - for (var i = 0; i < allSignatures.length; i++) { - if (allSignatures[i].isDefinition() || allSignatures[i] === signature) { - continue; - } - - if (!allSignatures[i].isResolved) { - this.resolveDeclaredSymbol(allSignatures[i], context); - } - - if (allSignatures[i].isStringConstantOverloadSignature()) { - continue; - } - - if (this.signatureIsAssignableToTarget(signature, allSignatures[i], null, context)) { - foundSubtypeSignature = true; - break; - } - } - - if (!foundSubtypeSignature) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature)); - } - } - } else if (definitionSignature && definitionSignature !== signature) { - var comparisonInfo = new TypeComparisonInfo(); - - if (!definitionSignature.isResolved) { - this.resolveDeclaredSymbol(definitionSignature, context); - } - - if (!this.signatureIsAssignableToTarget(definitionSignature, signature, funcDecl, context, comparisonInfo)) { - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overload_signature_is_not_compatible_with_function_definition_NL_0, [comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, TypeScript.DiagnosticCode.Overload_signature_is_not_compatible_with_function_definition)); - } - } - } - - var signatureForVisibilityCheck = definitionSignature; - if (!definitionSignature) { - if (allSignatures[0] === signature) { - return; - } - signatureForVisibilityCheck = allSignatures[0]; - } - - if (funcDecl.kind() !== 137 /* ConstructorDeclaration */ && functionDeclaration.kind !== 2097152 /* ConstructSignature */ && signatureForVisibilityCheck && signature !== signatureForVisibilityCheck) { - var errorCode; - - if (signatureForVisibilityCheck.anyDeclHasFlag(2 /* Private */) !== signature.anyDeclHasFlag(2 /* Private */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_public_or_private; - } else if (signatureForVisibilityCheck.anyDeclHasFlag(1 /* Exported */) !== signature.anyDeclHasFlag(1 /* Exported */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_exported_or_not_exported; - } else if (signatureForVisibilityCheck.anyDeclHasFlag(8 /* Ambient */) !== signature.anyDeclHasFlag(8 /* Ambient */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_ambient_or_non_ambient; - } else if (signatureForVisibilityCheck.anyDeclHasFlag(128 /* Optional */) !== signature.anyDeclHasFlag(128 /* Optional */)) { - errorCode = TypeScript.DiagnosticCode.Overload_signatures_must_all_be_optional_or_required; - } - - if (errorCode) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(funcDecl, errorCode)); - } - } - }; - - PullTypeResolver.prototype.checkSymbolPrivacy = function (declSymbol, symbol, privacyErrorReporter) { - if (!symbol || symbol.kind === 2 /* Primitive */) { - return; - } - - if (symbol.isType()) { - var typeSymbol = symbol; - var isNamedType = typeSymbol.isNamedTypeSymbol(); - - if (typeSymbol.isArrayNamedTypeReference()) { - this.checkSymbolPrivacy(declSymbol, typeSymbol.getElementType(), privacyErrorReporter); - return; - } - - if (!isNamedType) { - var typeOfSymbol = typeSymbol.getTypeOfSymbol(); - if (typeOfSymbol) { - this.checkSymbolPrivacy(declSymbol, typeOfSymbol, privacyErrorReporter); - return; - } - } - - if (typeSymbol.inSymbolPrivacyCheck) { - return; - } - - typeSymbol.inSymbolPrivacyCheck = true; - - var typars = typeSymbol.getTypeArgumentsOrTypeParameters(); - if (typars) { - for (var i = 0; i < typars.length; i++) { - this.checkSymbolPrivacy(declSymbol, typars[i], privacyErrorReporter); - } - } - - if (!isNamedType) { - var members = typeSymbol.getMembers(); - for (var i = 0; i < members.length; i++) { - this.checkSymbolPrivacy(declSymbol, members[i].type, privacyErrorReporter); - } - - this.checkTypePrivacyOfSignatures(declSymbol, typeSymbol.getCallSignatures(), privacyErrorReporter); - this.checkTypePrivacyOfSignatures(declSymbol, typeSymbol.getConstructSignatures(), privacyErrorReporter); - this.checkTypePrivacyOfSignatures(declSymbol, typeSymbol.getIndexSignatures(), privacyErrorReporter); - } else if (typeSymbol.kind === 8192 /* TypeParameter */) { - this.checkSymbolPrivacy(declSymbol, typeSymbol.getConstraint(), privacyErrorReporter); - } - - typeSymbol.inSymbolPrivacyCheck = false; - - if (!isNamedType) { - return; - } - } - - if (declSymbol.isExternallyVisible()) { - var symbolIsVisible = symbol.isExternallyVisible(); - - if (symbolIsVisible && symbol.kind !== 8192 /* TypeParameter */) { - var symbolPath = symbol.pathToRoot(); - var declSymbolPath = declSymbol.pathToRoot(); - - if (symbolPath[symbolPath.length - 1].kind === 32 /* DynamicModule */ && declSymbolPath[declSymbolPath.length - 1].kind === 32 /* DynamicModule */ && declSymbolPath[declSymbolPath.length - 1] !== symbolPath[symbolPath.length - 1]) { - symbolIsVisible = false; - var declSymbolScope = declSymbolPath[declSymbolPath.length - 1]; - for (var i = symbolPath.length - 1; i >= 0; i--) { - var aliasSymbols = symbolPath[i].getExternalAliasedSymbols(declSymbolScope); - if (aliasSymbols) { - symbolIsVisible = true; - aliasSymbols[0].setTypeUsedExternally(); - break; - } - } - symbol = symbolPath[symbolPath.length - 1]; - } - } else if (symbol.kind === 128 /* TypeAlias */) { - var aliasSymbol = symbol; - symbolIsVisible = true; - aliasSymbol.setTypeUsedExternally(); - } - - if (!symbolIsVisible) { - privacyErrorReporter(symbol); - } - } - }; - - PullTypeResolver.prototype.checkTypePrivacyOfSignatures = function (declSymbol, signatures, privacyErrorReporter) { - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; - if (signatures.length > 1 && signature.isDefinition()) { - continue; - } - - var typeParams = signature.getTypeParameters(); - for (var j = 0; j < typeParams.length; j++) { - this.checkSymbolPrivacy(declSymbol, typeParams[j], privacyErrorReporter); - } - - var params = signature.parameters; - for (var j = 0; j < params.length; j++) { - var paramType = params[j].type; - this.checkSymbolPrivacy(declSymbol, paramType, privacyErrorReporter); - } - - var returnType = signature.returnType; - this.checkSymbolPrivacy(declSymbol, returnType, privacyErrorReporter); - } - }; - - PullTypeResolver.prototype.typeParameterOfTypeDeclarationPrivacyErrorReporter = function (classOrInterface, typeParameterAST, typeParameter, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - var messageCode; - - var typeParameters = classOrInterface.kind() === 131 /* ClassDeclaration */ ? classOrInterface.typeParameterList : classOrInterface.typeParameterList; - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_interface_is_using_inaccessible_module_1; - } - } else { - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_interface_has_or_is_using_private_type_1; - } - } - - var messageArguments = [typeParameter.getScopedName(enclosingSymbol, false, true), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeParameterAST, messageCode, messageArguments)); - }; - - PullTypeResolver.prototype.baseListPrivacyErrorReporter = function (classOrInterface, declSymbol, baseAst, isExtendedType, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(classOrInterface); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - var messageCode; - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - if (isExtendedType) { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_extends_class_from_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_implements_interface_from_inaccessible_module_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_interface_0_extends_interface_from_inaccessible_module_1; - } - } else { - if (classOrInterface.kind() === 131 /* ClassDeclaration */) { - if (isExtendedType) { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_extends_private_class_1; - } else { - messageCode = TypeScript.DiagnosticCode.Exported_class_0_implements_private_interface_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_interface_0_extends_private_interface_1; - } - } - - var messageArguments = [declSymbol.getScopedName(enclosingSymbol), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseAst, messageCode, messageArguments)); - }; - - PullTypeResolver.prototype.variablePrivacyErrorReporter = function (declAST, declSymbol, symbol, context) { - var typeSymbol = symbol; - var enclosingDecl = this.getEnclosingDecl(declSymbol.getDeclarations()[0]); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - - var isProperty = declSymbol.kind === 4096 /* Property */; - var isPropertyOfClass = false; - var declParent = declSymbol.getContainer(); - if (declParent && (declParent.kind === 8 /* Class */ || declParent.kind === 32768 /* ConstructorMethod */)) { - isPropertyOfClass = true; - } - - var messageCode; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (declSymbol.anyDeclHasFlag(16 /* Static */)) { - messageCode = TypeScript.DiagnosticCode.Public_static_property_0_of_exported_class_is_using_inaccessible_module_1; - } else if (isProperty) { - if (isPropertyOfClass) { - messageCode = TypeScript.DiagnosticCode.Public_property_0_of_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Property_0_of_exported_interface_is_using_inaccessible_module_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_variable_0_is_using_inaccessible_module_1; - } - } else { - if (declSymbol.anyDeclHasFlag(16 /* Static */)) { - messageCode = TypeScript.DiagnosticCode.Public_static_property_0_of_exported_class_has_or_is_using_private_type_1; - } else if (isProperty) { - if (isPropertyOfClass) { - messageCode = TypeScript.DiagnosticCode.Public_property_0_of_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.Property_0_of_exported_interface_has_or_is_using_private_type_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.Exported_variable_0_has_or_is_using_private_type_1; - } - } - - var messageArguments = [declSymbol.getScopedName(enclosingSymbol), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(declAST, messageCode, messageArguments)); - }; - - PullTypeResolver.prototype.checkFunctionTypePrivacy = function (funcDeclAST, isStatic, typeParameters, parameters, returnTypeAnnotation, block, context) { - var _this = this; - if (funcDeclAST.kind() === 222 /* FunctionExpression */ || funcDeclAST.kind() === 241 /* FunctionPropertyAssignment */ || (funcDeclAST.kind() === 139 /* GetAccessor */ && funcDeclAST.parent.parent.kind() === 215 /* ObjectLiteralExpression */) || (funcDeclAST.kind() === 140 /* SetAccessor */ && funcDeclAST.parent.parent.kind() === 215 /* ObjectLiteralExpression */)) { - return; - } - - var functionDecl = this.semanticInfoChain.getDeclForAST(funcDeclAST); - var functionSymbol = functionDecl.getSymbol(); - ; - var functionSignature; - - var isGetter = funcDeclAST.kind() === 139 /* GetAccessor */; - var isSetter = funcDeclAST.kind() === 140 /* SetAccessor */; - var isIndexSignature = functionDecl.kind === 4194304 /* IndexSignature */; - - if (isGetter || isSetter) { - var accessorSymbol = functionSymbol; - functionSignature = (isGetter ? accessorSymbol.getGetter() : accessorSymbol.getSetter()).type.getCallSignatures()[0]; - } else { - if (!functionSymbol) { - var parentDecl = functionDecl.getParentDecl(); - functionSymbol = parentDecl.getSymbol(); - if (functionSymbol && functionSymbol.isType() && !functionSymbol.isNamedTypeSymbol()) { - return; - } - } else if (functionSymbol.kind === 65536 /* Method */ && !isStatic && !functionSymbol.getContainer().isNamedTypeSymbol()) { - return; - } - functionSignature = functionDecl.getSignatureSymbol(); - } - - if (typeParameters && !isGetter && !isSetter && !isIndexSignature && funcDeclAST.kind() !== 137 /* ConstructorDeclaration */) { - for (var i = 0; i < typeParameters.typeParameters.nonSeparatorCount(); i++) { - var typeParameterAST = typeParameters.typeParameters.nonSeparatorAt(i); - var typeParameter = this.resolveTypeParameterDeclaration(typeParameterAST, context); - this.checkSymbolPrivacy(functionSymbol, typeParameter, function (symbol) { - return _this.functionTypeArgumentArgumentTypePrivacyErrorReporter(funcDeclAST, isStatic, typeParameterAST, typeParameter, symbol, context); - }); - } - } - - if (!isGetter && !isIndexSignature) { - var funcParams = functionSignature.parameters; - for (var i = 0; i < funcParams.length; i++) { - this.checkSymbolPrivacy(functionSymbol, funcParams[i].type, function (symbol) { - return _this.functionArgumentTypePrivacyErrorReporter(funcDeclAST, isStatic, parameters, i, funcParams[i], symbol, context); - }); - } - } - - if (!isSetter) { - this.checkSymbolPrivacy(functionSymbol, functionSignature.returnType, function (symbol) { - return _this.functionReturnTypePrivacyErrorReporter(funcDeclAST, isStatic, returnTypeAnnotation, block, functionSignature.returnType, symbol, context); - }); - } - }; - - PullTypeResolver.prototype.functionTypeArgumentArgumentTypePrivacyErrorReporter = function (declAST, isStatic, typeParameterAST, typeParameter, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(declAST); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - - var isMethod = decl.kind === 65536 /* Method */; - var isMethodOfClass = false; - var declParent = decl.getParentDecl(); - if (declParent && (declParent.kind === 8 /* Class */ || isStatic)) { - isMethodOfClass = true; - } - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - var messageCode; - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_function_is_using_inaccessible_module_1; - } - } else { - if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1; - } - } else { - messageCode = TypeScript.DiagnosticCode.TypeParameter_0_of_exported_function_has_or_is_using_private_type_1; - } - } - - if (messageCode) { - var messageArgs = [typeParameter.getScopedName(enclosingSymbol, false, true), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(typeParameterAST, messageCode, messageArgs)); - } - }; - - PullTypeResolver.prototype.functionArgumentTypePrivacyErrorReporter = function (declAST, isStatic, parameters, argIndex, paramSymbol, symbol, context) { - var decl = this.semanticInfoChain.getDeclForAST(declAST); - var enclosingDecl = this.getEnclosingDecl(decl); - var enclosingSymbol = enclosingDecl ? enclosingDecl.getSymbol() : null; - - var isGetter = declAST.kind() === 139 /* GetAccessor */; - var isSetter = declAST.kind() === 140 /* SetAccessor */; - var isMethod = decl.kind === 65536 /* Method */; - var isMethodOfClass = false; - var declParent = decl.getParentDecl(); - if (declParent && (declParent.kind === 8 /* Class */ || isStatic)) { - isMethodOfClass = true; - } - - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingSymbol); - var messageCode; - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (declAST.kind() === 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_from_exported_class_is_using_inaccessible_module_1; - } else if (isSetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_property_setter_from_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_property_setter_from_exported_class_is_using_inaccessible_module_1; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1; - } - } else if (!isGetter) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_exported_function_is_using_inaccessible_module_1; - } - } else { - if (declAST.kind() === 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_type_1; - } else if (isSetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_type_1; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1; - } else { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1; - } - } else if (!isGetter && decl.kind !== 4194304 /* IndexSignature */) { - messageCode = TypeScript.DiagnosticCode.Parameter_0_of_exported_function_has_or_is_using_private_type_1; - } - } - - if (messageCode) { - var parameter = parameters.astAt(argIndex); - - var messageArgs = [paramSymbol.getScopedName(enclosingSymbol), typeSymbolName]; - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(parameter, messageCode, messageArgs)); - } - }; - - PullTypeResolver.prototype.functionReturnTypePrivacyErrorReporter = function (declAST, isStatic, returnTypeAnnotation, block, funcReturnType, symbol, context) { - var _this = this; - var decl = this.semanticInfoChain.getDeclForAST(declAST); - var enclosingDecl = this.getEnclosingDecl(decl); - - var isGetter = declAST.kind() === 139 /* GetAccessor */; - var isSetter = declAST.kind() === 140 /* SetAccessor */; - var isMethod = decl.kind === 65536 /* Method */; - var isMethodOfClass = false; - var declParent = decl.getParentDecl(); - if (declParent && (declParent.kind === 8 /* Class */ || isStatic)) { - isMethodOfClass = true; - } - - var messageCode = null; - var typeSymbol = symbol; - var typeSymbolName = typeSymbol.getScopedName(enclosingDecl ? enclosingDecl.getSymbol() : null); - if (typeSymbol.isContainer() && !typeSymbol.isEnum()) { - if (!TypeScript.isQuoted(typeSymbolName)) { - typeSymbolName = "'" + typeSymbolName + "'"; - } - - if (isGetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_property_getter_from_exported_class_is_using_inaccessible_module_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_property_getter_from_exported_class_is_using_inaccessible_module_0; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_0; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_call_signature_from_exported_interface_is_using_inaccessible_module_0; - } else if (decl.kind === 4194304 /* IndexSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_index_signature_from_exported_interface_is_using_inaccessible_module_0; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_method_from_exported_class_is_using_inaccessible_module_0; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_method_from_exported_class_is_using_inaccessible_module_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_method_from_exported_interface_is_using_inaccessible_module_0; - } - } else if (!isSetter && declAST.kind() !== 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_exported_function_is_using_inaccessible_module_0; - } - } else { - if (isGetter) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_type_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_type_0; - } - } else if (decl.kind === 2097152 /* ConstructSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_0; - } else if (decl.kind === 1048576 /* CallSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_type_0; - } else if (decl.kind === 4194304 /* IndexSignature */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_type_0; - } else if (isMethod) { - if (isStatic) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_type_0; - } else if (isMethodOfClass) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_public_method_from_exported_class_has_or_is_using_private_type_0; - } else { - messageCode = TypeScript.DiagnosticCode.Return_type_of_method_from_exported_interface_has_or_is_using_private_type_0; - } - } else if (!isSetter && declAST.kind() !== 137 /* ConstructorDeclaration */) { - messageCode = TypeScript.DiagnosticCode.Return_type_of_exported_function_has_or_is_using_private_type_0; - } - } - - if (messageCode) { - var messageArguments = [typeSymbolName]; - var reportOnFuncDecl = false; - - if (returnTypeAnnotation) { - var returnExpressionSymbol = this.resolveTypeReference(returnTypeAnnotation, context); - - if (TypeScript.PullHelpers.typeSymbolsAreIdentical(returnExpressionSymbol, funcReturnType)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(returnTypeAnnotation, messageCode, messageArguments)); - } - } - - if (block) { - var reportErrorOnReturnExpressions = function (ast, walker) { - var go = true; - switch (ast.kind()) { - case 129 /* FunctionDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - go = false; - break; - - case 150 /* ReturnStatement */: - var returnStatement = ast; - var returnExpressionSymbol = _this.resolveAST(returnStatement.expression, false, context).type; - - if (TypeScript.PullHelpers.typeSymbolsAreIdentical(returnExpressionSymbol, funcReturnType)) { - context.postDiagnostic(_this.semanticInfoChain.diagnosticFromAST(returnStatement, messageCode, messageArguments)); - } else { - reportOnFuncDecl = true; - } - go = false; - break; - - default: - break; - } - - walker.options.goChildren = go; - return ast; - }; - - TypeScript.getAstWalkerFactory().walk(block, reportErrorOnReturnExpressions); - } - - if (reportOnFuncDecl) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(declAST, messageCode, messageArguments)); - } - } - }; - - PullTypeResolver.prototype.enclosingClassIsDerived = function (classDecl) { - TypeScript.Debug.assert(classDecl.kind === 8 /* Class */); - - var classSymbol = classDecl.getSymbol(); - return classSymbol.getExtendedTypes().length > 0; - }; - - PullTypeResolver.prototype.isSuperInvocationExpression = function (ast) { - if (ast.kind() === 213 /* InvocationExpression */) { - var invocationExpression = ast; - if (invocationExpression.expression.kind() === 50 /* SuperKeyword */) { - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.isSuperInvocationExpressionStatement = function (node) { - if (node && node.kind() === 149 /* ExpressionStatement */) { - var expressionStatement = node; - if (this.isSuperInvocationExpression(expressionStatement.expression)) { - return true; - } - } - return false; - }; - - PullTypeResolver.prototype.getFirstStatementOfBlockOrNull = function (block) { - if (block && block.statements && block.statements.childCount() > 0) { - return block.statements.childAt(0); - } - - return null; - }; - - PullTypeResolver.prototype.superCallMustBeFirstStatementInConstructor = function (constructorDecl) { - TypeScript.Debug.assert(constructorDecl.kind === 32768 /* ConstructorMethod */); - - if (constructorDecl) { - var enclosingClass = constructorDecl.getParentDecl(); - - var classSymbol = enclosingClass.getSymbol(); - if (classSymbol.getExtendedTypes().length === 0) { - return false; - } - - var classMembers = classSymbol.getMembers(); - for (var i = 0, n1 = classMembers.length; i < n1; i++) { - var member = classMembers[i]; - - if (member.kind === 4096 /* Property */) { - var declarations = member.getDeclarations(); - for (var j = 0, n2 = declarations.length; j < n2; j++) { - var declaration = declarations[j]; - var ast = this.semanticInfoChain.getASTForDecl(declaration); - if (ast.kind() === 242 /* Parameter */) { - return true; - } - - if (ast.kind() === 136 /* MemberVariableDeclaration */) { - var variableDeclarator = ast; - if (variableDeclarator.variableDeclarator.equalsValueClause) { - return true; - } - } - } - } - } - } - - return false; - }; - - PullTypeResolver.prototype.checkForThisCaptureInArrowFunction = function (expression) { - var enclosingDecl = this.getEnclosingDeclForAST(expression); - - var declPath = enclosingDecl.getParentPath(); - - if (declPath.length) { - var inArrowFunction = false; - for (var i = declPath.length - 1; i >= 0; i--) { - var decl = declPath[i]; - var declKind = decl.kind; - var declFlags = decl.flags; - - if (declKind === 131072 /* FunctionExpression */ && TypeScript.hasFlag(declFlags, 8192 /* ArrowFunction */)) { - inArrowFunction = true; - continue; - } - - if (inArrowFunction) { - if (declKind === 16384 /* Function */ || declKind === 65536 /* Method */ || declKind === 32768 /* ConstructorMethod */ || declKind === 262144 /* GetAccessor */ || declKind === 524288 /* SetAccessor */ || declKind === 131072 /* FunctionExpression */ || declKind === 8 /* Class */ || declKind === 4 /* Container */ || declKind === 32 /* DynamicModule */ || declKind === 1 /* Script */) { - decl.setFlags(decl.flags | 262144 /* MustCaptureThis */); - - if (declKind === 8 /* Class */) { - var constructorSymbol = decl.getSymbol().getConstructorMethod(); - var constructorDecls = constructorSymbol.getDeclarations(); - for (var i = 0; i < constructorDecls.length; i++) { - constructorDecls[i].flags = constructorDecls[i].flags | 262144 /* MustCaptureThis */; - } - } - break; - } - } else if (declKind === 16384 /* Function */ || declKind === 131072 /* FunctionExpression */) { - break; - } - } - } - }; - - PullTypeResolver.prototype.typeCheckMembersAgainstIndexer = function (containerType, containerTypeDecl, context) { - var indexSignatures = this.getBothKindsOfIndexSignaturesExcludingAugmentedType(containerType, context); - var stringSignature = indexSignatures.stringSignature; - var numberSignature = indexSignatures.numericSignature; - - if (stringSignature || numberSignature) { - var members = containerTypeDecl.getChildDecls(); - for (var i = 0; i < members.length; i++) { - var member = members[i]; - if ((member.name || (member.kind === 4096 /* Property */ && member.name === "")) && member.kind !== 32768 /* ConstructorMethod */ && !TypeScript.hasFlag(member.flags, 16 /* Static */)) { - var memberSymbol = member.getSymbol(); - var relevantSignature = this.determineRelevantIndexerForMember(memberSymbol, numberSignature, stringSignature); - if (relevantSignature) { - var comparisonInfo = new TypeComparisonInfo(); - if (!this.sourceIsAssignableToTarget(memberSymbol.type, relevantSignature.returnType, member.ast(), context, comparisonInfo)) { - this.reportErrorThatMemberIsNotSubtypeOfIndexer(memberSymbol, relevantSignature, member.ast(), context, comparisonInfo); - } - } - } - } - } - }; - - PullTypeResolver.prototype.determineRelevantIndexerForMember = function (member, numberIndexSignature, stringIndexSignature) { - if (numberIndexSignature && TypeScript.PullHelpers.isNameNumeric(member.name)) { - return numberIndexSignature; - } else if (stringIndexSignature) { - return stringIndexSignature; - } - - return null; - }; - - PullTypeResolver.prototype.reportErrorThatMemberIsNotSubtypeOfIndexer = function (member, indexSignature, astForError, context, comparisonInfo) { - var enclosingSymbol = this.getEnclosingSymbolForAST(astForError); - if (indexSignature.parameters[0].type === this.semanticInfoChain.numberTypeSymbol) { - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0_NL_1, [indexSignature.returnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0, [indexSignature.returnType.toString(enclosingSymbol)])); - } - } else { - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_named_properties_must_be_assignable_to_string_indexer_type_0_NL_1, [indexSignature.returnType.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(astForError, TypeScript.DiagnosticCode.All_named_properties_must_be_assignable_to_string_indexer_type_0, [indexSignature.returnType.toString(enclosingSymbol)])); - } - } - }; - - PullTypeResolver.prototype.typeCheckIfTypeMemberPropertyOkToOverride = function (typeSymbol, extendedType, typeMember, extendedTypeMember, enclosingDecl, comparisonInfo) { - if (!typeSymbol.isClass()) { - return true; - } - - var typeMemberKind = typeMember.kind; - var extendedMemberKind = extendedTypeMember.kind; - - if (typeMemberKind === extendedMemberKind) { - return true; - } - - var errorCode; - if (typeMemberKind === 4096 /* Property */) { - if (typeMember.isAccessor()) { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; - } else { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; - } - } else if (typeMemberKind === 65536 /* Method */) { - if (extendedTypeMember.isAccessor()) { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; - } else { - errorCode = TypeScript.DiagnosticCode.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; - } - } - - var message = TypeScript.getDiagnosticMessage(errorCode, [typeSymbol.toString(), typeMember.getScopedNameEx().toString(), extendedType.toString()]); - comparisonInfo.addMessage(message); - return false; - }; - - PullTypeResolver.prototype.typeCheckIfTypeExtendsType = function (classOrInterface, name, typeSymbol, extendedType, enclosingDecl, context) { - var typeMembers = typeSymbol.getMembers(); - - var comparisonInfo = new TypeComparisonInfo(); - var foundError = false; - var foundError1 = false; - var foundError2 = false; - - for (var i = 0; i < typeMembers.length; i++) { - var propName = typeMembers[i].name; - var extendedTypeProp = extendedType.findMember(propName, true); - if (extendedTypeProp) { - this.resolveDeclaredSymbol(extendedTypeProp, context); - foundError1 = !this.typeCheckIfTypeMemberPropertyOkToOverride(typeSymbol, extendedType, typeMembers[i], extendedTypeProp, enclosingDecl, comparisonInfo); - - if (!foundError1) { - foundError2 = !this.sourcePropertyIsAssignableToTargetProperty(typeSymbol, extendedType, typeMembers[i], extendedTypeProp, classOrInterface, context, comparisonInfo); - } - - if (foundError1 || foundError2) { - foundError = true; - break; - } - } - } - - if (!foundError && typeSymbol.hasOwnCallSignatures()) { - foundError = !this.sourceCallSignaturesAreAssignableToTargetCallSignatures(typeSymbol, extendedType, classOrInterface, context, comparisonInfo); - } - - if (!foundError && typeSymbol.hasOwnConstructSignatures()) { - foundError = !this.sourceConstructSignaturesAreAssignableToTargetConstructSignatures(typeSymbol, extendedType, classOrInterface, context, comparisonInfo); - } - - if (!foundError && typeSymbol.hasOwnIndexSignatures()) { - foundError = !this.sourceIndexSignaturesAreAssignableToTargetIndexSignatures(typeSymbol, extendedType, classOrInterface, context, comparisonInfo); - } - - if (!foundError && typeSymbol.isClass()) { - var typeConstructorType = typeSymbol.getConstructorMethod().type; - var typeConstructorTypeMembers = typeConstructorType.getMembers(); - if (typeConstructorTypeMembers.length) { - var extendedConstructorType = extendedType.getConstructorMethod().type; - var comparisonInfoForPropTypeCheck = new TypeComparisonInfo(comparisonInfo); - - for (var i = 0; i < typeConstructorTypeMembers.length; i++) { - var propName = typeConstructorTypeMembers[i].name; - var extendedConstructorTypeProp = extendedConstructorType.findMember(propName, true); - if (extendedConstructorTypeProp) { - if (!extendedConstructorTypeProp.isResolved) { - this.resolveDeclaredSymbol(extendedConstructorTypeProp, context); - } - - if (!this.sourcePropertyIsAssignableToTargetProperty(typeConstructorType, extendedConstructorType, typeConstructorTypeMembers[i], extendedConstructorTypeProp, classOrInterface, context, comparisonInfo)) { - foundError = true; - break; - } - } - } - } - } - - if (foundError) { - var errorCode; - if (typeSymbol.isClass()) { - errorCode = TypeScript.DiagnosticCode.Class_0_cannot_extend_class_1_NL_2; - } else { - if (extendedType.isClass()) { - errorCode = TypeScript.DiagnosticCode.Interface_0_cannot_extend_class_1_NL_2; - } else { - errorCode = TypeScript.DiagnosticCode.Interface_0_cannot_extend_interface_1_NL_2; - } - } - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, errorCode, [typeSymbol.getScopedName(), extendedType.getScopedName(), comparisonInfo.message])); - } - }; - - PullTypeResolver.prototype.typeCheckIfClassImplementsType = function (classDecl, classSymbol, implementedType, enclosingDecl, context) { - var comparisonInfo = new TypeComparisonInfo(); - var foundError = !this.sourceMembersAreAssignableToTargetMembers(classSymbol, implementedType, classDecl, context, comparisonInfo); - if (!foundError) { - foundError = !this.sourceCallSignaturesAreAssignableToTargetCallSignatures(classSymbol, implementedType, classDecl, context, comparisonInfo); - if (!foundError) { - foundError = !this.sourceConstructSignaturesAreAssignableToTargetConstructSignatures(classSymbol, implementedType, classDecl, context, comparisonInfo); - if (!foundError) { - foundError = !this.sourceIndexSignaturesAreAssignableToTargetIndexSignatures(classSymbol, implementedType, classDecl, context, comparisonInfo); - } - } - } - - if (foundError) { - var enclosingSymbol = this.getEnclosingSymbolForAST(classDecl); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(classDecl.identifier, TypeScript.DiagnosticCode.Class_0_declares_interface_1_but_does_not_implement_it_NL_2, [classSymbol.getScopedName(enclosingSymbol), implementedType.getScopedName(enclosingSymbol), comparisonInfo.message])); - } - }; - - PullTypeResolver.prototype.computeValueSymbolFromAST = function (valueDeclAST, context) { - var prevInTypeCheck = context.inTypeCheck; - context.inTypeCheck = false; - - var typeSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(valueDeclAST); - - if (valueDeclAST.kind() == 11 /* IdentifierName */) { - var valueSymbol = this.computeNameExpression(valueDeclAST, context); - } else { - TypeScript.Debug.assert(valueDeclAST.kind() == 121 /* QualifiedName */); - var qualifiedName = valueDeclAST; - - var lhs = this.computeValueSymbolFromAST(qualifiedName.left, context); - var valueSymbol = this.computeDottedNameExpressionFromLHS(lhs.symbol, qualifiedName.left, qualifiedName.right, context, false); - } - var valueSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(valueDeclAST); - - this.semanticInfoChain.setAliasSymbolForAST(valueDeclAST, typeSymbolAlias); - context.inTypeCheck = prevInTypeCheck; - - return { symbol: valueSymbol, alias: valueSymbolAlias }; - }; - - PullTypeResolver.prototype.hasClassTypeSymbolConflictAsValue = function (baseDeclAST, typeSymbol, enclosingDecl, context) { - var typeSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(baseDeclAST); - - var valueDeclAST = baseDeclAST.kind() == 126 /* GenericType */ ? baseDeclAST.name : baseDeclAST; - var valueSymbolInfo = this.computeValueSymbolFromAST(valueDeclAST, context); - var valueSymbol = valueSymbolInfo.symbol; - var valueSymbolAlias = valueSymbolInfo.alias; - - if (typeSymbolAlias && valueSymbolAlias) { - return typeSymbolAlias !== valueSymbolAlias; - } - - if (!valueSymbol.anyDeclHasFlag(16384 /* ClassConstructorVariable */)) { - return true; - } - - var associatedContainerType = valueSymbol.type ? valueSymbol.type.getAssociatedContainerType() : null; - - if (associatedContainerType) { - return associatedContainerType !== typeSymbol.getRootSymbol(); - } - - return true; - }; - - PullTypeResolver.prototype.typeCheckBase = function (classOrInterface, name, typeSymbol, baseDeclAST, isExtendedType, enclosingDecl, context) { - var _this = this; - var typeDecl = this.semanticInfoChain.getDeclForAST(classOrInterface); - - var baseType = this.resolveTypeReference(baseDeclAST, context).type; - - if (!baseType) { - return; - } - - var typeDeclIsClass = typeSymbol.isClass(); - - if (!typeSymbol.isValidBaseKind(baseType, isExtendedType)) { - if (!baseType.isError()) { - if (isExtendedType) { - if (typeDeclIsClass) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.A_class_may_only_extend_another_class)); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.An_interface_may_only_extend_another_class_or_interface)); - } - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.A_class_may_only_implement_another_class_or_interface)); - } - } - return; - } else if (typeDeclIsClass && isExtendedType) { - if (this.hasClassTypeSymbolConflictAsValue(baseDeclAST, baseType, enclosingDecl, context)) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(baseDeclAST, TypeScript.DiagnosticCode.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_1, [TypeScript.ASTHelpers.getNameOfIdenfierOrQualifiedName(baseDeclAST.kind() == 126 /* GenericType */ ? baseDeclAST.name : baseDeclAST), baseType.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)])); - } - } - - if (baseType.hasBase(typeSymbol)) { - typeSymbol.setHasBaseTypeConflict(); - baseType.setHasBaseTypeConflict(); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, typeDeclIsClass ? TypeScript.DiagnosticCode.Class_0_is_recursively_referenced_as_a_base_type_of_itself : TypeScript.DiagnosticCode.Interface_0_is_recursively_referenced_as_a_base_type_of_itself, [typeSymbol.getScopedName()])); - return; - } - - if (isExtendedType) { - this.typeCheckCallBacks.push(function (context) { - return _this.typeCheckIfTypeExtendsType(classOrInterface, name, typeSymbol, baseType, enclosingDecl, context); - }); - } else { - TypeScript.Debug.assert(classOrInterface.kind() === 131 /* ClassDeclaration */); - - this.typeCheckCallBacks.push(function (context) { - return _this.typeCheckIfClassImplementsType(classOrInterface, typeSymbol, baseType, enclosingDecl, context); - }); - } - - this.checkSymbolPrivacy(typeSymbol, baseType, function (errorSymbol) { - return _this.baseListPrivacyErrorReporter(classOrInterface, typeSymbol, baseDeclAST, isExtendedType, errorSymbol, context); - }); - }; - - PullTypeResolver.prototype.typeCheckBases = function (classOrInterface, name, heritageClauses, typeSymbol, enclosingDecl, context) { - var _this = this; - var extendsClause = TypeScript.ASTHelpers.getExtendsHeritageClause(heritageClauses); - var implementsClause = TypeScript.ASTHelpers.getImplementsHeritageClause(heritageClauses); - if (!extendsClause && !implementsClause) { - return; - } - - if (extendsClause) { - for (var i = 0; i < extendsClause.typeNames.nonSeparatorCount(); i++) { - this.typeCheckBase(classOrInterface, name, typeSymbol, extendsClause.typeNames.nonSeparatorAt(i), true, enclosingDecl, context); - } - } - - if (typeSymbol.isClass()) { - if (implementsClause) { - for (var i = 0; i < implementsClause.typeNames.nonSeparatorCount(); i++) { - this.typeCheckBase(classOrInterface, name, typeSymbol, implementsClause.typeNames.nonSeparatorAt(i), false, enclosingDecl, context); - } - } - } else if (extendsClause && !typeSymbol.hasBaseTypeConflict() && typeSymbol.getExtendedTypes().length > 1) { - var firstInterfaceASTWithExtendsClause = TypeScript.ArrayUtilities.firstOrDefault(typeSymbol.getDeclarations(), function (decl) { - return decl.ast().heritageClauses !== null; - }).ast(); - if (classOrInterface === firstInterfaceASTWithExtendsClause) { - this.typeCheckCallBacks.push(function (context) { - _this.checkTypeCompatibilityBetweenBases(classOrInterface.identifier, typeSymbol, context); - }); - } - } - }; - - PullTypeResolver.prototype.checkTypeCompatibilityBetweenBases = function (name, typeSymbol, context) { - var derivedIndexSignatures = typeSymbol.getOwnIndexSignatures(); - - var inheritedMembersMap = TypeScript.createIntrinsicsObject(); - var inheritedIndexSignatures = new InheritedIndexSignatureInfo(); - - var typeHasOwnNumberIndexer = false; - var typeHasOwnStringIndexer = false; - - if (typeSymbol.hasOwnIndexSignatures()) { - var ownIndexSignatures = typeSymbol.getOwnIndexSignatures(); - for (var i = 0; i < ownIndexSignatures.length; i++) { - if (ownIndexSignatures[i].parameters[0].type === this.semanticInfoChain.numberTypeSymbol) { - typeHasOwnNumberIndexer = true; - } else { - typeHasOwnStringIndexer = true; - } - } - } - var baseTypes = typeSymbol.getExtendedTypes(); - for (var i = 0; i < baseTypes.length; i++) { - if (this.checkNamedPropertyIdentityBetweenBases(name, typeSymbol, baseTypes[i], inheritedMembersMap, context) || this.checkIndexSignatureIdentityBetweenBases(name, typeSymbol, baseTypes[i], inheritedIndexSignatures, typeHasOwnNumberIndexer, typeHasOwnStringIndexer, context)) { - return; - } - } - - if (this.checkThatInheritedNumberSignatureIsSubtypeOfInheritedStringSignature(name, typeSymbol, inheritedIndexSignatures, context)) { - return; - } - - this.checkInheritedMembersAgainstInheritedIndexSignatures(name, typeSymbol, inheritedIndexSignatures, inheritedMembersMap, context); - }; - - PullTypeResolver.prototype.checkNamedPropertyIdentityBetweenBases = function (interfaceName, interfaceSymbol, baseTypeSymbol, inheritedMembersMap, context) { - var baseMembers = baseTypeSymbol.getAllMembers(4096 /* Property */ | 65536 /* Method */, 0 /* all */); - for (var i = 0; i < baseMembers.length; i++) { - var member = baseMembers[i]; - var memberName = member.name; - - if (interfaceSymbol.findMember(memberName, false)) { - continue; - } - - this.resolveDeclaredSymbol(member, context); - - if (inheritedMembersMap[memberName]) { - var prevMember = inheritedMembersMap[memberName]; - if (prevMember.baseOrigin !== baseTypeSymbol && !this.propertiesAreIdenticalWithNewEnclosingTypes(baseTypeSymbol, prevMember.baseOrigin, member, prevMember.memberSymbol, context)) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Named_properties_0_of_types_1_and_2_are_not_identical, [memberName, prevMember.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName()]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(), prevMember.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName(), innerDiagnostic])); - return true; - } - } else { - inheritedMembersMap[memberName] = new MemberWithBaseOrigin(member, baseTypeSymbol); - } - } - - return false; - }; - - PullTypeResolver.prototype.checkIndexSignatureIdentityBetweenBases = function (interfaceName, interfaceSymbol, baseTypeSymbol, allInheritedSignatures, derivedTypeHasOwnNumberSignature, derivedTypeHasOwnStringSignature, context) { - if (derivedTypeHasOwnNumberSignature && derivedTypeHasOwnStringSignature) { - return false; - } - - var indexSignaturesFromThisBaseType = baseTypeSymbol.getIndexSignatures(); - for (var i = 0; i < indexSignaturesFromThisBaseType.length; i++) { - var currentInheritedSignature = indexSignaturesFromThisBaseType[i]; - - var parameterTypeIsString = currentInheritedSignature.parameters[0].type === this.semanticInfoChain.stringTypeSymbol; - var parameterTypeIsNumber = currentInheritedSignature.parameters[0].type === this.semanticInfoChain.numberTypeSymbol; - - if (parameterTypeIsString && derivedTypeHasOwnStringSignature || parameterTypeIsNumber && derivedTypeHasOwnNumberSignature) { - continue; - } - - if (parameterTypeIsString) { - if (allInheritedSignatures.stringSignatureWithBaseOrigin) { - if (allInheritedSignatures.stringSignatureWithBaseOrigin.baseOrigin !== baseTypeSymbol && !this.typesAreIdentical(allInheritedSignatures.stringSignatureWithBaseOrigin.signature.returnType, currentInheritedSignature.returnType, context)) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_of_string_indexer_of_types_0_and_1_are_not_identical, [allInheritedSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName()]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(), allInheritedSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName(), innerDiagnostic])); - return true; - } - } else { - allInheritedSignatures.stringSignatureWithBaseOrigin = new SignatureWithBaseOrigin(currentInheritedSignature, baseTypeSymbol); - } - } else if (parameterTypeIsNumber) { - if (allInheritedSignatures.numberSignatureWithBaseOrigin) { - if (allInheritedSignatures.numberSignatureWithBaseOrigin.baseOrigin !== baseTypeSymbol && !this.typesAreIdentical(allInheritedSignatures.numberSignatureWithBaseOrigin.signature.returnType, currentInheritedSignature.returnType, context)) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Types_of_number_indexer_of_types_0_and_1_are_not_identical, [allInheritedSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName()]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(), allInheritedSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(), baseTypeSymbol.getScopedName(), innerDiagnostic])); - return true; - } - } else { - allInheritedSignatures.numberSignatureWithBaseOrigin = new SignatureWithBaseOrigin(currentInheritedSignature, baseTypeSymbol); - } - } - } - - return false; - }; - - PullTypeResolver.prototype.checkInheritedMembersAgainstInheritedIndexSignatures = function (interfaceName, interfaceSymbol, inheritedIndexSignatures, inheritedMembers, context) { - if (!inheritedIndexSignatures.stringSignatureWithBaseOrigin && !inheritedIndexSignatures.numberSignatureWithBaseOrigin) { - return false; - } - - var comparisonInfo = new TypeComparisonInfo(); - var stringSignature = inheritedIndexSignatures.stringSignatureWithBaseOrigin && inheritedIndexSignatures.stringSignatureWithBaseOrigin.signature; - var numberSignature = inheritedIndexSignatures.numberSignatureWithBaseOrigin && inheritedIndexSignatures.numberSignatureWithBaseOrigin.signature; - for (var memberName in inheritedMembers) { - var memberWithBaseOrigin = inheritedMembers[memberName]; - if (!memberWithBaseOrigin) { - continue; - } - - var relevantSignature = this.determineRelevantIndexerForMember(memberWithBaseOrigin.memberSymbol, numberSignature, stringSignature); - if (!relevantSignature) { - continue; - } - - var relevantSignatureIsNumberSignature = relevantSignature.parameters[0].type === this.semanticInfoChain.numberTypeSymbol; - var signatureBaseOrigin = relevantSignatureIsNumberSignature ? inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin : inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin; - - if (signatureBaseOrigin === memberWithBaseOrigin.baseOrigin) { - continue; - } - - var memberIsSubtype = this.sourceIsAssignableToTarget(memberWithBaseOrigin.memberSymbol.type, relevantSignature.returnType, interfaceName, context, comparisonInfo); - - if (!memberIsSubtype) { - var enclosingSymbol = this.getEnclosingSymbolForAST(interfaceName); - if (relevantSignatureIsNumberSignature) { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_of_property_0_in_type_1_is_not_assignable_to_number_indexer_type_in_type_2_NL_3, [memberName, memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), comparisonInfo.message]); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(enclosingSymbol), memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), innerDiagnostic])); - } else { - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_of_property_0_in_type_1_is_not_assignable_to_string_indexer_type_in_type_2_NL_3, [memberName, memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), comparisonInfo.message]); - - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [interfaceSymbol.getDisplayName(enclosingSymbol), memberWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), innerDiagnostic])); - } - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.checkThatInheritedNumberSignatureIsSubtypeOfInheritedStringSignature = function (interfaceName, interfaceSymbol, inheritedIndexSignatures, context) { - if (inheritedIndexSignatures.numberSignatureWithBaseOrigin && inheritedIndexSignatures.stringSignatureWithBaseOrigin) { - if (inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin === inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin) { - return false; - } - - var comparisonInfo = new TypeComparisonInfo(); - var signatureIsSubtype = this.sourceIsAssignableToTarget(inheritedIndexSignatures.numberSignatureWithBaseOrigin.signature.returnType, inheritedIndexSignatures.stringSignatureWithBaseOrigin.signature.returnType, interfaceName, context, comparisonInfo); - - if (!signatureIsSubtype) { - var enclosingSymbol = this.getEnclosingSymbolForAST(interfaceName); - var innerDiagnostic = TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Type_of_number_indexer_in_type_0_is_not_assignable_to_string_indexer_type_in_type_1_NL_2, [ - inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), - inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), comparisonInfo.message]); - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(interfaceName, TypeScript.DiagnosticCode.Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3, [ - interfaceSymbol.getDisplayName(enclosingSymbol), inheritedIndexSignatures.numberSignatureWithBaseOrigin.baseOrigin.getScopedName(), - inheritedIndexSignatures.stringSignatureWithBaseOrigin.baseOrigin.getScopedName(enclosingSymbol), innerDiagnostic])); - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.checkAssignability = function (ast, source, target, context) { - var comparisonInfo = new TypeComparisonInfo(); - - var isAssignable = this.sourceIsAssignableToTarget(source, target, ast, context, comparisonInfo); - - if (!isAssignable) { - var enclosingSymbol = this.getEnclosingSymbolForAST(ast); - if (comparisonInfo.message) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Cannot_convert_0_to_1_NL_2, [source.toString(enclosingSymbol), target.toString(enclosingSymbol), comparisonInfo.message])); - } else { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Cannot_convert_0_to_1, [source.toString(enclosingSymbol), target.toString(enclosingSymbol)])); - } - } - }; - - PullTypeResolver.prototype.isReference = function (ast, astSymbol) { - if (ast.kind() === 217 /* ParenthesizedExpression */) { - return this.isReference(ast.expression, astSymbol); - } - - if (ast.kind() !== 11 /* IdentifierName */ && ast.kind() !== 212 /* MemberAccessExpression */ && ast.kind() !== 221 /* ElementAccessExpression */) { - return false; - } - - if (ast.kind() === 11 /* IdentifierName */) { - if (astSymbol.kind === 512 /* Variable */ && astSymbol.anyDeclHasFlag(4096 /* Enum */)) { - return false; - } - - if (astSymbol.kind === 512 /* Variable */ && astSymbol.anyDeclHasFlag(102400 /* SomeInitializedModule */)) { - return false; - } - - if (astSymbol.kind === 32768 /* ConstructorMethod */ || astSymbol.kind === 16384 /* Function */) { - return false; - } - } - - if (ast.kind() === 212 /* MemberAccessExpression */ && astSymbol.kind === 67108864 /* EnumMember */) { - return false; - } - - return true; - }; - - PullTypeResolver.prototype.checkForSuperMemberAccess = function (expression, name, resolvedName, context) { - if (resolvedName) { - if (expression.kind() === 50 /* SuperKeyword */ && !resolvedName.isError() && resolvedName.kind !== 65536 /* Method */) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode.Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword)); - return true; - } - } - - return false; - }; - - PullTypeResolver.prototype.getEnclosingDeclForAST = function (ast) { - return this.semanticInfoChain.getEnclosingDecl(ast); - }; - - PullTypeResolver.prototype.getEnclosingSymbolForAST = function (ast) { - var enclosingDecl = this.getEnclosingDeclForAST(ast); - return enclosingDecl ? enclosingDecl.getSymbol() : null; - }; - - PullTypeResolver.prototype.checkForPrivateMemberAccess = function (name, expressionType, resolvedName, context) { - if (resolvedName) { - if (resolvedName.anyDeclHasFlag(2 /* Private */)) { - var memberContainer = resolvedName.getContainer(); - if (memberContainer && memberContainer.kind === 33554432 /* ConstructorType */) { - memberContainer = memberContainer.getAssociatedContainerType(); - } - - if (memberContainer && memberContainer.isClass()) { - var memberClass = memberContainer.getDeclarations()[0].ast(); - TypeScript.Debug.assert(memberClass); - - var containingClass = this.getEnclosingClassDeclaration(name); - - if (!containingClass || containingClass !== memberClass) { - context.postDiagnostic(this.semanticInfoChain.diagnosticFromAST(name, TypeScript.DiagnosticCode._0_1_is_inaccessible, [memberContainer.toString(null, false), name.text()])); - return true; - } - } - } - } - - return false; - }; - - PullTypeResolver.prototype.instantiateType = function (type, typeParameterArgumentMap) { - if (type.isPrimitive()) { - return type; - } - - if (type.isError()) { - return type; - } - - if (typeParameterArgumentMap[type.pullSymbolID]) { - return typeParameterArgumentMap[type.pullSymbolID]; - } - - type._resolveDeclaredSymbol(); - if (type.isTypeParameter()) { - return this.instantiateTypeParameter(type, typeParameterArgumentMap); - } - - if (type.wrapsSomeTypeParameter(typeParameterArgumentMap)) { - return TypeScript.PullInstantiatedTypeReferenceSymbol.create(this, type, typeParameterArgumentMap); - } - - return type; - }; - - PullTypeResolver.prototype.instantiateTypeParameter = function (typeParameter, typeParameterArgumentMap) { - var constraint = typeParameter.getConstraint(); - if (!constraint) { - return typeParameter; - } - - var instantiatedConstraint = this.instantiateType(constraint, typeParameterArgumentMap); - - if (instantiatedConstraint == constraint) { - return typeParameter; - } - - var rootTypeParameter = typeParameter.getRootSymbol(); - var instantiation = rootTypeParameter.getSpecialization([instantiatedConstraint]); - if (instantiation) { - return instantiation; - } - - instantiation = new TypeScript.PullInstantiatedTypeParameterSymbol(rootTypeParameter, instantiatedConstraint); - return instantiation; - }; - - PullTypeResolver.prototype.instantiateSignature = function (signature, typeParameterArgumentMap) { - if (!signature.wrapsSomeTypeParameter(typeParameterArgumentMap)) { - return signature; - } - - var rootSignature = signature.getRootSymbol(); - var mutableTypeParameterMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(typeParameterArgumentMap); - TypeScript.PullInstantiationHelpers.instantiateTypeArgument(this, signature, mutableTypeParameterMap); - - var instantiatedSignature = rootSignature.getSpecialization(mutableTypeParameterMap.typeParameterArgumentMap); - if (instantiatedSignature) { - return instantiatedSignature; - } - - TypeScript.PullInstantiationHelpers.cleanUpTypeArgumentMap(signature, mutableTypeParameterMap); - typeParameterArgumentMap = mutableTypeParameterMap.typeParameterArgumentMap; - - instantiatedSignature = new TypeScript.PullInstantiatedSignatureSymbol(rootSignature, typeParameterArgumentMap); - - instantiatedSignature.returnType = this.instantiateType((rootSignature.returnType || this.semanticInfoChain.anyTypeSymbol), typeParameterArgumentMap); - instantiatedSignature.functionType = this.instantiateType(rootSignature.functionType, typeParameterArgumentMap); - - var parameters = rootSignature.parameters; - var parameter = null; - - if (parameters) { - for (var j = 0; j < parameters.length; j++) { - parameter = new TypeScript.PullSymbol(parameters[j].name, 2048 /* Parameter */); - parameter.setRootSymbol(parameters[j]); - - if (parameters[j].isOptional) { - parameter.isOptional = true; - } - if (parameters[j].isVarArg) { - parameter.isVarArg = true; - instantiatedSignature.hasVarArgs = true; - } - instantiatedSignature.addParameter(parameter, parameter.isOptional); - - parameter.type = this.instantiateType(parameters[j].type, typeParameterArgumentMap); - } - } - - return instantiatedSignature; - }; - PullTypeResolver.globalTypeCheckPhase = 0; - return PullTypeResolver; - })(); - TypeScript.PullTypeResolver = PullTypeResolver; - - var TypeComparisonInfo = (function () { - function TypeComparisonInfo(sourceComparisonInfo, useSameIndent) { - this.onlyCaptureFirstError = false; - this.flags = 0 /* SuccessfulComparison */; - this.message = ""; - this.stringConstantVal = null; - this.indent = 1; - if (sourceComparisonInfo) { - this.flags = sourceComparisonInfo.flags; - this.onlyCaptureFirstError = sourceComparisonInfo.onlyCaptureFirstError; - this.stringConstantVal = sourceComparisonInfo.stringConstantVal; - this.indent = sourceComparisonInfo.indent; - if (!useSameIndent) { - this.indent++; - } - } - } - TypeComparisonInfo.prototype.indentString = function () { - var result = ""; - - for (var i = 0; i < this.indent; i++) { - result += "\t"; - } - - return result; - }; - - TypeComparisonInfo.prototype.addMessage = function (message) { - if (!this.onlyCaptureFirstError && this.message) { - this.message = this.message + TypeScript.newLine() + this.indentString() + message; - } else { - this.message = this.indentString() + message; - } - }; - return TypeComparisonInfo; - })(); - TypeScript.TypeComparisonInfo = TypeComparisonInfo; - - function getPropertyAssignmentNameTextFromIdentifier(identifier) { - if (identifier.kind() === 11 /* IdentifierName */) { - return { actualText: identifier.text(), memberName: identifier.valueText() }; - } else if (identifier.kind() === 14 /* StringLiteral */) { - return { actualText: identifier.text(), memberName: identifier.valueText() }; - } else if (identifier.kind() === 13 /* NumericLiteral */) { - return { actualText: identifier.text(), memberName: identifier.valueText() }; - } else { - throw TypeScript.Errors.invalidOperation(); - } - } - TypeScript.getPropertyAssignmentNameTextFromIdentifier = getPropertyAssignmentNameTextFromIdentifier; - - function isTypesOnlyLocation(ast) { - while (ast && ast.parent) { - switch (ast.parent.kind()) { - case 244 /* TypeAnnotation */: - return true; - case 127 /* TypeQuery */: - return false; - case 125 /* ConstructorType */: - var constructorType = ast.parent; - if (constructorType.type === ast) { - return true; - } - break; - case 123 /* FunctionType */: - var functionType = ast.parent; - if (functionType.type === ast) { - return true; - } - break; - case 239 /* Constraint */: - var constraint = ast.parent; - if (constraint.type === ast) { - return true; - } - break; - case 220 /* CastExpression */: - var castExpression = ast.parent; - return castExpression.type === ast; - case 230 /* ExtendsHeritageClause */: - case 231 /* ImplementsHeritageClause */: - return true; - case 228 /* TypeArgumentList */: - return true; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - case 129 /* FunctionDeclaration */: - case 145 /* MethodSignature */: - case 212 /* MemberAccessExpression */: - case 242 /* Parameter */: - return false; - } - - ast = ast.parent; - } - - return false; - } - TypeScript.isTypesOnlyLocation = isTypesOnlyLocation; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.declCacheHit = 0; - TypeScript.declCacheMiss = 0; - TypeScript.symbolCacheHit = 0; - TypeScript.symbolCacheMiss = 0; - - var sentinalEmptyArray = []; - - var SemanticInfoChain = (function () { - function SemanticInfoChain(compiler, logger) { - this.compiler = compiler; - this.logger = logger; - this.documents = []; - this.fileNameToDocument = TypeScript.createIntrinsicsObject(); - this.anyTypeDecl = null; - this.booleanTypeDecl = null; - this.numberTypeDecl = null; - this.stringTypeDecl = null; - this.nullTypeDecl = null; - this.undefinedTypeDecl = null; - this.voidTypeDecl = null; - this.undefinedValueDecl = null; - this.anyTypeSymbol = null; - this.booleanTypeSymbol = null; - this.numberTypeSymbol = null; - this.stringTypeSymbol = null; - this.nullTypeSymbol = null; - this.undefinedTypeSymbol = null; - this.voidTypeSymbol = null; - this.undefinedValueSymbol = null; - this.emptyTypeSymbol = null; - this.astSymbolMap = []; - this.astAliasSymbolMap = []; - this.astCallResolutionDataMap = []; - this.declSymbolMap = []; - this.declSignatureSymbolMap = []; - this.declCache = null; - this.symbolCache = null; - this.fileNameToDiagnostics = null; - this._binder = null; - this._resolver = null; - this._topLevelDecls = null; - this._fileNames = null; - var globalDecl = new TypeScript.RootPullDecl("", "", 0 /* Global */, 0 /* None */, this, false); - this.documents[0] = new TypeScript.Document(this.compiler, this, "", [], null, 0 /* None */, 0, false, null, globalDecl); - - this.anyTypeDecl = new TypeScript.NormalPullDecl("any", "any", 2 /* Primitive */, 0 /* None */, globalDecl); - this.booleanTypeDecl = new TypeScript.NormalPullDecl("boolean", "boolean", 2 /* Primitive */, 0 /* None */, globalDecl); - this.numberTypeDecl = new TypeScript.NormalPullDecl("number", "number", 2 /* Primitive */, 0 /* None */, globalDecl); - this.stringTypeDecl = new TypeScript.NormalPullDecl("string", "string", 2 /* Primitive */, 0 /* None */, globalDecl); - this.voidTypeDecl = new TypeScript.NormalPullDecl("void", "void", 2 /* Primitive */, 0 /* None */, globalDecl); - - this.nullTypeDecl = new TypeScript.RootPullDecl("null", "", 2 /* Primitive */, 0 /* None */, this, false); - this.undefinedTypeDecl = new TypeScript.RootPullDecl("undefined", "", 2 /* Primitive */, 0 /* None */, this, false); - this.undefinedValueDecl = new TypeScript.NormalPullDecl("undefined", "undefined", 512 /* Variable */, 8 /* Ambient */, globalDecl); - - this.invalidate(); - } - SemanticInfoChain.prototype.getDocument = function (fileName) { - var document = this.fileNameToDocument[fileName]; - return document || null; - }; - - SemanticInfoChain.prototype.lineMap = function (fileName) { - return this.getDocument(fileName).lineMap(); - }; - - SemanticInfoChain.prototype.fileNames = function () { - if (this._fileNames === null) { - this._fileNames = this.documents.slice(1).map(function (s) { - return s.fileName; - }); - } - - return this._fileNames; - }; - - SemanticInfoChain.prototype.bindPrimitiveSymbol = function (decl, newSymbol) { - newSymbol.addDeclaration(decl); - decl.setSymbol(newSymbol); - newSymbol.setResolved(); - - return newSymbol; - }; - - SemanticInfoChain.prototype.addPrimitiveTypeSymbol = function (decl) { - var newSymbol = new TypeScript.PullPrimitiveTypeSymbol(decl.name); - return this.bindPrimitiveSymbol(decl, newSymbol); - }; - - SemanticInfoChain.prototype.addPrimitiveValueSymbol = function (decl, type) { - var newSymbol = new TypeScript.PullSymbol(decl.name, 512 /* Variable */); - newSymbol.type = type; - return this.bindPrimitiveSymbol(decl, newSymbol); - }; - - SemanticInfoChain.prototype.resetGlobalSymbols = function () { - this.anyTypeSymbol = this.addPrimitiveTypeSymbol(this.anyTypeDecl); - this.booleanTypeSymbol = this.addPrimitiveTypeSymbol(this.booleanTypeDecl); - this.numberTypeSymbol = this.addPrimitiveTypeSymbol(this.numberTypeDecl); - this.stringTypeSymbol = this.addPrimitiveTypeSymbol(this.stringTypeDecl); - this.voidTypeSymbol = this.addPrimitiveTypeSymbol(this.voidTypeDecl); - this.nullTypeSymbol = this.addPrimitiveTypeSymbol(this.nullTypeDecl); - this.undefinedTypeSymbol = this.addPrimitiveTypeSymbol(this.undefinedTypeDecl); - this.undefinedValueSymbol = this.addPrimitiveValueSymbol(this.undefinedValueDecl, this.undefinedTypeSymbol); - - var emptyTypeDecl = new TypeScript.PullSynthesizedDecl("{}", "{}", 8388608 /* ObjectType */, 0 /* None */, null, this); - var emptyTypeSymbol = new TypeScript.PullTypeSymbol("{}", 8388608 /* ObjectType */); - emptyTypeDecl.setSymbol(emptyTypeSymbol); - emptyTypeSymbol.addDeclaration(emptyTypeDecl); - emptyTypeSymbol.setResolved(); - this.emptyTypeSymbol = emptyTypeSymbol; - }; - - SemanticInfoChain.prototype.addDocument = function (document) { - var fileName = document.fileName; - - var existingIndex = TypeScript.ArrayUtilities.indexOf(this.documents, function (u) { - return u.fileName === fileName; - }); - if (existingIndex < 0) { - this.documents.push(document); - } else { - this.documents[existingIndex] = document; - } - - this.fileNameToDocument[fileName] = document; - - this.invalidate(); - }; - - SemanticInfoChain.prototype.removeDocument = function (fileName) { - TypeScript.Debug.assert(fileName !== "", "Can't remove the semantic info for the global decl."); - var index = TypeScript.ArrayUtilities.indexOf(this.documents, function (u) { - return u.fileName === fileName; - }); - if (index > 0) { - this.fileNameToDocument[fileName] = undefined; - this.documents.splice(index, 1); - this.invalidate(); - } - }; - - SemanticInfoChain.prototype.getDeclPathCacheID = function (declPath, declKind) { - var cacheID = ""; - - for (var i = 0; i < declPath.length; i++) { - cacheID += "#" + declPath[i]; - } - - return cacheID + "#" + declKind.toString(); - }; - - SemanticInfoChain.prototype.findTopLevelSymbol = function (name, kind, doNotGoPastThisDecl) { - var cacheID = this.getDeclPathCacheID([name], kind); - - var symbol = this.symbolCache[cacheID]; - - if (!symbol) { - for (var i = 0, n = this.documents.length; i < n; i++) { - var topLevelDecl = this.documents[i].topLevelDecl(); - - var symbol = this.findTopLevelSymbolInDecl(topLevelDecl, name, kind, doNotGoPastThisDecl); - if (symbol) { - break; - } - - if (doNotGoPastThisDecl && topLevelDecl.name === doNotGoPastThisDecl.fileName()) { - return null; - } - } - - if (symbol) { - this.symbolCache[cacheID] = symbol; - } - } - - return symbol; - }; - - SemanticInfoChain.prototype.findTopLevelSymbolInDecl = function (topLevelDecl, name, kind, doNotGoPastThisDecl) { - var doNotGoPastThisPosition = doNotGoPastThisDecl && doNotGoPastThisDecl.fileName() === topLevelDecl.fileName() ? doNotGoPastThisDecl.ast().start() : -1; - - var foundDecls = topLevelDecl.searchChildDecls(name, kind); - - for (var j = 0; j < foundDecls.length; j++) { - var foundDecl = foundDecls[j]; - - if (doNotGoPastThisPosition !== -1 && foundDecl.ast() && foundDecl.ast().start() > doNotGoPastThisPosition) { - break; - } - - var symbol = foundDecls[j].getSymbol(); - if (symbol) { - return symbol; - } - } - - return null; - }; - - SemanticInfoChain.prototype.findExternalModule = function (id) { - id = TypeScript.normalizePath(id); - - var tsFile = id + ".ts"; - var tsCacheID = this.getDeclPathCacheID([tsFile], 32 /* DynamicModule */); - symbol = this.symbolCache[tsCacheID]; - if (symbol != undefined) { - return symbol; - } - - var dtsFile = id + ".d.ts"; - var dtsCacheID = this.getDeclPathCacheID([dtsFile], 32 /* DynamicModule */); - var symbol = this.symbolCache[dtsCacheID]; - if (symbol) { - return symbol; - } - - var dtsSymbol; - for (var i = 0; i < this.documents.length; i++) { - var document = this.documents[i]; - var topLevelDecl = document.topLevelDecl(); - - if (topLevelDecl.isExternalModule()) { - var isTsFile = document.fileName === tsFile; - if (isTsFile || document.fileName === dtsFile) { - var dynamicModuleDecl = topLevelDecl.getChildDecls()[0]; - symbol = dynamicModuleDecl.getSymbol(); - - if (isTsFile) { - this.symbolCache[tsCacheID] = symbol; - - return symbol; - } else { - dtsSymbol = symbol; - } - } - } - } - - if (dtsSymbol) { - this.symbolCache[dtsCacheID] = symbol; - return dtsSymbol; - } - - this.symbolCache[dtsCacheID] = null; - this.symbolCache[tsCacheID] = null; - - return null; - }; - - SemanticInfoChain.prototype.findAmbientExternalModuleInGlobalContext = function (id) { - var cacheID = this.getDeclPathCacheID([id], 32 /* DynamicModule */); - - var symbol = this.symbolCache[cacheID]; - if (symbol == undefined) { - symbol = null; - for (var i = 0; i < this.documents.length; i++) { - var document = this.documents[i]; - var topLevelDecl = document.topLevelDecl(); - - if (!topLevelDecl.isExternalModule()) { - var dynamicModules = topLevelDecl.searchChildDecls(id, 32 /* DynamicModule */); - if (dynamicModules.length) { - symbol = dynamicModules[0].getSymbol(); - break; - } - } - } - - this.symbolCache[cacheID] = symbol; - } - - return symbol; - }; - - SemanticInfoChain.prototype.findDecls = function (declPath, declKind) { - var cacheID = this.getDeclPathCacheID(declPath, declKind); - - if (declPath.length) { - var cachedDecls = this.declCache[cacheID]; - - if (cachedDecls && cachedDecls.length) { - TypeScript.declCacheHit++; - return cachedDecls; - } - } - - TypeScript.declCacheMiss++; - - var declsToSearch = this.topLevelDecls(); - - var decls = TypeScript.sentinelEmptyArray; - var path; - var foundDecls = TypeScript.sentinelEmptyArray; - - for (var i = 0; i < declPath.length; i++) { - path = declPath[i]; - decls = TypeScript.sentinelEmptyArray; - - var kind = (i === declPath.length - 1) ? declKind : 164 /* SomeContainer */; - for (var j = 0; j < declsToSearch.length; j++) { - foundDecls = declsToSearch[j].searchChildDecls(path, kind); - - for (var k = 0; k < foundDecls.length; k++) { - if (decls === TypeScript.sentinelEmptyArray) { - decls = []; - } - decls[decls.length] = foundDecls[k]; - } - } - - declsToSearch = decls; - - if (!declsToSearch) { - break; - } - } - - if (decls.length) { - this.declCache[cacheID] = decls; - } - - return decls; - }; - - SemanticInfoChain.prototype.findDeclsFromPath = function (declPath, declKind) { - var declString = []; - - for (var i = 0, n = declPath.length; i < n; i++) { - if (declPath[i].kind & 1 /* Script */) { - continue; - } - - declString.push(declPath[i].name); - } - - return this.findDecls(declString, declKind); - }; - - SemanticInfoChain.prototype.findSymbol = function (declPath, declType) { - var cacheID = this.getDeclPathCacheID(declPath, declType); - - if (declPath.length) { - var cachedSymbol = this.symbolCache[cacheID]; - - if (cachedSymbol) { - TypeScript.symbolCacheHit++; - return cachedSymbol; - } - } - - TypeScript.symbolCacheMiss++; - - var decls = this.findDecls(declPath, declType); - var symbol = null; - - if (decls.length) { - var decl = decls[0]; - if (TypeScript.hasFlag(decl.kind, 164 /* SomeContainer */)) { - var valueDecl = decl.getValueDecl(); - if (valueDecl) { - valueDecl.ensureSymbolIsBound(); - } - } - symbol = decl.getSymbol(); - - if (symbol) { - for (var i = 1; i < decls.length; i++) { - decls[i].ensureSymbolIsBound(); - } - - this.symbolCache[cacheID] = symbol; - } - } - - return symbol; - }; - - SemanticInfoChain.prototype.cacheGlobalSymbol = function (symbol, kind) { - var cacheID1 = this.getDeclPathCacheID([symbol.name], kind); - var cacheID2 = this.getDeclPathCacheID([symbol.name], symbol.kind); - - if (!this.symbolCache[cacheID1]) { - this.symbolCache[cacheID1] = symbol; - } - - if (!this.symbolCache[cacheID2]) { - this.symbolCache[cacheID2] = symbol; - } - }; - - SemanticInfoChain.prototype.invalidate = function (oldSettings, newSettings) { - if (typeof oldSettings === "undefined") { oldSettings = null; } - if (typeof newSettings === "undefined") { newSettings = null; } - TypeScript.PullTypeResolver.globalTypeCheckPhase++; - - var cleanStart = new Date().getTime(); - - this.astSymbolMap.length = 0; - this.astAliasSymbolMap.length = 0; - this.astCallResolutionDataMap.length = 0; - - this.declCache = TypeScript.createIntrinsicsObject(); - this.symbolCache = TypeScript.createIntrinsicsObject(); - this.fileNameToDiagnostics = TypeScript.createIntrinsicsObject(); - this._binder = null; - this._resolver = null; - this._topLevelDecls = null; - this._fileNames = null; - - this.declSymbolMap.length = 0; - this.declSignatureSymbolMap.length = 0; - - if (oldSettings && newSettings) { - if (this.settingsChangeAffectsSyntax(oldSettings, newSettings)) { - for (var i = 1, n = this.documents.length; i < n; i++) { - this.documents[i].invalidate(); - } - } - } - - TypeScript.pullSymbolID = 0; - - this.resetGlobalSymbols(); - - var cleanEnd = new Date().getTime(); - }; - - SemanticInfoChain.prototype.settingsChangeAffectsSyntax = function (before, after) { - return before.allowAutomaticSemicolonInsertion() !== after.allowAutomaticSemicolonInsertion() || before.codeGenTarget() !== after.codeGenTarget() || before.propagateEnumConstants() !== after.propagateEnumConstants(); - }; - - SemanticInfoChain.prototype.setSymbolForAST = function (ast, symbol) { - this.astSymbolMap[ast.syntaxID()] = symbol; - }; - - SemanticInfoChain.prototype.getSymbolForAST = function (ast) { - return this.astSymbolMap[ast.syntaxID()] || null; - }; - - SemanticInfoChain.prototype.setAliasSymbolForAST = function (ast, symbol) { - this.astAliasSymbolMap[ast.syntaxID()] = symbol; - }; - - SemanticInfoChain.prototype.getAliasSymbolForAST = function (ast) { - return this.astAliasSymbolMap[ast.syntaxID()]; - }; - - SemanticInfoChain.prototype.getCallResolutionDataForAST = function (ast) { - return this.astCallResolutionDataMap[ast.syntaxID()]; - }; - - SemanticInfoChain.prototype.setCallResolutionDataForAST = function (ast, callResolutionData) { - if (callResolutionData) { - this.astCallResolutionDataMap[ast.syntaxID()] = callResolutionData; - } - }; - - SemanticInfoChain.prototype.setSymbolForDecl = function (decl, symbol) { - this.declSymbolMap[decl.declID] = symbol; - }; - - SemanticInfoChain.prototype.getSymbolForDecl = function (decl) { - return this.declSymbolMap[decl.declID]; - }; - - SemanticInfoChain.prototype.setSignatureSymbolForDecl = function (decl, signatureSymbol) { - this.declSignatureSymbolMap[decl.declID] = signatureSymbol; - }; - - SemanticInfoChain.prototype.getSignatureSymbolForDecl = function (decl) { - return this.declSignatureSymbolMap[decl.declID]; - }; - - SemanticInfoChain.prototype.addDiagnostic = function (diagnostic) { - var fileName = diagnostic.fileName(); - var diagnostics = this.fileNameToDiagnostics[fileName]; - if (!diagnostics) { - diagnostics = []; - this.fileNameToDiagnostics[fileName] = diagnostics; - } - - diagnostics.push(diagnostic); - }; - - SemanticInfoChain.prototype.getDiagnostics = function (fileName) { - var diagnostics = this.fileNameToDiagnostics[fileName]; - return diagnostics || []; - }; - - SemanticInfoChain.prototype.getBinder = function () { - if (!this._binder) { - this._binder = new TypeScript.PullSymbolBinder(this); - } - - return this._binder; - }; - - SemanticInfoChain.prototype.getResolver = function () { - if (!this._resolver) { - this._resolver = new TypeScript.PullTypeResolver(this.compiler.compilationSettings(), this); - } - - return this._resolver; - }; - - SemanticInfoChain.prototype.addSyntheticIndexSignature = function (containingDecl, containingSymbol, ast, indexParamName, indexParamType, returnType) { - var indexSignature = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - var indexParameterSymbol = new TypeScript.PullSymbol(indexParamName, 2048 /* Parameter */); - indexParameterSymbol.type = indexParamType; - indexSignature.addParameter(indexParameterSymbol); - indexSignature.returnType = returnType; - indexSignature.setResolved(); - indexParameterSymbol.setResolved(); - - containingSymbol.addIndexSignature(indexSignature); - - var indexSigDecl = new TypeScript.PullSynthesizedDecl("", "", 4194304 /* IndexSignature */, 2048 /* Signature */, containingDecl, containingDecl.semanticInfoChain); - var indexParamDecl = new TypeScript.PullSynthesizedDecl(indexParamName, indexParamName, 2048 /* Parameter */, 0 /* None */, indexSigDecl, containingDecl.semanticInfoChain); - indexSigDecl.setSignatureSymbol(indexSignature); - indexParamDecl.setSymbol(indexParameterSymbol); - indexSignature.addDeclaration(indexSigDecl); - indexParameterSymbol.addDeclaration(indexParamDecl); - }; - - SemanticInfoChain.prototype.getDeclForAST = function (ast) { - var document = this.getDocument(ast.fileName()); - - if (document) { - return document._getDeclForAST(ast); - } - - return null; - }; - - SemanticInfoChain.prototype.getEnclosingDecl = function (ast) { - return this.getDocument(ast.fileName()).getEnclosingDecl(ast); - }; - - SemanticInfoChain.prototype.setDeclForAST = function (ast, decl) { - this.getDocument(decl.fileName())._setDeclForAST(ast, decl); - }; - - SemanticInfoChain.prototype.getASTForDecl = function (decl) { - var document = this.getDocument(decl.fileName()); - if (document) { - return document._getASTForDecl(decl); - } - - return null; - }; - - SemanticInfoChain.prototype.setASTForDecl = function (decl, ast) { - this.getDocument(decl.fileName())._setASTForDecl(decl, ast); - }; - - SemanticInfoChain.prototype.topLevelDecl = function (fileName) { - var document = this.getDocument(fileName); - if (document) { - return document.topLevelDecl(); - } - - return null; - }; - - SemanticInfoChain.prototype.topLevelDecls = function () { - if (!this._topLevelDecls) { - this._topLevelDecls = TypeScript.ArrayUtilities.select(this.documents, function (u) { - return u.topLevelDecl(); - }); - } - - return this._topLevelDecls; - }; - - SemanticInfoChain.prototype.addDiagnosticFromAST = function (ast, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - this.addDiagnostic(this.diagnosticFromAST(ast, diagnosticKey, _arguments, additionalLocations)); - }; - - SemanticInfoChain.prototype.diagnosticFromAST = function (ast, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - return new TypeScript.Diagnostic(ast.fileName(), this.lineMap(ast.fileName()), ast.start(), ast.width(), diagnosticKey, _arguments, additionalLocations); - }; - - SemanticInfoChain.prototype.locationFromAST = function (ast) { - return new TypeScript.Location(ast.fileName(), this.lineMap(ast.fileName()), ast.start(), ast.width()); - }; - - SemanticInfoChain.prototype.duplicateIdentifierDiagnosticFromAST = function (ast, identifier, additionalLocationAST) { - return this.diagnosticFromAST(ast, TypeScript.DiagnosticCode.Duplicate_identifier_0, [identifier], additionalLocationAST ? [this.locationFromAST(additionalLocationAST)] : null); - }; - - SemanticInfoChain.prototype.addDuplicateIdentifierDiagnosticFromAST = function (ast, identifier, additionalLocationAST) { - this.addDiagnostic(this.duplicateIdentifierDiagnosticFromAST(ast, identifier, additionalLocationAST)); - }; - return SemanticInfoChain; - })(); - TypeScript.SemanticInfoChain = SemanticInfoChain; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var DeclCollectionContext = (function () { - function DeclCollectionContext(document, semanticInfoChain, propagateEnumConstants) { - this.document = document; - this.semanticInfoChain = semanticInfoChain; - this.propagateEnumConstants = propagateEnumConstants; - this.isDeclareFile = false; - this.parentChain = []; - } - DeclCollectionContext.prototype.getParent = function () { - return this.parentChain ? this.parentChain[this.parentChain.length - 1] : null; - }; - - DeclCollectionContext.prototype.pushParent = function (parentDecl) { - if (parentDecl) { - this.parentChain[this.parentChain.length] = parentDecl; - } - }; - - DeclCollectionContext.prototype.popParent = function () { - this.parentChain.length--; - }; - return DeclCollectionContext; - })(); - - function moduleElementsHasExportAssignment(moduleElements) { - return moduleElements.any(function (m) { - return m.kind() === 134 /* ExportAssignment */; - }); - } - - function containingModuleHasExportAssignment(ast) { - ast = ast.parent; - while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { - var moduleDecl = ast; - return moduleElementsHasExportAssignment(moduleDecl.moduleElements); - } else if (ast.kind() === 120 /* SourceUnit */) { - var sourceUnit = ast; - return moduleElementsHasExportAssignment(sourceUnit.moduleElements); - } - - ast = ast.parent; - } - - return false; - } - - function isParsingAmbientModule(ast, context) { - ast = ast.parent; - while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { - if (TypeScript.hasModifier(ast.modifiers, 8 /* Ambient */)) { - return true; - } - } - - ast = ast.parent; - } - - return false; - } - - function preCollectImportDecls(ast, context) { - var importDecl = ast; - var declFlags = 0 /* None */; - - var parent = context.getParent(); - - if (TypeScript.hasModifier(importDecl.modifiers, 1 /* Exported */) && !containingModuleHasExportAssignment(ast)) { - declFlags |= 1 /* Exported */; - } - - var decl = new TypeScript.NormalPullDecl(importDecl.identifier.valueText(), importDecl.identifier.text(), 128 /* TypeAlias */, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - } - - function preCollectScriptDecls(sourceUnit, context) { - var fileName = sourceUnit.fileName(); - - var isExternalModule = context.document.isExternalModule(); - - var decl = new TypeScript.RootPullDecl(fileName, fileName, 1 /* Script */, 0 /* None */, context.semanticInfoChain, isExternalModule); - context.semanticInfoChain.setDeclForAST(sourceUnit, decl); - context.semanticInfoChain.setASTForDecl(decl, sourceUnit); - - context.isDeclareFile = context.document.isDeclareFile(); - - context.pushParent(decl); - - if (isExternalModule) { - var declFlags = 1 /* Exported */; - if (TypeScript.isDTSFile(fileName)) { - declFlags |= 8 /* Ambient */; - } - - var moduleContainsExecutableCode = containsExecutableCode(sourceUnit.moduleElements); - var kind = 32 /* DynamicModule */; - var valueText = TypeScript.quoteStr(fileName); - - var decl = new TypeScript.NormalPullDecl(valueText, fileName, kind, declFlags, context.getParent()); - - context.semanticInfoChain.setASTForDecl(decl, sourceUnit); - - context.semanticInfoChain.setDeclForAST(sourceUnit, decl); - - if (!moduleElementsHasExportAssignment(sourceUnit.moduleElements) || moduleContainsExecutableCode) { - createModuleVariableDecl(decl, sourceUnit, context); - } - - context.pushParent(decl); - } - } - - function preCollectEnumDecls(enumDecl, context) { - var declFlags = 0 /* None */; - var enumName = enumDecl.identifier.valueText(); - - if ((TypeScript.hasModifier(enumDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(enumDecl, context)) && !containingModuleHasExportAssignment(enumDecl)) { - declFlags |= 1 /* Exported */; - } - - if (TypeScript.hasModifier(enumDecl.modifiers, 8 /* Ambient */) || isParsingAmbientModule(enumDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; - } - - declFlags |= 4096 /* Enum */; - var kind = 64 /* Enum */; - - var enumDeclaration = new TypeScript.NormalPullDecl(enumName, enumDecl.identifier.text(), kind, declFlags, context.getParent()); - context.semanticInfoChain.setDeclForAST(enumDecl, enumDeclaration); - context.semanticInfoChain.setASTForDecl(enumDeclaration, enumDecl); - - var valueDecl = new TypeScript.NormalPullDecl(enumDeclaration.name, enumDeclaration.getDisplayName(), 512 /* Variable */, enumDeclaration.flags, context.getParent()); - enumDeclaration.setValueDecl(valueDecl); - context.semanticInfoChain.setASTForDecl(valueDecl, enumDecl); - - context.pushParent(enumDeclaration); - } - - function createEnumElementDecls(propertyDecl, context) { - var parent = context.getParent(); - - var decl = new TypeScript.PullEnumElementDecl(propertyDecl.propertyName.valueText(), propertyDecl.propertyName.text(), parent); - context.semanticInfoChain.setDeclForAST(propertyDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyDecl); - } - - function preCollectModuleDecls(moduleDecl, context) { - var declFlags = 0 /* None */; - - var moduleContainsExecutableCode = containsExecutableCode(moduleDecl.moduleElements); - - var isDynamic = moduleDecl.stringLiteral !== null; - - if ((TypeScript.hasModifier(moduleDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(moduleDecl, context)) && !containingModuleHasExportAssignment(moduleDecl)) { - declFlags |= 1 /* Exported */; - } - - if (TypeScript.hasModifier(moduleDecl.modifiers, 8 /* Ambient */) || isParsingAmbientModule(moduleDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; - } - - var kind = isDynamic ? 32 /* DynamicModule */ : 4 /* Container */; - - if (moduleDecl.stringLiteral) { - var valueText = TypeScript.quoteStr(moduleDecl.stringLiteral.valueText()); - var text = moduleDecl.stringLiteral.text(); - - var decl = new TypeScript.NormalPullDecl(valueText, text, kind, declFlags, context.getParent()); - - context.semanticInfoChain.setDeclForAST(moduleDecl, decl); - context.semanticInfoChain.setDeclForAST(moduleDecl.stringLiteral, decl); - context.semanticInfoChain.setASTForDecl(decl, moduleDecl.stringLiteral); - - if (!moduleElementsHasExportAssignment(moduleDecl.moduleElements) || moduleContainsExecutableCode) { - createModuleVariableDecl(decl, moduleDecl.stringLiteral, context); - } - - context.pushParent(decl); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(moduleDecl.name); - for (var i = 0, n = moduleNames.length; i < n; i++) { - var moduleName = moduleNames[i]; - - var specificFlags = declFlags; - if (i > 0) { - specificFlags |= 1 /* Exported */; - } - - var decl = new TypeScript.NormalPullDecl(moduleName.valueText(), moduleName.text(), kind, specificFlags, context.getParent()); - - context.semanticInfoChain.setDeclForAST(moduleDecl, decl); - context.semanticInfoChain.setDeclForAST(moduleName, decl); - context.semanticInfoChain.setASTForDecl(decl, moduleName); - - if (moduleContainsExecutableCode) { - createModuleVariableDecl(decl, moduleName, context); - } - - context.pushParent(decl); - } - } - } - - function createModuleVariableDecl(decl, moduleNameAST, context) { - decl.setFlags(decl.flags | getInitializationFlag(decl)); - - var valueDecl = new TypeScript.NormalPullDecl(decl.name, decl.getDisplayName(), 512 /* Variable */, decl.flags, context.getParent()); - decl.setValueDecl(valueDecl); - context.semanticInfoChain.setASTForDecl(valueDecl, moduleNameAST); - } - - function containsExecutableCode(members) { - for (var i = 0, n = members.childCount(); i < n; i++) { - var member = members.childAt(i); - - if (member.kind() === 130 /* ModuleDeclaration */) { - var moduleDecl = member; - - if (containsExecutableCode(moduleDecl.moduleElements)) { - return true; - } - } else if (member.kind() === 133 /* ImportDeclaration */) { - if (TypeScript.hasModifier(member.modifiers, 1 /* Exported */)) { - return true; - } - } else if (member.kind() !== 128 /* InterfaceDeclaration */ && member.kind() !== 134 /* ExportAssignment */) { - return true; - } - } - - return false; - } - - function preCollectClassDecls(classDecl, context) { - var declFlags = 0 /* None */; - - if ((TypeScript.hasModifier(classDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(classDecl, context)) && !containingModuleHasExportAssignment(classDecl)) { - declFlags |= 1 /* Exported */; - } - - if (TypeScript.hasModifier(classDecl.modifiers, 8 /* Ambient */) || isParsingAmbientModule(classDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; - } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(classDecl.identifier.valueText(), classDecl.identifier.text(), 8 /* Class */, declFlags, parent); - - var constructorDecl = new TypeScript.NormalPullDecl(classDecl.identifier.valueText(), classDecl.identifier.text(), 512 /* Variable */, declFlags | 16384 /* ClassConstructorVariable */, parent); - - decl.setValueDecl(constructorDecl); - - context.semanticInfoChain.setDeclForAST(classDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, classDecl); - context.semanticInfoChain.setASTForDecl(constructorDecl, classDecl); - - context.pushParent(decl); - } - - function preCollectObjectTypeDecls(objectType, context) { - if (objectType.parent.kind() === 128 /* InterfaceDeclaration */) { - return; - } - - var declFlags = 0 /* None */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl("", "", 8388608 /* ObjectType */, declFlags, parent); - context.semanticInfoChain.setDeclForAST(objectType, decl); - context.semanticInfoChain.setASTForDecl(decl, objectType); - - context.pushParent(decl); - } - - function preCollectInterfaceDecls(interfaceDecl, context) { - var declFlags = 0 /* None */; - - if ((TypeScript.hasModifier(interfaceDecl.modifiers, 1 /* Exported */) || isParsingAmbientModule(interfaceDecl, context)) && !containingModuleHasExportAssignment(interfaceDecl)) { - declFlags |= 1 /* Exported */; - } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(interfaceDecl.identifier.valueText(), interfaceDecl.identifier.text(), 16 /* Interface */, declFlags, parent); - context.semanticInfoChain.setDeclForAST(interfaceDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, interfaceDecl); - - context.pushParent(decl); - } - - function preCollectParameterDecl(argDecl, context) { - var declFlags = 0 /* None */; - - if (TypeScript.hasModifier(argDecl.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; - } - - if (argDecl.questionToken !== null || argDecl.equalsValueClause !== null || argDecl.dotDotDotToken !== null) { - declFlags |= 128 /* Optional */; - } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(argDecl.identifier.valueText(), argDecl.identifier.text(), 2048 /* Parameter */, declFlags, parent); - - if (argDecl.equalsValueClause) { - parent.flags |= 33554432 /* HasDefaultArgs */; - } - - if (parent.kind === 32768 /* ConstructorMethod */) { - decl.setFlag(67108864 /* ConstructorParameter */); - } - - var isPublicOrPrivate = TypeScript.hasModifier(argDecl.modifiers, 4 /* Public */ | 2 /* Private */); - var isInConstructor = parent.kind === 32768 /* ConstructorMethod */; - if (isPublicOrPrivate && isInConstructor) { - var parentsParent = context.parentChain[context.parentChain.length - 2]; - - var propDeclFlags = declFlags & ~128 /* Optional */; - var propDecl = new TypeScript.NormalPullDecl(argDecl.identifier.valueText(), argDecl.identifier.text(), 4096 /* Property */, propDeclFlags, parentsParent); - propDecl.setValueDecl(decl); - decl.setFlag(8388608 /* PropertyParameter */); - propDecl.setFlag(8388608 /* PropertyParameter */); - - if (parent.kind === 32768 /* ConstructorMethod */) { - propDecl.setFlag(67108864 /* ConstructorParameter */); - } - - context.semanticInfoChain.setASTForDecl(decl, argDecl); - context.semanticInfoChain.setASTForDecl(propDecl, argDecl); - context.semanticInfoChain.setDeclForAST(argDecl, propDecl); - } else { - context.semanticInfoChain.setASTForDecl(decl, argDecl); - context.semanticInfoChain.setDeclForAST(argDecl, decl); - } - - parent.addVariableDeclToGroup(decl); - } - - function preCollectTypeParameterDecl(typeParameterDecl, context) { - var declFlags = 0 /* None */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(typeParameterDecl.identifier.valueText(), typeParameterDecl.identifier.text(), 8192 /* TypeParameter */, declFlags, parent); - context.semanticInfoChain.setASTForDecl(decl, typeParameterDecl); - context.semanticInfoChain.setDeclForAST(typeParameterDecl, decl); - } - - function createPropertySignature(propertyDecl, context) { - var declFlags = 4 /* Public */; - var parent = context.getParent(); - var declType = 4096 /* Property */; - - if (propertyDecl.questionToken !== null) { - declFlags |= 128 /* Optional */; - } - - var decl = new TypeScript.NormalPullDecl(propertyDecl.propertyName.valueText(), propertyDecl.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(propertyDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyDecl); - } - - function createMemberVariableDeclaration(memberDecl, context) { - var declFlags = 0 /* None */; - var declType = 4096 /* Property */; - - if (TypeScript.hasModifier(memberDecl.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; - } - - if (TypeScript.hasModifier(memberDecl.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; - } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(memberDecl.variableDeclarator.propertyName.valueText(), memberDecl.variableDeclarator.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(memberDecl, decl); - context.semanticInfoChain.setDeclForAST(memberDecl.variableDeclarator, decl); - context.semanticInfoChain.setASTForDecl(decl, memberDecl); - } - - function createVariableDeclaration(varDecl, context) { - var declFlags = 0 /* None */; - var declType = 512 /* Variable */; - - var modifiers = TypeScript.ASTHelpers.getVariableDeclaratorModifiers(varDecl); - if ((TypeScript.hasModifier(modifiers, 1 /* Exported */) || isParsingAmbientModule(varDecl, context)) && !containingModuleHasExportAssignment(varDecl)) { - declFlags |= 1 /* Exported */; - } - - if (TypeScript.hasModifier(modifiers, 8 /* Ambient */) || isParsingAmbientModule(varDecl, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; - } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(varDecl.propertyName.valueText(), varDecl.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(varDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, varDecl); - - if (parent) { - parent.addVariableDeclToGroup(decl); - } - } - - function preCollectVarDecls(ast, context) { - if (ast.parent.kind() === 136 /* MemberVariableDeclaration */) { - return; - } - - var varDecl = ast; - createVariableDeclaration(varDecl, context); - } - - function createFunctionTypeDeclaration(functionTypeDeclAST, context) { - var declFlags = 2048 /* Signature */; - var declType = 16777216 /* FunctionType */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(functionTypeDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, functionTypeDeclAST); - - context.pushParent(decl); - } - - function createConstructorTypeDeclaration(constructorTypeDeclAST, context) { - var declFlags = 0 /* None */; - var declType = 33554432 /* ConstructorType */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(constructorTypeDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, constructorTypeDeclAST); - - context.pushParent(decl); - } - - function createFunctionDeclaration(funcDeclAST, context) { - var declFlags = 0 /* None */; - var declType = 16384 /* Function */; - - if ((TypeScript.hasModifier(funcDeclAST.modifiers, 1 /* Exported */) || isParsingAmbientModule(funcDeclAST, context)) && !containingModuleHasExportAssignment(funcDeclAST)) { - declFlags |= 1 /* Exported */; - } - - if (TypeScript.hasModifier(funcDeclAST.modifiers, 8 /* Ambient */) || isParsingAmbientModule(funcDeclAST, context) || context.isDeclareFile) { - declFlags |= 8 /* Ambient */; - } - - if (!funcDeclAST.block) { - declFlags |= 2048 /* Signature */; - } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(funcDeclAST.identifier.valueText(), funcDeclAST.identifier.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(funcDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, funcDeclAST); - - context.pushParent(decl); - } - - function createAnyFunctionExpressionDeclaration(functionExpressionDeclAST, id, context, displayName) { - if (typeof displayName === "undefined") { displayName = null; } - var declFlags = 0 /* None */; - - if (functionExpressionDeclAST.kind() === 219 /* SimpleArrowFunctionExpression */ || functionExpressionDeclAST.kind() === 218 /* ParenthesizedArrowFunctionExpression */) { - declFlags |= 8192 /* ArrowFunction */; - } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var name = id ? id.text() : ""; - var displayNameText = displayName ? displayName.text() : ""; - var decl = new TypeScript.PullFunctionExpressionDecl(name, declFlags, parent, displayNameText); - context.semanticInfoChain.setDeclForAST(functionExpressionDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, functionExpressionDeclAST); - - context.pushParent(decl); - - if (functionExpressionDeclAST.kind() === 219 /* SimpleArrowFunctionExpression */) { - var simpleArrow = functionExpressionDeclAST; - var declFlags = 4 /* Public */; - - var parent = context.getParent(); - - if (TypeScript.hasFlag(parent.flags, 2097152 /* DeclaredInAWithBlock */)) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(simpleArrow.identifier.valueText(), simpleArrow.identifier.text(), 2048 /* Parameter */, declFlags, parent); - - context.semanticInfoChain.setASTForDecl(decl, simpleArrow.identifier); - context.semanticInfoChain.setDeclForAST(simpleArrow.identifier, decl); - - parent.addVariableDeclToGroup(decl); - } - } - - function createMemberFunctionDeclaration(funcDecl, context) { - var declFlags = 0 /* None */; - var declType = 65536 /* Method */; - - if (TypeScript.hasModifier(funcDecl.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; - } - - if (TypeScript.hasModifier(funcDecl.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; - } - - if (!funcDecl.block) { - declFlags |= 2048 /* Signature */; - } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(funcDecl.propertyName.valueText(), funcDecl.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(funcDecl, decl); - context.semanticInfoChain.setASTForDecl(decl, funcDecl); - - context.pushParent(decl); - } - - function createIndexSignatureDeclaration(indexSignatureDeclAST, context) { - var declFlags = 2048 /* Signature */; - var declType = 4194304 /* IndexSignature */; - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(indexSignatureDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, indexSignatureDeclAST); - - context.pushParent(decl); - } - - function createCallSignatureDeclaration(callSignature, context) { - var isChildOfObjectType = callSignature.parent && callSignature.parent.parent && callSignature.parent.kind() === 2 /* SeparatedList */ && callSignature.parent.parent.kind() === 122 /* ObjectType */; - - if (!isChildOfObjectType) { - return; - } - - var declFlags = 2048 /* Signature */; - var declType = 1048576 /* CallSignature */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(callSignature, decl); - context.semanticInfoChain.setASTForDecl(decl, callSignature); - - context.pushParent(decl); - } - - function createMethodSignatureDeclaration(method, context) { - var declFlags = 0 /* None */; - var declType = 65536 /* Method */; - - declFlags |= 4 /* Public */; - declFlags |= 2048 /* Signature */; - - if (method.questionToken !== null) { - declFlags |= 128 /* Optional */; - } - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl(method.propertyName.valueText(), method.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(method, decl); - context.semanticInfoChain.setASTForDecl(decl, method); - - context.pushParent(decl); - } - - function createConstructSignatureDeclaration(constructSignatureDeclAST, context) { - var declFlags = 2048 /* Signature */; - var declType = 2097152 /* ConstructSignature */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(constructSignatureDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, constructSignatureDeclAST); - - context.pushParent(decl); - } - - function createClassConstructorDeclaration(constructorDeclAST, context) { - var declFlags = 0 /* None */; - var declType = 32768 /* ConstructorMethod */; - - if (!constructorDeclAST.block) { - declFlags |= 2048 /* Signature */; - } - - var parent = context.getParent(); - - if (parent) { - var parentFlags = parent.flags; - - if (parentFlags & 1 /* Exported */) { - declFlags |= 1 /* Exported */; - } - } - - var decl = new TypeScript.NormalPullDecl(parent.name, parent.getDisplayName(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(constructorDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, constructorDeclAST); - - context.pushParent(decl); - } - - function createGetAccessorDeclaration(getAccessorDeclAST, context) { - var declFlags = 4 /* Public */; - var declType = 262144 /* GetAccessor */; - - if (TypeScript.hasModifier(getAccessorDeclAST.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; - } - - if (TypeScript.hasModifier(getAccessorDeclAST.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; - } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(getAccessorDeclAST.propertyName.valueText(), getAccessorDeclAST.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(getAccessorDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, getAccessorDeclAST); - - context.pushParent(decl); - } - - function createFunctionExpressionDeclaration(expression, context) { - createAnyFunctionExpressionDeclaration(expression, expression.identifier, context); - } - - function createSetAccessorDeclaration(setAccessorDeclAST, context) { - var declFlags = 4 /* Public */; - var declType = 524288 /* SetAccessor */; - - if (TypeScript.hasModifier(setAccessorDeclAST.modifiers, 16 /* Static */)) { - declFlags |= 16 /* Static */; - } - - if (TypeScript.hasModifier(setAccessorDeclAST.modifiers, 2 /* Private */)) { - declFlags |= 2 /* Private */; - } else { - declFlags |= 4 /* Public */; - } - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(setAccessorDeclAST.propertyName.valueText(), setAccessorDeclAST.propertyName.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(setAccessorDeclAST, decl); - context.semanticInfoChain.setASTForDecl(decl, setAccessorDeclAST); - - context.pushParent(decl); - } - - function preCollectCatchDecls(ast, context) { - var declFlags = 0 /* None */; - var declType = 268435456 /* CatchBlock */; - - var parent = context.getParent(); - - if (parent && (parent.kind === 134217728 /* WithBlock */ || (parent.flags & 2097152 /* DeclaredInAWithBlock */))) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - - context.pushParent(decl); - - var declFlags = 0 /* None */; - var declType = 1024 /* CatchVariable */; - - var parent = context.getParent(); - - if (TypeScript.hasFlag(parent.flags, 2097152 /* DeclaredInAWithBlock */)) { - declFlags |= 2097152 /* DeclaredInAWithBlock */; - } - - var decl = new TypeScript.NormalPullDecl(ast.identifier.valueText(), ast.identifier.text(), declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast.identifier, decl); - context.semanticInfoChain.setASTForDecl(decl, ast.identifier); - - if (parent) { - parent.addVariableDeclToGroup(decl); - } - } - - function preCollectWithDecls(ast, context) { - var declFlags = 0 /* None */; - var declType = 134217728 /* WithBlock */; - - var parent = context.getParent(); - - var decl = new TypeScript.NormalPullDecl("", "", declType, declFlags, parent); - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - - context.pushParent(decl); - } - - function preCollectObjectLiteralDecls(ast, context) { - var decl = new TypeScript.NormalPullDecl("", "", 256 /* ObjectLiteral */, 0 /* None */, context.getParent()); - - context.semanticInfoChain.setDeclForAST(ast, decl); - context.semanticInfoChain.setASTForDecl(decl, ast); - - context.pushParent(decl); - } - - function preCollectSimplePropertyAssignmentDecls(propertyAssignment, context) { - var assignmentText = TypeScript.getPropertyAssignmentNameTextFromIdentifier(propertyAssignment.propertyName); - var span = TypeScript.TextSpan.fromBounds(propertyAssignment.start(), propertyAssignment.end()); - - var decl = new TypeScript.NormalPullDecl(assignmentText.memberName, assignmentText.actualText, 4096 /* Property */, 4 /* Public */, context.getParent()); - - context.semanticInfoChain.setDeclForAST(propertyAssignment, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyAssignment); - } - - function preCollectFunctionPropertyAssignmentDecls(propertyAssignment, context) { - var assignmentText = TypeScript.getPropertyAssignmentNameTextFromIdentifier(propertyAssignment.propertyName); - - var decl = new TypeScript.NormalPullDecl(assignmentText.memberName, assignmentText.actualText, 4096 /* Property */, 4 /* Public */, context.getParent()); - - context.semanticInfoChain.setDeclForAST(propertyAssignment, decl); - context.semanticInfoChain.setASTForDecl(decl, propertyAssignment); - - createAnyFunctionExpressionDeclaration(propertyAssignment, propertyAssignment.propertyName, context, propertyAssignment.propertyName); - } - - function preCollectDecls(ast, context) { - switch (ast.kind()) { - case 120 /* SourceUnit */: - preCollectScriptDecls(ast, context); - break; - case 132 /* EnumDeclaration */: - preCollectEnumDecls(ast, context); - break; - case 243 /* EnumElement */: - createEnumElementDecls(ast, context); - break; - case 130 /* ModuleDeclaration */: - preCollectModuleDecls(ast, context); - break; - case 131 /* ClassDeclaration */: - preCollectClassDecls(ast, context); - break; - case 128 /* InterfaceDeclaration */: - preCollectInterfaceDecls(ast, context); - break; - case 122 /* ObjectType */: - preCollectObjectTypeDecls(ast, context); - break; - case 242 /* Parameter */: - preCollectParameterDecl(ast, context); - break; - case 136 /* MemberVariableDeclaration */: - createMemberVariableDeclaration(ast, context); - break; - case 141 /* PropertySignature */: - createPropertySignature(ast, context); - break; - case 225 /* VariableDeclarator */: - preCollectVarDecls(ast, context); - break; - case 137 /* ConstructorDeclaration */: - createClassConstructorDeclaration(ast, context); - break; - case 139 /* GetAccessor */: - createGetAccessorDeclaration(ast, context); - break; - case 140 /* SetAccessor */: - createSetAccessorDeclaration(ast, context); - break; - case 222 /* FunctionExpression */: - createFunctionExpressionDeclaration(ast, context); - break; - case 135 /* MemberFunctionDeclaration */: - createMemberFunctionDeclaration(ast, context); - break; - case 144 /* IndexSignature */: - createIndexSignatureDeclaration(ast, context); - break; - case 123 /* FunctionType */: - createFunctionTypeDeclaration(ast, context); - break; - case 125 /* ConstructorType */: - createConstructorTypeDeclaration(ast, context); - break; - case 142 /* CallSignature */: - createCallSignatureDeclaration(ast, context); - break; - case 143 /* ConstructSignature */: - createConstructSignatureDeclaration(ast, context); - break; - case 145 /* MethodSignature */: - createMethodSignatureDeclaration(ast, context); - break; - case 129 /* FunctionDeclaration */: - createFunctionDeclaration(ast, context); - break; - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - createAnyFunctionExpressionDeclaration(ast, null, context); - break; - case 133 /* ImportDeclaration */: - preCollectImportDecls(ast, context); - break; - case 238 /* TypeParameter */: - preCollectTypeParameterDecl(ast, context); - break; - case 236 /* CatchClause */: - preCollectCatchDecls(ast, context); - break; - case 163 /* WithStatement */: - preCollectWithDecls(ast, context); - break; - case 215 /* ObjectLiteralExpression */: - preCollectObjectLiteralDecls(ast, context); - break; - case 240 /* SimplePropertyAssignment */: - preCollectSimplePropertyAssignmentDecls(ast, context); - break; - case 241 /* FunctionPropertyAssignment */: - preCollectFunctionPropertyAssignmentDecls(ast, context); - break; - } - } - - function isContainer(decl) { - return decl.kind === 4 /* Container */ || decl.kind === 32 /* DynamicModule */ || decl.kind === 64 /* Enum */; - } - - function getInitializationFlag(decl) { - if (decl.kind & 4 /* Container */) { - return 32768 /* InitializedModule */; - } else if (decl.kind & 32 /* DynamicModule */) { - return 65536 /* InitializedDynamicModule */; - } - - return 0 /* None */; - } - - function hasInitializationFlag(decl) { - var kind = decl.kind; - - if (kind & 4 /* Container */) { - return (decl.flags & 32768 /* InitializedModule */) !== 0; - } else if (kind & 32 /* DynamicModule */) { - return (decl.flags & 65536 /* InitializedDynamicModule */) !== 0; - } - - return false; - } - - function postCollectDecls(ast, context) { - var currentDecl = context.getParent(); - - if (ast.kind() === 11 /* IdentifierName */ || ast.kind() === 14 /* StringLiteral */) { - if (currentDecl.kind === 4 /* Container */ || currentDecl.kind === 32 /* DynamicModule */) { - return; - } - } - - if (ast.kind() === 130 /* ModuleDeclaration */) { - var moduleDeclaration = ast; - if (moduleDeclaration.stringLiteral) { - TypeScript.Debug.assert(currentDecl.ast() === moduleDeclaration.stringLiteral); - context.popParent(); - } else { - var moduleNames = TypeScript.ASTHelpers.getModuleNames(moduleDeclaration.name); - for (var i = moduleNames.length - 1; i >= 0; i--) { - var moduleName = moduleNames[i]; - TypeScript.Debug.assert(currentDecl.ast() === moduleName); - context.popParent(); - currentDecl = context.getParent(); - } - } - } - - if (ast.kind() === 132 /* EnumDeclaration */) { - computeEnumElementConstantValues(ast, currentDecl, context); - } - - while (currentDecl.getParentDecl() && currentDecl.ast() === ast) { - context.popParent(); - currentDecl = context.getParent(); - } - } - - function computeEnumElementConstantValues(ast, enumDecl, context) { - TypeScript.Debug.assert(enumDecl.kind === 64 /* Enum */); - - var isAmbientEnum = TypeScript.hasFlag(enumDecl.flags, 8 /* Ambient */); - var inConstantSection = !isAmbientEnum; - var currentConstantValue = 0; - var enumMemberDecls = enumDecl.getChildDecls(); - - for (var i = 0, n = ast.enumElements.nonSeparatorCount(); i < n; i++) { - var enumElement = ast.enumElements.nonSeparatorAt(i); - var enumElementDecl = TypeScript.ArrayUtilities.first(enumMemberDecls, function (d) { - return context.semanticInfoChain.getASTForDecl(d) === enumElement; - }); - - TypeScript.Debug.assert(enumElementDecl.kind === 67108864 /* EnumMember */); - - if (enumElement.equalsValueClause === null) { - if (inConstantSection) { - enumElementDecl.constantValue = currentConstantValue; - currentConstantValue++; - } - } else { - enumElementDecl.constantValue = computeEnumElementConstantValue(enumElement.equalsValueClause.value, enumMemberDecls, context); - if (enumElementDecl.constantValue !== null && !isAmbientEnum) { - inConstantSection = true; - currentConstantValue = enumElementDecl.constantValue + 1; - } else { - inConstantSection = false; - } - } - - TypeScript.Debug.assert(enumElementDecl.constantValue !== undefined); - } - } - - function computeEnumElementConstantValue(expression, enumMemberDecls, context) { - TypeScript.Debug.assert(expression); - - if (TypeScript.ASTHelpers.isIntegerLiteralAST(expression)) { - var token; - switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - token = expression.operand; - break; - default: - token = expression; - } - - var value = token.value(); - return value && expression.kind() === 165 /* NegateExpression */ ? -value : value; - } else if (context.propagateEnumConstants) { - switch (expression.kind()) { - case 11 /* IdentifierName */: - var name = expression; - var matchingEnumElement = TypeScript.ArrayUtilities.firstOrDefault(enumMemberDecls, function (d) { - return d.name === name.valueText(); - }); - - return matchingEnumElement ? matchingEnumElement.constantValue : null; - - case 202 /* LeftShiftExpression */: - var binaryExpression = expression; - var left = computeEnumElementConstantValue(binaryExpression.left, enumMemberDecls, context); - var right = computeEnumElementConstantValue(binaryExpression.right, enumMemberDecls, context); - if (left === null || right === null) { - return null; - } - - return left << right; - - case 189 /* BitwiseOrExpression */: - var binaryExpression = expression; - var left = computeEnumElementConstantValue(binaryExpression.left, enumMemberDecls, context); - var right = computeEnumElementConstantValue(binaryExpression.right, enumMemberDecls, context); - if (left === null || right === null) { - return null; - } - - return left | right; - } - - return null; - } else { - return null; - } - } - - (function (DeclarationCreator) { - function create(document, semanticInfoChain, compilationSettings) { - var declCollectionContext = new DeclCollectionContext(document, semanticInfoChain, compilationSettings.propagateEnumConstants()); - - TypeScript.getAstWalkerFactory().simpleWalk(document.sourceUnit(), preCollectDecls, postCollectDecls, declCollectionContext); - - return declCollectionContext.getParent(); - } - DeclarationCreator.create = create; - })(TypeScript.DeclarationCreator || (TypeScript.DeclarationCreator = {})); - var DeclarationCreator = TypeScript.DeclarationCreator; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var PullSymbolBinder = (function () { - function PullSymbolBinder(semanticInfoChain) { - this.semanticInfoChain = semanticInfoChain; - this.declsBeingBound = []; - this.inBindingOtherDeclsWalker = new TypeScript.PullHelpers.OtherPullDeclsWalker(); - } - PullSymbolBinder.prototype.getParent = function (decl, returnInstanceType) { - if (typeof returnInstanceType === "undefined") { returnInstanceType = false; } - var parentDecl = decl.getParentDecl(); - - if (parentDecl.kind === 1 /* Script */) { - return null; - } - - var parent = parentDecl.getSymbol(); - - if (!parent && parentDecl && !parentDecl.hasBeenBound()) { - this.bindDeclToPullSymbol(parentDecl); - } - - parent = parentDecl.getSymbol(); - if (parent) { - var parentDeclKind = parentDecl.kind; - if (parentDeclKind === 262144 /* GetAccessor */) { - parent = parent.getGetter(); - } else if (parentDeclKind === 524288 /* SetAccessor */) { - parent = parent.getSetter(); - } - } - - if (parent) { - if (returnInstanceType && parent.isType() && parent.isContainer()) { - var instanceSymbol = parent.getInstanceSymbol(); - - if (instanceSymbol) { - return instanceSymbol.type; - } - } - - return parent.type; - } - - return null; - }; - - PullSymbolBinder.prototype.findDeclsInContext = function (startingDecl, declKind, searchGlobally) { - if (!searchGlobally) { - var parentDecl = startingDecl.getParentDecl(); - return parentDecl.searchChildDecls(startingDecl.name, declKind); - } - - var contextSymbolPath = startingDecl.getParentPath(); - - if (contextSymbolPath.length) { - var copyOfContextSymbolPath = []; - - for (var i = 0; i < contextSymbolPath.length; i++) { - if (contextSymbolPath[i].kind & 1 /* Script */) { - continue; - } - copyOfContextSymbolPath[copyOfContextSymbolPath.length] = contextSymbolPath[i].name; - } - - return this.semanticInfoChain.findDecls(copyOfContextSymbolPath, declKind); - } - }; - - PullSymbolBinder.prototype.getExistingSymbol = function (decl, searchKind, parent) { - var lookingForValue = (searchKind & 68147712 /* SomeValue */) !== 0; - var lookingForType = (searchKind & 58728795 /* SomeType */) !== 0; - var lookingForContainer = (searchKind & 164 /* SomeContainer */) !== 0; - var name = decl.name; - if (parent) { - var isExported = (decl.flags & 1 /* Exported */) !== 0; - - var prevSymbol = null; - if (lookingForValue) { - prevSymbol = parent.findContainedNonMember(name); - } else if (lookingForType) { - prevSymbol = parent.findContainedNonMemberType(name, searchKind); - } else if (lookingForContainer) { - prevSymbol = parent.findContainedNonMemberContainer(name, searchKind); - } - var prevIsExported = !prevSymbol; - if (!prevSymbol) { - if (lookingForValue) { - prevSymbol = parent.findMember(name, false); - } else if (lookingForType) { - prevSymbol = parent.findNestedType(name, searchKind); - } else if (lookingForContainer) { - prevSymbol = parent.findNestedContainer(name, searchKind); - } - } - - if (isExported && prevIsExported) { - return prevSymbol; - } - if (prevSymbol) { - var prevDecls = prevSymbol.getDeclarations(); - var lastPrevDecl = prevDecls[prevDecls.length - 1]; - var parentDecl = decl.getParentDecl(); - var prevParentDecl = lastPrevDecl && lastPrevDecl.getParentDecl(); - if (parentDecl !== prevParentDecl) { - return null; - } - - return prevSymbol; - } - } else { - var parentDecl = decl.getParentDecl(); - if (parentDecl && parentDecl.kind === 1 /* Script */) { - return this.semanticInfoChain.findTopLevelSymbol(name, searchKind, decl); - } else { - var prevDecls = parentDecl && parentDecl.searchChildDecls(name, searchKind); - return prevDecls[0] && prevDecls[0].getSymbol(); - } - } - - return null; - }; - - PullSymbolBinder.prototype.checkThatExportsMatch = function (decl, prevSymbol, reportError) { - if (typeof reportError === "undefined") { reportError = true; } - var isExported = (decl.flags & 1 /* Exported */) !== 0; - var prevDecls = prevSymbol.getDeclarations(); - var prevIsExported = (prevDecls[prevDecls.length - 1].flags & 1 /* Exported */) !== 0; - if ((isExported !== prevIsExported) && !prevSymbol.isSignature() && (decl.kind & 7340032 /* SomeSignature */) === 0) { - if (reportError) { - var ast = this.semanticInfoChain.getASTForDecl(decl); - this.semanticInfoChain.addDiagnosticFromAST(ast, TypeScript.DiagnosticCode.All_declarations_of_merged_declaration_0_must_be_exported_or_not_exported, [decl.getDisplayName()]); - } - return false; - } - - return true; - }; - - PullSymbolBinder.prototype.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList = function (signature, currentSignatures) { - var signatureDecl = signature.getDeclarations()[0]; - TypeScript.Debug.assert(signatureDecl); - var enclosingDecl = signatureDecl.getParentDecl(); - var indexToInsert = TypeScript.ArrayUtilities.indexOf(currentSignatures, function (someSignature) { - return someSignature.getDeclarations()[0].getParentDecl() !== enclosingDecl; - }); - return indexToInsert < 0 ? currentSignatures.length : indexToInsert; - }; - - PullSymbolBinder.prototype.bindEnumDeclarationToPullSymbol = function (enumContainerDecl) { - var enumName = enumContainerDecl.name; - - var enumContainerSymbol = null; - var enumInstanceSymbol = null; - var moduleInstanceTypeSymbol = null; - - var enumInstanceDecl = enumContainerDecl.getValueDecl(); - - var enumDeclKind = enumContainerDecl.kind; - - var parent = this.getParent(enumContainerDecl); - var parentInstanceSymbol = this.getParent(enumContainerDecl, true); - var parentDecl = enumContainerDecl.getParentDecl(); - var enumAST = this.semanticInfoChain.getASTForDecl(enumContainerDecl); - - var isExported = enumContainerDecl.flags & 1 /* Exported */; - - var createdNewSymbol = false; - - enumContainerSymbol = this.getExistingSymbol(enumContainerDecl, 64 /* Enum */, parent); - - if (enumContainerSymbol) { - if (enumContainerSymbol.kind !== enumDeclKind) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(enumAST.identifier, enumContainerDecl.getDisplayName(), enumContainerSymbol.getDeclarations()[0].ast()); - enumContainerSymbol = null; - } else if (!this.checkThatExportsMatch(enumContainerDecl, enumContainerSymbol)) { - enumContainerSymbol = null; - } - } - - if (enumContainerSymbol) { - enumInstanceSymbol = enumContainerSymbol.getInstanceSymbol(); - } else { - enumContainerSymbol = new TypeScript.PullContainerSymbol(enumName, enumDeclKind); - createdNewSymbol = true; - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(enumContainerSymbol, 64 /* Enum */); - } - } - - enumContainerSymbol.addDeclaration(enumContainerDecl); - enumContainerDecl.setSymbol(enumContainerSymbol); - - this.semanticInfoChain.setSymbolForAST(enumAST.identifier, enumContainerSymbol); - this.semanticInfoChain.setSymbolForAST(enumAST, enumContainerSymbol); - - if (!enumInstanceSymbol) { - var variableSymbol = null; - if (parentInstanceSymbol) { - if (isExported) { - variableSymbol = parentInstanceSymbol.findMember(enumName, false); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findContainedNonMember(enumName); - } - } else { - variableSymbol = parentInstanceSymbol.findContainedNonMember(enumName); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findMember(enumName, false); - } - } - - if (variableSymbol) { - var declarations = variableSymbol.getDeclarations(); - - if (declarations.length) { - var variableSymbolParentDecl = declarations[0].getParentDecl(); - - if (parentDecl !== variableSymbolParentDecl) { - variableSymbol = null; - } - } - } - } else if (!(enumContainerDecl.flags & 1 /* Exported */)) { - var siblingDecls = parentDecl.getChildDecls(); - var augmentedDecl = null; - - for (var i = 0; i < siblingDecls.length; i++) { - if (siblingDecls[i] === enumContainerDecl) { - break; - } - - if ((siblingDecls[i].name === enumName) && (siblingDecls[i].kind & 68147712 /* SomeValue */)) { - augmentedDecl = siblingDecls[i]; - break; - } - } - - if (augmentedDecl) { - variableSymbol = augmentedDecl.getSymbol(); - - if (variableSymbol) { - if (variableSymbol.isContainer()) { - variableSymbol = variableSymbol.getInstanceSymbol(); - } else if (variableSymbol && variableSymbol.isType()) { - variableSymbol = variableSymbol.getConstructorMethod(); - } - } - } - } - - if (variableSymbol) { - enumInstanceSymbol = variableSymbol; - moduleInstanceTypeSymbol = variableSymbol.type; - } else { - enumInstanceSymbol = new TypeScript.PullSymbol(enumName, 512 /* Variable */); - } - - enumContainerSymbol.setInstanceSymbol(enumInstanceSymbol); - - if (!moduleInstanceTypeSymbol) { - moduleInstanceTypeSymbol = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - enumInstanceSymbol.type = moduleInstanceTypeSymbol; - } - - moduleInstanceTypeSymbol.addDeclaration(enumContainerDecl); - - if (!moduleInstanceTypeSymbol.getAssociatedContainerType()) { - moduleInstanceTypeSymbol.setAssociatedContainerType(enumContainerSymbol); - } - } - - if (createdNewSymbol && parent) { - if (enumContainerDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberType(enumContainerSymbol); - } else { - parent.addEnclosedNonMemberType(enumContainerSymbol); - } - } - - if (createdNewSymbol) { - this.bindEnumIndexerDeclsToPullSymbols(enumContainerSymbol); - } - var valueDecl = enumContainerDecl.getValueDecl(); - - if (valueDecl) { - valueDecl.ensureSymbolIsBound(); - } - }; - - PullSymbolBinder.prototype.bindEnumIndexerDeclsToPullSymbols = function (enumContainerSymbol) { - var enumContainerInstanceTypeSymbol = enumContainerSymbol.getInstanceSymbol().type; - - var syntheticIndexerParameterSymbol = new TypeScript.PullSymbol("x", 2048 /* Parameter */); - syntheticIndexerParameterSymbol.type = this.semanticInfoChain.numberTypeSymbol; - syntheticIndexerParameterSymbol.setResolved(); - syntheticIndexerParameterSymbol.setIsSynthesized(); - - var syntheticIndexerSignatureSymbol = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - syntheticIndexerSignatureSymbol.addParameter(syntheticIndexerParameterSymbol); - syntheticIndexerSignatureSymbol.returnType = this.semanticInfoChain.stringTypeSymbol; - syntheticIndexerSignatureSymbol.setResolved(); - syntheticIndexerSignatureSymbol.setIsSynthesized(); - - enumContainerInstanceTypeSymbol.addIndexSignature(syntheticIndexerSignatureSymbol); - }; - - PullSymbolBinder.prototype.findExistingVariableSymbolForModuleValueDecl = function (decl) { - var isExported = TypeScript.hasFlag(decl.flags, 1 /* Exported */); - var modName = decl.name; - var parentInstanceSymbol = this.getParent(decl, true); - var parentDecl = decl.getParentDecl(); - - var variableSymbol = null; - - if (parentInstanceSymbol) { - if (isExported) { - variableSymbol = parentInstanceSymbol.findMember(modName, false); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findContainedNonMember(modName); - } - } else { - variableSymbol = parentInstanceSymbol.findContainedNonMember(modName); - - if (!variableSymbol) { - variableSymbol = parentInstanceSymbol.findMember(modName, false); - } - } - - if (variableSymbol) { - var declarations = variableSymbol.getDeclarations(); - - if (declarations.length) { - var variableSymbolParentDecl = declarations[0].getParentDecl(); - var isExportedOrHasTheSameParent = isExported || (parentDecl === variableSymbolParentDecl); - - var canReuseVariableSymbol = isExportedOrHasTheSameParent && this.checkThatExportsMatch(decl, variableSymbol, false); - - if (!canReuseVariableSymbol) { - variableSymbol = null; - } - } - } - } else if (!isExported) { - var siblingDecls = parentDecl.getChildDecls(); - - for (var i = 0; i < siblingDecls.length; i++) { - var sibling = siblingDecls[i]; - - var siblingIsSomeValue = TypeScript.hasFlag(sibling.kind, 68147712 /* SomeValue */); - var siblingIsFunctionOrHasImplictVarFlag = TypeScript.hasFlag(sibling.kind, 1032192 /* SomeFunction */) || TypeScript.hasFlag(sibling.flags, 118784 /* ImplicitVariable */); - - var isSiblingAnAugmentableVariable = sibling !== decl && sibling !== decl.getValueDecl() && sibling.name === modName && siblingIsSomeValue && siblingIsFunctionOrHasImplictVarFlag; - - if (isSiblingAnAugmentableVariable) { - if (sibling.hasSymbol()) { - variableSymbol = sibling.getSymbol(); - if (variableSymbol.isContainer()) { - variableSymbol = variableSymbol.getInstanceSymbol(); - } else if (variableSymbol && variableSymbol.isType()) { - variableSymbol = variableSymbol.getConstructorMethod(); - } - - break; - } - } - } - } - return variableSymbol; - }; - - PullSymbolBinder.prototype.bindModuleDeclarationToPullSymbol = function (moduleContainerDecl) { - var modName = moduleContainerDecl.name; - - var moduleContainerTypeSymbol = null; - var moduleKind = moduleContainerDecl.kind; - - var parent = this.getParent(moduleContainerDecl); - var parentInstanceSymbol = this.getParent(moduleContainerDecl, true); - var parentDecl = moduleContainerDecl.getParentDecl(); - var moduleNameAST = this.semanticInfoChain.getASTForDecl(moduleContainerDecl); - var moduleDeclAST = TypeScript.ASTHelpers.getEnclosingModuleDeclaration(moduleNameAST); - if (!moduleDeclAST) { - TypeScript.Debug.assert(moduleKind === 32 /* DynamicModule */); - TypeScript.Debug.assert(moduleNameAST.kind() === 120 /* SourceUnit */); - - moduleDeclAST = moduleNameAST; - } - - var isExported = TypeScript.hasFlag(moduleContainerDecl.flags, 1 /* Exported */); - var searchKind = 164 /* SomeContainer */; - var isInitializedModule = (moduleContainerDecl.flags & 102400 /* SomeInitializedModule */) !== 0; - - if (parent && moduleKind === 32 /* DynamicModule */) { - this.semanticInfoChain.addDiagnosticFromAST(moduleNameAST, TypeScript.DiagnosticCode.Ambient_external_module_declaration_must_be_defined_in_global_context, null); - } - - var createdNewSymbol = false; - - moduleContainerTypeSymbol = this.getExistingSymbol(moduleContainerDecl, searchKind, parent); - - if (moduleContainerTypeSymbol) { - if (moduleContainerTypeSymbol.kind !== moduleKind) { - if (isInitializedModule) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(moduleNameAST, moduleContainerDecl.getDisplayName(), moduleContainerTypeSymbol.getDeclarations()[0].ast()); - } - - moduleContainerTypeSymbol = null; - } else if (moduleKind === 32 /* DynamicModule */) { - this.semanticInfoChain.addDiagnosticFromAST(moduleNameAST, TypeScript.DiagnosticCode.Ambient_external_module_declaration_cannot_be_reopened); - } else if (!this.checkThatExportsMatch(moduleContainerDecl, moduleContainerTypeSymbol)) { - moduleContainerTypeSymbol = null; - } - } - - if (!moduleContainerTypeSymbol) { - moduleContainerTypeSymbol = new TypeScript.PullContainerSymbol(modName, moduleKind); - createdNewSymbol = true; - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(moduleContainerTypeSymbol, searchKind); - } - } - - moduleContainerTypeSymbol.addDeclaration(moduleContainerDecl); - moduleContainerDecl.setSymbol(moduleContainerTypeSymbol); - - this.semanticInfoChain.setSymbolForAST(moduleNameAST, moduleContainerTypeSymbol); - this.semanticInfoChain.setSymbolForAST(moduleDeclAST, moduleContainerTypeSymbol); - - var currentModuleValueDecl = moduleContainerDecl.getValueDecl(); - - var moduleDeclarations = moduleContainerTypeSymbol.getDeclarations(); - - if (createdNewSymbol) { - if (parent) { - if (moduleContainerDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberContainer(moduleContainerTypeSymbol); - } else { - parent.addEnclosedNonMemberContainer(moduleContainerTypeSymbol); - } - } - } - - if (currentModuleValueDecl) { - currentModuleValueDecl.ensureSymbolIsBound(); - - var instanceSymbol = null; - var instanceTypeSymbol = null; - if (currentModuleValueDecl.hasSymbol()) { - instanceSymbol = currentModuleValueDecl.getSymbol(); - } else { - instanceSymbol = new TypeScript.PullSymbol(modName, 512 /* Variable */); - currentModuleValueDecl.setSymbol(instanceSymbol); - if (!instanceSymbol.hasDeclaration(currentModuleValueDecl)) { - instanceSymbol.addDeclaration(currentModuleValueDecl); - } - } - - if (!instanceSymbol.type) { - instanceSymbol.type = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - } - - moduleContainerTypeSymbol.setInstanceSymbol(instanceSymbol); - - if (!instanceSymbol.type.getAssociatedContainerType()) { - instanceSymbol.type.setAssociatedContainerType(moduleContainerTypeSymbol); - } - } - }; - - PullSymbolBinder.prototype.bindImportDeclaration = function (importDeclaration) { - var declFlags = importDeclaration.flags; - var declKind = importDeclaration.kind; - var importDeclAST = this.semanticInfoChain.getASTForDecl(importDeclaration); - - var isExported = false; - var importSymbol = null; - var declName = importDeclaration.name; - var parentHadSymbol = false; - var parent = this.getParent(importDeclaration); - - importSymbol = this.getExistingSymbol(importDeclaration, 164 /* SomeContainer */, parent); - - if (importSymbol) { - parentHadSymbol = true; - } - - if (importSymbol) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(importDeclAST, importDeclaration.getDisplayName(), importSymbol.getDeclarations()[0].ast()); - importSymbol = null; - } - - if (!importSymbol) { - importSymbol = new TypeScript.PullTypeAliasSymbol(declName); - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(importSymbol, 164 /* SomeContainer */); - } - } - - importSymbol.addDeclaration(importDeclaration); - importDeclaration.setSymbol(importSymbol); - - this.semanticInfoChain.setSymbolForAST(importDeclAST, importSymbol); - - if (parent && !parentHadSymbol) { - if (declFlags & 1 /* Exported */) { - parent.addEnclosedMemberContainer(importSymbol); - } else { - parent.addEnclosedNonMemberContainer(importSymbol); - } - } - }; - - PullSymbolBinder.prototype.ensurePriorDeclarationsAreBound = function (container, currentDecl) { - if (!container) { - return; - } - - var parentDecls = container.getDeclarations(); - for (var i = 0; i < parentDecls.length; ++i) { - var parentDecl = parentDecls[i]; - var childDecls = parentDecl.getChildDecls(); - for (var j = 0; j < childDecls.length; ++j) { - var childDecl = childDecls[j]; - if (childDecl === currentDecl) { - return; - } - - if (childDecl.name === currentDecl.name) { - childDecl.ensureSymbolIsBound(); - } - } - } - }; - - PullSymbolBinder.prototype.bindClassDeclarationToPullSymbol = function (classDecl) { - var className = classDecl.name; - var classSymbol = null; - - var constructorSymbol = null; - var constructorTypeSymbol = null; - - var classAST = this.semanticInfoChain.getASTForDecl(classDecl); - - var parent = this.getParent(classDecl); - - this.ensurePriorDeclarationsAreBound(parent, classDecl); - - var parentDecl = classDecl.getParentDecl(); - var isExported = classDecl.flags & 1 /* Exported */; - var isGeneric = false; - - classSymbol = this.getExistingSymbol(classDecl, 58728795 /* SomeType */, parent); - - if (classSymbol && classSymbol.kind === 16 /* Interface */) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(classAST.identifier, classDecl.getDisplayName(), classSymbol.getDeclarations()[0].ast()); - classSymbol = null; - } - - classSymbol = new TypeScript.PullTypeSymbol(className, 8 /* Class */); - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(classSymbol, 8 /* Class */); - } - - classSymbol.addDeclaration(classDecl); - - classDecl.setSymbol(classSymbol); - - this.semanticInfoChain.setSymbolForAST(classAST.identifier, classSymbol); - this.semanticInfoChain.setSymbolForAST(classAST, classSymbol); - - if (parent) { - if (classDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberType(classSymbol); - } else { - parent.addEnclosedNonMemberType(classSymbol); - } - } - - var typeParameterDecls = classDecl.getTypeParameters(); - - for (var i = 0; i < typeParameterDecls.length; i++) { - var typeParameterSymbol = classSymbol.findTypeParameter(typeParameterDecls[i].name); - - if (typeParameterSymbol) { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameterSymbol.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameterSymbol.getName()]); - } - - typeParameterSymbol = new TypeScript.PullTypeParameterSymbol(typeParameterDecls[i].name); - - classSymbol.addTypeParameter(typeParameterSymbol); - typeParameterSymbol.addDeclaration(typeParameterDecls[i]); - typeParameterDecls[i].setSymbol(typeParameterSymbol); - } - - constructorSymbol = classSymbol.getConstructorMethod(); - constructorTypeSymbol = constructorSymbol ? constructorSymbol.type : null; - - if (!constructorSymbol) { - var siblingValueDecls = null; - if (parentDecl) { - siblingValueDecls = parentDecl.searchChildDecls(className, 68147712 /* SomeValue */); - - if (siblingValueDecls && siblingValueDecls[0] && siblingValueDecls[0].hasSymbol()) { - constructorSymbol = siblingValueDecls[0].getSymbol(); - } - } - - if (constructorSymbol) { - constructorTypeSymbol = constructorSymbol.type; - } else { - constructorSymbol = new TypeScript.PullSymbol(className, 32768 /* ConstructorMethod */); - constructorTypeSymbol = new TypeScript.PullTypeSymbol("", 33554432 /* ConstructorType */); - constructorSymbol.setIsSynthesized(); - constructorSymbol.type = constructorTypeSymbol; - } - - classSymbol.setConstructorMethod(constructorSymbol); - classSymbol.setHasDefaultConstructor(); - } - - if (constructorSymbol.getIsSynthesized()) { - constructorSymbol.addDeclaration(classDecl.getValueDecl()); - constructorTypeSymbol.addDeclaration(classDecl); - } else { - classSymbol.setHasDefaultConstructor(false); - } - - constructorTypeSymbol.setAssociatedContainerType(classSymbol); - - var valueDecl = classDecl.getValueDecl(); - - if (valueDecl) { - valueDecl.ensureSymbolIsBound(); - } - - this.bindStaticPrototypePropertyOfClass(classAST, classSymbol, constructorTypeSymbol); - }; - - PullSymbolBinder.prototype.bindInterfaceDeclarationToPullSymbol = function (interfaceDecl) { - var interfaceName = interfaceDecl.name; - var interfaceSymbol = null; - - var interfaceAST = this.semanticInfoChain.getASTForDecl(interfaceDecl); - var createdNewSymbol = false; - var parent = this.getParent(interfaceDecl); - - var acceptableSharedKind = 16 /* Interface */; - - interfaceSymbol = this.getExistingSymbol(interfaceDecl, 58728795 /* SomeType */, parent); - - if (interfaceSymbol) { - if (!(interfaceSymbol.kind & acceptableSharedKind)) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(interfaceAST.identifier, interfaceDecl.getDisplayName(), interfaceSymbol.getDeclarations()[0].ast()); - interfaceSymbol = null; - } else if (!this.checkThatExportsMatch(interfaceDecl, interfaceSymbol)) { - interfaceSymbol = null; - } - } - - if (!interfaceSymbol) { - interfaceSymbol = new TypeScript.PullTypeSymbol(interfaceName, 16 /* Interface */); - createdNewSymbol = true; - - if (!parent) { - this.semanticInfoChain.cacheGlobalSymbol(interfaceSymbol, acceptableSharedKind); - } - } - - interfaceSymbol.addDeclaration(interfaceDecl); - interfaceDecl.setSymbol(interfaceSymbol); - - if (createdNewSymbol) { - if (parent) { - if (interfaceDecl.flags & 1 /* Exported */) { - parent.addEnclosedMemberType(interfaceSymbol); - } else { - parent.addEnclosedNonMemberType(interfaceSymbol); - } - } - } - - var typeParameters = interfaceDecl.getTypeParameters(); - var typeParameter; - var typeParameterDecls = null; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = interfaceSymbol.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - interfaceSymbol.addTypeParameter(typeParameter); - } else { - typeParameterDecls = typeParameter.getDeclarations(); - - for (var j = 0; j < typeParameterDecls.length; j++) { - var typeParameterDeclParent = typeParameterDecls[j].getParentDecl(); - - if (typeParameterDeclParent && typeParameterDeclParent === interfaceDecl) { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameterDecls[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); - - break; - } - } - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - }; - - PullSymbolBinder.prototype.bindObjectTypeDeclarationToPullSymbol = function (objectDecl) { - var objectSymbolAST = this.semanticInfoChain.getASTForDecl(objectDecl); - - var objectSymbol = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - - objectSymbol.addDeclaration(objectDecl); - objectDecl.setSymbol(objectSymbol); - - this.semanticInfoChain.setSymbolForAST(objectSymbolAST, objectSymbol); - - var childDecls = objectDecl.getChildDecls(); - - for (var i = 0; i < childDecls.length; i++) { - this.bindDeclToPullSymbol(childDecls[i]); - } - }; - - PullSymbolBinder.prototype.bindConstructorTypeDeclarationToPullSymbol = function (constructorTypeDeclaration) { - var declKind = constructorTypeDeclaration.kind; - var declFlags = constructorTypeDeclaration.flags; - var constructorTypeAST = this.semanticInfoChain.getASTForDecl(constructorTypeDeclaration); - - var constructorTypeSymbol = new TypeScript.PullTypeSymbol("", 33554432 /* ConstructorType */); - - constructorTypeDeclaration.setSymbol(constructorTypeSymbol); - constructorTypeSymbol.addDeclaration(constructorTypeDeclaration); - this.semanticInfoChain.setSymbolForAST(constructorTypeAST, constructorTypeSymbol); - - var signature = new TypeScript.PullSignatureSymbol(2097152 /* ConstructSignature */); - - var funcDecl = this.semanticInfoChain.getASTForDecl(constructorTypeDeclaration); - if (TypeScript.lastParameterIsRest(funcDecl.parameterList)) { - signature.hasVarArgs = true; - } - - signature.addDeclaration(constructorTypeDeclaration); - constructorTypeDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.parameterList), constructorTypeSymbol, signature); - - var typeParameters = constructorTypeDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = constructorTypeSymbol.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.name]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - constructorTypeSymbol.appendConstructSignature(signature); - }; - - PullSymbolBinder.prototype.bindVariableDeclarationToPullSymbol = function (variableDeclaration) { - var declFlags = variableDeclaration.flags; - var declKind = variableDeclaration.kind; - var varDeclAST = this.semanticInfoChain.getASTForDecl(variableDeclaration); - var nameAST = varDeclAST.kind() === 131 /* ClassDeclaration */ ? varDeclAST.identifier : varDeclAST.kind() === 225 /* VariableDeclarator */ ? varDeclAST.propertyName : varDeclAST.kind() === 132 /* EnumDeclaration */ ? varDeclAST.identifier : varDeclAST; - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var variableSymbol = null; - - var declName = variableDeclaration.name; - - var parentHadSymbol = false; - - var parent = this.getParent(variableDeclaration, true); - - var parentDecl = variableDeclaration.getParentDecl(); - - var isImplicit = (declFlags & 118784 /* ImplicitVariable */) !== 0; - var isModuleValue = (declFlags & (32768 /* InitializedModule */)) !== 0; - var isEnumValue = (declFlags & 4096 /* Enum */) !== 0; - var isClassConstructorVariable = (declFlags & 16384 /* ClassConstructorVariable */) !== 0; - variableSymbol = this.getExistingSymbol(variableDeclaration, 68147712 /* SomeValue */, parent); - - if (!variableSymbol && isModuleValue) { - variableSymbol = this.findExistingVariableSymbolForModuleValueDecl(variableDeclaration.getContainerDecl()); - } - - if (variableSymbol && !variableSymbol.isType()) { - parentHadSymbol = true; - } - - var decl; - var decls; - var ast; - var members; - - if (variableSymbol) { - var prevKind = variableSymbol.kind; - var prevIsEnum = variableSymbol.anyDeclHasFlag(4096 /* Enum */); - var prevIsClassConstructorVariable = variableSymbol.anyDeclHasFlag(16384 /* ClassConstructorVariable */); - var prevIsModuleValue = variableSymbol.allDeclsHaveFlag(32768 /* InitializedModule */); - var prevIsImplicit = variableSymbol.anyDeclHasFlag(118784 /* ImplicitVariable */); - var prevIsFunction = TypeScript.ArrayUtilities.any(variableSymbol.getDeclarations(), function (decl) { - return decl.kind === 16384 /* Function */; - }); - var prevIsAmbient = variableSymbol.allDeclsHaveFlag(8 /* Ambient */); - var isAmbientOrPrevIsAmbient = prevIsAmbient || (variableDeclaration.flags & 8 /* Ambient */) !== 0; - var prevDecl = variableSymbol.getDeclarations()[0]; - var prevParentDecl = prevDecl.getParentDecl(); - var bothAreGlobal = parentDecl && (parentDecl.kind === 1 /* Script */) && (prevParentDecl.kind === 1 /* Script */); - var shareParent = bothAreGlobal || prevDecl.getParentDecl() === variableDeclaration.getParentDecl(); - var prevIsParam = shareParent && prevKind === 2048 /* Parameter */ && declKind == 512 /* Variable */; - - var acceptableRedeclaration = prevIsParam || (isImplicit && ((!isEnumValue && !isClassConstructorVariable && prevIsFunction) || ((isModuleValue || isEnumValue) && (prevIsModuleValue || prevIsEnum)) || (isClassConstructorVariable && prevIsModuleValue && isAmbientOrPrevIsAmbient) || (isModuleValue && prevIsClassConstructorVariable))); - - if (acceptableRedeclaration && (prevIsClassConstructorVariable || prevIsFunction) && !isAmbientOrPrevIsAmbient) { - if (prevDecl.fileName() !== variableDeclaration.fileName()) { - this.semanticInfoChain.addDiagnostic(TypeScript.PullHelpers.diagnosticFromDecl(variableDeclaration, TypeScript.DiagnosticCode.Module_0_cannot_merge_with_previous_declaration_of_1_in_a_different_file_2, [declName, declName, prevDecl.fileName()])); - variableSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(declName); - } - } - - if (!acceptableRedeclaration || prevIsParam) { - if (!prevIsParam && (isImplicit || prevIsImplicit || TypeScript.hasFlag(prevKind, 1032192 /* SomeFunction */)) || !shareParent) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(nameAST, variableDeclaration.getDisplayName(), variableSymbol.getDeclarations()[0].ast()); - variableSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(declName); - } else { - this.checkThatExportsMatch(variableDeclaration, variableSymbol); - variableSymbol = null; - parentHadSymbol = false; - } - } - - if (variableSymbol && !(variableSymbol.type && variableSymbol.type.isError()) && !this.checkThatExportsMatch(variableDeclaration, variableSymbol, !(isModuleValue && prevIsModuleValue))) { - variableSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(declName); - } - } - - if ((declFlags & 118784 /* ImplicitVariable */) === 0) { - if (!variableSymbol) { - variableSymbol = new TypeScript.PullSymbol(declName, declKind); - if (!parent && parentDecl.kind === 1 /* Script */) { - this.semanticInfoChain.cacheGlobalSymbol(variableSymbol, declKind); - } - } - - variableSymbol.addDeclaration(variableDeclaration); - variableDeclaration.setSymbol(variableSymbol); - - this.semanticInfoChain.setSymbolForAST(nameAST, variableSymbol); - this.semanticInfoChain.setSymbolForAST(varDeclAST, variableSymbol); - } else if (!parentHadSymbol) { - if (isClassConstructorVariable) { - var classTypeSymbol = variableSymbol; - - if (parent) { - members = parent.getMembers(); - - for (var i = 0; i < members.length; i++) { - if ((members[i].name === declName) && (members[i].kind === 8 /* Class */)) { - classTypeSymbol = members[i]; - break; - } - } - } - - if (!classTypeSymbol) { - var containerDecl = variableDeclaration.getContainerDecl(); - classTypeSymbol = containerDecl.getSymbol(); - if (!classTypeSymbol) { - classTypeSymbol = this.semanticInfoChain.findTopLevelSymbol(declName, 58728795 /* SomeType */, variableDeclaration); - } - } - - if (classTypeSymbol && (classTypeSymbol.kind !== 8 /* Class */)) { - classTypeSymbol = null; - } - - if (classTypeSymbol && classTypeSymbol.isClass()) { - variableSymbol = classTypeSymbol.getConstructorMethod(); - variableDeclaration.setSymbol(variableSymbol); - - decls = classTypeSymbol.getDeclarations(); - - if (decls.length) { - decl = decls[decls.length - 1]; - ast = this.semanticInfoChain.getASTForDecl(decl); - } - } else { - if (!variableSymbol) { - variableSymbol = new TypeScript.PullSymbol(declName, declKind); - } - - variableSymbol.addDeclaration(variableDeclaration); - variableDeclaration.setSymbol(variableSymbol); - - variableSymbol.type = this.semanticInfoChain.anyTypeSymbol; - } - } else if (declFlags & 102400 /* SomeInitializedModule */) { - var moduleContainerTypeSymbol = null; - var moduleParent = this.getParent(variableDeclaration); - - if (moduleParent) { - members = moduleParent.getMembers(); - - for (var i = 0; i < members.length; i++) { - if ((members[i].name === declName) && (members[i].isContainer())) { - moduleContainerTypeSymbol = members[i]; - break; - } - } - } - - if (!moduleContainerTypeSymbol) { - var containerDecl = variableDeclaration.getContainerDecl(); - moduleContainerTypeSymbol = containerDecl.getSymbol(); - if (!moduleContainerTypeSymbol) { - moduleContainerTypeSymbol = this.semanticInfoChain.findTopLevelSymbol(declName, 164 /* SomeContainer */, variableDeclaration); - - if (!moduleContainerTypeSymbol) { - moduleContainerTypeSymbol = this.semanticInfoChain.findTopLevelSymbol(declName, 64 /* Enum */, variableDeclaration); - } - } - } - - if (moduleContainerTypeSymbol && (!moduleContainerTypeSymbol.isContainer())) { - moduleContainerTypeSymbol = null; - } - - if (moduleContainerTypeSymbol) { - variableSymbol = moduleContainerTypeSymbol.getInstanceSymbol(); - if (!variableSymbol) { - variableSymbol = new TypeScript.PullSymbol(declName, declKind); - variableSymbol.type = new TypeScript.PullTypeSymbol("", 8388608 /* ObjectType */); - } - - if (!variableSymbol.hasDeclaration(variableDeclaration)) { - variableSymbol.addDeclaration(variableDeclaration); - } - variableDeclaration.setSymbol(variableSymbol); - } else { - TypeScript.Debug.assert(false, "Attempted to bind invalid implicit variable symbol"); - } - } - } else { - if (!variableSymbol.hasDeclaration(variableDeclaration)) { - variableSymbol.addDeclaration(variableDeclaration); - } - variableDeclaration.setSymbol(variableSymbol); - } - - var containerDecl = variableDeclaration.getContainerDecl(); - if (variableSymbol && variableSymbol.type && containerDecl && !variableSymbol.type.hasDeclaration(containerDecl)) { - variableSymbol.type.addDeclaration(containerDecl); - } - - if (parent && !parentHadSymbol) { - if (declFlags & 1 /* Exported */) { - parent.addMember(variableSymbol); - } else { - parent.addEnclosedNonMember(variableSymbol); - } - } - }; - - PullSymbolBinder.prototype.bindCatchVariableToPullSymbol = function (variableDeclaration) { - var declFlags = variableDeclaration.flags; - var declKind = variableDeclaration.kind; - var identifier = this.semanticInfoChain.getASTForDecl(variableDeclaration); - - var declName = variableDeclaration.name; - - var variableSymbol = new TypeScript.PullSymbol(declName, declKind); - - variableSymbol.addDeclaration(variableDeclaration); - variableDeclaration.setSymbol(variableSymbol); - - variableSymbol.type = this.semanticInfoChain.anyTypeSymbol; - - this.semanticInfoChain.setSymbolForAST(identifier, variableSymbol); - }; - - PullSymbolBinder.prototype.bindEnumMemberDeclarationToPullSymbol = function (propertyDeclaration) { - var declFlags = propertyDeclaration.flags; - var declKind = propertyDeclaration.kind; - var propDeclAST = this.semanticInfoChain.getASTForDecl(propertyDeclaration); - - var declName = propertyDeclaration.name; - - var parentHadSymbol = false; - - var parent = this.getParent(propertyDeclaration, true); - - var propertySymbol = parent.findMember(declName, false); - - if (propertySymbol) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(propDeclAST.propertyName, propertyDeclaration.getDisplayName(), propertySymbol.getDeclarations()[0].ast()); - } - - if (propertySymbol) { - parentHadSymbol = true; - } - - if (!parentHadSymbol) { - propertySymbol = new TypeScript.PullSymbol(declName, declKind); - } - - propertySymbol.addDeclaration(propertyDeclaration); - propertyDeclaration.setSymbol(propertySymbol); - - this.semanticInfoChain.setSymbolForAST(propDeclAST.propertyName, propertySymbol); - this.semanticInfoChain.setSymbolForAST(propDeclAST, propertySymbol); - - if (parent && !parentHadSymbol) { - parent.addMember(propertySymbol); - } - }; - - PullSymbolBinder.prototype.bindPropertyDeclarationToPullSymbol = function (propertyDeclaration) { - var declFlags = propertyDeclaration.flags; - var declKind = propertyDeclaration.kind; - - var ast = this.semanticInfoChain.getASTForDecl(propertyDeclaration); - var astName = ast.kind() === 136 /* MemberVariableDeclaration */ ? ast.variableDeclarator.propertyName : ast.kind() === 141 /* PropertySignature */ ? ast.propertyName : ast.kind() === 242 /* Parameter */ ? ast.identifier : ast.propertyName; - - var isStatic = false; - var isOptional = false; - - var propertySymbol = null; - - if (TypeScript.hasFlag(declFlags, 16 /* Static */)) { - isStatic = true; - } - - if (TypeScript.hasFlag(declFlags, 128 /* Optional */)) { - isOptional = true; - } - - var declName = propertyDeclaration.name; - - var parentHadSymbol = false; - - var parent = this.getParent(propertyDeclaration, true); - - if (parent.isClass() && isStatic) { - parent = parent.getConstructorMethod().type; - } - - propertySymbol = parent.findMember(declName, false); - - if (propertySymbol) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(astName, propertyDeclaration.getDisplayName(), propertySymbol.getDeclarations()[0].ast()); - } - - if (propertySymbol) { - parentHadSymbol = true; - } - - var classTypeSymbol; - - if (!parentHadSymbol) { - propertySymbol = new TypeScript.PullSymbol(declName, declKind); - } - - propertySymbol.addDeclaration(propertyDeclaration); - propertyDeclaration.setSymbol(propertySymbol); - - this.semanticInfoChain.setSymbolForAST(astName, propertySymbol); - this.semanticInfoChain.setSymbolForAST(ast, propertySymbol); - - if (isOptional) { - propertySymbol.isOptional = true; - } - - if (parent && !parentHadSymbol) { - parent.addMember(propertySymbol); - } - }; - - PullSymbolBinder.prototype.bindParameterSymbols = function (functionDeclaration, parameterList, funcType, signatureSymbol) { - var parameters = []; - var params = TypeScript.createIntrinsicsObject(); - var funcDecl = this.semanticInfoChain.getDeclForAST(functionDeclaration); - - if (parameterList) { - for (var i = 0, n = parameterList.length; i < n; i++) { - var argDecl = parameterList.astAt(i); - var id = parameterList.identifierAt(i); - var decl = this.semanticInfoChain.getDeclForAST(argDecl); - var isProperty = TypeScript.hasFlag(decl.flags, 8388608 /* PropertyParameter */); - var parameterSymbol = new TypeScript.PullSymbol(id.valueText(), 2048 /* Parameter */); - - if ((i === (n - 1)) && parameterList.lastParameterIsRest()) { - parameterSymbol.isVarArg = true; - } - - if (params[id.valueText()]) { - this.semanticInfoChain.addDiagnosticFromAST(argDecl, TypeScript.DiagnosticCode.Duplicate_identifier_0, [id.text()]); - } else { - params[id.valueText()] = true; - } - - if (decl) { - var isParameterOptional = false; - - if (isProperty) { - decl.ensureSymbolIsBound(); - var valDecl = decl.getValueDecl(); - - if (valDecl) { - isParameterOptional = TypeScript.hasFlag(valDecl.flags, 128 /* Optional */); - - valDecl.setSymbol(parameterSymbol); - parameterSymbol.addDeclaration(valDecl); - } - } else { - isParameterOptional = TypeScript.hasFlag(decl.flags, 128 /* Optional */); - - parameterSymbol.addDeclaration(decl); - decl.setSymbol(parameterSymbol); - } - - parameterSymbol.isOptional = isParameterOptional; - } - - signatureSymbol.addParameter(parameterSymbol, parameterSymbol.isOptional); - - if (signatureSymbol.isDefinition()) { - funcType.addEnclosedNonMember(parameterSymbol); - } - } - } - }; - - PullSymbolBinder.prototype.bindFunctionDeclarationToPullSymbol = function (functionDeclaration) { - var declKind = functionDeclaration.kind; - var declFlags = functionDeclaration.flags; - var funcDeclAST = this.semanticInfoChain.getASTForDecl(functionDeclaration); - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var funcName = functionDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - - var parent = this.getParent(functionDeclaration, true); - - var parentDecl = functionDeclaration.getParentDecl(); - var parentHadSymbol = false; - - var functionSymbol = null; - var functionTypeSymbol = null; - - functionSymbol = this.getExistingSymbol(functionDeclaration, 68147712 /* SomeValue */, parent); - - if (functionSymbol) { - var acceptableRedeclaration; - - if (functionSymbol.kind === 16384 /* Function */) { - acceptableRedeclaration = isSignature || functionSymbol.allDeclsHaveFlag(2048 /* Signature */); - } else { - var isCurrentDeclAmbient = TypeScript.hasFlag(functionDeclaration.flags, 8 /* Ambient */); - acceptableRedeclaration = TypeScript.ArrayUtilities.all(functionSymbol.getDeclarations(), function (decl) { - var isInitializedModuleOrAmbientDecl = TypeScript.hasFlag(decl.flags, 32768 /* InitializedModule */) && (isCurrentDeclAmbient || TypeScript.hasFlag(decl.flags, 8 /* Ambient */)); - var isSignature = TypeScript.hasFlag(decl.flags, 2048 /* Signature */); - return isInitializedModuleOrAmbientDecl || isSignature; - }); - } - - if (!acceptableRedeclaration) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(funcDeclAST.identifier, functionDeclaration.getDisplayName(), functionSymbol.getDeclarations()[0].ast()); - functionSymbol.type = this.semanticInfoChain.getResolver().getNewErrorTypeSymbol(funcName); - } - } - - if (functionSymbol) { - functionTypeSymbol = functionSymbol.type; - parentHadSymbol = true; - } - - if (!functionSymbol) { - functionSymbol = new TypeScript.PullSymbol(funcName, 16384 /* Function */); - } - - if (!functionTypeSymbol) { - functionTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - functionSymbol.type = functionTypeSymbol; - functionTypeSymbol.setFunctionSymbol(functionSymbol); - } - - functionDeclaration.setSymbol(functionSymbol); - functionSymbol.addDeclaration(functionDeclaration); - functionTypeSymbol.addDeclaration(functionDeclaration); - - this.semanticInfoChain.setSymbolForAST(funcDeclAST.identifier, functionSymbol); - this.semanticInfoChain.setSymbolForAST(funcDeclAST, functionSymbol); - - if (parent && !parentHadSymbol) { - if (isExported) { - parent.addMember(functionSymbol); - } else { - parent.addEnclosedNonMember(functionSymbol); - } - } - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - signature.addDeclaration(functionDeclaration); - functionDeclaration.setSignatureSymbol(signature); - - if (TypeScript.lastParameterIsRest(funcDeclAST.callSignature.parameterList)) { - signature.hasVarArgs = true; - } - - var funcDecl = this.semanticInfoChain.getASTForDecl(functionDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.callSignature.parameterList), functionTypeSymbol, signature); - - var typeParameters = functionDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = signature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.name]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - functionTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindFunctionExpressionToPullSymbol = function (functionExpressionDeclaration) { - var declKind = functionExpressionDeclaration.kind; - var declFlags = functionExpressionDeclaration.flags; - var ast = this.semanticInfoChain.getASTForDecl(functionExpressionDeclaration); - - var parameters = ast.kind() === 219 /* SimpleArrowFunctionExpression */ ? TypeScript.ASTHelpers.parametersFromIdentifier(ast.identifier) : TypeScript.ASTHelpers.parametersFromParameterList(TypeScript.ASTHelpers.getParameterList(ast)); - var funcExpAST = ast; - - var functionName = declKind === 131072 /* FunctionExpression */ ? functionExpressionDeclaration.getFunctionExpressionName() : functionExpressionDeclaration.name; - var functionSymbol = new TypeScript.PullSymbol(functionName, declKind); - var functionTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - functionTypeSymbol.setFunctionSymbol(functionSymbol); - - functionSymbol.type = functionTypeSymbol; - - functionExpressionDeclaration.setSymbol(functionSymbol); - functionSymbol.addDeclaration(functionExpressionDeclaration); - functionTypeSymbol.addDeclaration(functionExpressionDeclaration); - - var name = funcExpAST.kind() === 222 /* FunctionExpression */ ? funcExpAST.identifier : funcExpAST.kind() === 241 /* FunctionPropertyAssignment */ ? funcExpAST.propertyName : null; - if (name) { - this.semanticInfoChain.setSymbolForAST(name, functionSymbol); - } - - this.semanticInfoChain.setSymbolForAST(funcExpAST, functionSymbol); - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, true); - - if (parameters.lastParameterIsRest()) { - signature.hasVarArgs = true; - } - - var typeParameters = functionExpressionDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = signature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - signature.addDeclaration(functionExpressionDeclaration); - functionExpressionDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcExpAST, parameters, functionTypeSymbol, signature); - - functionTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindFunctionTypeDeclarationToPullSymbol = function (functionTypeDeclaration) { - var declKind = functionTypeDeclaration.kind; - var declFlags = functionTypeDeclaration.flags; - var funcTypeAST = this.semanticInfoChain.getASTForDecl(functionTypeDeclaration); - - var functionTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - - functionTypeDeclaration.setSymbol(functionTypeSymbol); - functionTypeSymbol.addDeclaration(functionTypeDeclaration); - this.semanticInfoChain.setSymbolForAST(funcTypeAST, functionTypeSymbol); - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - if (TypeScript.lastParameterIsRest(funcTypeAST.parameterList)) { - signature.hasVarArgs = true; - } - - var typeParameters = functionTypeDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = signature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - signature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.name]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - signature.addDeclaration(functionTypeDeclaration); - functionTypeDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcTypeAST, TypeScript.ASTHelpers.parametersFromParameterList(funcTypeAST.parameterList), functionTypeSymbol, signature); - - functionTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindMethodDeclarationToPullSymbol = function (methodDeclaration) { - var declKind = methodDeclaration.kind; - var declFlags = methodDeclaration.flags; - var methodAST = this.semanticInfoChain.getASTForDecl(methodDeclaration); - - var isPrivate = (declFlags & 2 /* Private */) !== 0; - var isStatic = (declFlags & 16 /* Static */) !== 0; - var isOptional = (declFlags & 128 /* Optional */) !== 0; - - var methodName = methodDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - - var parent = this.getParent(methodDeclaration, true); - var parentHadSymbol = false; - - var methodSymbol = null; - var methodTypeSymbol = null; - - if (parent.isClass() && isStatic) { - parent = parent.getConstructorMethod().type; - } - - methodSymbol = parent.findMember(methodName, false); - - if (methodSymbol && (methodSymbol.kind !== 65536 /* Method */ || (!isSignature && !methodSymbol.allDeclsHaveFlag(2048 /* Signature */)))) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(methodAST, methodDeclaration.getDisplayName(), methodSymbol.getDeclarations()[0].ast()); - methodSymbol = null; - } - - if (methodSymbol) { - methodTypeSymbol = methodSymbol.type; - parentHadSymbol = true; - } - - if (!methodSymbol) { - methodSymbol = new TypeScript.PullSymbol(methodName, 65536 /* Method */); - } - - if (!methodTypeSymbol) { - methodTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - methodSymbol.type = methodTypeSymbol; - methodTypeSymbol.setFunctionSymbol(methodSymbol); - } - - methodDeclaration.setSymbol(methodSymbol); - methodSymbol.addDeclaration(methodDeclaration); - methodTypeSymbol.addDeclaration(methodDeclaration); - - var nameAST = methodAST.kind() === 135 /* MemberFunctionDeclaration */ ? methodAST.propertyName : methodAST.propertyName; - - TypeScript.Debug.assert(nameAST); - - this.semanticInfoChain.setSymbolForAST(nameAST, methodSymbol); - this.semanticInfoChain.setSymbolForAST(methodAST, methodSymbol); - - if (isOptional) { - methodSymbol.isOptional = true; - } - - if (!parentHadSymbol) { - parent.addMember(methodSymbol); - } - - var sigKind = 1048576 /* CallSignature */; - - var signature = new TypeScript.PullSignatureSymbol(sigKind, !isSignature); - - var parameterList = TypeScript.ASTHelpers.getParameterList(methodAST); - if (TypeScript.lastParameterIsRest(parameterList)) { - signature.hasVarArgs = true; - } - - var typeParameters = methodDeclaration.getTypeParameters(); - var typeParameter; - var typeParameterName; - var typeParameterAST; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameterName = typeParameters[i].name; - typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameters[i]); - - typeParameter = signature.findTypeParameter(typeParameterName); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameterName); - signature.addTypeParameter(typeParameter); - } else { - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - signature.addDeclaration(methodDeclaration); - methodDeclaration.setSignatureSymbol(signature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(methodDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(TypeScript.ASTHelpers.getParameterList(funcDecl)), methodTypeSymbol, signature); - - var signatureIndex = this.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList(signature, methodTypeSymbol.getOwnCallSignatures()); - methodTypeSymbol.insertCallSignatureAtIndex(signature, signatureIndex); - }; - - PullSymbolBinder.prototype.bindStaticPrototypePropertyOfClass = function (classAST, classTypeSymbol, constructorTypeSymbol) { - var prototypeStr = "prototype"; - - var prototypeSymbol = constructorTypeSymbol.findMember(prototypeStr, false); - if (prototypeSymbol && !prototypeSymbol.getIsSynthesized()) { - this.semanticInfoChain.addDiagnostic(TypeScript.PullHelpers.diagnosticFromDecl(prototypeSymbol.getDeclarations()[0], TypeScript.DiagnosticCode.Duplicate_identifier_0, [prototypeSymbol.getDisplayName()])); - } - - if (!prototypeSymbol || !prototypeSymbol.getIsSynthesized()) { - var prototypeDecl = new TypeScript.PullSynthesizedDecl(prototypeStr, prototypeStr, 4096 /* Property */, 4 /* Public */ | 16 /* Static */, constructorTypeSymbol.getDeclarations()[0], this.semanticInfoChain); - - prototypeSymbol = new TypeScript.PullSymbol(prototypeStr, 4096 /* Property */); - prototypeSymbol.setIsSynthesized(); - prototypeSymbol.addDeclaration(prototypeDecl); - prototypeSymbol.type = classTypeSymbol; - constructorTypeSymbol.addMember(prototypeSymbol); - - if (prototypeSymbol.type && prototypeSymbol.type.isGeneric()) { - var resolver = this.semanticInfoChain.getResolver(); - prototypeSymbol.type = resolver.instantiateTypeToAny(prototypeSymbol.type, new TypeScript.PullTypeResolutionContext(resolver)); - } - prototypeSymbol.setResolved(); - } - }; - - PullSymbolBinder.prototype.bindConstructorDeclarationToPullSymbol = function (constructorDeclaration) { - var declKind = constructorDeclaration.kind; - var declFlags = constructorDeclaration.flags; - var constructorAST = this.semanticInfoChain.getASTForDecl(constructorDeclaration); - - var constructorName = constructorDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - - var parent = this.getParent(constructorDeclaration, true); - - var parentHadSymbol = false; - - var constructorSymbol = parent.getConstructorMethod(); - var constructorTypeSymbol = null; - - if (constructorSymbol && (constructorSymbol.kind !== 32768 /* ConstructorMethod */ || (!isSignature && constructorSymbol.type && constructorSymbol.type.hasOwnConstructSignatures()))) { - var hasDefinitionSignature = false; - var constructorSigs = constructorSymbol.type.getOwnDeclaredConstructSignatures(); - - for (var i = 0; i < constructorSigs.length; i++) { - if (!constructorSigs[i].anyDeclHasFlag(2048 /* Signature */)) { - hasDefinitionSignature = true; - break; - } - } - - if (hasDefinitionSignature) { - this.semanticInfoChain.addDiagnosticFromAST(constructorAST, TypeScript.DiagnosticCode.Multiple_constructor_implementations_are_not_allowed); - - constructorSymbol = null; - } - } - - if (constructorSymbol) { - constructorTypeSymbol = constructorSymbol.type; - } else { - constructorSymbol = new TypeScript.PullSymbol(constructorName, 32768 /* ConstructorMethod */); - constructorTypeSymbol = new TypeScript.PullTypeSymbol("", 33554432 /* ConstructorType */); - } - - parent.setConstructorMethod(constructorSymbol); - constructorSymbol.type = constructorTypeSymbol; - - constructorDeclaration.setSymbol(constructorSymbol); - constructorSymbol.addDeclaration(constructorDeclaration); - constructorTypeSymbol.addDeclaration(constructorDeclaration); - constructorSymbol.setIsSynthesized(false); - this.semanticInfoChain.setSymbolForAST(constructorAST, constructorSymbol); - - var constructSignature = new TypeScript.PullSignatureSymbol(2097152 /* ConstructSignature */, !isSignature); - constructSignature.returnType = parent; - constructSignature.addTypeParametersFromReturnType(); - - constructSignature.addDeclaration(constructorDeclaration); - constructorDeclaration.setSignatureSymbol(constructSignature); - - this.bindParameterSymbols(constructorAST, TypeScript.ASTHelpers.parametersFromParameterList(constructorAST.callSignature.parameterList), constructorTypeSymbol, constructSignature); - - if (TypeScript.lastParameterIsRest(constructorAST.callSignature.parameterList)) { - constructSignature.hasVarArgs = true; - } - - constructorTypeSymbol.appendConstructSignature(constructSignature); - }; - - PullSymbolBinder.prototype.bindConstructSignatureDeclarationToPullSymbol = function (constructSignatureDeclaration) { - var parent = this.getParent(constructSignatureDeclaration, true); - var constructorAST = this.semanticInfoChain.getASTForDecl(constructSignatureDeclaration); - - var constructSignature = new TypeScript.PullSignatureSymbol(2097152 /* ConstructSignature */); - - if (TypeScript.lastParameterIsRest(constructorAST.callSignature.parameterList)) { - constructSignature.hasVarArgs = true; - } - - var typeParameters = constructSignatureDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = constructSignature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - constructSignature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - constructSignature.addDeclaration(constructSignatureDeclaration); - constructSignatureDeclaration.setSignatureSymbol(constructSignature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(constructSignatureDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(TypeScript.ASTHelpers.getParameterList(funcDecl)), null, constructSignature); - - this.semanticInfoChain.setSymbolForAST(this.semanticInfoChain.getASTForDecl(constructSignatureDeclaration), constructSignature); - - var signatureIndex = this.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList(constructSignature, parent.getOwnDeclaredConstructSignatures()); - parent.insertConstructSignatureAtIndex(constructSignature, signatureIndex); - }; - - PullSymbolBinder.prototype.bindCallSignatureDeclarationToPullSymbol = function (callSignatureDeclaration) { - var parent = this.getParent(callSignatureDeclaration, true); - var callSignatureAST = this.semanticInfoChain.getASTForDecl(callSignatureDeclaration); - - var callSignature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */); - - if (TypeScript.lastParameterIsRest(callSignatureAST.parameterList)) { - callSignature.hasVarArgs = true; - } - - var typeParameters = callSignatureDeclaration.getTypeParameters(); - var typeParameter; - - for (var i = 0; i < typeParameters.length; i++) { - typeParameter = callSignature.findTypeParameter(typeParameters[i].name); - - if (!typeParameter) { - typeParameter = new TypeScript.PullTypeParameterSymbol(typeParameters[i].name); - - callSignature.addTypeParameter(typeParameter); - } else { - var typeParameterAST = this.semanticInfoChain.getASTForDecl(typeParameter.getDeclarations()[0]); - this.semanticInfoChain.addDiagnosticFromAST(typeParameterAST, TypeScript.DiagnosticCode.Duplicate_identifier_0, [typeParameter.getName()]); - } - - typeParameter.addDeclaration(typeParameters[i]); - typeParameters[i].setSymbol(typeParameter); - } - - callSignature.addDeclaration(callSignatureDeclaration); - callSignatureDeclaration.setSignatureSymbol(callSignature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(callSignatureDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameterList(funcDecl.parameterList), null, callSignature); - - this.semanticInfoChain.setSymbolForAST(this.semanticInfoChain.getASTForDecl(callSignatureDeclaration), callSignature); - - var signatureIndex = this.getIndexForInsertingSignatureAtEndOfEnclosingDeclInSignatureList(callSignature, parent.getOwnCallSignatures()); - parent.insertCallSignatureAtIndex(callSignature, signatureIndex); - }; - - PullSymbolBinder.prototype.bindIndexSignatureDeclarationToPullSymbol = function (indexSignatureDeclaration) { - var indexSignature = new TypeScript.PullSignatureSymbol(4194304 /* IndexSignature */); - - indexSignature.addDeclaration(indexSignatureDeclaration); - indexSignatureDeclaration.setSignatureSymbol(indexSignature); - - var funcDecl = this.semanticInfoChain.getASTForDecl(indexSignatureDeclaration); - this.bindParameterSymbols(funcDecl, TypeScript.ASTHelpers.parametersFromParameter(funcDecl.parameter), null, indexSignature); - - this.semanticInfoChain.setSymbolForAST(this.semanticInfoChain.getASTForDecl(indexSignatureDeclaration), indexSignature); - - var parent = this.getParent(indexSignatureDeclaration); - parent.addIndexSignature(indexSignature); - indexSignature.setContainer(parent); - }; - - PullSymbolBinder.prototype.bindGetAccessorDeclarationToPullSymbol = function (getAccessorDeclaration) { - var declKind = getAccessorDeclaration.kind; - var declFlags = getAccessorDeclaration.flags; - var funcDeclAST = this.semanticInfoChain.getASTForDecl(getAccessorDeclaration); - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var funcName = getAccessorDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - var isStatic = false; - - if (TypeScript.hasFlag(declFlags, 16 /* Static */)) { - isStatic = true; - } - - var parent = this.getParent(getAccessorDeclaration, true); - var parentHadSymbol = false; - - var accessorSymbol = null; - var getterSymbol = null; - var getterTypeSymbol = null; - - if (isStatic) { - parent = parent.getConstructorMethod().type; - } - - accessorSymbol = parent.findMember(funcName, false); - - if (accessorSymbol) { - if (!accessorSymbol.isAccessor()) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(funcDeclAST.propertyName, getAccessorDeclaration.getDisplayName(), accessorSymbol.getDeclarations()[0].ast()); - accessorSymbol = null; - } else { - getterSymbol = accessorSymbol.getGetter(); - - if (getterSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Getter_0_already_declared, [getAccessorDeclaration.getDisplayName()]); - accessorSymbol = null; - getterSymbol = null; - } - } - } - - if (accessorSymbol) { - parentHadSymbol = true; - } - - if (accessorSymbol && getterSymbol) { - getterTypeSymbol = getterSymbol.type; - } - - if (!accessorSymbol) { - accessorSymbol = new TypeScript.PullAccessorSymbol(funcName); - } - - if (!getterSymbol) { - getterSymbol = new TypeScript.PullSymbol(funcName, 16384 /* Function */); - getterTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - getterTypeSymbol.setFunctionSymbol(getterSymbol); - - getterSymbol.type = getterTypeSymbol; - - accessorSymbol.setGetter(getterSymbol); - } - - getAccessorDeclaration.setSymbol(accessorSymbol); - accessorSymbol.addDeclaration(getAccessorDeclaration); - getterSymbol.addDeclaration(getAccessorDeclaration); - - var nameAST = funcDeclAST.propertyName; - this.semanticInfoChain.setSymbolForAST(nameAST, accessorSymbol); - this.semanticInfoChain.setSymbolForAST(funcDeclAST, getterSymbol); - - if (!parentHadSymbol) { - parent.addMember(accessorSymbol); - } - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - signature.addDeclaration(getAccessorDeclaration); - getAccessorDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcDeclAST, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), getterTypeSymbol, signature); - - getterTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.bindSetAccessorDeclarationToPullSymbol = function (setAccessorDeclaration) { - var declKind = setAccessorDeclaration.kind; - var declFlags = setAccessorDeclaration.flags; - var funcDeclAST = this.semanticInfoChain.getASTForDecl(setAccessorDeclaration); - - var isExported = (declFlags & 1 /* Exported */) !== 0; - - var funcName = setAccessorDeclaration.name; - - var isSignature = (declFlags & 2048 /* Signature */) !== 0; - var isStatic = false; - - if (TypeScript.hasFlag(declFlags, 16 /* Static */)) { - isStatic = true; - } - - var parent = this.getParent(setAccessorDeclaration, true); - var parentHadSymbol = false; - - var accessorSymbol = null; - var setterSymbol = null; - var setterTypeSymbol = null; - - if (isStatic) { - parent = parent.getConstructorMethod().type; - } - - accessorSymbol = parent.findMember(funcName, false); - - if (accessorSymbol) { - if (!accessorSymbol.isAccessor()) { - this.semanticInfoChain.addDuplicateIdentifierDiagnosticFromAST(funcDeclAST.propertyName, setAccessorDeclaration.getDisplayName(), accessorSymbol.getDeclarations()[0].ast()); - accessorSymbol = null; - } else { - setterSymbol = accessorSymbol.getSetter(); - - if (setterSymbol) { - this.semanticInfoChain.addDiagnosticFromAST(funcDeclAST, TypeScript.DiagnosticCode.Setter_0_already_declared, [setAccessorDeclaration.getDisplayName()]); - accessorSymbol = null; - setterSymbol = null; - } - } - } - - if (accessorSymbol) { - parentHadSymbol = true; - - if (setterSymbol) { - setterTypeSymbol = setterSymbol.type; - } - } - - if (!accessorSymbol) { - accessorSymbol = new TypeScript.PullAccessorSymbol(funcName); - } - - if (!setterSymbol) { - setterSymbol = new TypeScript.PullSymbol(funcName, 16384 /* Function */); - setterTypeSymbol = new TypeScript.PullTypeSymbol("", 16777216 /* FunctionType */); - setterTypeSymbol.setFunctionSymbol(setterSymbol); - - setterSymbol.type = setterTypeSymbol; - - accessorSymbol.setSetter(setterSymbol); - } - - setAccessorDeclaration.setSymbol(accessorSymbol); - accessorSymbol.addDeclaration(setAccessorDeclaration); - setterSymbol.addDeclaration(setAccessorDeclaration); - - var nameAST = funcDeclAST.propertyName; - this.semanticInfoChain.setSymbolForAST(nameAST, accessorSymbol); - this.semanticInfoChain.setSymbolForAST(funcDeclAST, setterSymbol); - - if (!parentHadSymbol) { - parent.addMember(accessorSymbol); - } - - var signature = new TypeScript.PullSignatureSymbol(1048576 /* CallSignature */, !isSignature); - - signature.addDeclaration(setAccessorDeclaration); - setAccessorDeclaration.setSignatureSymbol(signature); - - this.bindParameterSymbols(funcDeclAST, TypeScript.ASTHelpers.parametersFromParameterList(funcDeclAST.parameterList), setterTypeSymbol, signature); - - setterTypeSymbol.appendCallSignature(signature); - }; - - PullSymbolBinder.prototype.getDeclsToBind = function (decl) { - var decls; - switch (decl.kind) { - case 64 /* Enum */: - case 32 /* DynamicModule */: - case 4 /* Container */: - case 16 /* Interface */: - decls = this.findDeclsInContext(decl, decl.kind, true); - break; - - case 512 /* Variable */: - case 16384 /* Function */: - case 65536 /* Method */: - case 32768 /* ConstructorMethod */: - decls = this.findDeclsInContext(decl, decl.kind, false); - break; - - default: - decls = [decl]; - } - TypeScript.Debug.assert(decls && decls.length > 0); - TypeScript.Debug.assert(TypeScript.ArrayUtilities.contains(decls, decl)); - return decls; - }; - - PullSymbolBinder.prototype.shouldBindDeclaration = function (decl) { - return !decl.hasBeenBound() && this.declsBeingBound.indexOf(decl.declID) < 0; - }; - - PullSymbolBinder.prototype.bindDeclToPullSymbol = function (decl) { - if (this.shouldBindDeclaration(decl)) { - this.bindAllDeclsToPullSymbol(decl); - } - }; - - PullSymbolBinder.prototype.bindAllDeclsToPullSymbol = function (askedDecl) { - var allDecls = this.getDeclsToBind(askedDecl); - for (var i = 0; i < allDecls.length; i++) { - var decl = allDecls[i]; - - if (this.shouldBindDeclaration(decl)) { - this.bindSingleDeclToPullSymbol(decl); - } - } - }; - - PullSymbolBinder.prototype.bindSingleDeclToPullSymbol = function (decl) { - this.declsBeingBound.push(decl.declID); - - switch (decl.kind) { - case 1 /* Script */: - var childDecls = decl.getChildDecls(); - for (var i = 0; i < childDecls.length; i++) { - this.bindDeclToPullSymbol(childDecls[i]); - } - break; - - case 64 /* Enum */: - this.bindEnumDeclarationToPullSymbol(decl); - break; - - case 32 /* DynamicModule */: - case 4 /* Container */: - this.bindModuleDeclarationToPullSymbol(decl); - break; - - case 16 /* Interface */: - this.bindInterfaceDeclarationToPullSymbol(decl); - break; - - case 8 /* Class */: - this.bindClassDeclarationToPullSymbol(decl); - break; - - case 16384 /* Function */: - this.bindFunctionDeclarationToPullSymbol(decl); - break; - - case 512 /* Variable */: - this.bindVariableDeclarationToPullSymbol(decl); - break; - - case 1024 /* CatchVariable */: - this.bindCatchVariableToPullSymbol(decl); - break; - - case 67108864 /* EnumMember */: - this.bindEnumMemberDeclarationToPullSymbol(decl); - break; - - case 4096 /* Property */: - this.bindPropertyDeclarationToPullSymbol(decl); - break; - - case 65536 /* Method */: - this.bindMethodDeclarationToPullSymbol(decl); - break; - - case 32768 /* ConstructorMethod */: - this.bindConstructorDeclarationToPullSymbol(decl); - break; - - case 1048576 /* CallSignature */: - this.bindCallSignatureDeclarationToPullSymbol(decl); - break; - - case 2097152 /* ConstructSignature */: - this.bindConstructSignatureDeclarationToPullSymbol(decl); - break; - - case 4194304 /* IndexSignature */: - this.bindIndexSignatureDeclarationToPullSymbol(decl); - break; - - case 262144 /* GetAccessor */: - this.bindGetAccessorDeclarationToPullSymbol(decl); - break; - - case 524288 /* SetAccessor */: - this.bindSetAccessorDeclarationToPullSymbol(decl); - break; - - case 8388608 /* ObjectType */: - this.bindObjectTypeDeclarationToPullSymbol(decl); - break; - - case 16777216 /* FunctionType */: - this.bindFunctionTypeDeclarationToPullSymbol(decl); - break; - - case 33554432 /* ConstructorType */: - this.bindConstructorTypeDeclarationToPullSymbol(decl); - break; - - case 131072 /* FunctionExpression */: - this.bindFunctionExpressionToPullSymbol(decl); - break; - - case 128 /* TypeAlias */: - this.bindImportDeclaration(decl); - break; - - case 2048 /* Parameter */: - case 8192 /* TypeParameter */: - decl.getParentDecl().getSymbol(); - break; - - case 268435456 /* CatchBlock */: - case 134217728 /* WithBlock */: - break; - - default: - TypeScript.CompilerDiagnostics.assert(false, "Unrecognized type declaration"); - } - - TypeScript.Debug.assert(TypeScript.ArrayUtilities.last(this.declsBeingBound) === decl.declID); - this.declsBeingBound.pop(); - }; - return PullSymbolBinder; - })(); - TypeScript.PullSymbolBinder = PullSymbolBinder; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (PullHelpers) { - function diagnosticFromDecl(decl, diagnosticKey, _arguments, additionalLocations) { - if (typeof _arguments === "undefined") { _arguments = null; } - if (typeof additionalLocations === "undefined") { additionalLocations = null; } - var ast = decl.ast(); - return decl.semanticInfoChain.diagnosticFromAST(ast, diagnosticKey, _arguments, additionalLocations); - } - PullHelpers.diagnosticFromDecl = diagnosticFromDecl; - - function resolveDeclaredSymbolToUseType(symbol) { - if (symbol.isSignature()) { - if (!symbol.returnType) { - symbol._resolveDeclaredSymbol(); - } - } else if (!symbol.type) { - symbol._resolveDeclaredSymbol(); - } - } - PullHelpers.resolveDeclaredSymbolToUseType = resolveDeclaredSymbolToUseType; - - function getSignatureForFuncDecl(functionDecl) { - var funcDecl = functionDecl.ast(); - var funcSymbol = functionDecl.getSymbol(); - - if (!funcSymbol) { - funcSymbol = functionDecl.getSignatureSymbol(); - } - - var functionSignature = null; - var typeSymbolWithAllSignatures = null; - if (funcSymbol.isSignature()) { - functionSignature = funcSymbol; - var parent = functionDecl.getParentDecl(); - typeSymbolWithAllSignatures = parent.getSymbol().type; - } else { - functionSignature = functionDecl.getSignatureSymbol(); - typeSymbolWithAllSignatures = funcSymbol.type; - } - var signatures; - - if (funcDecl.kind() === 137 /* ConstructorDeclaration */ || functionDecl.kind === 2097152 /* ConstructSignature */) { - signatures = typeSymbolWithAllSignatures.getConstructSignatures(); - } else if (functionDecl.kind === 4194304 /* IndexSignature */) { - signatures = typeSymbolWithAllSignatures.getIndexSignatures(); - } else { - signatures = typeSymbolWithAllSignatures.getCallSignatures(); - } - - return { - signature: functionSignature, - allSignatures: signatures - }; - } - PullHelpers.getSignatureForFuncDecl = getSignatureForFuncDecl; - - function getAccessorSymbol(getterOrSetter, semanticInfoChain) { - var functionDecl = semanticInfoChain.getDeclForAST(getterOrSetter); - var getterOrSetterSymbol = functionDecl.getSymbol(); - - return getterOrSetterSymbol; - } - PullHelpers.getAccessorSymbol = getAccessorSymbol; - - function getGetterAndSetterFunction(funcDecl, semanticInfoChain) { - var accessorSymbol = PullHelpers.getAccessorSymbol(funcDecl, semanticInfoChain); - var result = { - getter: null, - setter: null - }; - var getter = accessorSymbol.getGetter(); - if (getter) { - var getterDecl = getter.getDeclarations()[0]; - result.getter = semanticInfoChain.getASTForDecl(getterDecl); - } - var setter = accessorSymbol.getSetter(); - if (setter) { - var setterDecl = setter.getDeclarations()[0]; - result.setter = semanticInfoChain.getASTForDecl(setterDecl); - } - - return result; - } - PullHelpers.getGetterAndSetterFunction = getGetterAndSetterFunction; - - function symbolIsEnum(source) { - return source && (source.kind & (64 /* Enum */ | 67108864 /* EnumMember */)) !== 0; - } - PullHelpers.symbolIsEnum = symbolIsEnum; - - function symbolIsModule(symbol) { - return symbol && (symbol.kind === 4 /* Container */ || isOneDeclarationOfKind(symbol, 4 /* Container */)); - } - PullHelpers.symbolIsModule = symbolIsModule; - - function isOneDeclarationOfKind(symbol, kind) { - var decls = symbol.getDeclarations(); - for (var i = 0; i < decls.length; i++) { - if (decls[i].kind === kind) { - return true; - } - } - - return false; - } - - function isNameNumeric(name) { - return isFinite(+name); - } - PullHelpers.isNameNumeric = isNameNumeric; - - function typeSymbolsAreIdentical(a, b) { - if (a.isTypeReference() && !a.getIsSpecialized()) { - a = a.referencedTypeSymbol; - } - - if (b.isTypeReference() && !b.getIsSpecialized()) { - b = b.referencedTypeSymbol; - } - - return a === b; - } - PullHelpers.typeSymbolsAreIdentical = typeSymbolsAreIdentical; - - function getRootType(type) { - var rootType = type.getRootSymbol(); - - while (true) { - if (type === rootType) { - return type; - } - - type = rootType; - rootType = type.getRootSymbol(); - } - } - PullHelpers.getRootType = getRootType; - - function isSymbolLocal(symbol) { - var container = symbol.getContainer(); - if (container) { - var containerKind = container.kind; - if (containerKind & (1032192 /* SomeFunction */ | 16777216 /* FunctionType */)) { - return true; - } - - if (containerKind === 33554432 /* ConstructorType */ && !symbol.anyDeclHasFlag(16 /* Static */ | 1 /* Exported */)) { - return true; - } - } - - return false; - } - PullHelpers.isSymbolLocal = isSymbolLocal; - - function isExportedSymbolInClodule(symbol) { - var container = symbol.getContainer(); - return container && container.kind === 33554432 /* ConstructorType */ && symbolIsModule(container) && symbol.anyDeclHasFlag(1 /* Exported */); - } - PullHelpers.isExportedSymbolInClodule = isExportedSymbolInClodule; - - function isSymbolDeclaredInScopeChain(symbol, scopeSymbol) { - TypeScript.Debug.assert(symbol); - var symbolDeclarationScope = symbol.getContainer(); - - while (scopeSymbol) { - if (scopeSymbol === symbolDeclarationScope) { - return true; - } - - scopeSymbol = scopeSymbol.getContainer(); - } - - if (scopeSymbol === null && symbolDeclarationScope === null) { - return true; - } - - return false; - } - PullHelpers.isSymbolDeclaredInScopeChain = isSymbolDeclaredInScopeChain; - - - - function walkSignatureSymbol(signatureSymbol, walker) { - var continueWalk = true; - var parameters = signatureSymbol.parameters; - if (parameters) { - for (var i = 0; continueWalk && i < parameters.length; i++) { - continueWalk = walker.signatureParameterWalk(parameters[i]); - } - } - - if (continueWalk) { - continueWalk = walker.signatureReturnTypeWalk(signatureSymbol.returnType); - } - - return continueWalk; - } - - function walkPullTypeSymbolStructure(typeSymbol, walker) { - var continueWalk = true; - - var members = typeSymbol.getMembers(); - for (var i = 0; continueWalk && i < members.length; i++) { - continueWalk = walker.memberSymbolWalk(members[i]); - } - - if (continueWalk) { - var callSigantures = typeSymbol.getCallSignatures(); - for (var i = 0; continueWalk && i < callSigantures.length; i++) { - continueWalk = walker.callSignatureWalk(callSigantures[i]); - if (continueWalk) { - continueWalk = walkSignatureSymbol(callSigantures[i], walker); - } - } - } - - if (continueWalk) { - var constructSignatures = typeSymbol.getConstructSignatures(); - for (var i = 0; continueWalk && i < constructSignatures.length; i++) { - continueWalk = walker.constructSignatureWalk(constructSignatures[i]); - if (continueWalk) { - continueWalk = walkSignatureSymbol(constructSignatures[i], walker); - } - } - } - - if (continueWalk) { - var indexSignatures = typeSymbol.getIndexSignatures(); - for (var i = 0; continueWalk && i < indexSignatures.length; i++) { - continueWalk = walker.indexSignatureWalk(indexSignatures[i]); - if (continueWalk) { - continueWalk = walkSignatureSymbol(indexSignatures[i], walker); - } - } - } - } - PullHelpers.walkPullTypeSymbolStructure = walkPullTypeSymbolStructure; - - var OtherPullDeclsWalker = (function () { - function OtherPullDeclsWalker() { - this.currentlyWalkingOtherDecls = []; - } - OtherPullDeclsWalker.prototype.walkOtherPullDecls = function (currentDecl, otherDecls, callBack) { - if (otherDecls) { - var isAlreadyWalkingOtherDecl = TypeScript.ArrayUtilities.any(this.currentlyWalkingOtherDecls, function (inWalkingOtherDecl) { - return TypeScript.ArrayUtilities.contains(otherDecls, inWalkingOtherDecl); - }); - - if (!isAlreadyWalkingOtherDecl) { - this.currentlyWalkingOtherDecls.push(currentDecl); - for (var i = 0; i < otherDecls.length; i++) { - if (otherDecls[i] !== currentDecl) { - callBack(otherDecls[i]); - } - } - var currentlyWalkingOtherDeclsDecl = this.currentlyWalkingOtherDecls.pop(); - TypeScript.Debug.assert(currentlyWalkingOtherDeclsDecl == currentDecl); - } - } - }; - return OtherPullDeclsWalker; - })(); - PullHelpers.OtherPullDeclsWalker = OtherPullDeclsWalker; - })(TypeScript.PullHelpers || (TypeScript.PullHelpers = {})); - var PullHelpers = TypeScript.PullHelpers; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var WrapsTypeParameterCache = (function () { - function WrapsTypeParameterCache() { - this._wrapsTypeParameterCache = TypeScript.BitVector.getBitVector(true); - } - WrapsTypeParameterCache.prototype.getWrapsTypeParameter = function (typeParameterArgumentMap) { - var mapHasTypeParameterNotCached = false; - for (var typeParameterID in typeParameterArgumentMap) { - if (typeParameterArgumentMap.hasOwnProperty(typeParameterID)) { - var cachedValue = this._wrapsTypeParameterCache.valueAt(typeParameterID); - if (cachedValue) { - return typeParameterID; - } - mapHasTypeParameterNotCached = mapHasTypeParameterNotCached || cachedValue === undefined; - } - } - - if (!mapHasTypeParameterNotCached) { - return 0; - } - - return undefined; - }; - - WrapsTypeParameterCache.prototype.setWrapsTypeParameter = function (typeParameterArgumentMap, wrappingTypeParameterID) { - if (wrappingTypeParameterID) { - this._wrapsTypeParameterCache.setValueAt(wrappingTypeParameterID, true); - } else { - for (var typeParameterID in typeParameterArgumentMap) { - if (typeParameterArgumentMap.hasOwnProperty(typeParameterID)) { - this._wrapsTypeParameterCache.setValueAt(typeParameterID, false); - } - } - } - }; - return WrapsTypeParameterCache; - })(); - TypeScript.WrapsTypeParameterCache = WrapsTypeParameterCache; - - (function (PullInstantiationHelpers) { - var MutableTypeArgumentMap = (function () { - function MutableTypeArgumentMap(typeParameterArgumentMap) { - this.typeParameterArgumentMap = typeParameterArgumentMap; - this.createdDuplicateTypeArgumentMap = false; - } - MutableTypeArgumentMap.prototype.ensureTypeArgumentCopy = function () { - if (!this.createdDuplicateTypeArgumentMap) { - var passedInTypeArgumentMap = this.typeParameterArgumentMap; - this.typeParameterArgumentMap = []; - for (var typeParameterID in passedInTypeArgumentMap) { - if (passedInTypeArgumentMap.hasOwnProperty(typeParameterID)) { - this.typeParameterArgumentMap[typeParameterID] = passedInTypeArgumentMap[typeParameterID]; - } - } - this.createdDuplicateTypeArgumentMap = true; - } - }; - return MutableTypeArgumentMap; - })(); - PullInstantiationHelpers.MutableTypeArgumentMap = MutableTypeArgumentMap; - - function instantiateTypeArgument(resolver, symbol, mutableTypeParameterMap) { - if (symbol.getIsSpecialized()) { - var rootTypeArgumentMap = symbol.getTypeParameterArgumentMap(); - var newTypeArgumentMap = []; - var allowedTypeParameters = symbol.getAllowedToReferenceTypeParameters(); - for (var i = 0; i < allowedTypeParameters.length; i++) { - var typeParameterID = allowedTypeParameters[i].pullSymbolID; - var typeArg = rootTypeArgumentMap[typeParameterID]; - if (typeArg) { - newTypeArgumentMap[typeParameterID] = resolver.instantiateType(typeArg, mutableTypeParameterMap.typeParameterArgumentMap); - } - } - - for (var i = 0; i < allowedTypeParameters.length; i++) { - var typeParameterID = allowedTypeParameters[i].pullSymbolID; - if (newTypeArgumentMap[typeParameterID] && mutableTypeParameterMap.typeParameterArgumentMap[typeParameterID] != newTypeArgumentMap[typeParameterID]) { - mutableTypeParameterMap.ensureTypeArgumentCopy(); - mutableTypeParameterMap.typeParameterArgumentMap[typeParameterID] = newTypeArgumentMap[typeParameterID]; - } - } - } - } - PullInstantiationHelpers.instantiateTypeArgument = instantiateTypeArgument; - - function cleanUpTypeArgumentMap(symbol, mutableTypeArgumentMap) { - var allowedToReferenceTypeParameters = symbol.getAllowedToReferenceTypeParameters(); - for (var typeParameterID in mutableTypeArgumentMap.typeParameterArgumentMap) { - if (mutableTypeArgumentMap.typeParameterArgumentMap.hasOwnProperty(typeParameterID)) { - if (!TypeScript.ArrayUtilities.any(allowedToReferenceTypeParameters, function (typeParameter) { - return typeParameter.pullSymbolID == typeParameterID; - })) { - mutableTypeArgumentMap.ensureTypeArgumentCopy(); - delete mutableTypeArgumentMap.typeParameterArgumentMap[typeParameterID]; - } - } - } - } - PullInstantiationHelpers.cleanUpTypeArgumentMap = cleanUpTypeArgumentMap; - - function getAllowedToReferenceTypeParametersFromDecl(decl) { - var allowedToReferenceTypeParameters = []; - - var allowedToUseDeclTypeParameters = false; - var getTypeParametersFromParentDecl = false; - - switch (decl.kind) { - case 65536 /* Method */: - if (TypeScript.hasFlag(decl.flags, 16 /* Static */)) { - allowedToUseDeclTypeParameters = true; - break; - } - - case 16777216 /* FunctionType */: - case 33554432 /* ConstructorType */: - case 2097152 /* ConstructSignature */: - case 1048576 /* CallSignature */: - case 131072 /* FunctionExpression */: - case 16384 /* Function */: - allowedToUseDeclTypeParameters = true; - getTypeParametersFromParentDecl = true; - break; - - case 4096 /* Property */: - if (TypeScript.hasFlag(decl.flags, 16 /* Static */)) { - break; - } - - case 2048 /* Parameter */: - case 262144 /* GetAccessor */: - case 524288 /* SetAccessor */: - case 32768 /* ConstructorMethod */: - case 4194304 /* IndexSignature */: - case 8388608 /* ObjectType */: - case 256 /* ObjectLiteral */: - case 8192 /* TypeParameter */: - getTypeParametersFromParentDecl = true; - break; - - case 8 /* Class */: - case 16 /* Interface */: - allowedToUseDeclTypeParameters = true; - break; - } - - if (getTypeParametersFromParentDecl) { - allowedToReferenceTypeParameters = allowedToReferenceTypeParameters.concat(getAllowedToReferenceTypeParametersFromDecl(decl.getParentDecl())); - } - - if (allowedToUseDeclTypeParameters) { - var typeParameterDecls = decl.getTypeParameters(); - for (var i = 0; i < typeParameterDecls.length; i++) { - allowedToReferenceTypeParameters.push(typeParameterDecls[i].getSymbol()); - } - } - - return allowedToReferenceTypeParameters; - } - PullInstantiationHelpers.getAllowedToReferenceTypeParametersFromDecl = getAllowedToReferenceTypeParametersFromDecl; - - function createTypeParameterArgumentMap(typeParameters, typeArguments) { - return updateTypeParameterArgumentMap(typeParameters, typeArguments, {}); - } - PullInstantiationHelpers.createTypeParameterArgumentMap = createTypeParameterArgumentMap; - - function updateTypeParameterArgumentMap(typeParameters, typeArguments, typeParameterArgumentMap) { - for (var i = 0; i < typeParameters.length; i++) { - typeParameterArgumentMap[typeParameters[i].getRootSymbol().pullSymbolID] = typeArguments[i]; - } - return typeParameterArgumentMap; - } - PullInstantiationHelpers.updateTypeParameterArgumentMap = updateTypeParameterArgumentMap; - - function updateMutableTypeParameterArgumentMap(typeParameters, typeArguments, mutableMap) { - for (var i = 0; i < typeParameters.length; i++) { - var typeParameterId = typeParameters[i].getRootSymbol().pullSymbolID; - if (mutableMap.typeParameterArgumentMap[typeParameterId] !== typeArguments[i]) { - mutableMap.ensureTypeArgumentCopy(); - mutableMap.typeParameterArgumentMap[typeParameterId] = typeArguments[i]; - } - } - } - PullInstantiationHelpers.updateMutableTypeParameterArgumentMap = updateMutableTypeParameterArgumentMap; - - function twoTypesAreInstantiationsOfSameNamedGenericType(type1, type2) { - var type1IsGeneric = type1.isGeneric() && type1.getTypeArguments() !== null; - var type2IsGeneric = type2.isGeneric() && type2.getTypeArguments() !== null; - - if (type1IsGeneric && type2IsGeneric) { - var type1Root = TypeScript.PullHelpers.getRootType(type1); - var type2Root = TypeScript.PullHelpers.getRootType(type2); - return type1Root === type2Root; - } - - return false; - } - PullInstantiationHelpers.twoTypesAreInstantiationsOfSameNamedGenericType = twoTypesAreInstantiationsOfSameNamedGenericType; - })(TypeScript.PullInstantiationHelpers || (TypeScript.PullInstantiationHelpers = {})); - var PullInstantiationHelpers = TypeScript.PullInstantiationHelpers; -})(TypeScript || (TypeScript = {})); -if (Error) - Error.stackTraceLimit = 1000; - -var TypeScript; -(function (TypeScript) { - TypeScript.fileResolutionTime = 0; - TypeScript.fileResolutionIOTime = 0; - TypeScript.fileResolutionScanImportsTime = 0; - TypeScript.fileResolutionImportFileSearchTime = 0; - TypeScript.fileResolutionGetDefaultLibraryTime = 0; - TypeScript.sourceCharactersCompiled = 0; - TypeScript.syntaxTreeParseTime = 0; - TypeScript.syntaxDiagnosticsTime = 0; - TypeScript.astTranslationTime = 0; - TypeScript.typeCheckTime = 0; - - TypeScript.compilerResolvePathTime = 0; - TypeScript.compilerDirectoryNameTime = 0; - TypeScript.compilerDirectoryExistsTime = 0; - TypeScript.compilerFileExistsTime = 0; - - TypeScript.emitTime = 0; - TypeScript.emitWriteFileTime = 0; - - TypeScript.declarationEmitTime = 0; - TypeScript.declarationEmitIsExternallyVisibleTime = 0; - TypeScript.declarationEmitTypeSignatureTime = 0; - TypeScript.declarationEmitGetBoundDeclTypeTime = 0; - TypeScript.declarationEmitIsOverloadedCallSignatureTime = 0; - TypeScript.declarationEmitFunctionDeclarationGetSymbolTime = 0; - TypeScript.declarationEmitGetBaseTypeTime = 0; - TypeScript.declarationEmitGetAccessorFunctionTime = 0; - TypeScript.declarationEmitGetTypeParameterSymbolTime = 0; - TypeScript.declarationEmitGetImportDeclarationSymbolTime = 0; - - TypeScript.ioHostResolvePathTime = 0; - TypeScript.ioHostDirectoryNameTime = 0; - TypeScript.ioHostCreateDirectoryStructureTime = 0; - TypeScript.ioHostWriteFileTime = 0; - - (function (EmitOutputResult) { - EmitOutputResult[EmitOutputResult["Succeeded"] = 0] = "Succeeded"; - EmitOutputResult[EmitOutputResult["FailedBecauseOfSyntaxErrors"] = 1] = "FailedBecauseOfSyntaxErrors"; - EmitOutputResult[EmitOutputResult["FailedBecauseOfCompilerOptionsErrors"] = 2] = "FailedBecauseOfCompilerOptionsErrors"; - EmitOutputResult[EmitOutputResult["FailedToGenerateDeclarationsBecauseOfSemanticErrors"] = 3] = "FailedToGenerateDeclarationsBecauseOfSemanticErrors"; - })(TypeScript.EmitOutputResult || (TypeScript.EmitOutputResult = {})); - var EmitOutputResult = TypeScript.EmitOutputResult; - - var EmitOutput = (function () { - function EmitOutput(emitOutputResult) { - if (typeof emitOutputResult === "undefined") { emitOutputResult = 0 /* Succeeded */; } - this.outputFiles = []; - this.emitOutputResult = emitOutputResult; - } - return EmitOutput; - })(); - TypeScript.EmitOutput = EmitOutput; - - (function (OutputFileType) { - OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; - OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; - OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; - })(TypeScript.OutputFileType || (TypeScript.OutputFileType = {})); - var OutputFileType = TypeScript.OutputFileType; - - var OutputFile = (function () { - function OutputFile(name, writeByteOrderMark, text, fileType, sourceMapEntries) { - if (typeof sourceMapEntries === "undefined") { sourceMapEntries = []; } - this.name = name; - this.writeByteOrderMark = writeByteOrderMark; - this.text = text; - this.fileType = fileType; - this.sourceMapEntries = sourceMapEntries; - } - return OutputFile; - })(); - TypeScript.OutputFile = OutputFile; - - var CompileResult = (function () { - function CompileResult() { - this.diagnostics = []; - this.outputFiles = []; - } - CompileResult.fromDiagnostics = function (diagnostics) { - var result = new CompileResult(); - result.diagnostics = diagnostics; - return result; - }; - - CompileResult.fromOutputFiles = function (outputFiles) { - var result = new CompileResult(); - result.outputFiles = outputFiles; - return result; - }; - return CompileResult; - })(); - TypeScript.CompileResult = CompileResult; - - var TypeScriptCompiler = (function () { - function TypeScriptCompiler(logger, _settings) { - if (typeof logger === "undefined") { logger = new TypeScript.NullLogger(); } - if (typeof _settings === "undefined") { _settings = TypeScript.ImmutableCompilationSettings.defaultSettings(); } - this.logger = logger; - this._settings = _settings; - this.semanticInfoChain = null; - this.semanticInfoChain = new TypeScript.SemanticInfoChain(this, logger); - } - TypeScriptCompiler.prototype.compilationSettings = function () { - return this._settings; - }; - - TypeScriptCompiler.prototype.setCompilationSettings = function (newSettings) { - var oldSettings = this._settings; - this._settings = newSettings; - - if (!compareDataObjects(oldSettings, newSettings)) { - this.semanticInfoChain.invalidate(oldSettings, newSettings); - } - }; - - TypeScriptCompiler.prototype.getDocument = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - return this.semanticInfoChain.getDocument(fileName); - }; - - TypeScriptCompiler.prototype.cleanupSemanticCache = function () { - this.semanticInfoChain.invalidate(); - }; - - TypeScriptCompiler.prototype.addFile = function (fileName, scriptSnapshot, byteOrderMark, version, isOpen, referencedFiles) { - if (typeof referencedFiles === "undefined") { referencedFiles = []; } - fileName = TypeScript.switchToForwardSlashes(fileName); - - TypeScript.sourceCharactersCompiled += scriptSnapshot.getLength(); - - var document = TypeScript.Document.create(this, this.semanticInfoChain, fileName, scriptSnapshot, byteOrderMark, version, isOpen, referencedFiles); - - this.semanticInfoChain.addDocument(document); - }; - - TypeScriptCompiler.prototype.updateFile = function (fileName, scriptSnapshot, version, isOpen, textChangeRange) { - fileName = TypeScript.switchToForwardSlashes(fileName); - - var document = this.getDocument(fileName); - var updatedDocument = document.update(scriptSnapshot, version, isOpen, textChangeRange); - - this.semanticInfoChain.addDocument(updatedDocument); - }; - - TypeScriptCompiler.prototype.removeFile = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - this.semanticInfoChain.removeDocument(fileName); - }; - - TypeScriptCompiler.prototype.mapOutputFileName = function (document, emitOptions, extensionChanger) { - if (document.emitToOwnOutputFile()) { - var updatedFileName = document.fileName; - if (emitOptions.outputDirectory() !== "") { - updatedFileName = document.fileName.replace(emitOptions.commonDirectoryPath(), ""); - updatedFileName = emitOptions.outputDirectory() + updatedFileName; - } - return extensionChanger(updatedFileName, false); - } else { - return extensionChanger(emitOptions.sharedOutputFile(), true); - } - }; - - TypeScriptCompiler.prototype.writeByteOrderMarkForDocument = function (document) { - var printReason = false; - - if (document.emitToOwnOutputFile()) { - var result = document.byteOrderMark !== 0 /* None */; - if (printReason) { - TypeScript.Environment.standardOut.WriteLine("Emitting byte order mark because of: " + document.fileName); - } - return result; - } else { - var fileNames = this.fileNames(); - - var result = false; - for (var i = 0, n = fileNames.length; i < n; i++) { - var document = this.getDocument(fileNames[i]); - - if (document.isExternalModule()) { - continue; - } - - if (document.byteOrderMark !== 0 /* None */) { - if (printReason) { - TypeScript.Environment.standardOut.WriteLine("Emitting byte order mark because of: " + document.fileName); - result = true; - } else { - return true; - } - } - } - - return result; - } - }; - - TypeScriptCompiler.mapToDTSFileName = function (fileName, wholeFileNameReplaced) { - return TypeScript.getDeclareFilePath(fileName); - }; - - TypeScriptCompiler.prototype._shouldEmit = function (document) { - return !document.isDeclareFile(); - }; - - TypeScriptCompiler.prototype._shouldEmitDeclarations = function (document) { - if (!this.compilationSettings().generateDeclarationFiles()) { - return false; - } - - return this._shouldEmit(document); - }; - - TypeScriptCompiler.prototype.emitDocumentDeclarationsWorker = function (document, emitOptions, declarationEmitter) { - var sourceUnit = document.sourceUnit(); - TypeScript.Debug.assert(this._shouldEmitDeclarations(document)); - - if (declarationEmitter) { - declarationEmitter.document = document; - } else { - var declareFileName = this.mapOutputFileName(document, emitOptions, TypeScriptCompiler.mapToDTSFileName); - declarationEmitter = new TypeScript.DeclarationEmitter(declareFileName, document, this, emitOptions, this.semanticInfoChain); - } - - declarationEmitter.emitDeclarations(sourceUnit); - return declarationEmitter; - }; - - TypeScriptCompiler.prototype._emitDocumentDeclarations = function (document, emitOptions, onSingleFileEmitComplete, sharedEmitter) { - if (this._shouldEmitDeclarations(document)) { - if (document.emitToOwnOutputFile()) { - var singleEmitter = this.emitDocumentDeclarationsWorker(document, emitOptions); - if (singleEmitter) { - onSingleFileEmitComplete(singleEmitter.getOutputFile()); - } - } else { - sharedEmitter = this.emitDocumentDeclarationsWorker(document, emitOptions, sharedEmitter); - } - } - - return sharedEmitter; - }; - - TypeScriptCompiler.prototype.emitAllDeclarations = function (resolvePath) { - var start = new Date().getTime(); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var sharedEmitter = null; - var fileNames = this.fileNames(); - - for (var i = 0, n = fileNames.length; i < n; i++) { - var fileName = fileNames[i]; - - var document = this.getDocument(fileNames[i]); - - sharedEmitter = this._emitDocumentDeclarations(document, emitOptions, function (file) { - return emitOutput.outputFiles.push(file); - }, sharedEmitter); - } - - if (sharedEmitter) { - emitOutput.outputFiles.push(sharedEmitter.getOutputFile()); - } - - TypeScript.declarationEmitTime += new Date().getTime() - start; - - return emitOutput; - }; - - TypeScriptCompiler.prototype.emitDeclarations = function (fileName, resolvePath) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var document = this.getDocument(fileName); - - if (document.emitToOwnOutputFile()) { - this._emitDocumentDeclarations(document, emitOptions, function (file) { - return emitOutput.outputFiles.push(file); - }, null); - return emitOutput; - } else { - return this.emitAllDeclarations(resolvePath); - } - }; - - TypeScriptCompiler.prototype.canEmitDeclarations = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var document = this.getDocument(fileName); - return this._shouldEmitDeclarations(document); - }; - - TypeScriptCompiler.mapToFileNameExtension = function (extension, fileName, wholeFileNameReplaced) { - if (wholeFileNameReplaced) { - return fileName; - } else { - var splitFname = fileName.split("."); - splitFname.pop(); - return splitFname.join(".") + extension; - } - }; - - TypeScriptCompiler.mapToJSFileName = function (fileName, wholeFileNameReplaced) { - return TypeScriptCompiler.mapToFileNameExtension(".js", fileName, wholeFileNameReplaced); - }; - - TypeScriptCompiler.prototype.emitDocumentWorker = function (document, emitOptions, emitter) { - var sourceUnit = document.sourceUnit(); - TypeScript.Debug.assert(this._shouldEmit(document)); - - var typeScriptFileName = document.fileName; - if (!emitter) { - var javaScriptFileName = this.mapOutputFileName(document, emitOptions, TypeScriptCompiler.mapToJSFileName); - var outFile = new TypeScript.TextWriter(javaScriptFileName, this.writeByteOrderMarkForDocument(document), 0 /* JavaScript */); - - emitter = new TypeScript.Emitter(javaScriptFileName, outFile, emitOptions, this.semanticInfoChain); - - if (this.compilationSettings().mapSourceFiles()) { - var sourceMapFile = new TypeScript.TextWriter(javaScriptFileName + TypeScript.SourceMapper.MapFileExtension, false, 1 /* SourceMap */); - emitter.createSourceMapper(document, javaScriptFileName, outFile, sourceMapFile, emitOptions.resolvePath); - } - } else if (this.compilationSettings().mapSourceFiles()) { - emitter.setSourceMapperNewSourceFile(document); - } - - emitter.setDocument(document); - emitter.emitJavascript(sourceUnit, false); - - return emitter; - }; - - TypeScriptCompiler.prototype._emitDocument = function (document, emitOptions, onSingleFileEmitComplete, sharedEmitter) { - if (this._shouldEmit(document)) { - if (document.emitToOwnOutputFile()) { - var singleEmitter = this.emitDocumentWorker(document, emitOptions); - if (singleEmitter) { - onSingleFileEmitComplete(singleEmitter.getOutputFiles()); - } - } else { - sharedEmitter = this.emitDocumentWorker(document, emitOptions, sharedEmitter); - } - } - - return sharedEmitter; - }; - - TypeScriptCompiler.prototype.emitAll = function (resolvePath) { - var start = new Date().getTime(); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var fileNames = this.fileNames(); - var sharedEmitter = null; - - for (var i = 0, n = fileNames.length; i < n; i++) { - var fileName = fileNames[i]; - - var document = this.getDocument(fileName); - - sharedEmitter = this._emitDocument(document, emitOptions, function (files) { - return emitOutput.outputFiles.push.apply(emitOutput.outputFiles, files); - }, sharedEmitter); - } - - if (sharedEmitter) { - emitOutput.outputFiles.push.apply(emitOutput.outputFiles, sharedEmitter.getOutputFiles()); - } - - TypeScript.emitTime += new Date().getTime() - start; - return emitOutput; - }; - - TypeScriptCompiler.prototype.emit = function (fileName, resolvePath) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var emitOutput = new EmitOutput(); - - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - if (emitOptions.diagnostic()) { - emitOutput.emitOutputResult = 2 /* FailedBecauseOfCompilerOptionsErrors */; - return emitOutput; - } - - var document = this.getDocument(fileName); - - if (document.emitToOwnOutputFile()) { - this._emitDocument(document, emitOptions, function (files) { - return emitOutput.outputFiles.push.apply(emitOutput.outputFiles, files); - }, null); - return emitOutput; - } else { - return this.emitAll(resolvePath); - } - }; - - TypeScriptCompiler.prototype.compile = function (resolvePath, continueOnDiagnostics) { - if (typeof continueOnDiagnostics === "undefined") { continueOnDiagnostics = false; } - return new CompilerIterator(this, resolvePath, continueOnDiagnostics); - }; - - TypeScriptCompiler.prototype.getSyntacticDiagnostics = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - return this.getDocument(fileName).diagnostics(); - }; - - TypeScriptCompiler.prototype.getSyntaxTree = function (fileName) { - return this.getDocument(fileName).syntaxTree(); - }; - - TypeScriptCompiler.prototype.getSourceUnit = function (fileName) { - return this.getDocument(fileName).sourceUnit(); - }; - - TypeScriptCompiler.prototype.getSemanticDiagnostics = function (fileName) { - fileName = TypeScript.switchToForwardSlashes(fileName); - - var document = this.getDocument(fileName); - - var startTime = (new Date()).getTime(); - TypeScript.PullTypeResolver.typeCheck(this.compilationSettings(), this.semanticInfoChain, document); - var endTime = (new Date()).getTime(); - - TypeScript.typeCheckTime += endTime - startTime; - - var errors = this.semanticInfoChain.getDiagnostics(fileName); - - errors = TypeScript.ArrayUtilities.distinct(errors, TypeScript.Diagnostic.equals); - errors.sort(function (d1, d2) { - if (d1.fileName() < d2.fileName()) { - return -1; - } else if (d1.fileName() > d2.fileName()) { - return 1; - } - - if (d1.start() < d2.start()) { - return -1; - } else if (d1.start() > d2.start()) { - return 1; - } - - var code1 = TypeScript.diagnosticInformationMap[d1.diagnosticKey()].code; - var code2 = TypeScript.diagnosticInformationMap[d2.diagnosticKey()].code; - if (code1 < code2) { - return -1; - } else if (code1 > code2) { - return 1; - } - - return 0; - }); - - return errors; - }; - - TypeScriptCompiler.prototype.getCompilerOptionsDiagnostics = function (resolvePath) { - var emitOptions = new TypeScript.EmitOptions(this, resolvePath); - var emitDiagnostic = emitOptions.diagnostic(); - if (emitDiagnostic) { - return [emitDiagnostic]; - } - return TypeScript.sentinelEmptyArray; - }; - - TypeScriptCompiler.prototype.resolveAllFiles = function () { - var fileNames = this.fileNames(); - for (var i = 0, n = fileNames.length; i < n; i++) { - this.getSemanticDiagnostics(fileNames[i]); - } - }; - - TypeScriptCompiler.prototype.getSymbolOfDeclaration = function (decl) { - if (!decl) { - return null; - } - - var resolver = this.semanticInfoChain.getResolver(); - var ast = this.semanticInfoChain.getASTForDecl(decl); - if (!ast) { - return null; - } - - var enclosingDecl = resolver.getEnclosingDecl(decl); - if (ast.kind() === 139 /* GetAccessor */ || ast.kind() === 140 /* SetAccessor */) { - return this.getSymbolOfDeclaration(enclosingDecl); - } - - return resolver.resolveAST(ast, false, new TypeScript.PullTypeResolutionContext(resolver)); - }; - - TypeScriptCompiler.prototype.extractResolutionContextFromAST = function (resolver, ast, document, propagateContextualTypes) { - var scriptName = document.fileName; - - var enclosingDecl = null; - var enclosingDeclAST = null; - var inContextuallyTypedAssignment = false; - var inWithBlock = false; - - var resolutionContext = new TypeScript.PullTypeResolutionContext(resolver); - - if (!ast) { - return null; - } - - var path = this.getASTPath(ast); - - for (var i = 0, n = path.length; i < n; i++) { - var current = path[i]; - - switch (current.kind()) { - case 222 /* FunctionExpression */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - if (propagateContextualTypes) { - resolver.resolveAST(current, true, resolutionContext); - } - break; - - case 136 /* MemberVariableDeclaration */: - var memberVariable = current; - inContextuallyTypedAssignment = memberVariable.variableDeclarator.typeAnnotation !== null; - - this.extractResolutionContextForVariable(inContextuallyTypedAssignment, propagateContextualTypes, resolver, resolutionContext, enclosingDecl, memberVariable, memberVariable.variableDeclarator.equalsValueClause); - break; - - case 225 /* VariableDeclarator */: - var variableDeclarator = current; - inContextuallyTypedAssignment = variableDeclarator.typeAnnotation !== null; - - this.extractResolutionContextForVariable(inContextuallyTypedAssignment, propagateContextualTypes, resolver, resolutionContext, enclosingDecl, variableDeclarator, variableDeclarator.equalsValueClause); - break; - - case 213 /* InvocationExpression */: - case 216 /* ObjectCreationExpression */: - if (propagateContextualTypes) { - var isNew = current.kind() === 216 /* ObjectCreationExpression */; - var callExpression = current; - var contextualType = null; - - if ((i + 2 < n) && callExpression.argumentList === path[i + 1] && callExpression.argumentList.arguments === path[i + 2]) { - var callResolutionResults = new TypeScript.PullAdditionalCallResolutionData(); - if (isNew) { - resolver.resolveObjectCreationExpression(callExpression, resolutionContext, callResolutionResults); - } else { - resolver.resolveInvocationExpression(callExpression, resolutionContext, callResolutionResults); - } - - if (callResolutionResults.actualParametersContextTypeSymbols) { - var argExpression = path[i + 3]; - if (argExpression) { - for (var j = 0, m = callExpression.argumentList.arguments.nonSeparatorCount(); j < m; j++) { - if (callExpression.argumentList.arguments.nonSeparatorAt(j) === argExpression) { - var callContextualType = callResolutionResults.actualParametersContextTypeSymbols[j]; - if (callContextualType) { - contextualType = callContextualType; - break; - } - } - } - } - } - } else { - if (isNew) { - resolver.resolveObjectCreationExpression(callExpression, resolutionContext); - } else { - resolver.resolveInvocationExpression(callExpression, resolutionContext); - } - } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 214 /* ArrayLiteralExpression */: - if (propagateContextualTypes) { - var contextualType = null; - var currentContextualType = resolutionContext.getContextualType(); - if (currentContextualType && currentContextualType.isArrayNamedTypeReference()) { - contextualType = currentContextualType.getElementType(); - } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 215 /* ObjectLiteralExpression */: - if (propagateContextualTypes) { - var objectLiteralExpression = current; - var objectLiteralResolutionContext = new TypeScript.PullAdditionalObjectLiteralResolutionData(); - resolver.resolveObjectLiteralExpression(objectLiteralExpression, inContextuallyTypedAssignment, resolutionContext, objectLiteralResolutionContext); - - var memeberAST = (path[i + 1] && path[i + 1].kind() === 2 /* SeparatedList */) ? path[i + 2] : path[i + 1]; - if (memeberAST) { - var contextualType = null; - var memberDecls = objectLiteralExpression.propertyAssignments; - if (memberDecls && objectLiteralResolutionContext.membersContextTypeSymbols) { - for (var j = 0, m = memberDecls.nonSeparatorCount(); j < m; j++) { - if (memberDecls.nonSeparatorAt(j) === memeberAST) { - var memberContextualType = objectLiteralResolutionContext.membersContextTypeSymbols[j]; - if (memberContextualType) { - contextualType = memberContextualType; - break; - } - } - } - } - - resolutionContext.pushNewContextualType(contextualType); - } - } - - break; - - case 174 /* AssignmentExpression */: - if (propagateContextualTypes) { - var assignmentExpression = current; - var contextualType = null; - - if (path[i + 1] && path[i + 1] === assignmentExpression.right) { - var leftType = resolver.resolveAST(assignmentExpression.left, inContextuallyTypedAssignment, resolutionContext).type; - if (leftType) { - inContextuallyTypedAssignment = true; - contextualType = leftType; - } - } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 220 /* CastExpression */: - var castExpression = current; - if (!(i + 1 < n && path[i + 1] === castExpression.type)) { - if (propagateContextualTypes) { - var contextualType = null; - var typeSymbol = resolver.resolveAST(castExpression, inContextuallyTypedAssignment, resolutionContext).type; - - if (typeSymbol) { - inContextuallyTypedAssignment = true; - contextualType = typeSymbol; - } - - resolutionContext.pushNewContextualType(contextualType); - } - } - - break; - - case 150 /* ReturnStatement */: - if (propagateContextualTypes) { - var returnStatement = current; - var contextualType = null; - - if (enclosingDecl && (enclosingDecl.kind & 1032192 /* SomeFunction */)) { - var typeAnnotation = TypeScript.ASTHelpers.getType(enclosingDeclAST); - if (typeAnnotation) { - var returnTypeSymbol = resolver.resolveTypeReference(typeAnnotation, resolutionContext); - if (returnTypeSymbol) { - inContextuallyTypedAssignment = true; - contextualType = returnTypeSymbol; - } - } else { - var currentContextualType = resolutionContext.getContextualType(); - if (currentContextualType && currentContextualType.isFunction()) { - var contextualSignatures = currentContextualType.kind == 33554432 /* ConstructorType */ ? currentContextualType.getConstructSignatures() : currentContextualType.getCallSignatures(); - var currentContextualTypeSignatureSymbol = contextualSignatures[0]; - var currentContextualTypeReturnTypeSymbol = currentContextualTypeSignatureSymbol.returnType; - if (currentContextualTypeReturnTypeSymbol) { - inContextuallyTypedAssignment = true; - contextualType = currentContextualTypeReturnTypeSymbol; - } - } - } - } - - resolutionContext.pushNewContextualType(contextualType); - } - - break; - - case 122 /* ObjectType */: - if (propagateContextualTypes && TypeScript.isTypesOnlyLocation(current)) { - resolver.resolveAST(current, false, resolutionContext); - } - - break; - - case 163 /* WithStatement */: - inWithBlock = true; - break; - - case 146 /* Block */: - inContextuallyTypedAssignment = false; - break; - } - - var decl = this.semanticInfoChain.getDeclForAST(current); - if (decl) { - enclosingDecl = decl; - enclosingDeclAST = current; - } - } - - if (ast && ast.parent && ast.kind() === 11 /* IdentifierName */) { - if (ast.parent.kind() === 212 /* MemberAccessExpression */) { - if (ast.parent.name === ast) { - ast = ast.parent; - } - } else if (ast.parent.kind() === 121 /* QualifiedName */) { - if (ast.parent.right === ast) { - ast = ast.parent; - } - } - } - - return { - ast: ast, - enclosingDecl: enclosingDecl, - resolutionContext: resolutionContext, - inContextuallyTypedAssignment: inContextuallyTypedAssignment, - inWithBlock: inWithBlock - }; - }; - - TypeScriptCompiler.prototype.extractResolutionContextForVariable = function (inContextuallyTypedAssignment, propagateContextualTypes, resolver, resolutionContext, enclosingDecl, assigningAST, init) { - if (inContextuallyTypedAssignment) { - if (propagateContextualTypes) { - resolver.resolveAST(assigningAST, false, resolutionContext); - var varSymbol = this.semanticInfoChain.getSymbolForAST(assigningAST); - - var contextualType = null; - if (varSymbol && inContextuallyTypedAssignment) { - contextualType = varSymbol.type; - } - - resolutionContext.pushNewContextualType(contextualType); - - if (init) { - resolver.resolveAST(init, inContextuallyTypedAssignment, resolutionContext); - } - } - } - }; - - TypeScriptCompiler.prototype.getASTPath = function (ast) { - var result = []; - - while (ast) { - result.unshift(ast); - ast = ast.parent; - } - - return result; - }; - - TypeScriptCompiler.prototype.pullGetSymbolInformationFromAST = function (ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; - } - - ast = context.ast; - var symbol = resolver.resolveAST(ast, context.inContextuallyTypedAssignment, context.resolutionContext); - - if (!symbol) { - TypeScript.Debug.assert(ast.kind() === 120 /* SourceUnit */, "No symbol was found for ast and ast was not source unit. Ast Kind: " + TypeScript.SyntaxKind[ast.kind()]); - return null; - } - - if (symbol.isTypeReference()) { - symbol = symbol.getReferencedTypeSymbol(); - } - - var aliasSymbol = this.semanticInfoChain.getAliasSymbolForAST(ast); - - return { - symbol: symbol, - aliasSymbol: aliasSymbol, - ast: ast, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.pullGetCallInformationFromAST = function (ast, document) { - if (ast.kind() !== 213 /* InvocationExpression */ && ast.kind() !== 216 /* ObjectCreationExpression */) { - return null; - } - - var isNew = ast.kind() === 216 /* ObjectCreationExpression */; - - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; - } - - var callResolutionResults = new TypeScript.PullAdditionalCallResolutionData(); - - if (isNew) { - resolver.resolveObjectCreationExpression(ast, context.resolutionContext, callResolutionResults); - } else { - resolver.resolveInvocationExpression(ast, context.resolutionContext, callResolutionResults); - } - - return { - targetSymbol: callResolutionResults.targetSymbol, - resolvedSignatures: callResolutionResults.resolvedSignatures, - candidateSignature: callResolutionResults.candidateSignature, - ast: ast, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl), - isConstructorCall: isNew - }; - }; - - TypeScriptCompiler.prototype.pullGetVisibleMemberSymbolsFromAST = function (ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; - } - - var symbols = resolver.getVisibleMembersFromExpression(ast, context.enclosingDecl, context.resolutionContext); - if (!symbols) { - return null; - } - - return { - symbols: symbols, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.pullGetVisibleDeclsFromAST = function (ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, false); - if (!context || context.inWithBlock) { - return null; - } - - return resolver.getVisibleDecls(context.enclosingDecl); - }; - - TypeScriptCompiler.prototype.pullGetContextualMembersFromAST = function (ast, document) { - if (ast.kind() !== 215 /* ObjectLiteralExpression */) { - return null; - } - - var resolver = this.semanticInfoChain.getResolver(); - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; - } - - var members = resolver.getVisibleContextSymbols(context.enclosingDecl, context.resolutionContext); - - return { - symbols: members, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.pullGetDeclInformation = function (decl, ast, document) { - var resolver = this.semanticInfoChain.getResolver(); - - var context = this.extractResolutionContextFromAST(resolver, ast, document, true); - if (!context || context.inWithBlock) { - return null; - } - - var astForDecl = decl.ast(); - if (!astForDecl) { - return null; - } - - var astForDeclContext = this.extractResolutionContextFromAST(resolver, astForDecl, this.getDocument(astForDecl.fileName()), true); - if (!astForDeclContext) { - return null; - } - - var symbol = decl.getSymbol(); - resolver.resolveDeclaredSymbol(symbol, context.resolutionContext); - symbol.setUnresolved(); - - return { - symbol: symbol, - aliasSymbol: null, - ast: ast, - enclosingScopeSymbol: this.getSymbolOfDeclaration(context.enclosingDecl) - }; - }; - - TypeScriptCompiler.prototype.topLevelDeclaration = function (fileName) { - return this.semanticInfoChain.topLevelDecl(fileName); - }; - - TypeScriptCompiler.prototype.getDeclForAST = function (ast) { - return this.semanticInfoChain.getDeclForAST(ast); - }; - - TypeScriptCompiler.prototype.fileNames = function () { - return this.semanticInfoChain.fileNames(); - }; - - TypeScriptCompiler.prototype.topLevelDecl = function (fileName) { - return this.semanticInfoChain.topLevelDecl(fileName); - }; - - TypeScriptCompiler.getLocationText = function (location, resolvePath) { - return resolvePath(location.fileName()) + "(" + (location.line() + 1) + "," + (location.character() + 1) + ")"; - }; - - TypeScriptCompiler.getFullDiagnosticText = function (diagnostic, resolvePath) { - var result = ""; - if (diagnostic.fileName()) { - result += this.getLocationText(diagnostic, resolvePath) + ": "; - } - - result += diagnostic.message(); - - var additionalLocations = diagnostic.additionalLocations(); - if (additionalLocations.length > 0) { - result += " " + TypeScript.getLocalizedText(TypeScript.DiagnosticCode.Additional_locations, null) + TypeScript.Environment.newLine; - - for (var i = 0, n = additionalLocations.length; i < n; i++) { - result += "\t" + this.getLocationText(additionalLocations[i], resolvePath) + TypeScript.Environment.newLine; - } - } else { - result += TypeScript.Environment.newLine; - } - - return result; - }; - return TypeScriptCompiler; - })(); - TypeScript.TypeScriptCompiler = TypeScriptCompiler; - - var CompilerPhase; - (function (CompilerPhase) { - CompilerPhase[CompilerPhase["Syntax"] = 0] = "Syntax"; - CompilerPhase[CompilerPhase["Semantics"] = 1] = "Semantics"; - CompilerPhase[CompilerPhase["EmitOptionsValidation"] = 2] = "EmitOptionsValidation"; - CompilerPhase[CompilerPhase["Emit"] = 3] = "Emit"; - CompilerPhase[CompilerPhase["DeclarationEmit"] = 4] = "DeclarationEmit"; - })(CompilerPhase || (CompilerPhase = {})); - - var CompilerIterator = (function () { - function CompilerIterator(compiler, resolvePath, continueOnDiagnostics, startingPhase) { - if (typeof startingPhase === "undefined") { startingPhase = 0 /* Syntax */; } - this.compiler = compiler; - this.resolvePath = resolvePath; - this.continueOnDiagnostics = continueOnDiagnostics; - this.index = -1; - this.fileNames = null; - this._current = null; - this._emitOptions = null; - this._sharedEmitter = null; - this._sharedDeclarationEmitter = null; - this.hadSyntacticDiagnostics = false; - this.hadSemanticDiagnostics = false; - this.hadEmitDiagnostics = false; - this.fileNames = compiler.fileNames(); - this.compilerPhase = startingPhase; - } - CompilerIterator.prototype.current = function () { - return this._current; - }; - - CompilerIterator.prototype.moveNext = function () { - this._current = null; - - while (this.moveNextInternal()) { - if (this._current) { - return true; - } - } - - return false; - }; - - CompilerIterator.prototype.moveNextInternal = function () { - this.index++; - - while (this.shouldMoveToNextPhase()) { - this.index = 0; - this.compilerPhase++; - } - - if (this.compilerPhase > 4 /* DeclarationEmit */) { - return false; - } - - switch (this.compilerPhase) { - case 0 /* Syntax */: - return this.moveNextSyntaxPhase(); - case 1 /* Semantics */: - return this.moveNextSemanticsPhase(); - case 2 /* EmitOptionsValidation */: - return this.moveNextEmitOptionsValidationPhase(); - case 3 /* Emit */: - return this.moveNextEmitPhase(); - case 4 /* DeclarationEmit */: - return this.moveNextDeclarationEmitPhase(); - } - }; - - CompilerIterator.prototype.shouldMoveToNextPhase = function () { - switch (this.compilerPhase) { - case 2 /* EmitOptionsValidation */: - return this.index === 1; - - case 0 /* Syntax */: - case 1 /* Semantics */: - return this.index === this.fileNames.length; - - case 3 /* Emit */: - case 4 /* DeclarationEmit */: - return this.index === (this.fileNames.length + 1); - } - - return false; - }; - - CompilerIterator.prototype.moveNextSyntaxPhase = function () { - TypeScript.Debug.assert(this.index >= 0 && this.index < this.fileNames.length); - var fileName = this.fileNames[this.index]; - - var diagnostics = this.compiler.getSyntacticDiagnostics(fileName); - if (diagnostics.length) { - if (!this.continueOnDiagnostics) { - this.hadSyntacticDiagnostics = true; - } - - this._current = CompileResult.fromDiagnostics(diagnostics); - } - - return true; - }; - - CompilerIterator.prototype.moveNextSemanticsPhase = function () { - if (this.hadSyntacticDiagnostics) { - return false; - } - - TypeScript.Debug.assert(this.index >= 0 && this.index < this.fileNames.length); - var fileName = this.fileNames[this.index]; - var diagnostics = this.compiler.getSemanticDiagnostics(fileName); - if (diagnostics.length) { - if (!this.continueOnDiagnostics) { - this.hadSemanticDiagnostics = true; - } - - this._current = CompileResult.fromDiagnostics(diagnostics); - } - - return true; - }; - - CompilerIterator.prototype.moveNextEmitOptionsValidationPhase = function () { - TypeScript.Debug.assert(!this.hadSyntacticDiagnostics); - - if (!this._emitOptions) { - this._emitOptions = new TypeScript.EmitOptions(this.compiler, this.resolvePath); - } - - if (this._emitOptions.diagnostic()) { - if (!this.continueOnDiagnostics) { - this.hadEmitDiagnostics = true; - } - - this._current = CompileResult.fromDiagnostics([this._emitOptions.diagnostic()]); - } - - return true; - }; - - CompilerIterator.prototype.moveNextEmitPhase = function () { - var _this = this; - TypeScript.Debug.assert(!this.hadSyntacticDiagnostics); - TypeScript.Debug.assert(this._emitOptions); - - if (this.hadEmitDiagnostics) { - return false; - } - - TypeScript.Debug.assert(this.index >= 0 && this.index <= this.fileNames.length); - if (this.index < this.fileNames.length) { - var fileName = this.fileNames[this.index]; - var document = this.compiler.getDocument(fileName); - - this._sharedEmitter = this.compiler._emitDocument(document, this._emitOptions, function (outputFiles) { - _this._current = CompileResult.fromOutputFiles(outputFiles); - }, this._sharedEmitter); - return true; - } - - if (this.index === this.fileNames.length && this._sharedEmitter) { - this._current = CompileResult.fromOutputFiles(this._sharedEmitter.getOutputFiles()); - } - - return true; - }; - - CompilerIterator.prototype.moveNextDeclarationEmitPhase = function () { - var _this = this; - TypeScript.Debug.assert(!this.hadSyntacticDiagnostics); - TypeScript.Debug.assert(!this.hadEmitDiagnostics); - if (this.hadSemanticDiagnostics) { - return false; - } - - if (!this.compiler.compilationSettings().generateDeclarationFiles()) { - return false; - } - - TypeScript.Debug.assert(this.index >= 0 && this.index <= this.fileNames.length); - if (this.index < this.fileNames.length) { - var fileName = this.fileNames[this.index]; - var document = this.compiler.getDocument(fileName); - - this._sharedDeclarationEmitter = this.compiler._emitDocumentDeclarations(document, this._emitOptions, function (file) { - _this._current = CompileResult.fromOutputFiles([file]); - }, this._sharedDeclarationEmitter); - return true; - } - - if (this.index === this.fileNames.length && this._sharedDeclarationEmitter) { - this._current = CompileResult.fromOutputFiles([this._sharedDeclarationEmitter.getOutputFile()]); - } - - return true; - }; - return CompilerIterator; - })(); - - function compareDataObjects(dst, src) { - for (var e in dst) { - if (typeof dst[e] === "object") { - if (!compareDataObjects(dst[e], src[e])) - return false; - } else if (typeof dst[e] !== "function") { - if (dst[e] !== src[e]) - return false; - } - } - return true; - } - TypeScript.compareDataObjects = compareDataObjects; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (GenerativeTypeClassification) { - GenerativeTypeClassification[GenerativeTypeClassification["Unknown"] = 0] = "Unknown"; - GenerativeTypeClassification[GenerativeTypeClassification["Open"] = 1] = "Open"; - GenerativeTypeClassification[GenerativeTypeClassification["Closed"] = 2] = "Closed"; - GenerativeTypeClassification[GenerativeTypeClassification["InfinitelyExpanding"] = 3] = "InfinitelyExpanding"; - })(TypeScript.GenerativeTypeClassification || (TypeScript.GenerativeTypeClassification = {})); - var GenerativeTypeClassification = TypeScript.GenerativeTypeClassification; - - var PullTypeReferenceSymbol = (function (_super) { - __extends(PullTypeReferenceSymbol, _super); - function PullTypeReferenceSymbol(referencedTypeSymbol) { - _super.call(this, referencedTypeSymbol.name, referencedTypeSymbol.kind); - this.referencedTypeSymbol = referencedTypeSymbol; - this.isResolved = true; - - TypeScript.Debug.assert(referencedTypeSymbol !== null, "Type root symbol may not be null"); - - this.setRootSymbol(referencedTypeSymbol); - - this.typeReference = this; - } - PullTypeReferenceSymbol.createTypeReference = function (type) { - if (type.isTypeReference()) { - return type; - } - - var typeReference = type.typeReference; - - if (!typeReference) { - typeReference = new PullTypeReferenceSymbol(type); - type.typeReference = typeReference; - } - - return typeReference; - }; - - PullTypeReferenceSymbol.prototype.isTypeReference = function () { - return true; - }; - - PullTypeReferenceSymbol.prototype.setResolved = function () { - }; - - PullTypeReferenceSymbol.prototype.setUnresolved = function () { - }; - PullTypeReferenceSymbol.prototype.invalidate = function () { - }; - - PullTypeReferenceSymbol.prototype.ensureReferencedTypeIsResolved = function () { - this._getResolver().resolveDeclaredSymbol(this.referencedTypeSymbol); - }; - - PullTypeReferenceSymbol.prototype.getReferencedTypeSymbol = function () { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol; - }; - - PullTypeReferenceSymbol.prototype._getResolver = function () { - return this.referencedTypeSymbol._getResolver(); - }; - - PullTypeReferenceSymbol.prototype.hasMembers = function () { - return this.referencedTypeSymbol.hasMembers(); - }; - - PullTypeReferenceSymbol.prototype.setAssociatedContainerType = function (type) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": setAssociatedContainerType"); - }; - - PullTypeReferenceSymbol.prototype.getAssociatedContainerType = function () { - return this.referencedTypeSymbol.getAssociatedContainerType(); - }; - - PullTypeReferenceSymbol.prototype.getFunctionSymbol = function () { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.getFunctionSymbol(); - }; - PullTypeReferenceSymbol.prototype.setFunctionSymbol = function (symbol) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": setFunctionSymbol"); - }; - - PullTypeReferenceSymbol.prototype.addContainedNonMember = function (nonMember) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addContainedNonMember"); - }; - PullTypeReferenceSymbol.prototype.findContainedNonMemberContainer = function (containerName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.findContainedNonMemberContainer(containerName, kind); - }; - - PullTypeReferenceSymbol.prototype.addMember = function (memberSymbol) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addMember"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedMemberType = function (enclosedType) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedMemberType"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedMemberContainer = function (enclosedContainer) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedMemberContainer"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedNonMember = function (enclosedNonMember) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedNonMember"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedNonMemberType = function (enclosedNonMemberType) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedNonMemberType"); - }; - PullTypeReferenceSymbol.prototype.addEnclosedNonMemberContainer = function (enclosedNonMemberContainer) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addEnclosedNonMemberContainer"); - }; - PullTypeReferenceSymbol.prototype.addTypeParameter = function (typeParameter) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addTypeParameter"); - }; - PullTypeReferenceSymbol.prototype.addConstructorTypeParameter = function (typeParameter) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addConstructorTypeParameter"); - }; - - PullTypeReferenceSymbol.prototype.findContainedNonMember = function (name) { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findContainedNonMember(name); - }; - - PullTypeReferenceSymbol.prototype.findContainedNonMemberType = function (typeName, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findContainedNonMemberType(typeName, kind); - }; - - PullTypeReferenceSymbol.prototype.getMembers = function () { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.getMembers(); - }; - - PullTypeReferenceSymbol.prototype.setHasDefaultConstructor = function (hasOne) { - if (typeof hasOne === "undefined") { hasOne = true; } - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ":setHasDefaultConstructor"); - }; - PullTypeReferenceSymbol.prototype.getHasDefaultConstructor = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getHasDefaultConstructor(); - }; - PullTypeReferenceSymbol.prototype.getConstructorMethod = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getConstructorMethod(); - }; - PullTypeReferenceSymbol.prototype.setConstructorMethod = function (constructorMethod) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": setConstructorMethod"); - }; - PullTypeReferenceSymbol.prototype.getTypeParameters = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypeParameters(); - }; - - PullTypeReferenceSymbol.prototype.isGeneric = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.isGeneric(); - }; - - PullTypeReferenceSymbol.prototype.addSpecialization = function (specializedVersionOfThisType, substitutingTypes) { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.addSpecialization(specializedVersionOfThisType, substitutingTypes); - }; - PullTypeReferenceSymbol.prototype.getSpecialization = function (substitutingTypes) { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getSpecialization(substitutingTypes); - }; - PullTypeReferenceSymbol.prototype.getKnownSpecializations = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getKnownSpecializations(); - }; - PullTypeReferenceSymbol.prototype.getTypeArguments = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypeArguments(); - }; - PullTypeReferenceSymbol.prototype.getTypeArgumentsOrTypeParameters = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypeArgumentsOrTypeParameters(); - }; - - PullTypeReferenceSymbol.prototype.appendCallSignature = function (callSignature) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": appendCallSignature"); - }; - PullTypeReferenceSymbol.prototype.insertCallSignatureAtIndex = function (callSignature, index) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": insertCallSignatureAtIndex"); - }; - PullTypeReferenceSymbol.prototype.appendConstructSignature = function (callSignature) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": appendConstructSignature"); - }; - PullTypeReferenceSymbol.prototype.insertConstructSignatureAtIndex = function (callSignature, index) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": insertConstructSignatureAtIndex"); - }; - PullTypeReferenceSymbol.prototype.addIndexSignature = function (indexSignature) { - TypeScript.Debug.fail("Reference symbol " + this.pullSymbolID + ": addIndexSignature"); - }; - - PullTypeReferenceSymbol.prototype.hasOwnCallSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.hasOwnCallSignatures(); - }; - PullTypeReferenceSymbol.prototype.getCallSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getCallSignatures(); - }; - PullTypeReferenceSymbol.prototype.hasOwnConstructSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.hasOwnConstructSignatures(); - }; - PullTypeReferenceSymbol.prototype.getConstructSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getConstructSignatures(); - }; - PullTypeReferenceSymbol.prototype.hasOwnIndexSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.hasOwnIndexSignatures(); - }; - PullTypeReferenceSymbol.prototype.getIndexSignatures = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getIndexSignatures(); - }; - - PullTypeReferenceSymbol.prototype.addImplementedType = function (implementedType) { - this.referencedTypeSymbol.addImplementedType(implementedType); - }; - PullTypeReferenceSymbol.prototype.getImplementedTypes = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getImplementedTypes(); - }; - PullTypeReferenceSymbol.prototype.addExtendedType = function (extendedType) { - this.referencedTypeSymbol.addExtendedType(extendedType); - }; - PullTypeReferenceSymbol.prototype.getExtendedTypes = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getExtendedTypes(); - }; - PullTypeReferenceSymbol.prototype.addTypeThatExtendsThisType = function (type) { - this.referencedTypeSymbol.addTypeThatExtendsThisType(type); - }; - PullTypeReferenceSymbol.prototype.getTypesThatExtendThisType = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypesThatExtendThisType(); - }; - PullTypeReferenceSymbol.prototype.addTypeThatExplicitlyImplementsThisType = function (type) { - this.referencedTypeSymbol.addTypeThatExplicitlyImplementsThisType(type); - }; - PullTypeReferenceSymbol.prototype.getTypesThatExplicitlyImplementThisType = function () { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.getTypesThatExplicitlyImplementThisType(); - }; - - PullTypeReferenceSymbol.prototype.isValidBaseKind = function (baseType, isExtendedType) { - this.ensureReferencedTypeIsResolved(); - return this.referencedTypeSymbol.isValidBaseKind(baseType, isExtendedType); - }; - - PullTypeReferenceSymbol.prototype.findMember = function (name, lookInParent) { - if (typeof lookInParent === "undefined") { lookInParent = true; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findMember(name, lookInParent); - }; - PullTypeReferenceSymbol.prototype.findNestedType = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findNestedType(name, kind); - }; - PullTypeReferenceSymbol.prototype.findNestedContainer = function (name, kind) { - if (typeof kind === "undefined") { kind = 0 /* None */; } - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findNestedContainer(name, kind); - }; - PullTypeReferenceSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisiblity) { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.getAllMembers(searchDeclKind, memberVisiblity); - }; - - PullTypeReferenceSymbol.prototype.findTypeParameter = function (name) { - this.ensureReferencedTypeIsResolved(); - - return this.referencedTypeSymbol.findTypeParameter(name); - }; - - PullTypeReferenceSymbol.prototype.hasOnlyOverloadCallSignatures = function () { - return this.referencedTypeSymbol.hasOnlyOverloadCallSignatures(); - }; - return PullTypeReferenceSymbol; - })(TypeScript.PullTypeSymbol); - TypeScript.PullTypeReferenceSymbol = PullTypeReferenceSymbol; - - TypeScript.nSpecializationsCreated = 0; - TypeScript.nSpecializedSignaturesCreated = 0; - TypeScript.nSpecializedTypeParameterCreated = 0; - - var PullInstantiatedTypeReferenceSymbol = (function (_super) { - __extends(PullInstantiatedTypeReferenceSymbol, _super); - function PullInstantiatedTypeReferenceSymbol(referencedTypeSymbol, _typeParameterArgumentMap, isInstanceReferenceType) { - _super.call(this, referencedTypeSymbol); - this.referencedTypeSymbol = referencedTypeSymbol; - this._typeParameterArgumentMap = _typeParameterArgumentMap; - this.isInstanceReferenceType = isInstanceReferenceType; - this._instantiatedMembers = null; - this._allInstantiatedMemberNameCache = null; - this._instantiatedMemberNameCache = TypeScript.createIntrinsicsObject(); - this._instantiatedCallSignatures = null; - this._instantiatedConstructSignatures = null; - this._instantiatedIndexSignatures = null; - this._typeArgumentReferences = undefined; - this._instantiatedConstructorMethod = null; - this._instantiatedAssociatedContainerType = null; - this._isArray = undefined; - this._generativeTypeClassification = []; - - TypeScript.nSpecializationsCreated++; - } - PullInstantiatedTypeReferenceSymbol.prototype.getIsSpecialized = function () { - return !this.isInstanceReferenceType; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getGenerativeTypeClassification = function (enclosingType) { - if (!this.isNamedTypeSymbol()) { - return 0 /* Unknown */; - } - - var generativeTypeClassification = this._generativeTypeClassification[enclosingType.pullSymbolID] || 0 /* Unknown */; - if (generativeTypeClassification === 0 /* Unknown */) { - var typeParameters = enclosingType.getTypeParameters(); - var enclosingTypeParameterMap = []; - for (var i = 0; i < typeParameters.length; i++) { - enclosingTypeParameterMap[typeParameters[i].pullSymbolID] = typeParameters[i]; - } - - var typeArguments = this.getTypeArguments(); - for (var i = 0; i < typeArguments.length; i++) { - if (typeArguments[i].wrapsSomeTypeParameter(enclosingTypeParameterMap, true)) { - generativeTypeClassification = 1 /* Open */; - break; - } - } - - if (generativeTypeClassification === 1 /* Open */) { - if (this.wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReference(enclosingType)) { - generativeTypeClassification = 3 /* InfinitelyExpanding */; - } - } else { - generativeTypeClassification = 2 /* Closed */; - } - - this._generativeTypeClassification[enclosingType.pullSymbolID] = generativeTypeClassification; - } - - return generativeTypeClassification; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.isArrayNamedTypeReference = function () { - if (this._isArray === undefined) { - this._isArray = this.getRootSymbol().isArrayNamedTypeReference() || (this.getRootSymbol() === this._getResolver().getArrayNamedType()); - } - return this._isArray; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getElementType = function () { - if (!this.isArrayNamedTypeReference()) { - return null; - } - - var typeArguments = this.getTypeArguments(); - return typeArguments ? typeArguments[0] : null; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getReferencedTypeSymbol = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.getIsSpecialized()) { - return this; - } - - return this.referencedTypeSymbol; - }; - - PullInstantiatedTypeReferenceSymbol.create = function (resolver, type, typeParameterArgumentMap) { - TypeScript.Debug.assert(resolver); - - var mutableTypeParameterMap = new TypeScript.PullInstantiationHelpers.MutableTypeArgumentMap(typeParameterArgumentMap); - - TypeScript.PullInstantiationHelpers.instantiateTypeArgument(resolver, type, mutableTypeParameterMap); - - var rootType = type.getRootSymbol(); - var instantiation = rootType.getSpecialization(mutableTypeParameterMap.typeParameterArgumentMap); - if (instantiation) { - return instantiation; - } - - TypeScript.PullInstantiationHelpers.cleanUpTypeArgumentMap(type, mutableTypeParameterMap); - typeParameterArgumentMap = mutableTypeParameterMap.typeParameterArgumentMap; - - var isInstanceReferenceType = (type.kind & 8216 /* SomeInstantiatableType */) != 0; - var resolvedTypeParameterArgumentMap = typeParameterArgumentMap; - if (isInstanceReferenceType) { - var typeParameters = rootType.getTypeParameters(); - for (var i = 0; i < typeParameters.length; i++) { - if (!TypeScript.PullHelpers.typeSymbolsAreIdentical(typeParameters[i], typeParameterArgumentMap[typeParameters[i].pullSymbolID])) { - isInstanceReferenceType = false; - break; - } - } - - if (isInstanceReferenceType) { - typeParameterArgumentMap = []; - } - } - - instantiation = new PullInstantiatedTypeReferenceSymbol(rootType, typeParameterArgumentMap, isInstanceReferenceType); - - rootType.addSpecialization(instantiation, resolvedTypeParameterArgumentMap); - - return instantiation; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.isGeneric = function () { - return this.getRootSymbol().isGeneric(); - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getTypeParameterArgumentMap = function () { - return this._typeParameterArgumentMap; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getTypeArguments = function () { - if (this.isInstanceReferenceType) { - return this.getTypeParameters(); - } - - if (this._typeArgumentReferences === undefined) { - var typeParameters = this.referencedTypeSymbol.getTypeParameters(); - - if (typeParameters.length) { - var typeArgument = null; - var typeArguments = []; - - for (var i = 0; i < typeParameters.length; i++) { - typeArgument = this._typeParameterArgumentMap[typeParameters[i].pullSymbolID]; - - if (!typeArgument) { - TypeScript.Debug.fail("type argument count mismatch"); - } - - if (typeArgument) { - typeArguments[typeArguments.length] = typeArgument; - } - } - - this._typeArgumentReferences = typeArguments; - } else { - this._typeArgumentReferences = null; - } - } - - return this._typeArgumentReferences; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getTypeArgumentsOrTypeParameters = function () { - return this.getTypeArguments(); - }; - - PullInstantiatedTypeReferenceSymbol.prototype.populateInstantiatedMemberFromReferencedMember = function (referencedMember) { - var instantiatedMember; - TypeScript.PullHelpers.resolveDeclaredSymbolToUseType(referencedMember); - - if (!referencedMember.type.wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - instantiatedMember = referencedMember; - } else { - instantiatedMember = new TypeScript.PullSymbol(referencedMember.name, referencedMember.kind); - instantiatedMember.setRootSymbol(referencedMember); - instantiatedMember.type = this._getResolver().instantiateType(referencedMember.type, this._typeParameterArgumentMap); - instantiatedMember.isOptional = referencedMember.isOptional; - } - this._instantiatedMemberNameCache[instantiatedMember.name] = instantiatedMember; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getMembers = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getMembers(); - } - - if (!this._instantiatedMembers) { - var referencedMembers = this.referencedTypeSymbol.getMembers(); - var referencedMember = null; - var instantiatedMember = null; - - this._instantiatedMembers = []; - - for (var i = 0; i < referencedMembers.length; i++) { - referencedMember = referencedMembers[i]; - - this._getResolver().resolveDeclaredSymbol(referencedMember); - - if (!this._instantiatedMemberNameCache[referencedMember.name]) { - this.populateInstantiatedMemberFromReferencedMember(referencedMember); - } - - this._instantiatedMembers[this._instantiatedMembers.length] = this._instantiatedMemberNameCache[referencedMember.name]; - } - } - - return this._instantiatedMembers; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.findMember = function (name, lookInParent) { - if (typeof lookInParent === "undefined") { lookInParent = true; } - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.findMember(name, lookInParent); - } - - var memberSymbol = this._instantiatedMemberNameCache[name]; - - if (!memberSymbol) { - var referencedMemberSymbol = this.referencedTypeSymbol.findMember(name, lookInParent); - - if (referencedMemberSymbol) { - this.populateInstantiatedMemberFromReferencedMember(referencedMemberSymbol); - memberSymbol = this._instantiatedMemberNameCache[name]; - } else { - memberSymbol = null; - } - } - - return memberSymbol; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getAllMembers = function (searchDeclKind, memberVisiblity) { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getAllMembers(searchDeclKind, memberVisiblity); - } - - var requestedMembers = []; - var allReferencedMembers = this.referencedTypeSymbol.getAllMembers(searchDeclKind, memberVisiblity); - - if (!this._allInstantiatedMemberNameCache) { - this._allInstantiatedMemberNameCache = TypeScript.createIntrinsicsObject(); - - var members = this.getMembers(); - - for (var i = 0; i < members.length; i++) { - this._allInstantiatedMemberNameCache[members[i].name] = members[i]; - } - } - - var referencedMember = null; - var requestedMember = null; - - for (var i = 0; i < allReferencedMembers.length; i++) { - referencedMember = allReferencedMembers[i]; - - this._getResolver().resolveDeclaredSymbol(referencedMember); - - if (this._allInstantiatedMemberNameCache[referencedMember.name]) { - requestedMembers[requestedMembers.length] = this._allInstantiatedMemberNameCache[referencedMember.name]; - } else { - if (!referencedMember.type.wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._allInstantiatedMemberNameCache[referencedMember.name] = referencedMember; - requestedMembers[requestedMembers.length] = referencedMember; - } else { - requestedMember = new TypeScript.PullSymbol(referencedMember.name, referencedMember.kind); - requestedMember.setRootSymbol(referencedMember); - - requestedMember.type = this._getResolver().instantiateType(referencedMember.type, this._typeParameterArgumentMap); - requestedMember.isOptional = referencedMember.isOptional; - - this._allInstantiatedMemberNameCache[requestedMember.name] = requestedMember; - requestedMembers[requestedMembers.length] = requestedMember; - } - } - } - - return requestedMembers; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getConstructorMethod = function () { - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getConstructorMethod(); - } - - if (!this._instantiatedConstructorMethod) { - var referencedConstructorMethod = this.referencedTypeSymbol.getConstructorMethod(); - this._instantiatedConstructorMethod = new TypeScript.PullSymbol(referencedConstructorMethod.name, referencedConstructorMethod.kind); - this._instantiatedConstructorMethod.setRootSymbol(referencedConstructorMethod); - this._instantiatedConstructorMethod.setResolved(); - - this._instantiatedConstructorMethod.type = PullInstantiatedTypeReferenceSymbol.create(this._getResolver(), referencedConstructorMethod.type, this._typeParameterArgumentMap); - } - - return this._instantiatedConstructorMethod; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getAssociatedContainerType = function () { - if (!this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getAssociatedContainerType(); - } - - if (!this._instantiatedAssociatedContainerType) { - var referencedAssociatedContainerType = this.referencedTypeSymbol.getAssociatedContainerType(); - - if (referencedAssociatedContainerType) { - this._instantiatedAssociatedContainerType = PullInstantiatedTypeReferenceSymbol.create(this._getResolver(), referencedAssociatedContainerType, this._typeParameterArgumentMap); - } - } - - return this._instantiatedAssociatedContainerType; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getCallSignatures = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getCallSignatures(); - } - - if (this._instantiatedCallSignatures) { - return this._instantiatedCallSignatures; - } - - var referencedCallSignatures = this.referencedTypeSymbol.getCallSignatures(); - this._instantiatedCallSignatures = []; - - for (var i = 0; i < referencedCallSignatures.length; i++) { - this._getResolver().resolveDeclaredSymbol(referencedCallSignatures[i]); - - if (!referencedCallSignatures[i].wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._instantiatedCallSignatures[this._instantiatedCallSignatures.length] = referencedCallSignatures[i]; - } else { - this._instantiatedCallSignatures[this._instantiatedCallSignatures.length] = this._getResolver().instantiateSignature(referencedCallSignatures[i], this._typeParameterArgumentMap); - this._instantiatedCallSignatures[this._instantiatedCallSignatures.length - 1].functionType = this; - } - } - - return this._instantiatedCallSignatures; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getConstructSignatures = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getConstructSignatures(); - } - - if (this._instantiatedConstructSignatures) { - return this._instantiatedConstructSignatures; - } - - var referencedConstructSignatures = this.referencedTypeSymbol.getConstructSignatures(); - this._instantiatedConstructSignatures = []; - - for (var i = 0; i < referencedConstructSignatures.length; i++) { - this._getResolver().resolveDeclaredSymbol(referencedConstructSignatures[i]); - - if (!referencedConstructSignatures[i].wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._instantiatedConstructSignatures[this._instantiatedConstructSignatures.length] = referencedConstructSignatures[i]; - } else { - this._instantiatedConstructSignatures[this._instantiatedConstructSignatures.length] = this._getResolver().instantiateSignature(referencedConstructSignatures[i], this._typeParameterArgumentMap); - this._instantiatedConstructSignatures[this._instantiatedConstructSignatures.length - 1].functionType = this; - } - } - - return this._instantiatedConstructSignatures; - }; - - PullInstantiatedTypeReferenceSymbol.prototype.getIndexSignatures = function () { - this.ensureReferencedTypeIsResolved(); - - if (this.isInstanceReferenceType) { - return this.referencedTypeSymbol.getIndexSignatures(); - } - - if (this._instantiatedIndexSignatures) { - return this._instantiatedIndexSignatures; - } - - var referencedIndexSignatures = this.referencedTypeSymbol.getIndexSignatures(); - this._instantiatedIndexSignatures = []; - - for (var i = 0; i < referencedIndexSignatures.length; i++) { - this._getResolver().resolveDeclaredSymbol(referencedIndexSignatures[i]); - - if (!referencedIndexSignatures[i].wrapsSomeTypeParameter(this._typeParameterArgumentMap)) { - this._instantiatedIndexSignatures[this._instantiatedIndexSignatures.length] = referencedIndexSignatures[i]; - } else { - this._instantiatedIndexSignatures[this._instantiatedIndexSignatures.length] = this._getResolver().instantiateSignature(referencedIndexSignatures[i], this._typeParameterArgumentMap); - this._instantiatedIndexSignatures[this._instantiatedIndexSignatures.length - 1].functionType = this; - } - } - - return this._instantiatedIndexSignatures; - }; - return PullInstantiatedTypeReferenceSymbol; - })(PullTypeReferenceSymbol); - TypeScript.PullInstantiatedTypeReferenceSymbol = PullInstantiatedTypeReferenceSymbol; - - var PullInstantiatedSignatureSymbol = (function (_super) { - __extends(PullInstantiatedSignatureSymbol, _super); - function PullInstantiatedSignatureSymbol(rootSignature, _typeParameterArgumentMap) { - _super.call(this, rootSignature.kind, rootSignature.isDefinition()); - this._typeParameterArgumentMap = _typeParameterArgumentMap; - this.setRootSymbol(rootSignature); - TypeScript.nSpecializedSignaturesCreated++; - - rootSignature.addSpecialization(this, _typeParameterArgumentMap); - } - PullInstantiatedSignatureSymbol.prototype.getTypeParameterArgumentMap = function () { - return this._typeParameterArgumentMap; - }; - - PullInstantiatedSignatureSymbol.prototype.getIsSpecialized = function () { - return true; - }; - - PullInstantiatedSignatureSymbol.prototype._getResolver = function () { - return this.getRootSymbol()._getResolver(); - }; - - PullInstantiatedSignatureSymbol.prototype.getTypeParameters = function () { - var _this = this; - if (!this._typeParameters) { - var rootSymbol = this.getRootSymbol(); - var typeParameters = rootSymbol.getTypeParameters(); - var hasInstantiatedTypeParametersOfThisSignature = TypeScript.ArrayUtilities.all(typeParameters, function (typeParameter) { - return _this._typeParameterArgumentMap[typeParameter.pullSymbolID] !== undefined; - }); - - if (!hasInstantiatedTypeParametersOfThisSignature && typeParameters.length) { - this._typeParameters = []; - for (var i = 0; i < typeParameters.length; i++) { - this._typeParameters[this._typeParameters.length] = this._getResolver().instantiateTypeParameter(typeParameters[i], this._typeParameterArgumentMap); - } - } else { - this._typeParameters = TypeScript.sentinelEmptyArray; - } - } - - return this._typeParameters; - }; - - PullInstantiatedSignatureSymbol.prototype.getAllowedToReferenceTypeParameters = function () { - var rootSymbol = this.getRootSymbol(); - return rootSymbol.getAllowedToReferenceTypeParameters(); - }; - return PullInstantiatedSignatureSymbol; - })(TypeScript.PullSignatureSymbol); - TypeScript.PullInstantiatedSignatureSymbol = PullInstantiatedSignatureSymbol; - - var PullInstantiatedTypeParameterSymbol = (function (_super) { - __extends(PullInstantiatedTypeParameterSymbol, _super); - function PullInstantiatedTypeParameterSymbol(rootTypeParameter, constraintType) { - _super.call(this, rootTypeParameter.name); - TypeScript.nSpecializedTypeParameterCreated++; - - this.setRootSymbol(rootTypeParameter); - this.setConstraint(constraintType); - - rootTypeParameter.addSpecialization(this, [constraintType]); - } - PullInstantiatedTypeParameterSymbol.prototype._getResolver = function () { - return this.getRootSymbol()._getResolver(); - }; - return PullInstantiatedTypeParameterSymbol; - })(TypeScript.PullTypeParameterSymbol); - TypeScript.PullInstantiatedTypeParameterSymbol = PullInstantiatedTypeParameterSymbol; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxTreeToAstVisitor = (function () { - function SyntaxTreeToAstVisitor(fileName, lineMap, compilationSettings) { - this.fileName = fileName; - this.lineMap = lineMap; - this.compilationSettings = compilationSettings; - this.position = 0; - this.previousTokenTrailingComments = null; - } - SyntaxTreeToAstVisitor.visit = function (syntaxTree, fileName, compilationSettings, incrementalAST) { - var visitor = incrementalAST ? new SyntaxTreeToIncrementalAstVisitor(fileName, syntaxTree.lineMap(), compilationSettings) : new SyntaxTreeToAstVisitor(fileName, syntaxTree.lineMap(), compilationSettings); - return syntaxTree.sourceUnit().accept(visitor); - }; - - SyntaxTreeToAstVisitor.prototype.movePast = function (element) { - if (element !== null) { - this.position += element.fullWidth(); - } - }; - - SyntaxTreeToAstVisitor.prototype.moveTo = function (element1, element2) { - if (element2 !== null) { - this.position += TypeScript.Syntax.childOffset(element1, element2); - } - }; - - SyntaxTreeToAstVisitor.prototype.setCommentsAndSpan = function (ast, fullStart, node) { - var firstToken = node.firstToken(); - var lastToken = node.lastToken(); - - this.setSpan(ast, fullStart, node, firstToken, lastToken); - ast.setPreComments(this.convertTokenLeadingComments(firstToken, fullStart)); - ast.setPostComments(this.convertNodeTrailingComments(node, lastToken, fullStart)); - }; - - SyntaxTreeToAstVisitor.prototype.createTokenSpan = function (fullStart, element) { - if (element === null) { - return null; - } - - if (element.fullWidth() === 0) { - return new TypeScript.ASTSpan(-1, -1); - } - - var leadingTriviaWidth = element.leadingTriviaWidth(); - var trailingTriviaWidth = element.trailingTriviaWidth(); - - var start = fullStart + leadingTriviaWidth; - var end = fullStart + element.fullWidth() - trailingTriviaWidth; - - return new TypeScript.ASTSpan(start, end); - }; - - SyntaxTreeToAstVisitor.prototype.setSpan = function (span, fullStart, element, firstToken, lastToken) { - if (typeof firstToken === "undefined") { firstToken = element.firstToken(); } - if (typeof lastToken === "undefined") { lastToken = element.lastToken(); } - var leadingTriviaWidth = firstToken ? firstToken.leadingTriviaWidth() : 0; - var trailingTriviaWidth = lastToken ? lastToken.trailingTriviaWidth() : 0; - - var desiredMinChar = fullStart + leadingTriviaWidth; - var desiredLimChar = fullStart + element.fullWidth() - trailingTriviaWidth; - - this.setSpanExplicit(span, desiredMinChar, desiredLimChar); - - span._trailingTriviaWidth = trailingTriviaWidth; - }; - - SyntaxTreeToAstVisitor.prototype.setSpanExplicit = function (span, start, end) { - span._start = start; - span._end = end; - }; - - SyntaxTreeToAstVisitor.prototype.visitSyntaxList = function (node) { - var start = this.position; - var array = new Array(node.childCount()); - - for (var i = 0, n = node.childCount(); i < n; i++) { - array[i] = node.childAt(i).accept(this); - } - - var result = new TypeScript.ISyntaxList2(this.fileName, array); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSeparatedSyntaxList = function (list) { - var start = this.position; - var array = new Array(list.nonSeparatorCount()); - - for (var i = 0, n = list.childCount(); i < n; i++) { - if (i % 2 === 0) { - array[i / 2] = list.childAt(i).accept(this); - this.previousTokenTrailingComments = null; - } else { - var separatorToken = list.childAt(i); - this.previousTokenTrailingComments = this.convertTokenTrailingComments(separatorToken, this.position + separatorToken.leadingTriviaWidth() + separatorToken.width()); - this.movePast(separatorToken); - } - } - - var result = new TypeScript.ISeparatedSyntaxList2(this.fileName, array, list.separatorCount()); - this.setSpan(result, start, list); - - result.setPostComments(this.previousTokenTrailingComments); - this.previousTokenTrailingComments = null; - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.convertComment = function (trivia, commentStartPosition, hasTrailingNewLine) { - var comment = new TypeScript.Comment(trivia, hasTrailingNewLine, commentStartPosition, commentStartPosition + trivia.fullWidth()); - - return comment; - }; - - SyntaxTreeToAstVisitor.prototype.convertComments = function (triviaList, commentStartPosition) { - var result = []; - - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - - if (trivia.isComment()) { - var hasTrailingNewLine = ((i + 1) < n) && triviaList.syntaxTriviaAt(i + 1).isNewLine(); - result.push(this.convertComment(trivia, commentStartPosition, hasTrailingNewLine)); - } - - commentStartPosition += trivia.fullWidth(); - } - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.mergeComments = function (comments1, comments2) { - if (comments1 === null) { - return comments2; - } - - if (comments2 === null) { - return comments1; - } - - return comments1.concat(comments2); - }; - - SyntaxTreeToAstVisitor.prototype.convertTokenLeadingComments = function (token, commentStartPosition) { - if (token === null) { - return null; - } - - var preComments = token.hasLeadingComment() ? this.convertComments(token.leadingTrivia(), commentStartPosition) : null; - - var previousTokenTrailingComments = this.previousTokenTrailingComments; - this.previousTokenTrailingComments = null; - - return this.mergeComments(previousTokenTrailingComments, preComments); - }; - - SyntaxTreeToAstVisitor.prototype.convertTokenTrailingComments = function (token, commentStartPosition) { - if (token === null || !token.hasTrailingComment() || token.hasTrailingNewLine()) { - return null; - } - - return this.convertComments(token.trailingTrivia(), commentStartPosition); - }; - - SyntaxTreeToAstVisitor.prototype.convertNodeTrailingComments = function (node, lastToken, nodeStart) { - if (lastToken === null || !lastToken.hasTrailingComment() || lastToken.hasTrailingNewLine()) { - return null; - } - - return this.convertComments(lastToken.trailingTrivia(), nodeStart + node.fullWidth() - lastToken.trailingTriviaWidth()); - }; - - SyntaxTreeToAstVisitor.prototype.visitIdentifier = function (token) { - return this.visitToken(token); - }; - - SyntaxTreeToAstVisitor.prototype.visitToken = function (token) { - var fullStart = this.position; - - var result = this.visitTokenWorker(token); - - this.movePast(token); - - var start = fullStart + token.leadingTriviaWidth(); - this.setSpanExplicit(result, start, start + token.width()); - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTokenWorker = function (token) { - switch (token.tokenKind) { - case 60 /* AnyKeyword */: - return new TypeScript.BuiltInType(60 /* AnyKeyword */, token.text(), token.valueText()); - case 61 /* BooleanKeyword */: - return new TypeScript.BuiltInType(61 /* BooleanKeyword */, token.text(), token.valueText()); - case 67 /* NumberKeyword */: - return new TypeScript.BuiltInType(67 /* NumberKeyword */, token.text(), token.valueText()); - case 69 /* StringKeyword */: - return new TypeScript.BuiltInType(69 /* StringKeyword */, token.text(), token.valueText()); - case 41 /* VoidKeyword */: - return new TypeScript.BuiltInType(41 /* VoidKeyword */, token.text(), token.valueText()); - case 35 /* ThisKeyword */: - return new TypeScript.ThisExpression(token.text(), token.valueText()); - case 50 /* SuperKeyword */: - return new TypeScript.SuperExpression(token.text(), token.valueText()); - case 37 /* TrueKeyword */: - return new TypeScript.LiteralExpression(37 /* TrueKeyword */, token.text(), token.valueText()); - case 24 /* FalseKeyword */: - return new TypeScript.LiteralExpression(24 /* FalseKeyword */, token.text(), token.valueText()); - case 32 /* NullKeyword */: - return new TypeScript.LiteralExpression(32 /* NullKeyword */, token.text(), token.valueText()); - case 14 /* StringLiteral */: - return new TypeScript.StringLiteral(token.text(), token.valueText()); - case 12 /* RegularExpressionLiteral */: - return new TypeScript.RegularExpressionLiteral(token.text(), token.valueText()); - case 13 /* NumericLiteral */: - var fullStart = this.position; - var preComments = this.convertTokenLeadingComments(token, fullStart); - - var result = new TypeScript.NumericLiteral(token.value(), token.text(), token.valueText()); - - result.setPreComments(preComments); - return result; - case 11 /* IdentifierName */: - return new TypeScript.Identifier(token.text()); - default: - throw TypeScript.Errors.invalidOperation(); - } - }; - - SyntaxTreeToAstVisitor.prototype.visitSourceUnit = function (node) { - var start = this.position; - TypeScript.Debug.assert(start === 0); - - var bod = this.visitSyntaxList(node.moduleElements); - var comments = this.convertTokenLeadingComments(node.endOfFileToken, TypeScript.Syntax.childOffset(node, node.endOfFileToken)); - var result = new TypeScript.SourceUnit(bod, comments, this.fileName); - this.setSpanExplicit(result, start, start + node.fullWidth()); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitExternalModuleReference = function (node) { - var start = this.position; - - this.moveTo(node, node.stringLiteral); - var stringLiteral = node.stringLiteral.accept(this); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ExternalModuleReference(stringLiteral); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitModuleNameModuleReference = function (node) { - var start = this.position; - var moduleName = node.moduleName.accept(this); - - var result = new TypeScript.ModuleNameModuleReference(moduleName); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitClassDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var heritageClauses = node.heritageClauses ? this.visitSyntaxList(node.heritageClauses) : null; - - this.movePast(node.openBraceToken); - var members = this.visitSyntaxList(node.classElements); - - var closeBraceToken = this.createTokenSpan(this.position, node.closeBraceToken); - this.movePast(node.closeBraceToken); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.ClassDeclaration(modifiers, name, typeParameters, heritageClauses, members, closeBraceToken); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitModifiers = function (modifiers) { - var result = null; - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 47 /* ExportKeyword */)) { - result = result || []; - result.push(1 /* Exported */); - } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 63 /* DeclareKeyword */)) { - result = result || []; - result.push(8 /* Ambient */); - } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 58 /* StaticKeyword */)) { - result = result || []; - result.push(16 /* Static */); - } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 57 /* PublicKeyword */)) { - result = result || []; - result.push(4 /* Public */); - } - - if (TypeScript.SyntaxUtilities.containsToken(modifiers, 55 /* PrivateKeyword */)) { - result = result || []; - result.push(2 /* Private */); - } - - return result || TypeScript.sentinelEmptyArray; - }; - - SyntaxTreeToAstVisitor.prototype.visitInterfaceDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var heritageClauses = node.heritageClauses ? this.visitSyntaxList(node.heritageClauses) : null; - - var body = this.visitObjectType(node.body); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.InterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, body); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitHeritageClause = function (node) { - var start = this.position; - - this.movePast(node.extendsOrImplementsKeyword); - var typeNames = this.visitSeparatedSyntaxList(node.typeNames); - - var result = new TypeScript.HeritageClause(node.extendsOrImplementsKeyword.tokenKind === 48 /* ExtendsKeyword */ ? 230 /* ExtendsHeritageClause */ : 231 /* ImplementsHeritageClause */, typeNames); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitModuleDeclaration = function (node) { - var start = this.position; - - var modifiers = this.visitModifiers(node.modifiers); - - this.moveTo(node, node.moduleKeyword); - this.movePast(node.moduleKeyword); - - var moduleName = node.name ? node.name.accept(this) : null; - var stringLiteral = node.stringLiteral ? node.stringLiteral.accept(this) : null; - - this.movePast(node.openBraceToken); - - var moduleElements = this.visitSyntaxList(node.moduleElements); - - var closeBraceToken = this.createTokenSpan(this.position, node.closeBraceToken); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.ModuleDeclaration(modifiers, moduleName, stringLiteral, moduleElements, closeBraceToken); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - - var callSignature = this.visitCallSignature(node.callSignature); - var block = node.block ? this.visitBlock(node.block) : null; - - this.movePast(node.semicolonToken); - - var result = new TypeScript.FunctionDeclaration(this.visitModifiers(node.modifiers), name, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEnumDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var identifier = this.visitIdentifier(node.identifier); - - this.movePast(node.openBraceToken); - - var enumElements = this.visitSeparatedSyntaxList(node.enumElements); - - this.movePast(node.closeBraceToken); - - var result = new TypeScript.EnumDeclaration(this.visitModifiers(node.modifiers), identifier, enumElements); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEnumElement = function (node) { - var start = this.position; - - var memberName = this.visitToken(node.propertyName); - - var value = node.equalsValueClause !== null ? this.visitEqualsValueClause(node.equalsValueClause) : null; - - var result = new TypeScript.EnumElement(memberName, value); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitImportDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - this.movePast(node.equalsToken); - var alias = node.moduleReference.accept(this); - this.movePast(node.semicolonToken); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.ImportDeclaration(modifiers, name, alias); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitExportAssignment = function (node) { - var start = this.position; - - this.moveTo(node, node.identifier); - var name = this.visitIdentifier(node.identifier); - this.movePast(node.semicolonToken); - - var result = new TypeScript.ExportAssignment(name); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVariableStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.variableDeclaration); - - var declaration = node.variableDeclaration.accept(this); - this.movePast(node.semicolonToken); - - var modifiers = this.visitModifiers(node.modifiers); - - var result = new TypeScript.VariableStatement(modifiers, declaration); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVariableDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.variableDeclarators); - var variableDecls = this.visitSeparatedSyntaxList(node.variableDeclarators); - - var result = new TypeScript.VariableDeclaration(variableDecls); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVariableDeclarator = function (node) { - var start = this.position; - var propertyName = this.visitToken(node.propertyName); - var typeExpr = this.visitTypeAnnotation(node.typeAnnotation); - var init = node.equalsValueClause ? this.visitEqualsValueClause(node.equalsValueClause) : null; - - var result = new TypeScript.VariableDeclarator(propertyName, typeExpr, init); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEqualsValueClause = function (node) { - var start = this.position; - var afterEqualsComments = this.convertTokenTrailingComments(node.equalsToken, this.position + node.equalsToken.leadingTriviaWidth() + node.equalsToken.width()); - - this.movePast(node.equalsToken); - var value = node.value.accept(this); - value.setPreComments(this.mergeComments(afterEqualsComments, value.preComments())); - - var result = new TypeScript.EqualsValueClause(value); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitPrefixUnaryExpression = function (node) { - var start = this.position; - - this.movePast(node.operatorToken); - var operand = node.operand.accept(this); - - var result = new TypeScript.PrefixUnaryExpression(node.kind(), operand); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitArrayLiteralExpression = function (node) { - var start = this.position; - var openStart = this.position + node.openBracketToken.leadingTriviaWidth(); - this.movePast(node.openBracketToken); - - var expressions = this.visitSeparatedSyntaxList(node.expressions); - - var closeStart = this.position + node.closeBracketToken.leadingTriviaWidth(); - this.movePast(node.closeBracketToken); - - var result = new TypeScript.ArrayLiteralExpression(expressions); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitOmittedExpression = function (node) { - var start = this.position; - - var result = new TypeScript.OmittedExpression(); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParenthesizedExpression = function (node) { - var start = this.position; - - var openParenToken = node.openParenToken; - var openParenTrailingComments = this.convertTokenTrailingComments(openParenToken, start + openParenToken.leadingTriviaWidth() + openParenToken.width()); - - this.movePast(openParenToken); - - var expr = node.expression.accept(this); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ParenthesizedExpression(openParenTrailingComments, expr); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSimpleArrowFunctionExpression = function (node) { - var start = this.position; - - var identifier = node.identifier.accept(this); - this.movePast(node.equalsGreaterThanToken); - - var block = node.block ? this.visitBlock(node.block) : null; - var expression = node.expression ? node.expression.accept(this) : null; - - var result = new TypeScript.SimpleArrowFunctionExpression(identifier, block, expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - var start = this.position; - - var callSignature = this.visitCallSignature(node.callSignature); - this.movePast(node.equalsGreaterThanToken); - - var block = node.block ? this.visitBlock(node.block) : null; - var expression = node.expression ? node.expression.accept(this) : null; - - var result = new TypeScript.ParenthesizedArrowFunctionExpression(callSignature, block, expression); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitType = function (type) { - return type ? type.accept(this) : null; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeQuery = function (node) { - var start = this.position; - this.movePast(node.typeOfKeyword); - var name = node.name.accept(this); - - var result = new TypeScript.TypeQuery(name); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitQualifiedName = function (node) { - var start = this.position; - var left = this.visitType(node.left); - this.movePast(node.dotToken); - var right = this.visitIdentifier(node.right); - - var result = new TypeScript.QualifiedName(left, right); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeArgumentList = function (node) { - if (node === null) { - return null; - } - - var start = this.position; - this.movePast(node.lessThanToken); - var typeArguments = this.visitSeparatedSyntaxList(node.typeArguments); - this.movePast(node.greaterThanToken); - - var result = new TypeScript.TypeArgumentList(typeArguments); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstructorType = function (node) { - var start = this.position; - - this.movePast(node.newKeyword); - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var parameters = this.visitParameterList(node.parameterList); - this.movePast(node.equalsGreaterThanToken); - var returnType = this.visitType(node.type); - - var result = new TypeScript.ConstructorType(typeParameters, parameters, returnType); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionType = function (node) { - var start = this.position; - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var parameters = this.visitParameterList(node.parameterList); - this.movePast(node.equalsGreaterThanToken); - var returnType = this.visitType(node.type); - - var result = new TypeScript.FunctionType(typeParameters, parameters, returnType); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitObjectType = function (node) { - var start = this.position; - - this.movePast(node.openBraceToken); - var typeMembers = this.visitSeparatedSyntaxList(node.typeMembers); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.ObjectType(typeMembers); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitArrayType = function (node) { - var start = this.position; - - var underlying = this.visitType(node.type); - this.movePast(node.openBracketToken); - this.movePast(node.closeBracketToken); - - var result = new TypeScript.ArrayType(underlying); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitGenericType = function (node) { - var start = this.position; - - var underlying = this.visitType(node.name); - var typeArguments = this.visitTypeArgumentList(node.typeArgumentList); - - var result = new TypeScript.GenericType(underlying, typeArguments); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeAnnotation = function (node) { - if (!node) { - return null; - } - - var start = this.position; - this.movePast(node.colonToken); - var type = this.visitType(node.type); - - var result = new TypeScript.TypeAnnotation(type); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitBlock = function (node) { - if (!node) { - return null; - } - - var start = this.position; - - this.movePast(node.openBraceToken); - var statements = this.visitSyntaxList(node.statements); - var closeBracePosition = this.position; - - var closeBraceLeadingComments = this.convertTokenLeadingComments(node.closeBraceToken, this.position); - var closeBraceToken = this.createTokenSpan(this.position, node.closeBraceToken); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.Block(statements, closeBraceLeadingComments, closeBraceToken); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParameter = function (node) { - var start = this.position; - - var dotDotDotToken = this.createTokenSpan(this.position, node.dotDotDotToken); - - this.moveTo(node, node.identifier); - var identifier = this.visitIdentifier(node.identifier); - - var questionToken = this.createTokenSpan(this.position, node.questionToken); - this.movePast(node.questionToken); - var typeExpr = this.visitTypeAnnotation(node.typeAnnotation); - var init = node.equalsValueClause ? node.equalsValueClause.accept(this) : null; - - var modifiers = this.visitModifiers(node.modifiers); - - var result = new TypeScript.Parameter(dotDotDotToken, modifiers, identifier, questionToken, typeExpr, init); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMemberAccessExpression = function (node) { - var start = this.position; - - var expression = node.expression.accept(this); - this.movePast(node.dotToken); - var name = this.visitIdentifier(node.name); - - var result = new TypeScript.MemberAccessExpression(expression, name); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitPostfixUnaryExpression = function (node) { - var start = this.position; - - var operand = node.operand.accept(this); - this.movePast(node.operatorToken); - - var result = new TypeScript.PostfixUnaryExpression(node.kind() === 210 /* PostIncrementExpression */ ? 210 /* PostIncrementExpression */ : 211 /* PostDecrementExpression */, operand); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitElementAccessExpression = function (node) { - var start = this.position; - - var expression = node.expression.accept(this); - this.movePast(node.openBracketToken); - var argumentExpression = node.argumentExpression.accept(this); - this.movePast(node.closeBracketToken); - - var result = new TypeScript.ElementAccessExpression(expression, argumentExpression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitInvocationExpression = function (node) { - var start = this.position; - - var expression = node.expression.accept(this); - var argumentList = this.visitArgumentList(node.argumentList); - - var result = new TypeScript.InvocationExpression(expression, argumentList); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitArgumentList = function (node) { - if (node === null) { - return null; - } - - var start = this.position; - - var typeArguments = this.visitTypeArgumentList(node.typeArgumentList); - - this.movePast(node.openParenToken); - - var _arguments = this.visitSeparatedSyntaxList(node.arguments); - - if (node.arguments.fullWidth() === 0 && node.closeParenToken.fullWidth() === 0) { - var openParenTokenEnd = start + node.openParenToken.leadingTriviaWidth() + node.openParenToken.width(); - this.setSpanExplicit(_arguments, openParenTokenEnd, openParenTokenEnd + node.openParenToken.trailingTriviaWidth()); - } - - var closeParenToken = this.createTokenSpan(this.position, node.closeParenToken); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ArgumentList(typeArguments, _arguments, closeParenToken); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitBinaryExpression = function (node) { - var start = this.position; - - var left = node.left.accept(this); - this.movePast(node.operatorToken); - var right = node.right.accept(this); - - var result = new TypeScript.BinaryExpression(node.kind(), left, right); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConditionalExpression = function (node) { - var start = this.position; - - var condition = node.condition.accept(this); - this.movePast(node.questionToken); - var whenTrue = node.whenTrue.accept(this); - this.movePast(node.colonToken); - var whenFalse = node.whenFalse.accept(this); - - var result = new TypeScript.ConditionalExpression(condition, whenTrue, whenFalse); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstructSignature = function (node) { - var start = this.position; - - this.movePast(node.newKeyword); - var callSignature = this.visitCallSignature(node.callSignature); - - var result = new TypeScript.ConstructSignature(callSignature); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMethodSignature = function (node) { - var start = this.position; - - var name = this.visitToken(node.propertyName); - - var questionToken = this.createTokenSpan(this.position, node.questionToken); - this.movePast(node.questionToken); - - var callSignature = this.visitCallSignature(node.callSignature); - - var result = new TypeScript.MethodSignature(name, questionToken, callSignature); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitIndexSignature = function (node) { - var start = this.position; - - this.movePast(node.openBracketToken); - - var parameter = node.parameter.accept(this); - - this.movePast(node.closeBracketToken); - var returnType = this.visitTypeAnnotation(node.typeAnnotation); - - var result = new TypeScript.IndexSignature(parameter, returnType); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitPropertySignature = function (node) { - var start = this.position; - - var name = this.visitToken(node.propertyName); - - var questionToken = this.createTokenSpan(this.position, node.questionToken); - this.movePast(node.questionToken); - var typeExpr = this.visitTypeAnnotation(node.typeAnnotation); - - var result = new TypeScript.PropertySignature(name, questionToken, typeExpr); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitParameterList = function (node) { - if (!node) { - return null; - } - - var start = this.position; - - var openParenToken = node.openParenToken; - - this.previousTokenTrailingComments = this.convertTokenTrailingComments(openParenToken, start + openParenToken.leadingTriviaWidth() + openParenToken.width()); - var openParenTrailingComments = null; - if (node.parameters.childCount() === 0) { - openParenTrailingComments = this.previousTokenTrailingComments; - this.previousTokenTrailingComments = null; - } - - this.movePast(node.openParenToken); - var parameters = this.visitSeparatedSyntaxList(node.parameters); - this.movePast(node.closeParenToken); - - var result = new TypeScript.ParameterList(openParenTrailingComments, parameters); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCallSignature = function (node) { - var start = this.position; - - var typeParameters = this.visitTypeParameterList(node.typeParameterList); - var parameters = this.visitParameterList(node.parameterList); - var returnType = this.visitTypeAnnotation(node.typeAnnotation); - - var result = new TypeScript.CallSignature(typeParameters, parameters, returnType); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeParameterList = function (node) { - if (!node) { - return null; - } - - var start = this.position; - this.movePast(node.lessThanToken); - var typeParameters = this.visitSeparatedSyntaxList(node.typeParameters); - this.movePast(node.greaterThanToken); - - var result = new TypeScript.TypeParameterList(typeParameters); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeParameter = function (node) { - var start = this.position; - - var identifier = this.visitIdentifier(node.identifier); - var constraint = node.constraint ? node.constraint.accept(this) : null; - - var result = new TypeScript.TypeParameter(identifier, constraint); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstraint = function (node) { - var start = this.position; - this.movePast(node.extendsKeyword); - var type = this.visitType(node.type); - - var result = new TypeScript.Constraint(type); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitIfStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.condition); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - var thenBod = node.statement.accept(this); - var elseBod = node.elseClause ? node.elseClause.accept(this) : null; - - var result = new TypeScript.IfStatement(condition, thenBod, elseBod); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitElseClause = function (node) { - var start = this.position; - - this.movePast(node.elseKeyword); - var statement = node.statement.accept(this); - - var result = new TypeScript.ElseClause(statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitExpressionStatement = function (node) { - var start = this.position; - - var preComments = this.convertTokenLeadingComments(node.firstToken(), start); - var expression = node.expression.accept(this); - - var semicolonPosition = this.position; - - var postComments = this.convertComments(node.semicolonToken.trailingTrivia(), this.position + node.semicolonToken.leadingTriviaWidth() + node.semicolonToken.width()); - this.movePast(node.semicolonToken); - - var result = new TypeScript.ExpressionStatement(expression); - this.setSpan(result, start, node); - - result.setPreComments(preComments); - result.setPostComments(postComments); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitConstructorDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.callSignature); - var callSignature = this.visitCallSignature(node.callSignature); - - var block = node.block ? node.block.accept(this) : null; - - this.movePast(node.semicolonToken); - - var result = new TypeScript.ConstructorDeclaration(callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitIndexMemberDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.indexSignature); - var indexSignature = node.indexSignature.accept(this); - - this.movePast(node.semicolonToken); - - var result = new TypeScript.IndexMemberDeclaration(indexSignature); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMemberFunctionDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.propertyName); - var name = this.visitToken(node.propertyName); - - var callSignature = this.visitCallSignature(node.callSignature); - var block = node.block ? this.visitBlock(node.block) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.MemberFunctionDeclaration(this.visitModifiers(node.modifiers), name, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitGetAccessor = function (node) { - var start = this.position; - - this.moveTo(node, node.propertyName); - var name = this.visitToken(node.propertyName); - var parameters = this.visitParameterList(node.parameterList); - var returnType = this.visitTypeAnnotation(node.typeAnnotation); - - var block = node.block ? node.block.accept(this) : null; - var result = new TypeScript.GetAccessor(this.visitModifiers(node.modifiers), name, parameters, returnType, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSetAccessor = function (node) { - var start = this.position; - - this.moveTo(node, node.propertyName); - var name = this.visitToken(node.propertyName); - var parameters = this.visitParameterList(node.parameterList); - var block = node.block ? node.block.accept(this) : null; - var result = new TypeScript.SetAccessor(this.visitModifiers(node.modifiers), name, parameters, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitMemberVariableDeclaration = function (node) { - var start = this.position; - - this.moveTo(node, node.variableDeclarator); - var variableDeclarator = node.variableDeclarator.accept(this); - this.movePast(node.semicolonToken); - - var modifiers = this.visitModifiers(node.modifiers); - var result = new TypeScript.MemberVariableDeclaration(modifiers, variableDeclarator); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitThrowStatement = function (node) { - var start = this.position; - - this.movePast(node.throwKeyword); - var expression = node.expression.accept(this); - this.movePast(node.semicolonToken); - - var result = new TypeScript.ThrowStatement(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitReturnStatement = function (node) { - var start = this.position; - - this.movePast(node.returnKeyword); - var expression = node.expression ? node.expression.accept(this) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.ReturnStatement(expression); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitObjectCreationExpression = function (node) { - var start = this.position; - - this.movePast(node.newKeyword); - var expression = node.expression.accept(this); - var argumentList = this.visitArgumentList(node.argumentList); - - var result = new TypeScript.ObjectCreationExpression(expression, argumentList); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSwitchStatement = function (node) { - var start = this.position; - - this.movePast(node.switchKeyword); - this.movePast(node.openParenToken); - var expression = node.expression.accept(this); - - var closeParenToken = this.createTokenSpan(this.position, node.closeParenToken); - this.movePast(node.closeParenToken); - this.movePast(node.openBraceToken); - var switchClauses = this.visitSyntaxList(node.switchClauses); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.SwitchStatement(expression, closeParenToken, switchClauses); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCaseSwitchClause = function (node) { - var start = this.position; - - this.movePast(node.caseKeyword); - var expression = node.expression.accept(this); - this.movePast(node.colonToken); - var statements = this.visitSyntaxList(node.statements); - - var result = new TypeScript.CaseSwitchClause(expression, statements); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDefaultSwitchClause = function (node) { - var start = this.position; - - this.movePast(node.defaultKeyword); - this.movePast(node.colonToken); - var statements = this.visitSyntaxList(node.statements); - - var result = new TypeScript.DefaultSwitchClause(statements); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitBreakStatement = function (node) { - var start = this.position; - - this.movePast(node.breakKeyword); - var identifier = node.identifier ? node.identifier.accept(this) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.BreakStatement(identifier); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitContinueStatement = function (node) { - var start = this.position; - - this.movePast(node.continueKeyword); - var identifier = node.identifier ? node.identifier.accept(this) : null; - this.movePast(node.semicolonToken); - - var result = new TypeScript.ContinueStatement(identifier); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitForStatement = function (node) { - var start = this.position; - - this.movePast(node.forKeyword); - this.movePast(node.openParenToken); - var variableDeclaration = node.variableDeclaration ? node.variableDeclaration.accept(this) : null; - var initializer = node.initializer ? node.initializer.accept(this) : null; - - this.movePast(node.firstSemicolonToken); - var cond = node.condition ? node.condition.accept(this) : null; - this.movePast(node.secondSemicolonToken); - var incr = node.incrementor ? node.incrementor.accept(this) : null; - this.movePast(node.closeParenToken); - var body = node.statement.accept(this); - - var result = new TypeScript.ForStatement(variableDeclaration, initializer, cond, incr, body); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitForInStatement = function (node) { - var start = this.position; - - this.movePast(node.forKeyword); - this.movePast(node.openParenToken); - var variableDeclaration = node.variableDeclaration ? node.variableDeclaration.accept(this) : null; - var left = node.left ? node.left.accept(this) : null; - - this.movePast(node.inKeyword); - var expression = node.expression.accept(this); - this.movePast(node.closeParenToken); - var body = node.statement.accept(this); - - var result = new TypeScript.ForInStatement(variableDeclaration, left, expression, body); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitWhileStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.condition); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - var statement = node.statement.accept(this); - - var result = new TypeScript.WhileStatement(condition, statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitWithStatement = function (node) { - var start = this.position; - - this.moveTo(node, node.condition); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - var statement = node.statement.accept(this); - - var result = new TypeScript.WithStatement(condition, statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCastExpression = function (node) { - var start = this.position; - - this.movePast(node.lessThanToken); - var castTerm = this.visitType(node.type); - this.movePast(node.greaterThanToken); - var expression = node.expression.accept(this); - - var result = new TypeScript.CastExpression(castTerm, expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitObjectLiteralExpression = function (node) { - var start = this.position; - - var openStart = this.position + node.openBraceToken.leadingTriviaWidth(); - this.movePast(node.openBraceToken); - - var propertyAssignments = this.visitSeparatedSyntaxList(node.propertyAssignments); - - var closeStart = this.position + node.closeBraceToken.leadingTriviaWidth(); - this.movePast(node.closeBraceToken); - - var result = new TypeScript.ObjectLiteralExpression(propertyAssignments); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitSimplePropertyAssignment = function (node) { - var start = this.position; - - var preComments = this.convertTokenLeadingComments(node.firstToken(), start); - var postComments = this.convertNodeTrailingComments(node, node.lastToken(), start); - - var propertyName = node.propertyName.accept(this); - - var afterColonComments = this.convertTokenTrailingComments(node.colonToken, this.position + node.colonToken.leadingTriviaWidth() + node.colonToken.width()); - - this.movePast(node.colonToken); - var expression = node.expression.accept(this); - expression.setPreComments(this.mergeComments(afterColonComments, expression.preComments())); - - var result = new TypeScript.SimplePropertyAssignment(propertyName, expression); - this.setSpan(result, start, node); - - result.setPreComments(preComments); - result.setPostComments(postComments); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionPropertyAssignment = function (node) { - var start = this.position; - - var propertyName = node.propertyName.accept(this); - var callSignature = this.visitCallSignature(node.callSignature); - var block = this.visitBlock(node.block); - - var result = new TypeScript.FunctionPropertyAssignment(propertyName, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFunctionExpression = function (node) { - var start = this.position; - - this.movePast(node.functionKeyword); - var name = node.identifier === null ? null : this.visitIdentifier(node.identifier); - - var callSignature = this.visitCallSignature(node.callSignature); - var block = node.block ? node.block.accept(this) : null; - - var result = new TypeScript.FunctionExpression(name, callSignature, block); - this.setCommentsAndSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitEmptyStatement = function (node) { - var start = this.position; - - this.movePast(node.semicolonToken); - - var result = new TypeScript.EmptyStatement(); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTryStatement = function (node) { - var start = this.position; - - this.movePast(node.tryKeyword); - var tryBody = node.block.accept(this); - - var catchClause = null; - if (node.catchClause !== null) { - catchClause = node.catchClause.accept(this); - } - - var finallyBody = null; - if (node.finallyClause !== null) { - finallyBody = node.finallyClause.accept(this); - } - - var result = new TypeScript.TryStatement(tryBody, catchClause, finallyBody); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitCatchClause = function (node) { - var start = this.position; - - this.movePast(node.catchKeyword); - this.movePast(node.openParenToken); - var identifier = this.visitIdentifier(node.identifier); - var typeAnnotation = this.visitTypeAnnotation(node.typeAnnotation); - this.movePast(node.closeParenToken); - var block = node.block.accept(this); - - var result = new TypeScript.CatchClause(identifier, typeAnnotation, block); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitFinallyClause = function (node) { - var start = this.position; - this.movePast(node.finallyKeyword); - var block = node.block.accept(this); - - var result = new TypeScript.FinallyClause(block); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitLabeledStatement = function (node) { - var start = this.position; - - var identifier = this.visitIdentifier(node.identifier); - this.movePast(node.colonToken); - var statement = node.statement.accept(this); - - var result = new TypeScript.LabeledStatement(identifier, statement); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDoStatement = function (node) { - var start = this.position; - - this.movePast(node.doKeyword); - var statement = node.statement.accept(this); - var whileKeyword = this.createTokenSpan(this.position, node.whileKeyword); - - this.movePast(node.whileKeyword); - this.movePast(node.openParenToken); - var condition = node.condition.accept(this); - this.movePast(node.closeParenToken); - this.movePast(node.semicolonToken); - - var result = new TypeScript.DoStatement(statement, whileKeyword, condition); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitTypeOfExpression = function (node) { - var start = this.position; - - this.movePast(node.typeOfKeyword); - var expression = node.expression.accept(this); - - var result = new TypeScript.TypeOfExpression(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDeleteExpression = function (node) { - var start = this.position; - - this.movePast(node.deleteKeyword); - var expression = node.expression.accept(this); - - var result = new TypeScript.DeleteExpression(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitVoidExpression = function (node) { - var start = this.position; - - this.movePast(node.voidKeyword); - var expression = node.expression.accept(this); - - var result = new TypeScript.VoidExpression(expression); - this.setSpan(result, start, node); - - return result; - }; - - SyntaxTreeToAstVisitor.prototype.visitDebuggerStatement = function (node) { - var start = this.position; - - this.movePast(node.debuggerKeyword); - this.movePast(node.semicolonToken); - - var result = new TypeScript.DebuggerStatement(); - this.setSpan(result, start, node); - - return result; - }; - return SyntaxTreeToAstVisitor; - })(); - TypeScript.SyntaxTreeToAstVisitor = SyntaxTreeToAstVisitor; - - function applyDelta(ast, delta) { - if (ast) { - if (ast._start !== -1) { - ast._start += delta; - } - - if (ast._end !== -1) { - ast._end += delta; - } - } - } - - function applyDeltaToComments(comments, delta) { - if (comments && comments.length > 0) { - for (var i = 0; i < comments.length; i++) { - var comment = comments[i]; - applyDelta(comment, delta); - } - } - } - - var SyntaxTreeToIncrementalAstVisitor = (function (_super) { - __extends(SyntaxTreeToIncrementalAstVisitor, _super); - function SyntaxTreeToIncrementalAstVisitor() { - _super.apply(this, arguments); - } - SyntaxTreeToIncrementalAstVisitor.prototype.applyDelta = function (ast, delta) { - if (delta === 0) { - return; - } - - var pre = function (cur) { - applyDelta(cur, delta); - applyDeltaToComments(cur.preComments(), delta); - applyDeltaToComments(cur.postComments(), delta); - - switch (cur.kind()) { - case 146 /* Block */: - applyDelta(cur.closeBraceToken, delta); - break; - - case 226 /* ArgumentList */: - applyDelta(cur.closeParenToken, delta); - break; - - case 130 /* ModuleDeclaration */: - applyDelta(cur.endingToken, delta); - break; - - case 131 /* ClassDeclaration */: - applyDelta(cur.closeBraceToken, delta); - break; - - case 161 /* DoStatement */: - applyDelta(cur.whileKeyword, delta); - break; - - case 151 /* SwitchStatement */: - applyDelta(cur.closeParenToken, delta); - break; - } - }; - - TypeScript.getAstWalkerFactory().simpleWalk(ast, pre); - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.setSpanExplicit = function (span, start, end) { - if (span._start !== -1) { - var delta = start - span._start; - this.applyDelta(span, delta); - - span._end = end; - } else { - _super.prototype.setSpanExplicit.call(this, span, start, end); - } - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.getAndMovePastAST = function (element) { - if (this.previousTokenTrailingComments !== null) { - return null; - } - - var result = element._ast; - if (!result) { - return null; - } - - var start = this.position; - this.movePast(element); - this.setSpan(result, start, element); - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.setAST = function (element, ast) { - element._ast = ast; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSyntaxList = function (list) { - var result = this.getAndMovePastAST(list); - if (!result) { - result = _super.prototype.visitSyntaxList.call(this, list); - - if (list.childCount() > 0) { - this.setAST(list, result); - } - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSeparatedSyntaxList = function (list) { - var result = this.getAndMovePastAST(list); - if (!result) { - result = _super.prototype.visitSeparatedSyntaxList.call(this, list); - - if (list.childCount() > 0) { - this.setAST(list, result); - } - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitToken = function (token) { - var result = this.getAndMovePastAST(token); - - if (!result) { - result = _super.prototype.visitToken.call(this, token); - this.setAST(token, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitClassDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitClassDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitInterfaceDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitInterfaceDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitHeritageClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitHeritageClause.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitModuleDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitModuleDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitImportDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitImportDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitExportAssignment = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitExportAssignment.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitPrefixUnaryExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitPrefixUnaryExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitArrayLiteralExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitArrayLiteralExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitOmittedExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitOmittedExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitParenthesizedExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitParenthesizedExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSimpleArrowFunctionExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSimpleArrowFunctionExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitParenthesizedArrowFunctionExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitQualifiedName = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - var result = _super.prototype.visitQualifiedName.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConstructorType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConstructorType.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionType.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitObjectType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitObjectType.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitArrayType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitArrayType.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitGenericType = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitGenericType.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitBlock = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitBlock.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitParameter = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitParameter.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMemberAccessExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMemberAccessExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitPostfixUnaryExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitPostfixUnaryExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitElementAccessExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitElementAccessExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitInvocationExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitInvocationExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitBinaryExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitBinaryExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConditionalExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConditionalExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConstructSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConstructSignature.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMethodSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMethodSignature.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitIndexSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitIndexSignature.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitPropertySignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitPropertySignature.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCallSignature = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCallSignature.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitTypeParameter = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitTypeParameter.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitIfStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitIfStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitExpressionStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitExpressionStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitConstructorDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitConstructorDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMemberFunctionDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMemberFunctionDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitGetAccessor = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitGetAccessor.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSetAccessor = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSetAccessor.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitMemberVariableDeclaration = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitMemberVariableDeclaration.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitThrowStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitThrowStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitReturnStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitReturnStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitObjectCreationExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitObjectCreationExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSwitchStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSwitchStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCaseSwitchClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCaseSwitchClause.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDefaultSwitchClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDefaultSwitchClause.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitBreakStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitBreakStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitContinueStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitContinueStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitForStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitForStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitForInStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitForInStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitWhileStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitWhileStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitWithStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitWithStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCastExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCastExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitObjectLiteralExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitObjectLiteralExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitSimplePropertyAssignment = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitSimplePropertyAssignment.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionPropertyAssignment = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionPropertyAssignment.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitFunctionExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitFunctionExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitEmptyStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitEmptyStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitTryStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitTryStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitCatchClause = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitCatchClause.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitLabeledStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitLabeledStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDoStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDoStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitTypeOfExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitTypeOfExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDeleteExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDeleteExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitVoidExpression = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitVoidExpression.call(this, node); - this.setAST(node, result); - } - - return result; - }; - - SyntaxTreeToIncrementalAstVisitor.prototype.visitDebuggerStatement = function (node) { - var result = this.getAndMovePastAST(node); - if (!result) { - result = _super.prototype.visitDebuggerStatement.call(this, node); - this.setAST(node, result); - } - - return result; - }; - return SyntaxTreeToIncrementalAstVisitor; - })(SyntaxTreeToAstVisitor); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ASTSpan = (function () { - function ASTSpan(_start, _end) { - this._start = _start; - this._end = _end; - } - ASTSpan.prototype.start = function () { - return this._start; - }; - - ASTSpan.prototype.end = function () { - return this._end; - }; - return ASTSpan; - })(); - TypeScript.ASTSpan = ASTSpan; - - var astID = 0; - - function structuralEqualsNotIncludingPosition(ast1, ast2) { - return structuralEquals(ast1, ast2, false); - } - TypeScript.structuralEqualsNotIncludingPosition = structuralEqualsNotIncludingPosition; - - function structuralEqualsIncludingPosition(ast1, ast2) { - return structuralEquals(ast1, ast2, true); - } - TypeScript.structuralEqualsIncludingPosition = structuralEqualsIncludingPosition; - - function commentStructuralEqualsNotIncludingPosition(ast1, ast2) { - return commentStructuralEquals(ast1, ast2, false); - } - - function commentStructuralEqualsIncludingPosition(ast1, ast2) { - return commentStructuralEquals(ast1, ast2, true); - } - - function structuralEquals(ast1, ast2, includingPosition) { - if (ast1 === ast2) { - return true; - } - - return ast1 !== null && ast2 !== null && ast1.kind() === ast2.kind() && ast1.structuralEquals(ast2, includingPosition); - } - - function commentStructuralEquals(ast1, ast2, includingPosition) { - if (ast1 === ast2) { - return true; - } - - return ast1 !== null && ast2 !== null && ast1.structuralEquals(ast2, includingPosition); - } - - function astArrayStructuralEquals(array1, array2, includingPosition) { - return TypeScript.ArrayUtilities.sequenceEquals(array1, array2, includingPosition ? structuralEqualsIncludingPosition : structuralEqualsNotIncludingPosition); - } - - function commentArrayStructuralEquals(array1, array2, includingPosition) { - return TypeScript.ArrayUtilities.sequenceEquals(array1, array2, includingPosition ? commentStructuralEqualsIncludingPosition : commentStructuralEqualsNotIncludingPosition); - } - - var AST = (function () { - function AST() { - this.parent = null; - this._start = -1; - this._end = -1; - this._trailingTriviaWidth = 0; - this._astID = astID++; - this._preComments = null; - this._postComments = null; - } - AST.prototype.syntaxID = function () { - return this._astID; - }; - - AST.prototype.start = function () { - return this._start; - }; - - AST.prototype.end = function () { - return this._end; - }; - - AST.prototype.trailingTriviaWidth = function () { - return this._trailingTriviaWidth; - }; - - AST.prototype.fileName = function () { - return this.parent.fileName(); - }; - - AST.prototype.kind = function () { - throw TypeScript.Errors.abstract(); - }; - - AST.prototype.preComments = function () { - return this._preComments; - }; - - AST.prototype.postComments = function () { - return this._postComments; - }; - - AST.prototype.setPreComments = function (comments) { - if (comments && comments.length) { - this._preComments = comments; - } else if (this._preComments) { - this._preComments = null; - } - }; - - AST.prototype.setPostComments = function (comments) { - if (comments && comments.length) { - this._postComments = comments; - } else if (this._postComments) { - this._postComments = null; - } - }; - - AST.prototype.width = function () { - return this.end() - this.start(); - }; - - AST.prototype.structuralEquals = function (ast, includingPosition) { - if (includingPosition) { - if (this.start() !== ast.start() || this.end() !== ast.end()) { - return false; - } - } - - return commentArrayStructuralEquals(this.preComments(), ast.preComments(), includingPosition) && commentArrayStructuralEquals(this.postComments(), ast.postComments(), includingPosition); - }; - - AST.prototype.isExpression = function () { - return false; - }; - return AST; - })(); - TypeScript.AST = AST; - - var ISyntaxList2 = (function (_super) { - __extends(ISyntaxList2, _super); - function ISyntaxList2(_fileName, members) { - _super.call(this); - this._fileName = _fileName; - this.members = members; - - for (var i = 0, n = members.length; i < n; i++) { - members[i].parent = this; - } - } - ISyntaxList2.prototype.childCount = function () { - return this.members.length; - }; - - ISyntaxList2.prototype.childAt = function (index) { - return this.members[index]; - }; - - ISyntaxList2.prototype.fileName = function () { - return this._fileName; - }; - - ISyntaxList2.prototype.kind = function () { - return 1 /* List */; - }; - - ISyntaxList2.prototype.firstOrDefault = function (func) { - return TypeScript.ArrayUtilities.firstOrDefault(this.members, func); - }; - - ISyntaxList2.prototype.lastOrDefault = function (func) { - return TypeScript.ArrayUtilities.lastOrDefault(this.members, func); - }; - - ISyntaxList2.prototype.any = function (func) { - return TypeScript.ArrayUtilities.any(this.members, func); - }; - - ISyntaxList2.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && astArrayStructuralEquals(this.members, ast.members, includingPosition); - }; - return ISyntaxList2; - })(AST); - TypeScript.ISyntaxList2 = ISyntaxList2; - - var ISeparatedSyntaxList2 = (function (_super) { - __extends(ISeparatedSyntaxList2, _super); - function ISeparatedSyntaxList2(_fileName, members, _separatorCount) { - _super.call(this); - this._fileName = _fileName; - this.members = members; - this._separatorCount = _separatorCount; - - for (var i = 0, n = members.length; i < n; i++) { - members[i].parent = this; - } - } - ISeparatedSyntaxList2.prototype.nonSeparatorCount = function () { - return this.members.length; - }; - - ISeparatedSyntaxList2.prototype.separatorCount = function () { - return this._separatorCount; - }; - - ISeparatedSyntaxList2.prototype.nonSeparatorAt = function (index) { - return this.members[index]; - }; - - ISeparatedSyntaxList2.prototype.nonSeparatorIndexOf = function (ast) { - for (var i = 0, n = this.nonSeparatorCount(); i < n; i++) { - if (this.nonSeparatorAt(i) === ast) { - return i; - } - } - - return -1; - }; - - ISeparatedSyntaxList2.prototype.fileName = function () { - return this._fileName; - }; - - ISeparatedSyntaxList2.prototype.kind = function () { - return 2 /* SeparatedList */; - }; - - ISeparatedSyntaxList2.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && astArrayStructuralEquals(this.members, ast.members, includingPosition); - }; - return ISeparatedSyntaxList2; - })(AST); - TypeScript.ISeparatedSyntaxList2 = ISeparatedSyntaxList2; - - var SourceUnit = (function (_super) { - __extends(SourceUnit, _super); - function SourceUnit(moduleElements, endOfFileTokenLeadingComments, _fileName) { - _super.call(this); - this.moduleElements = moduleElements; - this.endOfFileTokenLeadingComments = endOfFileTokenLeadingComments; - this._fileName = _fileName; - moduleElements && (moduleElements.parent = this); - } - SourceUnit.prototype.fileName = function () { - return this._fileName; - }; - - SourceUnit.prototype.kind = function () { - return 120 /* SourceUnit */; - }; - - SourceUnit.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.moduleElements, ast.moduleElements, includingPosition); - }; - return SourceUnit; - })(AST); - TypeScript.SourceUnit = SourceUnit; - - var Identifier = (function (_super) { - __extends(Identifier, _super); - function Identifier(_text) { - _super.call(this); - this._text = _text; - this._valueText = null; - } - Identifier.prototype.text = function () { - return this._text; - }; - Identifier.prototype.valueText = function () { - if (!this._valueText) { - var text = this._text; - if (text === "__proto__") { - this._valueText = "#__proto__"; - } else { - this._valueText = TypeScript.Syntax.massageEscapes(text); - } - } - - return this._valueText; - }; - - Identifier.prototype.kind = function () { - return 11 /* IdentifierName */; - }; - - Identifier.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && this._text === ast._text; - }; - - Identifier.prototype.isExpression = function () { - return true; - }; - return Identifier; - })(AST); - TypeScript.Identifier = Identifier; - - var LiteralExpression = (function (_super) { - __extends(LiteralExpression, _super); - function LiteralExpression(_nodeType, _text, _valueText) { - _super.call(this); - this._nodeType = _nodeType; - this._text = _text; - this._valueText = _valueText; - } - LiteralExpression.prototype.text = function () { - return this._text; - }; - - LiteralExpression.prototype.valueText = function () { - return this._valueText; - }; - - LiteralExpression.prototype.kind = function () { - return this._nodeType; - }; - - LiteralExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - LiteralExpression.prototype.isExpression = function () { - return true; - }; - return LiteralExpression; - })(AST); - TypeScript.LiteralExpression = LiteralExpression; - - var ThisExpression = (function (_super) { - __extends(ThisExpression, _super); - function ThisExpression(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - } - ThisExpression.prototype.text = function () { - return this._text; - }; - - ThisExpression.prototype.valueText = function () { - return this._valueText; - }; - - ThisExpression.prototype.kind = function () { - return 35 /* ThisKeyword */; - }; - - ThisExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - ThisExpression.prototype.isExpression = function () { - return true; - }; - return ThisExpression; - })(AST); - TypeScript.ThisExpression = ThisExpression; - - var SuperExpression = (function (_super) { - __extends(SuperExpression, _super); - function SuperExpression(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - } - SuperExpression.prototype.text = function () { - return this._text; - }; - - SuperExpression.prototype.valueText = function () { - return this._valueText; - }; - - SuperExpression.prototype.kind = function () { - return 50 /* SuperKeyword */; - }; - - SuperExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - SuperExpression.prototype.isExpression = function () { - return true; - }; - return SuperExpression; - })(AST); - TypeScript.SuperExpression = SuperExpression; - - var NumericLiteral = (function (_super) { - __extends(NumericLiteral, _super); - function NumericLiteral(_value, _text, _valueText) { - _super.call(this); - this._value = _value; - this._text = _text; - this._valueText = _valueText; - } - NumericLiteral.prototype.text = function () { - return this._text; - }; - NumericLiteral.prototype.valueText = function () { - return this._valueText; - }; - NumericLiteral.prototype.value = function () { - return this._value; - }; - - NumericLiteral.prototype.kind = function () { - return 13 /* NumericLiteral */; - }; - - NumericLiteral.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && (this._value === ast._value || (isNaN(this._value) && isNaN(ast._value))) && this._text === ast._text; - }; - - NumericLiteral.prototype.isExpression = function () { - return true; - }; - return NumericLiteral; - })(AST); - TypeScript.NumericLiteral = NumericLiteral; - - var RegularExpressionLiteral = (function (_super) { - __extends(RegularExpressionLiteral, _super); - function RegularExpressionLiteral(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - } - RegularExpressionLiteral.prototype.text = function () { - return this._text; - }; - - RegularExpressionLiteral.prototype.valueText = function () { - return this._valueText; - }; - - RegularExpressionLiteral.prototype.kind = function () { - return 12 /* RegularExpressionLiteral */; - }; - - RegularExpressionLiteral.prototype.isExpression = function () { - return true; - }; - return RegularExpressionLiteral; - })(AST); - TypeScript.RegularExpressionLiteral = RegularExpressionLiteral; - - var StringLiteral = (function (_super) { - __extends(StringLiteral, _super); - function StringLiteral(_text, _valueText) { - _super.call(this); - this._text = _text; - this._valueText = _valueText; - this._valueText = _valueText === "__proto__" ? "#__proto__" : _valueText; - } - StringLiteral.prototype.text = function () { - return this._text; - }; - StringLiteral.prototype.valueText = function () { - return this._valueText; - }; - - StringLiteral.prototype.kind = function () { - return 14 /* StringLiteral */; - }; - - StringLiteral.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && this._text === ast._text; - }; - - StringLiteral.prototype.isExpression = function () { - return true; - }; - return StringLiteral; - })(AST); - TypeScript.StringLiteral = StringLiteral; - - var TypeAnnotation = (function (_super) { - __extends(TypeAnnotation, _super); - function TypeAnnotation(type) { - _super.call(this); - this.type = type; - type && (type.parent = this); - } - TypeAnnotation.prototype.kind = function () { - return 244 /* TypeAnnotation */; - }; - return TypeAnnotation; - })(AST); - TypeScript.TypeAnnotation = TypeAnnotation; - - var BuiltInType = (function (_super) { - __extends(BuiltInType, _super); - function BuiltInType(_nodeType, _text, _valueText) { - _super.call(this); - this._nodeType = _nodeType; - this._text = _text; - this._valueText = _valueText; - } - BuiltInType.prototype.text = function () { - return this._text; - }; - - BuiltInType.prototype.valueText = function () { - return this._valueText; - }; - - BuiltInType.prototype.kind = function () { - return this._nodeType; - }; - return BuiltInType; - })(AST); - TypeScript.BuiltInType = BuiltInType; - - var ExternalModuleReference = (function (_super) { - __extends(ExternalModuleReference, _super); - function ExternalModuleReference(stringLiteral) { - _super.call(this); - this.stringLiteral = stringLiteral; - stringLiteral && (stringLiteral.parent = this); - } - ExternalModuleReference.prototype.kind = function () { - return 245 /* ExternalModuleReference */; - }; - return ExternalModuleReference; - })(AST); - TypeScript.ExternalModuleReference = ExternalModuleReference; - - var ModuleNameModuleReference = (function (_super) { - __extends(ModuleNameModuleReference, _super); - function ModuleNameModuleReference(moduleName) { - _super.call(this); - this.moduleName = moduleName; - moduleName && (moduleName.parent = this); - } - ModuleNameModuleReference.prototype.kind = function () { - return 246 /* ModuleNameModuleReference */; - }; - return ModuleNameModuleReference; - })(AST); - TypeScript.ModuleNameModuleReference = ModuleNameModuleReference; - - var ImportDeclaration = (function (_super) { - __extends(ImportDeclaration, _super); - function ImportDeclaration(modifiers, identifier, moduleReference) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.moduleReference = moduleReference; - identifier && (identifier.parent = this); - moduleReference && (moduleReference.parent = this); - } - ImportDeclaration.prototype.kind = function () { - return 133 /* ImportDeclaration */; - }; - - ImportDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.moduleReference, ast.moduleReference, includingPosition); - }; - return ImportDeclaration; - })(AST); - TypeScript.ImportDeclaration = ImportDeclaration; - - var ExportAssignment = (function (_super) { - __extends(ExportAssignment, _super); - function ExportAssignment(identifier) { - _super.call(this); - this.identifier = identifier; - identifier && (identifier.parent = this); - } - ExportAssignment.prototype.kind = function () { - return 134 /* ExportAssignment */; - }; - - ExportAssignment.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition); - }; - return ExportAssignment; - })(AST); - TypeScript.ExportAssignment = ExportAssignment; - - var TypeParameterList = (function (_super) { - __extends(TypeParameterList, _super); - function TypeParameterList(typeParameters) { - _super.call(this); - this.typeParameters = typeParameters; - typeParameters && (typeParameters.parent = this); - } - TypeParameterList.prototype.kind = function () { - return 229 /* TypeParameterList */; - }; - return TypeParameterList; - })(AST); - TypeScript.TypeParameterList = TypeParameterList; - - var ClassDeclaration = (function (_super) { - __extends(ClassDeclaration, _super); - function ClassDeclaration(modifiers, identifier, typeParameterList, heritageClauses, classElements, closeBraceToken) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.classElements = classElements; - this.closeBraceToken = closeBraceToken; - identifier && (identifier.parent = this); - typeParameterList && (typeParameterList.parent = this); - heritageClauses && (heritageClauses.parent = this); - classElements && (classElements.parent = this); - } - ClassDeclaration.prototype.kind = function () { - return 131 /* ClassDeclaration */; - }; - - ClassDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.classElements, ast.classElements, includingPosition) && structuralEquals(this.typeParameterList, ast.typeParameterList, includingPosition) && structuralEquals(this.heritageClauses, ast.heritageClauses, includingPosition); - }; - return ClassDeclaration; - })(AST); - TypeScript.ClassDeclaration = ClassDeclaration; - - var InterfaceDeclaration = (function (_super) { - __extends(InterfaceDeclaration, _super); - function InterfaceDeclaration(modifiers, identifier, typeParameterList, heritageClauses, body) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.typeParameterList = typeParameterList; - this.heritageClauses = heritageClauses; - this.body = body; - identifier && (identifier.parent = this); - typeParameterList && (typeParameterList.parent = this); - body && (body.parent = this); - heritageClauses && (heritageClauses.parent = this); - } - InterfaceDeclaration.prototype.kind = function () { - return 128 /* InterfaceDeclaration */; - }; - - InterfaceDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.body, ast.body, includingPosition) && structuralEquals(this.typeParameterList, ast.typeParameterList, includingPosition) && structuralEquals(this.heritageClauses, ast.heritageClauses, includingPosition); - }; - return InterfaceDeclaration; - })(AST); - TypeScript.InterfaceDeclaration = InterfaceDeclaration; - - var HeritageClause = (function (_super) { - __extends(HeritageClause, _super); - function HeritageClause(_nodeType, typeNames) { - _super.call(this); - this._nodeType = _nodeType; - this.typeNames = typeNames; - typeNames && (typeNames.parent = this); - } - HeritageClause.prototype.kind = function () { - return this._nodeType; - }; - - HeritageClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.typeNames, ast.typeNames, includingPosition); - }; - return HeritageClause; - })(AST); - TypeScript.HeritageClause = HeritageClause; - - var ModuleDeclaration = (function (_super) { - __extends(ModuleDeclaration, _super); - function ModuleDeclaration(modifiers, name, stringLiteral, moduleElements, endingToken) { - _super.call(this); - this.modifiers = modifiers; - this.name = name; - this.stringLiteral = stringLiteral; - this.moduleElements = moduleElements; - this.endingToken = endingToken; - name && (name.parent = this); - stringLiteral && (stringLiteral.parent = this); - moduleElements && (moduleElements.parent = this); - } - ModuleDeclaration.prototype.kind = function () { - return 130 /* ModuleDeclaration */; - }; - - ModuleDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.name, ast.name, includingPosition) && structuralEquals(this.moduleElements, ast.moduleElements, includingPosition); - }; - return ModuleDeclaration; - })(AST); - TypeScript.ModuleDeclaration = ModuleDeclaration; - - var FunctionDeclaration = (function (_super) { - __extends(FunctionDeclaration, _super); - function FunctionDeclaration(modifiers, identifier, callSignature, block) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - identifier && (identifier.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - FunctionDeclaration.prototype.kind = function () { - return 129 /* FunctionDeclaration */; - }; - - FunctionDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.block, ast.block, includingPosition) && structuralEquals(this.callSignature, ast.callSignature, includingPosition); - }; - return FunctionDeclaration; - })(AST); - TypeScript.FunctionDeclaration = FunctionDeclaration; - - var VariableStatement = (function (_super) { - __extends(VariableStatement, _super); - function VariableStatement(modifiers, declaration) { - _super.call(this); - this.modifiers = modifiers; - this.declaration = declaration; - declaration && (declaration.parent = this); - } - VariableStatement.prototype.kind = function () { - return 148 /* VariableStatement */; - }; - - VariableStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.declaration, ast.declaration, includingPosition); - }; - return VariableStatement; - })(AST); - TypeScript.VariableStatement = VariableStatement; - - var VariableDeclaration = (function (_super) { - __extends(VariableDeclaration, _super); - function VariableDeclaration(declarators) { - _super.call(this); - this.declarators = declarators; - declarators && (declarators.parent = this); - } - VariableDeclaration.prototype.kind = function () { - return 224 /* VariableDeclaration */; - }; - - VariableDeclaration.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.declarators, ast.declarators, includingPosition); - }; - return VariableDeclaration; - })(AST); - TypeScript.VariableDeclaration = VariableDeclaration; - - var VariableDeclarator = (function (_super) { - __extends(VariableDeclarator, _super); - function VariableDeclarator(propertyName, typeAnnotation, equalsValueClause) { - _super.call(this); - this.propertyName = propertyName; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - propertyName && (propertyName.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - equalsValueClause && (equalsValueClause.parent = this); - } - VariableDeclarator.prototype.kind = function () { - return 225 /* VariableDeclarator */; - }; - return VariableDeclarator; - })(AST); - TypeScript.VariableDeclarator = VariableDeclarator; - - var EqualsValueClause = (function (_super) { - __extends(EqualsValueClause, _super); - function EqualsValueClause(value) { - _super.call(this); - this.value = value; - value && (value.parent = this); - } - EqualsValueClause.prototype.kind = function () { - return 232 /* EqualsValueClause */; - }; - return EqualsValueClause; - })(AST); - TypeScript.EqualsValueClause = EqualsValueClause; - - var PrefixUnaryExpression = (function (_super) { - __extends(PrefixUnaryExpression, _super); - function PrefixUnaryExpression(_nodeType, operand) { - _super.call(this); - this._nodeType = _nodeType; - this.operand = operand; - operand && (operand.parent = this); - } - PrefixUnaryExpression.prototype.kind = function () { - return this._nodeType; - }; - - PrefixUnaryExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.operand, ast.operand, includingPosition); - }; - - PrefixUnaryExpression.prototype.isExpression = function () { - return true; - }; - return PrefixUnaryExpression; - })(AST); - TypeScript.PrefixUnaryExpression = PrefixUnaryExpression; - - var ArrayLiteralExpression = (function (_super) { - __extends(ArrayLiteralExpression, _super); - function ArrayLiteralExpression(expressions) { - _super.call(this); - this.expressions = expressions; - expressions && (expressions.parent = this); - } - ArrayLiteralExpression.prototype.kind = function () { - return 214 /* ArrayLiteralExpression */; - }; - - ArrayLiteralExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expressions, ast.expressions, includingPosition); - }; - - ArrayLiteralExpression.prototype.isExpression = function () { - return true; - }; - return ArrayLiteralExpression; - })(AST); - TypeScript.ArrayLiteralExpression = ArrayLiteralExpression; - - var OmittedExpression = (function (_super) { - __extends(OmittedExpression, _super); - function OmittedExpression() { - _super.apply(this, arguments); - } - OmittedExpression.prototype.kind = function () { - return 223 /* OmittedExpression */; - }; - - OmittedExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - - OmittedExpression.prototype.isExpression = function () { - return true; - }; - return OmittedExpression; - })(AST); - TypeScript.OmittedExpression = OmittedExpression; - - var ParenthesizedExpression = (function (_super) { - __extends(ParenthesizedExpression, _super); - function ParenthesizedExpression(openParenTrailingComments, expression) { - _super.call(this); - this.openParenTrailingComments = openParenTrailingComments; - this.expression = expression; - expression && (expression.parent = this); - } - ParenthesizedExpression.prototype.kind = function () { - return 217 /* ParenthesizedExpression */; - }; - - ParenthesizedExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - ParenthesizedExpression.prototype.isExpression = function () { - return true; - }; - return ParenthesizedExpression; - })(AST); - TypeScript.ParenthesizedExpression = ParenthesizedExpression; - - var SimpleArrowFunctionExpression = (function (_super) { - __extends(SimpleArrowFunctionExpression, _super); - function SimpleArrowFunctionExpression(identifier, block, expression) { - _super.call(this); - this.identifier = identifier; - this.block = block; - this.expression = expression; - identifier && (identifier.parent = this); - block && (block.parent = this); - expression && (expression.parent = this); - } - SimpleArrowFunctionExpression.prototype.kind = function () { - return 219 /* SimpleArrowFunctionExpression */; - }; - - SimpleArrowFunctionExpression.prototype.isExpression = function () { - return true; - }; - return SimpleArrowFunctionExpression; - })(AST); - TypeScript.SimpleArrowFunctionExpression = SimpleArrowFunctionExpression; - - var ParenthesizedArrowFunctionExpression = (function (_super) { - __extends(ParenthesizedArrowFunctionExpression, _super); - function ParenthesizedArrowFunctionExpression(callSignature, block, expression) { - _super.call(this); - this.callSignature = callSignature; - this.block = block; - this.expression = expression; - callSignature && (callSignature.parent = this); - block && (block.parent = this); - expression && (expression.parent = this); - } - ParenthesizedArrowFunctionExpression.prototype.kind = function () { - return 218 /* ParenthesizedArrowFunctionExpression */; - }; - - ParenthesizedArrowFunctionExpression.prototype.isExpression = function () { - return true; - }; - return ParenthesizedArrowFunctionExpression; - })(AST); - TypeScript.ParenthesizedArrowFunctionExpression = ParenthesizedArrowFunctionExpression; - - var QualifiedName = (function (_super) { - __extends(QualifiedName, _super); - function QualifiedName(left, right) { - _super.call(this); - this.left = left; - this.right = right; - left && (left.parent = this); - right && (right.parent = this); - } - QualifiedName.prototype.kind = function () { - return 121 /* QualifiedName */; - }; - - QualifiedName.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.left, ast.left, includingPosition) && structuralEquals(this.right, ast.right, includingPosition); - }; - return QualifiedName; - })(AST); - TypeScript.QualifiedName = QualifiedName; - - var ParameterList = (function (_super) { - __extends(ParameterList, _super); - function ParameterList(openParenTrailingComments, parameters) { - _super.call(this); - this.openParenTrailingComments = openParenTrailingComments; - this.parameters = parameters; - parameters && (parameters.parent = this); - } - ParameterList.prototype.kind = function () { - return 227 /* ParameterList */; - }; - return ParameterList; - })(AST); - TypeScript.ParameterList = ParameterList; - - var ConstructorType = (function (_super) { - __extends(ConstructorType, _super); - function ConstructorType(typeParameterList, parameterList, type) { - _super.call(this); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.type = type; - typeParameterList && (typeParameterList.parent = this); - parameterList && (parameterList.parent = this); - type && (type.parent = this); - } - ConstructorType.prototype.kind = function () { - return 125 /* ConstructorType */; - }; - return ConstructorType; - })(AST); - TypeScript.ConstructorType = ConstructorType; - - var FunctionType = (function (_super) { - __extends(FunctionType, _super); - function FunctionType(typeParameterList, parameterList, type) { - _super.call(this); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.type = type; - typeParameterList && (typeParameterList.parent = this); - parameterList && (parameterList.parent = this); - type && (type.parent = this); - } - FunctionType.prototype.kind = function () { - return 123 /* FunctionType */; - }; - return FunctionType; - })(AST); - TypeScript.FunctionType = FunctionType; - - var ObjectType = (function (_super) { - __extends(ObjectType, _super); - function ObjectType(typeMembers) { - _super.call(this); - this.typeMembers = typeMembers; - typeMembers && (typeMembers.parent = this); - } - ObjectType.prototype.kind = function () { - return 122 /* ObjectType */; - }; - - ObjectType.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.typeMembers, ast.typeMembers, includingPosition); - }; - return ObjectType; - })(AST); - TypeScript.ObjectType = ObjectType; - - var ArrayType = (function (_super) { - __extends(ArrayType, _super); - function ArrayType(type) { - _super.call(this); - this.type = type; - type && (type.parent = this); - } - ArrayType.prototype.kind = function () { - return 124 /* ArrayType */; - }; - - ArrayType.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.type, ast.type, includingPosition); - }; - return ArrayType; - })(AST); - TypeScript.ArrayType = ArrayType; - - var TypeArgumentList = (function (_super) { - __extends(TypeArgumentList, _super); - function TypeArgumentList(typeArguments) { - _super.call(this); - this.typeArguments = typeArguments; - typeArguments && (typeArguments.parent = this); - } - TypeArgumentList.prototype.kind = function () { - return 228 /* TypeArgumentList */; - }; - return TypeArgumentList; - })(AST); - TypeScript.TypeArgumentList = TypeArgumentList; - - var GenericType = (function (_super) { - __extends(GenericType, _super); - function GenericType(name, typeArgumentList) { - _super.call(this); - this.name = name; - this.typeArgumentList = typeArgumentList; - name && (name.parent = this); - typeArgumentList && (typeArgumentList.parent = this); - } - GenericType.prototype.kind = function () { - return 126 /* GenericType */; - }; - - GenericType.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.name, ast.name, includingPosition) && structuralEquals(this.typeArgumentList, ast.typeArgumentList, includingPosition); - }; - return GenericType; - })(AST); - TypeScript.GenericType = GenericType; - - var TypeQuery = (function (_super) { - __extends(TypeQuery, _super); - function TypeQuery(name) { - _super.call(this); - this.name = name; - name && (name.parent = this); - } - TypeQuery.prototype.kind = function () { - return 127 /* TypeQuery */; - }; - - TypeQuery.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.name, ast.name, includingPosition); - }; - return TypeQuery; - })(AST); - TypeScript.TypeQuery = TypeQuery; - - var Block = (function (_super) { - __extends(Block, _super); - function Block(statements, closeBraceLeadingComments, closeBraceToken) { - _super.call(this); - this.statements = statements; - this.closeBraceLeadingComments = closeBraceLeadingComments; - this.closeBraceToken = closeBraceToken; - statements && (statements.parent = this); - } - Block.prototype.kind = function () { - return 146 /* Block */; - }; - - Block.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statements, ast.statements, includingPosition); - }; - return Block; - })(AST); - TypeScript.Block = Block; - - var Parameter = (function (_super) { - __extends(Parameter, _super); - function Parameter(dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - _super.call(this); - this.dotDotDotToken = dotDotDotToken; - this.modifiers = modifiers; - this.identifier = identifier; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - this.equalsValueClause = equalsValueClause; - identifier && (identifier.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - equalsValueClause && (equalsValueClause.parent = this); - } - Parameter.prototype.kind = function () { - return 242 /* Parameter */; - }; - return Parameter; - })(AST); - TypeScript.Parameter = Parameter; - - var MemberAccessExpression = (function (_super) { - __extends(MemberAccessExpression, _super); - function MemberAccessExpression(expression, name) { - _super.call(this); - this.expression = expression; - this.name = name; - expression && (expression.parent = this); - name && (name.parent = this); - } - MemberAccessExpression.prototype.kind = function () { - return 212 /* MemberAccessExpression */; - }; - - MemberAccessExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.name, ast.name, includingPosition); - }; - - MemberAccessExpression.prototype.isExpression = function () { - return true; - }; - return MemberAccessExpression; - })(AST); - TypeScript.MemberAccessExpression = MemberAccessExpression; - - var PostfixUnaryExpression = (function (_super) { - __extends(PostfixUnaryExpression, _super); - function PostfixUnaryExpression(_nodeType, operand) { - _super.call(this); - this._nodeType = _nodeType; - this.operand = operand; - operand && (operand.parent = this); - } - PostfixUnaryExpression.prototype.kind = function () { - return this._nodeType; - }; - - PostfixUnaryExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.operand, ast.operand, includingPosition); - }; - - PostfixUnaryExpression.prototype.isExpression = function () { - return true; - }; - return PostfixUnaryExpression; - })(AST); - TypeScript.PostfixUnaryExpression = PostfixUnaryExpression; - - var ElementAccessExpression = (function (_super) { - __extends(ElementAccessExpression, _super); - function ElementAccessExpression(expression, argumentExpression) { - _super.call(this); - this.expression = expression; - this.argumentExpression = argumentExpression; - expression && (expression.parent = this); - argumentExpression && (argumentExpression.parent = this); - } - ElementAccessExpression.prototype.kind = function () { - return 221 /* ElementAccessExpression */; - }; - - ElementAccessExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.argumentExpression, ast.argumentExpression, includingPosition); - }; - - ElementAccessExpression.prototype.isExpression = function () { - return true; - }; - return ElementAccessExpression; - })(AST); - TypeScript.ElementAccessExpression = ElementAccessExpression; - - var InvocationExpression = (function (_super) { - __extends(InvocationExpression, _super); - function InvocationExpression(expression, argumentList) { - _super.call(this); - this.expression = expression; - this.argumentList = argumentList; - expression && (expression.parent = this); - argumentList && (argumentList.parent = this); - } - InvocationExpression.prototype.kind = function () { - return 213 /* InvocationExpression */; - }; - - InvocationExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.argumentList, ast.argumentList, includingPosition); - }; - - InvocationExpression.prototype.isExpression = function () { - return true; - }; - return InvocationExpression; - })(AST); - TypeScript.InvocationExpression = InvocationExpression; - - var ArgumentList = (function (_super) { - __extends(ArgumentList, _super); - function ArgumentList(typeArgumentList, _arguments, closeParenToken) { - _super.call(this); - this.typeArgumentList = typeArgumentList; - this.closeParenToken = closeParenToken; - this.arguments = _arguments; - - typeArgumentList && (typeArgumentList.parent = this); - _arguments && (_arguments.parent = this); - } - ArgumentList.prototype.kind = function () { - return 226 /* ArgumentList */; - }; - return ArgumentList; - })(AST); - TypeScript.ArgumentList = ArgumentList; - - var BinaryExpression = (function (_super) { - __extends(BinaryExpression, _super); - function BinaryExpression(_nodeType, left, right) { - _super.call(this); - this._nodeType = _nodeType; - this.left = left; - this.right = right; - left && (left.parent = this); - right && (right.parent = this); - } - BinaryExpression.prototype.kind = function () { - return this._nodeType; - }; - - BinaryExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.left, ast.left, includingPosition) && structuralEquals(this.right, ast.right, includingPosition); - }; - - BinaryExpression.prototype.isExpression = function () { - return true; - }; - return BinaryExpression; - })(AST); - TypeScript.BinaryExpression = BinaryExpression; - - var ConditionalExpression = (function (_super) { - __extends(ConditionalExpression, _super); - function ConditionalExpression(condition, whenTrue, whenFalse) { - _super.call(this); - this.condition = condition; - this.whenTrue = whenTrue; - this.whenFalse = whenFalse; - condition && (condition.parent = this); - whenTrue && (whenTrue.parent = this); - whenFalse && (whenFalse.parent = this); - } - ConditionalExpression.prototype.kind = function () { - return 186 /* ConditionalExpression */; - }; - - ConditionalExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.whenTrue, ast.whenTrue, includingPosition) && structuralEquals(this.whenFalse, ast.whenFalse, includingPosition); - }; - - ConditionalExpression.prototype.isExpression = function () { - return true; - }; - return ConditionalExpression; - })(AST); - TypeScript.ConditionalExpression = ConditionalExpression; - - var ConstructSignature = (function (_super) { - __extends(ConstructSignature, _super); - function ConstructSignature(callSignature) { - _super.call(this); - this.callSignature = callSignature; - callSignature && (callSignature.parent = this); - } - ConstructSignature.prototype.kind = function () { - return 143 /* ConstructSignature */; - }; - return ConstructSignature; - })(AST); - TypeScript.ConstructSignature = ConstructSignature; - - var MethodSignature = (function (_super) { - __extends(MethodSignature, _super); - function MethodSignature(propertyName, questionToken, callSignature) { - _super.call(this); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.callSignature = callSignature; - propertyName && (propertyName.parent = this); - callSignature && (callSignature.parent = this); - } - MethodSignature.prototype.kind = function () { - return 145 /* MethodSignature */; - }; - return MethodSignature; - })(AST); - TypeScript.MethodSignature = MethodSignature; - - var IndexSignature = (function (_super) { - __extends(IndexSignature, _super); - function IndexSignature(parameter, typeAnnotation) { - _super.call(this); - this.parameter = parameter; - this.typeAnnotation = typeAnnotation; - parameter && (parameter.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - } - IndexSignature.prototype.kind = function () { - return 144 /* IndexSignature */; - }; - return IndexSignature; - })(AST); - TypeScript.IndexSignature = IndexSignature; - - var PropertySignature = (function (_super) { - __extends(PropertySignature, _super); - function PropertySignature(propertyName, questionToken, typeAnnotation) { - _super.call(this); - this.propertyName = propertyName; - this.questionToken = questionToken; - this.typeAnnotation = typeAnnotation; - propertyName && (propertyName.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - } - PropertySignature.prototype.kind = function () { - return 141 /* PropertySignature */; - }; - return PropertySignature; - })(AST); - TypeScript.PropertySignature = PropertySignature; - - var CallSignature = (function (_super) { - __extends(CallSignature, _super); - function CallSignature(typeParameterList, parameterList, typeAnnotation) { - _super.call(this); - this.typeParameterList = typeParameterList; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - typeParameterList && (typeParameterList.parent = this); - parameterList && (parameterList.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - } - CallSignature.prototype.kind = function () { - return 142 /* CallSignature */; - }; - return CallSignature; - })(AST); - TypeScript.CallSignature = CallSignature; - - var TypeParameter = (function (_super) { - __extends(TypeParameter, _super); - function TypeParameter(identifier, constraint) { - _super.call(this); - this.identifier = identifier; - this.constraint = constraint; - identifier && (identifier.parent = this); - constraint && (constraint.parent = this); - } - TypeParameter.prototype.kind = function () { - return 238 /* TypeParameter */; - }; - - TypeParameter.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.constraint, ast.constraint, includingPosition); - }; - return TypeParameter; - })(AST); - TypeScript.TypeParameter = TypeParameter; - - var Constraint = (function (_super) { - __extends(Constraint, _super); - function Constraint(type) { - _super.call(this); - this.type = type; - type && (type.parent = this); - } - Constraint.prototype.kind = function () { - return 239 /* Constraint */; - }; - return Constraint; - })(AST); - TypeScript.Constraint = Constraint; - - var ElseClause = (function (_super) { - __extends(ElseClause, _super); - function ElseClause(statement) { - _super.call(this); - this.statement = statement; - statement && (statement.parent = this); - } - ElseClause.prototype.kind = function () { - return 235 /* ElseClause */; - }; - - ElseClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return ElseClause; - })(AST); - TypeScript.ElseClause = ElseClause; - - var IfStatement = (function (_super) { - __extends(IfStatement, _super); - function IfStatement(condition, statement, elseClause) { - _super.call(this); - this.condition = condition; - this.statement = statement; - this.elseClause = elseClause; - condition && (condition.parent = this); - statement && (statement.parent = this); - elseClause && (elseClause.parent = this); - } - IfStatement.prototype.kind = function () { - return 147 /* IfStatement */; - }; - - IfStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition) && structuralEquals(this.elseClause, ast.elseClause, includingPosition); - }; - return IfStatement; - })(AST); - TypeScript.IfStatement = IfStatement; - - var ExpressionStatement = (function (_super) { - __extends(ExpressionStatement, _super); - function ExpressionStatement(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - ExpressionStatement.prototype.kind = function () { - return 149 /* ExpressionStatement */; - }; - - ExpressionStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return ExpressionStatement; - })(AST); - TypeScript.ExpressionStatement = ExpressionStatement; - - var ConstructorDeclaration = (function (_super) { - __extends(ConstructorDeclaration, _super); - function ConstructorDeclaration(callSignature, block) { - _super.call(this); - this.callSignature = callSignature; - this.block = block; - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - ConstructorDeclaration.prototype.kind = function () { - return 137 /* ConstructorDeclaration */; - }; - return ConstructorDeclaration; - })(AST); - TypeScript.ConstructorDeclaration = ConstructorDeclaration; - - var MemberFunctionDeclaration = (function (_super) { - __extends(MemberFunctionDeclaration, _super); - function MemberFunctionDeclaration(modifiers, propertyName, callSignature, block) { - _super.call(this); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - propertyName && (propertyName.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - MemberFunctionDeclaration.prototype.kind = function () { - return 135 /* MemberFunctionDeclaration */; - }; - return MemberFunctionDeclaration; - })(AST); - TypeScript.MemberFunctionDeclaration = MemberFunctionDeclaration; - - var GetAccessor = (function (_super) { - __extends(GetAccessor, _super); - function GetAccessor(modifiers, propertyName, parameterList, typeAnnotation, block) { - _super.call(this); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.typeAnnotation = typeAnnotation; - this.block = block; - propertyName && (propertyName.parent = this); - parameterList && (parameterList.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - block && (block.parent = this); - } - GetAccessor.prototype.kind = function () { - return 139 /* GetAccessor */; - }; - return GetAccessor; - })(AST); - TypeScript.GetAccessor = GetAccessor; - - var SetAccessor = (function (_super) { - __extends(SetAccessor, _super); - function SetAccessor(modifiers, propertyName, parameterList, block) { - _super.call(this); - this.modifiers = modifiers; - this.propertyName = propertyName; - this.parameterList = parameterList; - this.block = block; - propertyName && (propertyName.parent = this); - parameterList && (parameterList.parent = this); - block && (block.parent = this); - } - SetAccessor.prototype.kind = function () { - return 140 /* SetAccessor */; - }; - return SetAccessor; - })(AST); - TypeScript.SetAccessor = SetAccessor; - - var MemberVariableDeclaration = (function (_super) { - __extends(MemberVariableDeclaration, _super); - function MemberVariableDeclaration(modifiers, variableDeclarator) { - _super.call(this); - this.modifiers = modifiers; - this.variableDeclarator = variableDeclarator; - variableDeclarator && (variableDeclarator.parent = this); - } - MemberVariableDeclaration.prototype.kind = function () { - return 136 /* MemberVariableDeclaration */; - }; - return MemberVariableDeclaration; - })(AST); - TypeScript.MemberVariableDeclaration = MemberVariableDeclaration; - - var IndexMemberDeclaration = (function (_super) { - __extends(IndexMemberDeclaration, _super); - function IndexMemberDeclaration(indexSignature) { - _super.call(this); - this.indexSignature = indexSignature; - indexSignature && (indexSignature.parent = this); - } - IndexMemberDeclaration.prototype.kind = function () { - return 138 /* IndexMemberDeclaration */; - }; - return IndexMemberDeclaration; - })(AST); - TypeScript.IndexMemberDeclaration = IndexMemberDeclaration; - - var ThrowStatement = (function (_super) { - __extends(ThrowStatement, _super); - function ThrowStatement(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - ThrowStatement.prototype.kind = function () { - return 157 /* ThrowStatement */; - }; - - ThrowStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return ThrowStatement; - })(AST); - TypeScript.ThrowStatement = ThrowStatement; - - var ReturnStatement = (function (_super) { - __extends(ReturnStatement, _super); - function ReturnStatement(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - ReturnStatement.prototype.kind = function () { - return 150 /* ReturnStatement */; - }; - - ReturnStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return ReturnStatement; - })(AST); - TypeScript.ReturnStatement = ReturnStatement; - - var ObjectCreationExpression = (function (_super) { - __extends(ObjectCreationExpression, _super); - function ObjectCreationExpression(expression, argumentList) { - _super.call(this); - this.expression = expression; - this.argumentList = argumentList; - expression && (expression.parent = this); - argumentList && (argumentList.parent = this); - } - ObjectCreationExpression.prototype.kind = function () { - return 216 /* ObjectCreationExpression */; - }; - - ObjectCreationExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.argumentList, ast.argumentList, includingPosition); - }; - - ObjectCreationExpression.prototype.isExpression = function () { - return true; - }; - return ObjectCreationExpression; - })(AST); - TypeScript.ObjectCreationExpression = ObjectCreationExpression; - - var SwitchStatement = (function (_super) { - __extends(SwitchStatement, _super); - function SwitchStatement(expression, closeParenToken, switchClauses) { - _super.call(this); - this.expression = expression; - this.closeParenToken = closeParenToken; - this.switchClauses = switchClauses; - expression && (expression.parent = this); - switchClauses && (switchClauses.parent = this); - } - SwitchStatement.prototype.kind = function () { - return 151 /* SwitchStatement */; - }; - - SwitchStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.switchClauses, ast.switchClauses, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - return SwitchStatement; - })(AST); - TypeScript.SwitchStatement = SwitchStatement; - - var CaseSwitchClause = (function (_super) { - __extends(CaseSwitchClause, _super); - function CaseSwitchClause(expression, statements) { - _super.call(this); - this.expression = expression; - this.statements = statements; - expression && (expression.parent = this); - statements && (statements.parent = this); - } - CaseSwitchClause.prototype.kind = function () { - return 233 /* CaseSwitchClause */; - }; - - CaseSwitchClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.statements, ast.statements, includingPosition); - }; - return CaseSwitchClause; - })(AST); - TypeScript.CaseSwitchClause = CaseSwitchClause; - - var DefaultSwitchClause = (function (_super) { - __extends(DefaultSwitchClause, _super); - function DefaultSwitchClause(statements) { - _super.call(this); - this.statements = statements; - statements && (statements.parent = this); - } - DefaultSwitchClause.prototype.kind = function () { - return 234 /* DefaultSwitchClause */; - }; - - DefaultSwitchClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statements, ast.statements, includingPosition); - }; - return DefaultSwitchClause; - })(AST); - TypeScript.DefaultSwitchClause = DefaultSwitchClause; - - var BreakStatement = (function (_super) { - __extends(BreakStatement, _super); - function BreakStatement(identifier) { - _super.call(this); - this.identifier = identifier; - } - BreakStatement.prototype.kind = function () { - return 152 /* BreakStatement */; - }; - - BreakStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - return BreakStatement; - })(AST); - TypeScript.BreakStatement = BreakStatement; - - var ContinueStatement = (function (_super) { - __extends(ContinueStatement, _super); - function ContinueStatement(identifier) { - _super.call(this); - this.identifier = identifier; - } - ContinueStatement.prototype.kind = function () { - return 153 /* ContinueStatement */; - }; - - ContinueStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - return ContinueStatement; - })(AST); - TypeScript.ContinueStatement = ContinueStatement; - - var ForStatement = (function (_super) { - __extends(ForStatement, _super); - function ForStatement(variableDeclaration, initializer, condition, incrementor, statement) { - _super.call(this); - this.variableDeclaration = variableDeclaration; - this.initializer = initializer; - this.condition = condition; - this.incrementor = incrementor; - this.statement = statement; - variableDeclaration && (variableDeclaration.parent = this); - initializer && (initializer.parent = this); - condition && (condition.parent = this); - incrementor && (incrementor.parent = this); - statement && (statement.parent = this); - } - ForStatement.prototype.kind = function () { - return 154 /* ForStatement */; - }; - - ForStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.initializer, ast.initializer, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.incrementor, ast.incrementor, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return ForStatement; - })(AST); - TypeScript.ForStatement = ForStatement; - - var ForInStatement = (function (_super) { - __extends(ForInStatement, _super); - function ForInStatement(variableDeclaration, left, expression, statement) { - _super.call(this); - this.variableDeclaration = variableDeclaration; - this.left = left; - this.expression = expression; - this.statement = statement; - variableDeclaration && (variableDeclaration.parent = this); - left && (left.parent = this); - expression && (expression.parent = this); - statement && (statement.parent = this); - } - ForInStatement.prototype.kind = function () { - return 155 /* ForInStatement */; - }; - - ForInStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.variableDeclaration, ast.variableDeclaration, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return ForInStatement; - })(AST); - TypeScript.ForInStatement = ForInStatement; - - var WhileStatement = (function (_super) { - __extends(WhileStatement, _super); - function WhileStatement(condition, statement) { - _super.call(this); - this.condition = condition; - this.statement = statement; - condition && (condition.parent = this); - statement && (statement.parent = this); - } - WhileStatement.prototype.kind = function () { - return 158 /* WhileStatement */; - }; - - WhileStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return WhileStatement; - })(AST); - TypeScript.WhileStatement = WhileStatement; - - var WithStatement = (function (_super) { - __extends(WithStatement, _super); - function WithStatement(condition, statement) { - _super.call(this); - this.condition = condition; - this.statement = statement; - condition && (condition.parent = this); - statement && (statement.parent = this); - } - WithStatement.prototype.kind = function () { - return 163 /* WithStatement */; - }; - - WithStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return WithStatement; - })(AST); - TypeScript.WithStatement = WithStatement; - - var EnumDeclaration = (function (_super) { - __extends(EnumDeclaration, _super); - function EnumDeclaration(modifiers, identifier, enumElements) { - _super.call(this); - this.modifiers = modifiers; - this.identifier = identifier; - this.enumElements = enumElements; - identifier && (identifier.parent = this); - enumElements && (enumElements.parent = this); - } - EnumDeclaration.prototype.kind = function () { - return 132 /* EnumDeclaration */; - }; - return EnumDeclaration; - })(AST); - TypeScript.EnumDeclaration = EnumDeclaration; - - var EnumElement = (function (_super) { - __extends(EnumElement, _super); - function EnumElement(propertyName, equalsValueClause) { - _super.call(this); - this.propertyName = propertyName; - this.equalsValueClause = equalsValueClause; - propertyName && (propertyName.parent = this); - equalsValueClause && (equalsValueClause.parent = this); - } - EnumElement.prototype.kind = function () { - return 243 /* EnumElement */; - }; - return EnumElement; - })(AST); - TypeScript.EnumElement = EnumElement; - - var CastExpression = (function (_super) { - __extends(CastExpression, _super); - function CastExpression(type, expression) { - _super.call(this); - this.type = type; - this.expression = expression; - type && (type.parent = this); - expression && (expression.parent = this); - } - CastExpression.prototype.kind = function () { - return 220 /* CastExpression */; - }; - - CastExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.type, ast.type, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - CastExpression.prototype.isExpression = function () { - return true; - }; - return CastExpression; - })(AST); - TypeScript.CastExpression = CastExpression; - - var ObjectLiteralExpression = (function (_super) { - __extends(ObjectLiteralExpression, _super); - function ObjectLiteralExpression(propertyAssignments) { - _super.call(this); - this.propertyAssignments = propertyAssignments; - propertyAssignments && (propertyAssignments.parent = this); - } - ObjectLiteralExpression.prototype.kind = function () { - return 215 /* ObjectLiteralExpression */; - }; - - ObjectLiteralExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.propertyAssignments, ast.propertyAssignments, includingPosition); - }; - - ObjectLiteralExpression.prototype.isExpression = function () { - return true; - }; - return ObjectLiteralExpression; - })(AST); - TypeScript.ObjectLiteralExpression = ObjectLiteralExpression; - - var SimplePropertyAssignment = (function (_super) { - __extends(SimplePropertyAssignment, _super); - function SimplePropertyAssignment(propertyName, expression) { - _super.call(this); - this.propertyName = propertyName; - this.expression = expression; - propertyName && (propertyName.parent = this); - expression && (expression.parent = this); - } - SimplePropertyAssignment.prototype.kind = function () { - return 240 /* SimplePropertyAssignment */; - }; - return SimplePropertyAssignment; - })(AST); - TypeScript.SimplePropertyAssignment = SimplePropertyAssignment; - - var FunctionPropertyAssignment = (function (_super) { - __extends(FunctionPropertyAssignment, _super); - function FunctionPropertyAssignment(propertyName, callSignature, block) { - _super.call(this); - this.propertyName = propertyName; - this.callSignature = callSignature; - this.block = block; - propertyName && (propertyName.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - FunctionPropertyAssignment.prototype.kind = function () { - return 241 /* FunctionPropertyAssignment */; - }; - return FunctionPropertyAssignment; - })(AST); - TypeScript.FunctionPropertyAssignment = FunctionPropertyAssignment; - - var FunctionExpression = (function (_super) { - __extends(FunctionExpression, _super); - function FunctionExpression(identifier, callSignature, block) { - _super.call(this); - this.identifier = identifier; - this.callSignature = callSignature; - this.block = block; - identifier && (identifier.parent = this); - callSignature && (callSignature.parent = this); - block && (block.parent = this); - } - FunctionExpression.prototype.kind = function () { - return 222 /* FunctionExpression */; - }; - - FunctionExpression.prototype.isExpression = function () { - return true; - }; - return FunctionExpression; - })(AST); - TypeScript.FunctionExpression = FunctionExpression; - - var EmptyStatement = (function (_super) { - __extends(EmptyStatement, _super); - function EmptyStatement() { - _super.apply(this, arguments); - } - EmptyStatement.prototype.kind = function () { - return 156 /* EmptyStatement */; - }; - - EmptyStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition); - }; - return EmptyStatement; - })(AST); - TypeScript.EmptyStatement = EmptyStatement; - - var TryStatement = (function (_super) { - __extends(TryStatement, _super); - function TryStatement(block, catchClause, finallyClause) { - _super.call(this); - this.block = block; - this.catchClause = catchClause; - this.finallyClause = finallyClause; - block && (block.parent = this); - catchClause && (catchClause.parent = this); - finallyClause && (finallyClause.parent = this); - } - TryStatement.prototype.kind = function () { - return 159 /* TryStatement */; - }; - - TryStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.block, ast.block, includingPosition) && structuralEquals(this.catchClause, ast.catchClause, includingPosition) && structuralEquals(this.finallyClause, ast.finallyClause, includingPosition); - }; - return TryStatement; - })(AST); - TypeScript.TryStatement = TryStatement; - - var CatchClause = (function (_super) { - __extends(CatchClause, _super); - function CatchClause(identifier, typeAnnotation, block) { - _super.call(this); - this.identifier = identifier; - this.typeAnnotation = typeAnnotation; - this.block = block; - identifier && (identifier.parent = this); - typeAnnotation && (typeAnnotation.parent = this); - block && (block.parent = this); - } - CatchClause.prototype.kind = function () { - return 236 /* CatchClause */; - }; - - CatchClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.typeAnnotation, ast.typeAnnotation, includingPosition) && structuralEquals(this.block, ast.block, includingPosition); - }; - return CatchClause; - })(AST); - TypeScript.CatchClause = CatchClause; - - var FinallyClause = (function (_super) { - __extends(FinallyClause, _super); - function FinallyClause(block) { - _super.call(this); - this.block = block; - block && (block.parent = this); - } - FinallyClause.prototype.kind = function () { - return 237 /* FinallyClause */; - }; - - FinallyClause.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.block, ast.block, includingPosition); - }; - return FinallyClause; - })(AST); - TypeScript.FinallyClause = FinallyClause; - - var LabeledStatement = (function (_super) { - __extends(LabeledStatement, _super); - function LabeledStatement(identifier, statement) { - _super.call(this); - this.identifier = identifier; - this.statement = statement; - identifier && (identifier.parent = this); - statement && (statement.parent = this); - } - LabeledStatement.prototype.kind = function () { - return 160 /* LabeledStatement */; - }; - - LabeledStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.identifier, ast.identifier, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition); - }; - return LabeledStatement; - })(AST); - TypeScript.LabeledStatement = LabeledStatement; - - var DoStatement = (function (_super) { - __extends(DoStatement, _super); - function DoStatement(statement, whileKeyword, condition) { - _super.call(this); - this.statement = statement; - this.whileKeyword = whileKeyword; - this.condition = condition; - statement && (statement.parent = this); - condition && (condition.parent = this); - } - DoStatement.prototype.kind = function () { - return 161 /* DoStatement */; - }; - - DoStatement.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.statement, ast.statement, includingPosition) && structuralEquals(this.condition, ast.condition, includingPosition); - }; - return DoStatement; - })(AST); - TypeScript.DoStatement = DoStatement; - - var TypeOfExpression = (function (_super) { - __extends(TypeOfExpression, _super); - function TypeOfExpression(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - TypeOfExpression.prototype.kind = function () { - return 171 /* TypeOfExpression */; - }; - - TypeOfExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - TypeOfExpression.prototype.isExpression = function () { - return true; - }; - return TypeOfExpression; - })(AST); - TypeScript.TypeOfExpression = TypeOfExpression; - - var DeleteExpression = (function (_super) { - __extends(DeleteExpression, _super); - function DeleteExpression(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - DeleteExpression.prototype.kind = function () { - return 170 /* DeleteExpression */; - }; - - DeleteExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - DeleteExpression.prototype.isExpression = function () { - return true; - }; - return DeleteExpression; - })(AST); - TypeScript.DeleteExpression = DeleteExpression; - - var VoidExpression = (function (_super) { - __extends(VoidExpression, _super); - function VoidExpression(expression) { - _super.call(this); - this.expression = expression; - expression && (expression.parent = this); - } - VoidExpression.prototype.kind = function () { - return 172 /* VoidExpression */; - }; - - VoidExpression.prototype.structuralEquals = function (ast, includingPosition) { - return _super.prototype.structuralEquals.call(this, ast, includingPosition) && structuralEquals(this.expression, ast.expression, includingPosition); - }; - - VoidExpression.prototype.isExpression = function () { - return true; - }; - return VoidExpression; - })(AST); - TypeScript.VoidExpression = VoidExpression; - - var DebuggerStatement = (function (_super) { - __extends(DebuggerStatement, _super); - function DebuggerStatement() { - _super.apply(this, arguments); - } - DebuggerStatement.prototype.kind = function () { - return 162 /* DebuggerStatement */; - }; - return DebuggerStatement; - })(AST); - TypeScript.DebuggerStatement = DebuggerStatement; - - var Comment = (function () { - function Comment(_trivia, endsLine, _start, _end) { - this._trivia = _trivia; - this.endsLine = endsLine; - this._start = _start; - this._end = _end; - } - Comment.prototype.start = function () { - return this._start; - }; - - Comment.prototype.end = function () { - return this._end; - }; - - Comment.prototype.fullText = function () { - return this._trivia.fullText(); - }; - - Comment.prototype.kind = function () { - return this._trivia.kind(); - }; - - Comment.prototype.structuralEquals = function (ast, includingPosition) { - if (includingPosition) { - if (this.start() !== ast.start() || this.end() !== ast.end()) { - return false; - } - } - - return this._trivia.fullText() === ast._trivia.fullText() && this.endsLine === ast.endsLine; - }; - return Comment; - })(); - TypeScript.Comment = Comment; -})(TypeScript || (TypeScript = {})); diff --git a/lib/typescript-src/support/typescript/bin/typescriptServices.d.ts b/lib/typescript-src/support/typescript/bin/typescriptServices.d.ts new file mode 100644 index 0000000..1f73697 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/typescriptServices.d.ts @@ -0,0 +1,1849 @@ +/*! ***************************************************************************** +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 ts { + 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, + NumericLiteral = 6, + StringLiteral = 7, + RegularExpressionLiteral = 8, + NoSubstitutionTemplateLiteral = 9, + TemplateHead = 10, + TemplateMiddle = 11, + TemplateTail = 12, + OpenBraceToken = 13, + CloseBraceToken = 14, + OpenParenToken = 15, + CloseParenToken = 16, + OpenBracketToken = 17, + CloseBracketToken = 18, + DotToken = 19, + DotDotDotToken = 20, + SemicolonToken = 21, + CommaToken = 22, + LessThanToken = 23, + GreaterThanToken = 24, + LessThanEqualsToken = 25, + GreaterThanEqualsToken = 26, + EqualsEqualsToken = 27, + ExclamationEqualsToken = 28, + EqualsEqualsEqualsToken = 29, + ExclamationEqualsEqualsToken = 30, + EqualsGreaterThanToken = 31, + PlusToken = 32, + MinusToken = 33, + AsteriskToken = 34, + SlashToken = 35, + PercentToken = 36, + PlusPlusToken = 37, + MinusMinusToken = 38, + LessThanLessThanToken = 39, + GreaterThanGreaterThanToken = 40, + GreaterThanGreaterThanGreaterThanToken = 41, + AmpersandToken = 42, + BarToken = 43, + CaretToken = 44, + ExclamationToken = 45, + TildeToken = 46, + AmpersandAmpersandToken = 47, + BarBarToken = 48, + QuestionToken = 49, + ColonToken = 50, + EqualsToken = 51, + PlusEqualsToken = 52, + MinusEqualsToken = 53, + AsteriskEqualsToken = 54, + SlashEqualsToken = 55, + PercentEqualsToken = 56, + LessThanLessThanEqualsToken = 57, + GreaterThanGreaterThanEqualsToken = 58, + GreaterThanGreaterThanGreaterThanEqualsToken = 59, + AmpersandEqualsToken = 60, + BarEqualsToken = 61, + CaretEqualsToken = 62, + Identifier = 63, + BreakKeyword = 64, + CaseKeyword = 65, + CatchKeyword = 66, + ClassKeyword = 67, + ConstKeyword = 68, + ContinueKeyword = 69, + DebuggerKeyword = 70, + DefaultKeyword = 71, + DeleteKeyword = 72, + DoKeyword = 73, + ElseKeyword = 74, + EnumKeyword = 75, + ExportKeyword = 76, + ExtendsKeyword = 77, + FalseKeyword = 78, + FinallyKeyword = 79, + ForKeyword = 80, + FunctionKeyword = 81, + IfKeyword = 82, + ImportKeyword = 83, + InKeyword = 84, + InstanceOfKeyword = 85, + NewKeyword = 86, + NullKeyword = 87, + ReturnKeyword = 88, + SuperKeyword = 89, + SwitchKeyword = 90, + ThisKeyword = 91, + ThrowKeyword = 92, + TrueKeyword = 93, + TryKeyword = 94, + TypeOfKeyword = 95, + VarKeyword = 96, + VoidKeyword = 97, + WhileKeyword = 98, + WithKeyword = 99, + ImplementsKeyword = 100, + InterfaceKeyword = 101, + LetKeyword = 102, + PackageKeyword = 103, + PrivateKeyword = 104, + ProtectedKeyword = 105, + PublicKeyword = 106, + StaticKeyword = 107, + YieldKeyword = 108, + AnyKeyword = 109, + BooleanKeyword = 110, + ConstructorKeyword = 111, + DeclareKeyword = 112, + GetKeyword = 113, + ModuleKeyword = 114, + RequireKeyword = 115, + NumberKeyword = 116, + SetKeyword = 117, + StringKeyword = 118, + TypeKeyword = 119, + QualifiedName = 120, + ComputedPropertyName = 121, + TypeParameter = 122, + Parameter = 123, + Property = 124, + Method = 125, + Constructor = 126, + GetAccessor = 127, + SetAccessor = 128, + CallSignature = 129, + ConstructSignature = 130, + IndexSignature = 131, + TypeReference = 132, + FunctionType = 133, + ConstructorType = 134, + TypeQuery = 135, + TypeLiteral = 136, + ArrayType = 137, + TupleType = 138, + UnionType = 139, + ParenthesizedType = 140, + ArrayLiteralExpression = 141, + ObjectLiteralExpression = 142, + PropertyAccessExpression = 143, + ElementAccessExpression = 144, + CallExpression = 145, + NewExpression = 146, + TaggedTemplateExpression = 147, + TypeAssertionExpression = 148, + ParenthesizedExpression = 149, + FunctionExpression = 150, + ArrowFunction = 151, + DeleteExpression = 152, + TypeOfExpression = 153, + VoidExpression = 154, + PrefixUnaryExpression = 155, + PostfixUnaryExpression = 156, + BinaryExpression = 157, + ConditionalExpression = 158, + TemplateExpression = 159, + YieldExpression = 160, + OmittedExpression = 161, + TemplateSpan = 162, + Block = 163, + VariableStatement = 164, + EmptyStatement = 165, + ExpressionStatement = 166, + IfStatement = 167, + DoStatement = 168, + WhileStatement = 169, + ForStatement = 170, + ForInStatement = 171, + ContinueStatement = 172, + BreakStatement = 173, + ReturnStatement = 174, + WithStatement = 175, + SwitchStatement = 176, + LabeledStatement = 177, + ThrowStatement = 178, + TryStatement = 179, + TryBlock = 180, + FinallyBlock = 181, + DebuggerStatement = 182, + VariableDeclaration = 183, + FunctionDeclaration = 184, + ClassDeclaration = 185, + InterfaceDeclaration = 186, + TypeAliasDeclaration = 187, + EnumDeclaration = 188, + ModuleDeclaration = 189, + ModuleBlock = 190, + ImportDeclaration = 191, + ExportAssignment = 192, + ExternalModuleReference = 193, + CaseClause = 194, + DefaultClause = 195, + HeritageClause = 196, + CatchClause = 197, + PropertyAssignment = 198, + ShorthandPropertyAssignment = 199, + EnumMember = 200, + SourceFile = 201, + Program = 202, + SyntaxList = 203, + Count = 204, + FirstAssignment = 51, + LastAssignment = 62, + FirstReservedWord = 64, + LastReservedWord = 99, + FirstKeyword = 64, + LastKeyword = 119, + FirstFutureReservedWord = 100, + LastFutureReservedWord = 108, + FirstTypeNode = 132, + LastTypeNode = 140, + FirstPunctuation = 13, + LastPunctuation = 62, + FirstToken = 0, + LastToken = 119, + FirstTriviaToken = 2, + LastTriviaToken = 5, + FirstLiteralToken = 6, + LastLiteralToken = 9, + FirstTemplateToken = 9, + LastTemplateToken = 12, + FirstOperator = 21, + LastOperator = 62, + FirstBinaryOperator = 23, + LastBinaryOperator = 62, + FirstNode = 120, + } + 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, + ContainsError = 16, + HasPropagatedChildContainsErrorFlag = 32, + } + 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; + 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 { + name: Identifier; + type?: TypeNode; + initializer?: Expression; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier; + questionToken?: Node; + type?: TypeNode | StringLiteralExpression; + initializer?: Expression; + } + interface PropertyDeclaration extends Declaration, ClassElement { + _propertyDeclarationBrand: any; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + type VariableOrParameterDeclaration = VariableDeclaration | ParameterDeclaration; + type VariableOrParameterOrPropertyDeclaration = VariableOrParameterDeclaration | PropertyDeclaration; + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: DeclarationName; + questionToken?: Node; + initializer: Expression; + } + /** + * 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 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 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 { + declarations: NodeArray; + } + 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 { + declarations?: NodeArray; + initializer?: Expression; + condition?: Expression; + iterator?: Expression; + } + interface ForInStatement extends IterationStatement { + declarations?: NodeArray; + variable?: 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; + getLineAndCharacterFromPosition(position: number): LineAndCharacter; + getPositionFromLineAndCharacter(line: number, character: number): number; + getLineStarts(): number[]; + amdDependencies: string[]; + amdModuleName: string; + referencedFiles: FileReference[]; + referenceDiagnostics: Diagnostic[]; + parseDiagnostics: Diagnostic[]; + grammarDiagnostics: Diagnostic[]; + getSyntacticDiagnostics(): Diagnostic[]; + semanticDiagnostics: Diagnostic[]; + hasNoDefaultLib: boolean; + externalModuleIndicator: Node; + nodeCount: number; + identifierCount: number; + symbolCount: number; + isOpen: boolean; + version: string; + languageVersion: ScriptTarget; + identifiers: Map; + } + interface Program { + getSourceFile(filename: string): SourceFile; + getSourceFiles(): SourceFile[]; + getCompilerOptions(): CompilerOptions; + getCompilerHost(): CompilerHost; + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getTypeChecker(fullTypeCheckMode: boolean): 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 EmitReturnStatus { + Succeeded = 0, + AllOutputGenerationSkipped = 1, + JSGeneratedWithSemanticErrors = 2, + DeclarationGenerationSkipped = 3, + EmitErrorsEncountered = 4, + CompilerOptionsErrors = 5, + } + interface EmitResult { + emitResultStatus: EmitReturnStatus; + diagnostics: Diagnostic[]; + sourceMaps: SourceMapData[]; + } + interface TypeChecker { + getProgram(): Program; + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + emitFiles(targetSourceFile?: SourceFile): EmitResult; + 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; + isEmitBlocked(sourceFile?: SourceFile): boolean; + getEnumMemberValue(node: EnumMember): 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, + } + 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 { + getProgram(): Program; + 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; + getEnumMemberValue(node: EnumMember): number; + hasSemanticErrors(sourceFile?: SourceFile): boolean; + isDeclarationVisible(node: Declaration): boolean; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableOrParameterDeclaration, 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: PropertyAccessExpression | ElementAccessExpression): number; + isEmitBlocked(sourceFile?: SourceFile): 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, + CallSignature = 131072, + ConstructSignature = 262144, + IndexSignature = 524288, + TypeParameter = 1048576, + TypeAlias = 2097152, + ExportValue = 4194304, + ExportType = 8388608, + ExportNamespace = 16777216, + Import = 33554432, + Instantiated = 67108864, + Merged = 134217728, + Transient = 268435456, + Prototype = 536870912, + UnionProperty = 1073741824, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 3152352, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + Signature = 917504, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 3258879, + InterfaceExcludes = 3152288, + RegularEnumExcludes = 3258623, + ConstEnumExcludes = 3259263, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 2103776, + TypeAliasExcludes = 3152352, + ImportExcludes = 33554432, + ModuleMember = 35653619, + ExportHasLocal = 944, + HasLocals = 1041936, + HasExports = 1952, + HasMembers = 6240, + IsContainer = 1048560, + PropertyOrAccessor = 98308, + Export = 29360128, + } + 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; + } + 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, + Intrinsic = 127, + StringLike = 258, + NumberLike = 132, + ObjectType = 48128, + } + 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; + openReferenceTargets: GenericType[]; + openReferenceChecks: 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; + isEarly?: boolean; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string; + category: DiagnosticCategory; + code: number; + /** + * Early error - any error (can be produced at parsing\binding\typechecking step) that blocks emit + */ + isEarly?: boolean; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + codepage?: number; + declaration?: boolean; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noLib?: boolean; + noLibCheck?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + preserveConstEnums?: boolean; + removeComments?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: 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; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + error?: DiagnosticMessage; + } + 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(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + } +} +declare module ts { + interface ErrorCallback { + (message: DiagnosticMessage): void; + } + interface CommentCallback { + (pos: number, end: 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(lineStarts: number[], line: number, character: number): number; + function getLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function positionToLineAndCharacter(text: string, pos: number): { + line: number; + character: number; + }; + 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 ts { + function getNodeConstructor(kind: SyntaxKind): new () => Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodes?: (nodes: Node[]) => T): T; + function createCompilerHost(options: CompilerOptions): CompilerHost; + function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, version: string, isOpen?: boolean): SourceFile; + function createProgram(rootNames: string[], options: CompilerOptions, host: CompilerHost): Program; +} +declare module ts { + function createTypeChecker(program: Program, fullTypeCheck: boolean): TypeChecker; +} +declare module ts { + 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 { + getScriptSnapshot(): IScriptSnapshot; + getNamedDeclarations(): Declaration[]; + update(scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean, 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; + /** + * 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 + * 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 Logger { + log(s: string): void; + } + interface LanguageServiceHost extends Logger { + getCompilationSettings(): CompilerOptions; + getScriptFileNames(): string[]; + getScriptVersion(fileName: string): string; + getScriptIsOpen(fileName: string): boolean; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFilename(options: CompilerOptions): string; + } + 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; + getSourceFile(filename: string): SourceFile; + dispose(): void; + } + class TextSpan { + private _start; + private _length; + /** + * Creates a TextSpan instance beginning with the position Start and having the Length + * specified with length. + */ + constructor(start: number, length: number); + toJSON(key: any): any; + start(): number; + length(): number; + end(): number; + isEmpty(): boolean; + /** + * Determines whether the position lies within the span. Returns true if the position is greater than or equal to Start and strictly less + * than End, otherwise false. + * @param position The position to check. + */ + containsPosition(position: number): boolean; + /** + * Determines whether span falls completely within this span. Returns true if the specified span falls completely within this span, otherwise false. + * @param span The span to check. + */ + containsTextSpan(span: TextSpan): boolean; + /** + * Determines whether the given span overlaps this span. Two spans are considered to overlap + * if they have positions in common and neither is empty. Empty spans do not overlap with any + * other span. Returns true if the spans overlap, false otherwise. + * @param span The span to check. + */ + overlapsWith(span: TextSpan): boolean; + /** + * Returns the overlap with the given span, or undefined if there is no overlap. + * @param span The span to check. + */ + overlap(span: TextSpan): TextSpan; + /** + * Determines whether span intersects this span. Two spans are considered to + * intersect if they have positions in common or the end of one span + * coincides with the start of the other span. Returns true if the spans intersect, false otherwise. + * @param The span to check. + */ + intersectsWithTextSpan(span: TextSpan): boolean; + intersectsWith(start: number, length: number): boolean; + /** + * Determines whether the given position intersects this span. + * A position is considered to intersect if it is between the start and + * end positions (inclusive) of this span. Returns true if the position intersects, false otherwise. + * @param position The position to check. + */ + intersectsWithPosition(position: number): boolean; + /** + * Returns the intersection with the given span, or undefined if there is no intersection. + * @param span The span to check. + */ + intersection(span: TextSpan): TextSpan; + /** + * Creates a new TextSpan from the given start and end positions + * as opposed to a position and length. + */ + static fromBounds(start: number, end: number): TextSpan; + } + class TextChangeRange { + static unchanged: TextChangeRange; + private _span; + private _newLength; + /** + * Initializes a new instance of TextChangeRange. + */ + constructor(span: TextSpan, newLength: number); + /** + * The span of text before the edit which is being changed + */ + span(): TextSpan; + /** + * Width of the span after the edit. A 0 here would represent a delete + */ + newLength(): number; + newSpan(): TextSpan; + isUnchanged(): boolean; + /** + * Called to merge all the changes that occurred across several versions of a script snapshot + * into a single change. i.e. if a user keeps making successive edits to a script we will + * have a text change from V1 to V2, V2 to V3, ..., Vn. + * + * This function will then merge those changes into a single change range valid between V1 and + * Vn. + */ + static collapseChangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; + } + 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; + 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[]; + emitOutputStatus: EmitReturnStatus; + } + 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; + } + interface DocumentRegistry { + acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean): SourceFile; + updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TextChangeRange): SourceFile; + 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 createDocumentRegistry(): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry): LanguageService; + function createClassifier(host: Logger): Classifier; +} diff --git a/lib/typescript-src/support/typescript/bin/typescriptServices.js b/lib/typescript-src/support/typescript/bin/typescriptServices.js new file mode 100644 index 0000000..1afcbf7 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/typescriptServices.js @@ -0,0 +1,26273 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +var ts; +(function (ts) { + (function (SyntaxKind) { + SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; + SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 6] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 7] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 8] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 9] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 10] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 11] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 12] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 13] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 14] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 15] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 16] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 17] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 18] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 19] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 20] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 21] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 22] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 23] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 24] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 25] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 26] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 27] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 28] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 29] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 30] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 31] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 32] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 33] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 34] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 35] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 36] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 37] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 38] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 39] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 40] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 41] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 42] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 43] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 44] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 45] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 46] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 47] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 48] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 49] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 50] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 51] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 52] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 53] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 54] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 55] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 56] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 57] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 58] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 59] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 60] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 61] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 62] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 63] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 64] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 65] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 66] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 67] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 68] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 69] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 70] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 71] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 72] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 73] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 74] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 75] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 76] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 77] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 78] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 79] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 80] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 81] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 82] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 83] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 84] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 85] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 86] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 87] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 88] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 89] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 90] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 91] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 92] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 93] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 94] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 95] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 96] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 97] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 98] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 99] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 100] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 101] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 102] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 103] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 104] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 105] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 106] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 107] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 108] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 109] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 110] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 111] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 112] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 113] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 114] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 115] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 116] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 117] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 118] = "StringKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 119] = "TypeKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 120] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 121] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 122] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 123] = "Parameter"; + SyntaxKind[SyntaxKind["Property"] = 124] = "Property"; + SyntaxKind[SyntaxKind["Method"] = 125] = "Method"; + SyntaxKind[SyntaxKind["Constructor"] = 126] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 127] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 128] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 129] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 130] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 131] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 132] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 133] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 134] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 135] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 136] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 137] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 138] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 139] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 140] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 141] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 142] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 143] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 144] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 145] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 146] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 147] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 148] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 149] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 150] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 151] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 152] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 153] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 154] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 155] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 156] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 157] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 158] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 159] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 160] = "YieldExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 161] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 162] = "TemplateSpan"; + SyntaxKind[SyntaxKind["Block"] = 163] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 164] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 165] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 166] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 167] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 168] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 169] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 170] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 171] = "ForInStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 172] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 173] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 174] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 175] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 176] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 177] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 178] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 179] = "TryStatement"; + SyntaxKind[SyntaxKind["TryBlock"] = 180] = "TryBlock"; + SyntaxKind[SyntaxKind["FinallyBlock"] = 181] = "FinallyBlock"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 182] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 183] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 184] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 185] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 186] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 187] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 188] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 189] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 190] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 191] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 192] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 193] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 194] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 195] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 196] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 197] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 198] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 199] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 200] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 201] = "SourceFile"; + SyntaxKind[SyntaxKind["Program"] = 202] = "Program"; + SyntaxKind[SyntaxKind["SyntaxList"] = 203] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 204] = "Count"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 51] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 62] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 64] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 99] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 64] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 119] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 100] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 108] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 132] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 140] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 13] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 62] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = 119] = "LastToken"; + SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 5] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 6] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 9] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 9] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 12] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstOperator"] = 21] = "FirstOperator"; + SyntaxKind[SyntaxKind["LastOperator"] = 62] = "LastOperator"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 23] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 62] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 120] = "FirstNode"; + })(ts.SyntaxKind || (ts.SyntaxKind = {})); + var SyntaxKind = ts.SyntaxKind; + (function (NodeFlags) { + NodeFlags[NodeFlags["Export"] = 1] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 16] = "Public"; + NodeFlags[NodeFlags["Private"] = 32] = "Private"; + NodeFlags[NodeFlags["Protected"] = 64] = "Protected"; + NodeFlags[NodeFlags["Static"] = 128] = "Static"; + NodeFlags[NodeFlags["MultiLine"] = 256] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 512] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 1024] = "DeclarationFile"; + NodeFlags[NodeFlags["Let"] = 2048] = "Let"; + NodeFlags[NodeFlags["Const"] = 4096] = "Const"; + NodeFlags[NodeFlags["OctalLiteral"] = 8192] = "OctalLiteral"; + NodeFlags[NodeFlags["Modifier"] = 243] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 6144] = "BlockScoped"; + })(ts.NodeFlags || (ts.NodeFlags = {})); + var NodeFlags = ts.NodeFlags; + (function (ParserContextFlags) { + ParserContextFlags[ParserContextFlags["StrictMode"] = 1] = "StrictMode"; + ParserContextFlags[ParserContextFlags["DisallowIn"] = 2] = "DisallowIn"; + ParserContextFlags[ParserContextFlags["Yield"] = 4] = "Yield"; + ParserContextFlags[ParserContextFlags["GeneratorParameter"] = 8] = "GeneratorParameter"; + ParserContextFlags[ParserContextFlags["ContainsError"] = 16] = "ContainsError"; + ParserContextFlags[ParserContextFlags["HasPropagatedChildContainsErrorFlag"] = 32] = "HasPropagatedChildContainsErrorFlag"; + })(ts.ParserContextFlags || (ts.ParserContextFlags = {})); + var ParserContextFlags = ts.ParserContextFlags; + (function (EmitReturnStatus) { + EmitReturnStatus[EmitReturnStatus["Succeeded"] = 0] = "Succeeded"; + EmitReturnStatus[EmitReturnStatus["AllOutputGenerationSkipped"] = 1] = "AllOutputGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["JSGeneratedWithSemanticErrors"] = 2] = "JSGeneratedWithSemanticErrors"; + EmitReturnStatus[EmitReturnStatus["DeclarationGenerationSkipped"] = 3] = "DeclarationGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["EmitErrorsEncountered"] = 4] = "EmitErrorsEncountered"; + EmitReturnStatus[EmitReturnStatus["CompilerOptionsErrors"] = 5] = "CompilerOptionsErrors"; + })(ts.EmitReturnStatus || (ts.EmitReturnStatus = {})); + var EmitReturnStatus = ts.EmitReturnStatus; + (function (TypeFormatFlags) { + TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; + TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType"; + TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction"; + TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation"; + TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature"; + TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike"; + TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; + })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); + var TypeFormatFlags = ts.TypeFormatFlags; + (function (SymbolFormatFlags) { + SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None"; + SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments"; + SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; + })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); + var SymbolFormatFlags = ts.SymbolFormatFlags; + (function (SymbolAccessibility) { + SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible"; + SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible"; + SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; + })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); + var SymbolAccessibility = ts.SymbolAccessibility; + (function (SymbolFlags) { + SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; + SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable"; + SymbolFlags[SymbolFlags["Property"] = 4] = "Property"; + SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember"; + SymbolFlags[SymbolFlags["Function"] = 16] = "Function"; + SymbolFlags[SymbolFlags["Class"] = 32] = "Class"; + SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface"; + SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 8192] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor"; + SymbolFlags[SymbolFlags["CallSignature"] = 131072] = "CallSignature"; + SymbolFlags[SymbolFlags["ConstructSignature"] = 262144] = "ConstructSignature"; + SymbolFlags[SymbolFlags["IndexSignature"] = 524288] = "IndexSignature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 1048576] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 2097152] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 4194304] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 8388608] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 16777216] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Import"] = 33554432] = "Import"; + SymbolFlags[SymbolFlags["Instantiated"] = 67108864] = "Instantiated"; + SymbolFlags[SymbolFlags["Merged"] = 134217728] = "Merged"; + SymbolFlags[SymbolFlags["Transient"] = 268435456] = "Transient"; + SymbolFlags[SymbolFlags["Prototype"] = 536870912] = "Prototype"; + SymbolFlags[SymbolFlags["UnionProperty"] = 1073741824] = "UnionProperty"; + SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; + SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; + SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; + SymbolFlags[SymbolFlags["Type"] = 3152352] = "Type"; + SymbolFlags[SymbolFlags["Namespace"] = 1536] = "Namespace"; + SymbolFlags[SymbolFlags["Module"] = 1536] = "Module"; + SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor"; + SymbolFlags[SymbolFlags["Signature"] = 917504] = "Signature"; + SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes"; + SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes"; + SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes"; + SymbolFlags[SymbolFlags["PropertyExcludes"] = 107455] = "PropertyExcludes"; + SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 107455] = "EnumMemberExcludes"; + SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes"; + SymbolFlags[SymbolFlags["ClassExcludes"] = 3258879] = "ClassExcludes"; + SymbolFlags[SymbolFlags["InterfaceExcludes"] = 3152288] = "InterfaceExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 3258623] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 3259263] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; + SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes"; + SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes"; + SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 2103776] = "TypeParameterExcludes"; + SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 3152352] = "TypeAliasExcludes"; + SymbolFlags[SymbolFlags["ImportExcludes"] = 33554432] = "ImportExcludes"; + SymbolFlags[SymbolFlags["ModuleMember"] = 35653619] = "ModuleMember"; + SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal"; + SymbolFlags[SymbolFlags["HasLocals"] = 1041936] = "HasLocals"; + SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports"; + SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers"; + SymbolFlags[SymbolFlags["IsContainer"] = 1048560] = "IsContainer"; + SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; + SymbolFlags[SymbolFlags["Export"] = 29360128] = "Export"; + })(ts.SymbolFlags || (ts.SymbolFlags = {})); + var SymbolFlags = ts.SymbolFlags; + (function (NodeCheckFlags) { + NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; + NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; + NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["EmitExtends"] = 8] = "EmitExtends"; + NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 16] = "SuperInstance"; + NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 32] = "SuperStatic"; + NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 64] = "ContextChecked"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 128] = "EnumValuesComputed"; + })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); + var NodeCheckFlags = ts.NodeCheckFlags; + (function (TypeFlags) { + TypeFlags[TypeFlags["Any"] = 1] = "Any"; + TypeFlags[TypeFlags["String"] = 2] = "String"; + TypeFlags[TypeFlags["Number"] = 4] = "Number"; + TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean"; + TypeFlags[TypeFlags["Void"] = 16] = "Void"; + TypeFlags[TypeFlags["Undefined"] = 32] = "Undefined"; + TypeFlags[TypeFlags["Null"] = 64] = "Null"; + TypeFlags[TypeFlags["Enum"] = 128] = "Enum"; + TypeFlags[TypeFlags["StringLiteral"] = 256] = "StringLiteral"; + TypeFlags[TypeFlags["TypeParameter"] = 512] = "TypeParameter"; + TypeFlags[TypeFlags["Class"] = 1024] = "Class"; + TypeFlags[TypeFlags["Interface"] = 2048] = "Interface"; + TypeFlags[TypeFlags["Reference"] = 4096] = "Reference"; + TypeFlags[TypeFlags["Tuple"] = 8192] = "Tuple"; + TypeFlags[TypeFlags["Union"] = 16384] = "Union"; + TypeFlags[TypeFlags["Anonymous"] = 32768] = "Anonymous"; + TypeFlags[TypeFlags["FromSignature"] = 65536] = "FromSignature"; + TypeFlags[TypeFlags["Intrinsic"] = 127] = "Intrinsic"; + TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; + TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; + TypeFlags[TypeFlags["ObjectType"] = 48128] = "ObjectType"; + })(ts.TypeFlags || (ts.TypeFlags = {})); + var TypeFlags = ts.TypeFlags; + (function (SignatureKind) { + SignatureKind[SignatureKind["Call"] = 0] = "Call"; + SignatureKind[SignatureKind["Construct"] = 1] = "Construct"; + })(ts.SignatureKind || (ts.SignatureKind = {})); + var SignatureKind = ts.SignatureKind; + (function (IndexKind) { + IndexKind[IndexKind["String"] = 0] = "String"; + IndexKind[IndexKind["Number"] = 1] = "Number"; + })(ts.IndexKind || (ts.IndexKind = {})); + var IndexKind = ts.IndexKind; + (function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; + })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var DiagnosticCategory = ts.DiagnosticCategory; + (function (ModuleKind) { + ModuleKind[ModuleKind["None"] = 0] = "None"; + ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; + ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; + })(ts.ModuleKind || (ts.ModuleKind = {})); + var ModuleKind = ts.ModuleKind; + (function (ScriptTarget) { + ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; + ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; + ScriptTarget[ScriptTarget["ES6"] = 2] = "ES6"; + ScriptTarget[ScriptTarget["Latest"] = 2] = "Latest"; + })(ts.ScriptTarget || (ts.ScriptTarget = {})); + var ScriptTarget = ts.ScriptTarget; + (function (CharacterCodes) { + CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; + CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; + CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; + CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; + CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator"; + CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator"; + CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine"; + CharacterCodes[CharacterCodes["space"] = 32] = "space"; + CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace"; + CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad"; + CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad"; + CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace"; + CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace"; + CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace"; + CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace"; + CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace"; + CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace"; + CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace"; + CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace"; + CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace"; + CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace"; + CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace"; + CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace"; + CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace"; + CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham"; + CharacterCodes[CharacterCodes["_"] = 95] = "_"; + CharacterCodes[CharacterCodes["$"] = 36] = "$"; + CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; + CharacterCodes[CharacterCodes["_1"] = 49] = "_1"; + CharacterCodes[CharacterCodes["_2"] = 50] = "_2"; + CharacterCodes[CharacterCodes["_3"] = 51] = "_3"; + CharacterCodes[CharacterCodes["_4"] = 52] = "_4"; + CharacterCodes[CharacterCodes["_5"] = 53] = "_5"; + CharacterCodes[CharacterCodes["_6"] = 54] = "_6"; + CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; + CharacterCodes[CharacterCodes["_8"] = 56] = "_8"; + CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; + CharacterCodes[CharacterCodes["a"] = 97] = "a"; + CharacterCodes[CharacterCodes["b"] = 98] = "b"; + CharacterCodes[CharacterCodes["c"] = 99] = "c"; + CharacterCodes[CharacterCodes["d"] = 100] = "d"; + CharacterCodes[CharacterCodes["e"] = 101] = "e"; + CharacterCodes[CharacterCodes["f"] = 102] = "f"; + CharacterCodes[CharacterCodes["g"] = 103] = "g"; + CharacterCodes[CharacterCodes["h"] = 104] = "h"; + CharacterCodes[CharacterCodes["i"] = 105] = "i"; + CharacterCodes[CharacterCodes["j"] = 106] = "j"; + CharacterCodes[CharacterCodes["k"] = 107] = "k"; + CharacterCodes[CharacterCodes["l"] = 108] = "l"; + CharacterCodes[CharacterCodes["m"] = 109] = "m"; + CharacterCodes[CharacterCodes["n"] = 110] = "n"; + CharacterCodes[CharacterCodes["o"] = 111] = "o"; + CharacterCodes[CharacterCodes["p"] = 112] = "p"; + CharacterCodes[CharacterCodes["q"] = 113] = "q"; + CharacterCodes[CharacterCodes["r"] = 114] = "r"; + CharacterCodes[CharacterCodes["s"] = 115] = "s"; + CharacterCodes[CharacterCodes["t"] = 116] = "t"; + CharacterCodes[CharacterCodes["u"] = 117] = "u"; + CharacterCodes[CharacterCodes["v"] = 118] = "v"; + CharacterCodes[CharacterCodes["w"] = 119] = "w"; + CharacterCodes[CharacterCodes["x"] = 120] = "x"; + CharacterCodes[CharacterCodes["y"] = 121] = "y"; + CharacterCodes[CharacterCodes["z"] = 122] = "z"; + CharacterCodes[CharacterCodes["A"] = 65] = "A"; + CharacterCodes[CharacterCodes["B"] = 66] = "B"; + CharacterCodes[CharacterCodes["C"] = 67] = "C"; + CharacterCodes[CharacterCodes["D"] = 68] = "D"; + CharacterCodes[CharacterCodes["E"] = 69] = "E"; + CharacterCodes[CharacterCodes["F"] = 70] = "F"; + CharacterCodes[CharacterCodes["G"] = 71] = "G"; + CharacterCodes[CharacterCodes["H"] = 72] = "H"; + CharacterCodes[CharacterCodes["I"] = 73] = "I"; + CharacterCodes[CharacterCodes["J"] = 74] = "J"; + CharacterCodes[CharacterCodes["K"] = 75] = "K"; + CharacterCodes[CharacterCodes["L"] = 76] = "L"; + CharacterCodes[CharacterCodes["M"] = 77] = "M"; + CharacterCodes[CharacterCodes["N"] = 78] = "N"; + CharacterCodes[CharacterCodes["O"] = 79] = "O"; + CharacterCodes[CharacterCodes["P"] = 80] = "P"; + CharacterCodes[CharacterCodes["Q"] = 81] = "Q"; + CharacterCodes[CharacterCodes["R"] = 82] = "R"; + CharacterCodes[CharacterCodes["S"] = 83] = "S"; + CharacterCodes[CharacterCodes["T"] = 84] = "T"; + CharacterCodes[CharacterCodes["U"] = 85] = "U"; + CharacterCodes[CharacterCodes["V"] = 86] = "V"; + CharacterCodes[CharacterCodes["W"] = 87] = "W"; + CharacterCodes[CharacterCodes["X"] = 88] = "X"; + CharacterCodes[CharacterCodes["Y"] = 89] = "Y"; + CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; + CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; + CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; + CharacterCodes[CharacterCodes["at"] = 64] = "at"; + CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; + CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; + CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; + CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; + CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; + CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; + CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; + CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; + CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; + CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; + CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; + CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; + CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; + CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; + CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; + CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; + CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; + CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; + CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; + CharacterCodes[CharacterCodes["question"] = 63] = "question"; + CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; + CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; + CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; + CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; + CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; + CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; + CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark"; + CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; + CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; + })(ts.CharacterCodes || (ts.CharacterCodes = {})); + var CharacterCodes = ts.CharacterCodes; +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(ts.Ternary || (ts.Ternary = {})); + var Ternary = ts.Ternary; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(ts.Comparison || (ts.Comparison = {})); + var Comparison = ts.Comparison; + function forEach(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + var result = callback(array[i]); + if (result) { + return result; + } + } + } + return undefined; + } + ts.forEach = forEach; + function contains(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return true; + } + } + } + return false; + } + ts.contains = contains; + function indexOf(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + } + return -1; + } + ts.indexOf = indexOf; + function countWhere(array, predicate) { + var count = 0; + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (predicate(array[i])) { + count++; + } + } + } + return count; + } + ts.countWhere = countWhere; + function filter(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (f(item)) { + result.push(item); + } + } + } + return result; + } + ts.filter = filter; + function map(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + result.push(f(array[i])); + } + } + return result; + } + ts.map = map; + function concatenate(array1, array2) { + if (!array2 || !array2.length) + return array1; + if (!array1 || !array1.length) + return array2; + return array1.concat(array2); + } + ts.concatenate = concatenate; + function deduplicate(array) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) + result.push(item); + } + } + return result; + } + ts.deduplicate = deduplicate; + function sum(array, prop) { + var result = 0; + for (var i = 0; i < array.length; i++) { + result += array[i][prop]; + } + return result; + } + ts.sum = sum; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; + function binarySearch(array, value) { + var low = 0; + var high = array.length - 1; + while (low <= high) { + var middle = low + ((high - low) >> 1); + var midValue = array[middle]; + if (midValue === value) { + return middle; + } + else if (midValue > value) { + high = middle - 1; + } + else { + low = middle + 1; + } + } + return ~low; + } + ts.binarySearch = binarySearch; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasProperty(map, key) { + return hasOwnProperty.call(map, key); + } + ts.hasProperty = hasProperty; + function getProperty(map, key) { + return hasOwnProperty.call(map, key) ? map[key] : undefined; + } + ts.getProperty = getProperty; + function isEmpty(map) { + for (var id in map) { + if (hasProperty(map, id)) { + return false; + } + } + return true; + } + ts.isEmpty = isEmpty; + function clone(object) { + var result = {}; + for (var id in object) { + result[id] = object[id]; + } + return result; + } + ts.clone = clone; + function forEachValue(map, callback) { + var result; + for (var id in map) { + if (result = callback(map[id])) + break; + } + return result; + } + ts.forEachValue = forEachValue; + function forEachKey(map, callback) { + var result; + for (var id in map) { + if (result = callback(id)) + break; + } + return result; + } + ts.forEachKey = forEachKey; + function lookUp(map, key) { + return hasProperty(map, key) ? map[key] : undefined; + } + ts.lookUp = lookUp; + function mapToArray(map) { + var result = []; + for (var id in map) { + result.push(map[id]); + } + return result; + } + ts.mapToArray = mapToArray; + function arrayToMap(array, makeKey) { + var result = {}; + forEach(array, function (value) { + result[makeKey(value)] = value; + }); + return result; + } + ts.arrayToMap = arrayToMap; + function formatStringFromArgs(text, args, baseIndex) { + baseIndex = baseIndex || 0; + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + } + ts.localizedDiagnosticMessages = undefined; + function getLocaleSpecificMessage(message) { + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + } + ts.getLocaleSpecificMessage = getLocaleSpecificMessage; + function createFileDiagnostic(file, start, length, message) { + Debug.assert(start >= 0, "start must be non-negative, is " + start); + Debug.assert(length >= 0, "length must be non-negative, is " + length); + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file: file, + start: start, + length: length, + messageText: text, + category: message.category, + code: message.code, + isEarly: message.isEarly + }; + } + ts.createFileDiagnostic = createFileDiagnostic; + function createCompilerDiagnostic(message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 1) { + text = formatStringFromArgs(text, arguments, 1); + } + return { + file: undefined, + start: undefined, + length: undefined, + messageText: text, + category: message.category, + code: message.code, + isEarly: message.isEarly + }; + } + ts.createCompilerDiagnostic = createCompilerDiagnostic; + function chainDiagnosticMessages(details, message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return { + messageText: text, + category: message.category, + code: message.code, + next: details + }; + } + ts.chainDiagnosticMessages = chainDiagnosticMessages; + function concatenateDiagnosticMessageChains(headChain, tailChain) { + Debug.assert(!headChain.next); + headChain.next = tailChain; + return headChain; + } + ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; + function flattenDiagnosticChain(file, start, length, diagnosticChain, newLine) { + 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: file, + start: start, + length: length, + code: code, + category: category, + messageText: messageText + }; + } + ts.flattenDiagnosticChain = flattenDiagnosticChain; + function compareValues(a, b) { + if (a === b) + return 0 /* EqualTo */; + if (a === undefined) + return -1 /* LessThan */; + if (b === undefined) + return 1 /* GreaterThan */; + return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + } + ts.compareValues = compareValues; + function getDiagnosticFilename(diagnostic) { + return diagnostic.file ? diagnostic.file.filename : undefined; + } + function compareDiagnostics(d1, d2) { + 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; + } + ts.compareDiagnostics = compareDiagnostics; + function deduplicateSortedDiagnostics(diagnostics) { + if (diagnostics.length < 2) { + return diagnostics; + } + var newDiagnostics = [diagnostics[0]]; + var previousDiagnostic = diagnostics[0]; + for (var i = 1; i < diagnostics.length; i++) { + var currentDiagnostic = diagnostics[i]; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0 /* EqualTo */; + if (!isDupe) { + newDiagnostics.push(currentDiagnostic); + previousDiagnostic = currentDiagnostic; + } + } + return newDiagnostics; + } + ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics; + function normalizeSlashes(path) { + return path.replace(/\\/g, "/"); + } + ts.normalizeSlashes = normalizeSlashes; + function getRootLength(path) { + if (path.charCodeAt(0) === 47 /* slash */) { + if (path.charCodeAt(1) !== 47 /* slash */) + return 1; + var p1 = path.indexOf("/", 2); + if (p1 < 0) + return 2; + var p2 = path.indexOf("/", p1 + 1); + if (p2 < 0) + return p1 + 1; + return p2 + 1; + } + if (path.charCodeAt(1) === 58 /* colon */) { + if (path.charCodeAt(2) === 47 /* slash */) + return 3; + return 2; + } + return 0; + } + ts.getRootLength = getRootLength; + ts.directorySeparator = "/"; + function getNormalizedParts(normalizedSlashedPath, rootLength) { + var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); + var normalized = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (part !== ".") { + if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { + normalized.pop(); + } + else { + normalized.push(part); + } + } + } + return normalized; + } + function normalizePath(path) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + var normalized = getNormalizedParts(path, rootLength); + return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); + } + ts.normalizePath = normalizePath; + function getDirectoryPath(path) { + return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); + } + ts.getDirectoryPath = getDirectoryPath; + function isUrl(path) { + return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; + } + ts.isUrl = isUrl; + function isRootedDiskPath(path) { + return getRootLength(path) !== 0; + } + ts.isRootedDiskPath = isRootedDiskPath; + function normalizedPathComponents(path, rootLength) { + var normalizedParts = getNormalizedParts(path, rootLength); + return [path.substr(0, rootLength)].concat(normalizedParts); + } + function getNormalizedPathComponents(path, currentDirectory) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength == 0) { + path = combinePaths(normalizeSlashes(currentDirectory), path); + rootLength = getRootLength(path); + } + return normalizedPathComponents(path, rootLength); + } + ts.getNormalizedPathComponents = getNormalizedPathComponents; + function getNormalizedAbsolutePath(filename, currentDirectory) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(filename, currentDirectory)); + } + ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath; + function getNormalizedPathFromPathComponents(pathComponents) { + if (pathComponents && pathComponents.length) { + return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); + } + } + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; + function getNormalizedPathComponentsOfUrl(url) { + var urlLength = url.length; + var rootLength = url.indexOf("://") + "://".length; + while (rootLength < urlLength) { + if (url.charCodeAt(rootLength) === 47 /* slash */) { + rootLength++; + } + else { + break; + } + } + if (rootLength === urlLength) { + return [url]; + } + var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); + if (indexOfNextSlash !== -1) { + rootLength = indexOfNextSlash + 1; + return normalizedPathComponents(url, rootLength); + } + else { + return [url + ts.directorySeparator]; + } + } + function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { + if (isUrl(pathOrUrl)) { + return getNormalizedPathComponentsOfUrl(pathOrUrl); + } + else { + return getNormalizedPathComponents(pathOrUrl, currentDirectory); + } + } + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { + var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); + var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); + if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { + directoryComponents.length--; + } + for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { + break; + } + } + if (joinStartIndex) { + var relativePath = ""; + var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); + for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (directoryComponents[joinStartIndex] !== "") { + relativePath = relativePath + ".." + ts.directorySeparator; + } + } + return relativePath + relativePathComponents.join(ts.directorySeparator); + } + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); + if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { + absolutePath = "file:///" + absolutePath; + } + return absolutePath; + } + ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; + function getBaseFilename(path) { + var i = path.lastIndexOf(ts.directorySeparator); + return i < 0 ? path : path.substring(i + 1); + } + ts.getBaseFilename = getBaseFilename; + function combinePaths(path1, path2) { + if (!(path1 && path1.length)) + return path2; + if (!(path2 && path2.length)) + return path1; + if (path2.charAt(0) === ts.directorySeparator) + return path2; + if (path1.charAt(path1.length - 1) === ts.directorySeparator) + return path1 + path2; + return path1 + ts.directorySeparator + path2; + } + ts.combinePaths = combinePaths; + function fileExtensionIs(path, extension) { + var pathLen = path.length; + var extLen = extension.length; + return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; + } + ts.fileExtensionIs = fileExtensionIs; + var supportedExtensions = [".d.ts", ".ts", ".js"]; + function removeFileExtension(path) { + for (var i = 0; i < supportedExtensions.length; i++) { + var ext = supportedExtensions[i]; + if (fileExtensionIs(path, ext)) { + return path.substr(0, path.length - ext.length); + } + } + return path; + } + ts.removeFileExtension = removeFileExtension; + var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\\\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\0": "\\0", + "\r": "\\r", + "\n": "\\n", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function escapeString(s) { + return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, function (c) { + return escapedCharsMap[c] || c; + }) : s; + } + ts.escapeString = escapeString; + function Symbol(flags, name) { + this.flags = flags; + this.name = name; + this.declarations = undefined; + } + function Type(checker, flags) { + this.flags = flags; + } + function Signature(checker) { + } + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + Node.prototype = { + kind: kind, + pos: 0, + end: 0, + flags: 0, + parent: undefined + }; + return Node; + }, + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } + }; + (function (AssertionLevel) { + AssertionLevel[AssertionLevel["None"] = 0] = "None"; + AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; + AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; + AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; + })(ts.AssertionLevel || (ts.AssertionLevel = {})); + var AssertionLevel = ts.AssertionLevel; + var Debug; + (function (Debug) { + var currentAssertionLevel = 0 /* None */; + function shouldAssert(level) { + return currentAssertionLevel >= level; + } + Debug.shouldAssert = shouldAssert; + function assert(expression, message, verboseDebugInfo) { + if (!expression) { + var verboseDebugString = ""; + if (verboseDebugInfo) { + verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); + } + throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); + } + } + Debug.assert = assert; + function fail(message) { + Debug.assert(false, message); + } + Debug.fail = fail; + })(Debug = ts.Debug || (ts.Debug = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.sys = (function () { + function getWScriptSystem() { + var fso = new ActiveXObject("Scripting.FileSystemObject"); + var fileStream = new ActiveXObject("ADODB.Stream"); + fileStream.Type = 2; + var binaryStream = new ActiveXObject("ADODB.Stream"); + binaryStream.Type = 1; + var args = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + function readFile(fileName, encoding) { + if (!fso.FileExists(fileName)) { + return undefined; + } + fileStream.Open(); + try { + if (encoding) { + fileStream.Charset = encoding; + fileStream.LoadFromFile(fileName); + } + else { + fileStream.Charset = "x-ansi"; + fileStream.LoadFromFile(fileName); + var bom = fileStream.ReadText(2) || ""; + fileStream.Position = 0; + fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; + } + return fileStream.ReadText(); + } + catch (e) { + throw e; + } + finally { + fileStream.Close(); + } + } + function writeFile(fileName, data, writeByteOrderMark) { + fileStream.Open(); + binaryStream.Open(); + try { + fileStream.Charset = "utf-8"; + fileStream.WriteText(data); + if (writeByteOrderMark) { + fileStream.Position = 0; + } + else { + fileStream.Position = 3; + } + fileStream.CopyTo(binaryStream); + binaryStream.SaveToFile(fileName, 2); + } + finally { + binaryStream.Close(); + fileStream.Close(); + } + } + return { + args: args, + newLine: "\r\n", + useCaseSensitiveFileNames: false, + write: function (s) { + WScript.StdOut.Write(s); + }, + readFile: readFile, + writeFile: writeFile, + resolvePath: function (path) { + return fso.GetAbsolutePathName(path); + }, + fileExists: function (path) { + return fso.FileExists(path); + }, + directoryExists: function (path) { + return fso.FolderExists(path); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + fso.CreateFolder(directoryName); + } + }, + getExecutingFilePath: function () { + return WScript.ScriptFullName; + }, + getCurrentDirectory: function () { + return new ActiveXObject("WScript.Shell").CurrentDirectory; + }, + exit: function (exitCode) { + try { + WScript.Quit(exitCode); + } + catch (e) { + } + } + }; + } + function getNodeSystem() { + var _fs = require("fs"); + var _path = require("path"); + var _os = require('os'); + var platform = _os.platform(); + var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + function readFile(fileName, encoding) { + if (!_fs.existsSync(fileName)) { + return undefined; + } + var buffer = _fs.readFileSync(fileName); + var len = buffer.length; + if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { + len &= ~1; + for (var i = 0; i < len; i += 2) { + var temp = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = temp; + } + return buffer.toString("utf16le", 2); + } + if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { + return buffer.toString("utf16le", 2); + } + if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + return buffer.toString("utf8", 3); + } + return buffer.toString("utf8"); + } + function writeFile(fileName, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = '\uFEFF' + data; + } + _fs.writeFileSync(fileName, data, "utf8"); + } + return { + args: process.argv.slice(2), + newLine: _os.EOL, + useCaseSensitiveFileNames: useCaseSensitiveFileNames, + write: function (s) { + _fs.writeSync(1, s); + }, + readFile: readFile, + writeFile: writeFile, + watchFile: function (fileName, callback) { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } + }; + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); + } + ; + }, + resolvePath: function (path) { + return _path.resolve(path); + }, + fileExists: function (path) { + return _fs.existsSync(path); + }, + directoryExists: function (path) { + return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + _fs.mkdirSync(directoryName); + } + }, + getExecutingFilePath: function () { + return __filename; + }, + getCurrentDirectory: function () { + return process.cwd(); + }, + getMemoryUsage: function () { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + }, + exit: function (exitCode) { + process.exit(exitCode); + } + }; + } + if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + return getWScriptSystem(); + } + else if (typeof module !== "undefined" && module.exports) { + return getNodeSystem(); + } + else { + return undefined; + } + })(); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* 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: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, + A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: 1 /* Error */, key: "A function implementation cannot be declared in an ambient context." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* 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: 1 /* 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: 1 /* Error */, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* 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: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* 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: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* 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: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, + A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: 1 /* Error */, key: "A constructor implementation cannot be declared in an ambient context." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1 /* Error */, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* 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: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1 /* Error */, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1 /* Error */, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1 /* Error */, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1 /* Error */, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1 /* Error */, key: "Computed property names are not allowed in enums." }, + Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Computed property names are not allowed in method overloads." }, + Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: 1 /* Error */, key: "Computed property names are not allowed in interfaces." }, + Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: 1 /* 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: 1 /* Error */, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1 /* Error */, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1 /* Error */, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1 /* Error */, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1 /* Error */, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1 /* Error */, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1 /* Error */, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1 /* Error */, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1 /* Error */, key: "Unexpected token. '{' expected." }, + 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." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, + Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: 1 /* Error */, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." }, + Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: 1 /* Error */, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1 /* Error */, key: "An AMD module cannot have multiple name assignments." }, + 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}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* 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: 1 /* 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: 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'." }, + 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'." }, + 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}'." }, + 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." }, + 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." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2 /* Message */, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + 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." }, + 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" }, + Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, + 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..." }, + KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, + FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, + VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, + LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* Error */, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + 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}." }, + Warn_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." }, + 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." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* 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: 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." }, + Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported." }, + Computed_property_names_are_not_currently_supported: { code: 9002, category: 1 /* Error */, key: "Computed property names are not currently supported." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var textToToken = { + "any": 109 /* AnyKeyword */, + "boolean": 110 /* BooleanKeyword */, + "break": 64 /* BreakKeyword */, + "case": 65 /* CaseKeyword */, + "catch": 66 /* CatchKeyword */, + "class": 67 /* ClassKeyword */, + "continue": 69 /* ContinueKeyword */, + "const": 68 /* ConstKeyword */, + "constructor": 111 /* ConstructorKeyword */, + "debugger": 70 /* DebuggerKeyword */, + "declare": 112 /* DeclareKeyword */, + "default": 71 /* DefaultKeyword */, + "delete": 72 /* DeleteKeyword */, + "do": 73 /* DoKeyword */, + "else": 74 /* ElseKeyword */, + "enum": 75 /* EnumKeyword */, + "export": 76 /* ExportKeyword */, + "extends": 77 /* ExtendsKeyword */, + "false": 78 /* FalseKeyword */, + "finally": 79 /* FinallyKeyword */, + "for": 80 /* ForKeyword */, + "function": 81 /* FunctionKeyword */, + "get": 113 /* GetKeyword */, + "if": 82 /* IfKeyword */, + "implements": 100 /* ImplementsKeyword */, + "import": 83 /* ImportKeyword */, + "in": 84 /* InKeyword */, + "instanceof": 85 /* InstanceOfKeyword */, + "interface": 101 /* InterfaceKeyword */, + "let": 102 /* LetKeyword */, + "module": 114 /* ModuleKeyword */, + "new": 86 /* NewKeyword */, + "null": 87 /* NullKeyword */, + "number": 116 /* NumberKeyword */, + "package": 103 /* PackageKeyword */, + "private": 104 /* PrivateKeyword */, + "protected": 105 /* ProtectedKeyword */, + "public": 106 /* PublicKeyword */, + "require": 115 /* RequireKeyword */, + "return": 88 /* ReturnKeyword */, + "set": 117 /* SetKeyword */, + "static": 107 /* StaticKeyword */, + "string": 118 /* StringKeyword */, + "super": 89 /* SuperKeyword */, + "switch": 90 /* SwitchKeyword */, + "this": 91 /* ThisKeyword */, + "throw": 92 /* ThrowKeyword */, + "true": 93 /* TrueKeyword */, + "try": 94 /* TryKeyword */, + "type": 119 /* TypeKeyword */, + "typeof": 95 /* TypeOfKeyword */, + "var": 96 /* VarKeyword */, + "void": 97 /* VoidKeyword */, + "while": 98 /* WhileKeyword */, + "with": 99 /* WithKeyword */, + "yield": 108 /* YieldKeyword */, + "{": 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 */ + }; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); + } + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + for (var name in source) { + if (source.hasOwnProperty(name)) { + result[source[name]] = name; + } + } + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos++); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionFromLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line > 0); + return lineStarts[line - 1] + character - 1; + } + ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; + function getLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = (~lineNumber) - 1; + } + return { + line: lineNumber + 1, + character: position - lineStarts[lineNumber] + 1 + }; + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + function positionToLineAndCharacter(text, pos) { + var lineStarts = computeLineStarts(text); + return getLineAndCharacterOfPosition(lineStarts, pos); + } + ts.positionToLineAndCharacter = positionToLineAndCharacter; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; + } + ts.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; + } + function isOctalDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; + } + ts.isOctalDigit = isOctalDigit; + function skipTrivia(text, pos, stopAfterLineBreak) { + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (stopAfterLineBreak) + return pos; + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts.skipTrivia = skipTrivia; + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + result[result.length - 1].hasTrailingNewLine = true; + } + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { + var startPos = pos; + pos += 2; + if (nextChar === 47 /* slash */) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) + result = []; + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + result[result.length - 1].hasTrailingNewLine = true; + } + pos++; + continue; + } + break; + } + return result; + } + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function createScanner(languageVersion, skipTrivia, text, onError) { + var pos; + var len; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var tokenIsUnterminated; + function error(message) { + if (onError) { + onError(message); + } + } + function isIdentifierStart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + function isIdentifierPart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46 /* dot */) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { + pos++; + if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanHexDigits(count, mustMatchCount) { + var digits = 0; + var value = 0; + while (digits < count || !mustMatchCount) { + var ch = text.charCodeAt(pos); + if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { + value = value * 16 + ch - 48 /* _0 */; + } + else if (ch >= 65 /* A */ && ch <= 70 /* F */) { + value = value * 16 + ch - 65 /* A */ + 10; + } + else if (ch >= 97 /* a */ && ch <= 102 /* f */) { + value = value * 16 + ch - 97 /* a */ + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function scanString() { + var quote = text.charCodeAt(pos++); + var result = ""; + var start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 /* backslash */) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96 /* backtick */) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; + break; + } + if (currChar === 92 /* backslash */) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13 /* carriageReturn */) { + contents += text.substring(start, pos); + if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos++; + } + pos++; + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48 /* _0 */: + return "\0"; + case 98 /* b */: + return "\b"; + case 116 /* t */: + return "\t"; + case 110 /* n */: + return "\n"; + case 118 /* v */: + return "\v"; + case 102 /* f */: + return "\f"; + case 114 /* r */: + return "\r"; + case 39 /* singleQuote */: + return "\'"; + case 34 /* doubleQuote */: + return "\""; + case 120 /* x */: + case 117 /* u */: + var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13 /* carriageReturn */: + if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + case 8232 /* lineSeparator */: + case 8233 /* paragraphSeparator */: + return ""; + default: + return String.fromCharCode(ch); + } + } + function peekUnicodeEscape() { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { + var start = pos; + pos += 2; + var value = scanHexDigits(4, true); + pos = start; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch)) { + pos++; + } + else if (ch === 92 /* backslash */) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; + } + } + return token = 63 /* Identifier */; + } + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48 /* _0 */; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; + } + if (numberOfDigits === 0) { + return -1; + } + return value; + } + function scan() { + startPos = pos; + precedingLineBreak = false; + tokenIsUnterminated = false; + while (true) { + tokenPos = pos; + if (pos >= len) { + return token = 1 /* EndOfFileToken */; + } + var ch = text.charCodeAt(pos); + switch (ch) { + case 10 /* lineFeed */: + case 13 /* carriageReturn */: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos += 2; + } + else { + pos++; + } + return token = 4 /* NewLineTrivia */; + } + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5 /* WhitespaceTrivia */; + } + case 33 /* exclamation */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; + } + return pos += 2, token = 28 /* ExclamationEqualsToken */; + } + return pos++, token = 45 /* ExclamationToken */; + case 34 /* doubleQuote */: + case 39 /* singleQuote */: + tokenValue = scanString(); + return token = 7 /* StringLiteral */; + case 96 /* backtick */: + return token = scanTemplateAndSetTokenValue(); + case 37 /* percent */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 56 /* PercentEqualsToken */; + } + return pos++, token = 36 /* PercentToken */; + case 38 /* ampersand */: + if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { + return pos += 2, token = 47 /* AmpersandAmpersandToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 60 /* AmpersandEqualsToken */; + } + return pos++, token = 42 /* AmpersandToken */; + case 40 /* openParen */: + return pos++, token = 15 /* OpenParenToken */; + case 41 /* closeParen */: + return pos++, token = 16 /* CloseParenToken */; + case 42 /* asterisk */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 54 /* AsteriskEqualsToken */; + } + return pos++, token = 34 /* AsteriskToken */; + case 43 /* plus */: + if (text.charCodeAt(pos + 1) === 43 /* plus */) { + return pos += 2, token = 37 /* PlusPlusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 52 /* PlusEqualsToken */; + } + return pos++, token = 32 /* PlusToken */; + case 44 /* comma */: + return pos++, token = 22 /* CommaToken */; + case 45 /* minus */: + if (text.charCodeAt(pos + 1) === 45 /* minus */) { + return pos += 2, token = 38 /* MinusMinusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 53 /* MinusEqualsToken */; + } + return pos++, token = 33 /* MinusToken */; + case 46 /* dot */: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + } + if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { + return pos += 3, token = 20 /* DotDotDotToken */; + } + return pos++, token = 19 /* DotToken */; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (skipTrivia) { + continue; + } + else { + return token = 2 /* SingleLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + var commentClosed = false; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3 /* MultiLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 55 /* SlashEqualsToken */; + } + return pos++, token = 35 /* SlashToken */; + case 48 /* _0 */: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { + pos += 2; + var value = scanHexDigits(1, false); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 6 /* NumericLiteral */; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; + } + tokenValue = "" + value; + return 6 /* NumericLiteral */; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return 6 /* NumericLiteral */; + } + if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return token = 6 /* NumericLiteral */; + } + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + case 56 /* _8 */: + case 57 /* _9 */: + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + case 58 /* colon */: + return pos++, token = 50 /* ColonToken */; + case 59 /* semicolon */: + return pos++, token = 21 /* SemicolonToken */; + case 60 /* lessThan */: + if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; + } + return pos += 2, token = 39 /* LessThanLessThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 25 /* LessThanEqualsToken */; + } + return pos++, token = 23 /* LessThanToken */; + case 61 /* equals */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; + } + return pos += 2, token = 27 /* EqualsEqualsToken */; + } + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + return pos += 2, token = 31 /* EqualsGreaterThanToken */; + } + return pos++, token = 51 /* EqualsToken */; + case 62 /* greaterThan */: + return pos++, token = 24 /* GreaterThanToken */; + case 63 /* question */: + return pos++, token = 49 /* QuestionToken */; + case 91 /* openBracket */: + return pos++, token = 17 /* OpenBracketToken */; + case 93 /* closeBracket */: + return pos++, token = 18 /* CloseBracketToken */; + case 94 /* caret */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 62 /* CaretEqualsToken */; + } + return pos++, token = 44 /* CaretToken */; + case 123 /* openBrace */: + return pos++, token = 13 /* OpenBraceToken */; + case 124 /* bar */: + if (text.charCodeAt(pos + 1) === 124 /* bar */) { + return pos += 2, token = 48 /* BarBarToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 61 /* BarEqualsToken */; + } + return pos++, token = 43 /* BarToken */; + case 125 /* closeBrace */: + return pos++, token = 14 /* CloseBraceToken */; + case 126 /* tilde */: + return pos++, token = 46 /* TildeToken */; + case 92 /* backslash */: + var ch = peekUnicodeEscape(); + if (ch >= 0 && isIdentifierStart(ch)) { + pos += 6; + tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + default: + if (isIdentifierStart(ch)) { + pos++; + while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92 /* backslash */) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + } + } + } + function reScanGreaterToken() { + if (token === 24 /* GreaterThanToken */) { + if (text.charCodeAt(pos) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + } + return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; + } + return pos++, token = 40 /* GreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos) === 61 /* equals */) { + return pos++, token = 26 /* GreaterThanEqualsToken */; + } + } + return token; + } + function reScanSlashToken() { + if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= len) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 /* slash */ && !inCharacterClass) { + p++; + break; + } + else if (ch === 91 /* openBracket */) { + inCharacterClass = true; + } + else if (ch === 92 /* backslash */) { + inEscape = true; + } + else if (ch === 93 /* closeBracket */) { + inCharacterClass = false; + } + p++; + } + while (p < len && isIdentifierPart(text.charCodeAt(p))) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 8 /* RegularExpressionLiteral */; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryScan(callback) { + return speculationHelper(callback, false); + } + function setText(newText) { + text = newText || ""; + len = text.length; + setTextPos(0); + } + function setTextPos(textPos) { + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0 /* Unknown */; + precedingLineBreak = false; + } + setText(text); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 63 /* Identifier */ || token > 99 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 64 /* FirstReservedWord */ && token <= 99 /* LastReservedWord */; }, + isUnterminated: function () { return tokenIsUnterminated; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scan: scan, + setText: setText, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead + }; + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if (declaration.kind === kind) { + return declaration; + } + } + return undefined; + } + ts.getDeclarationOfKind = getDeclarationOfKind; + var stringWriters = []; + function getSingleLineStringWriter() { + if (stringWriters.length == 0) { + var str = ""; + var writeText = function (text) { return str += text; }; + return { + string: function () { return str; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeSymbol: writeText, + writeLine: function () { return str += " "; }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { return str = ""; }, + trackSymbol: function () { + } + }; + } + return stringWriters.pop(); + } + ts.getSingleLineStringWriter = getSingleLineStringWriter; + function releaseStringWriter(writer) { + writer.clear(); + stringWriters.push(writer); + } + ts.releaseStringWriter = releaseStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts.getFullWidth = getFullWidth; + function hasFlag(val, flag) { + return (val & flag) !== 0; + } + ts.hasFlag = hasFlag; + function containsParseError(node) { + if (!hasFlag(node.parserContextFlags, 32 /* HasPropagatedChildContainsErrorFlag */)) { + var val = hasFlag(node.parserContextFlags, 16 /* ContainsError */) || ts.forEachChild(node, containsParseError); + if (val) { + node.parserContextFlags |= 16 /* ContainsError */; + } + node.parserContextFlags |= 32 /* HasPropagatedChildContainsErrorFlag */; + } + return hasFlag(node.parserContextFlags, 16 /* ContainsError */); + } + ts.containsParseError = containsParseError; + function getSourceFileOfNode(node) { + while (node && node.kind !== 201 /* SourceFile */) { + node = node.parent; + } + return node; + } + ts.getSourceFileOfNode = getSourceFileOfNode; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = file.getLineAndCharacterFromPosition(node.pos); + return file.filename + "(" + loc.line + "," + loc.character + ")"; + } + ts.nodePosToString = nodePosToString; + function getStartPosOfNode(node) { + return node.pos; + } + ts.getStartPosOfNode = getStartPosOfNode; + function isMissingNode(node) { + return node.pos === node.end && node.kind !== 1 /* EndOfFileToken */; + } + ts.isMissingNode = isMissingNode; + function getTokenPosOfNode(node, sourceFile) { + if (isMissingNode(node)) { + return node.pos; + } + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); + } + ts.getTokenPosOfNode = getTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node) { + if (isMissingNode(node)) { + return ""; + } + var text = sourceFile.text; + return text.substring(ts.skipTrivia(text, node.pos), node.end); + } + ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function getTextOfNodeFromSourceText(sourceText, node) { + if (isMissingNode(node)) { + return ""; + } + return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + } + ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node) { + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node); + } + ts.getTextOfNode = getTextOfNode; + function escapeIdentifier(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier; + } + ts.escapeIdentifier = escapeIdentifier; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; + function declarationNameToString(name) { + return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts.declarationNameToString = declarationNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = getTokenPosOfNode(node, file); + var length = node.end - start; + return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeFromMessageChain(node, messageChain, newLine) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = ts.skipTrivia(file.text, node.pos); + var length = node.end - start; + return ts.flattenDiagnosticChain(file, start, length, messageChain, newLine); + } + ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function getErrorSpanForNode(node) { + var errorSpan; + switch (node.kind) { + case 183 /* VariableDeclaration */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 189 /* ModuleDeclaration */: + case 188 /* EnumDeclaration */: + case 200 /* EnumMember */: + errorSpan = node.name; + break; + } + return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node; + } + ts.getErrorSpanForNode = getErrorSpanForNode; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; + function isDeclarationFile(file) { + return (file.flags & 1024 /* DeclarationFile */) !== 0; + } + ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return node.kind === 188 /* EnumDeclaration */ && isConst(node); + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; + function isConst(node) { + return !!(node.flags & 4096 /* Const */); + } + ts.isConst = isConst; + function isLet(node) { + return !!(node.flags & 2048 /* Let */); + } + ts.isLet = isLet; + function isPrologueDirective(node) { + return node.kind === 166 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; + } + ts.isPrologueDirective = isPrologueDirective; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); + if (node.kind === 123 /* Parameter */ || node.kind === 122 /* TypeParameter */) { + return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); + } + else { + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + } + } + ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getJsDocComments(node, sourceFileOfNode) { + return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + function isJsDocComment(comment) { + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47 /* slash */; + } + } + ts.getJsDocComments = getJsDocComments; + ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 174 /* ReturnStatement */: + return visitor(node); + case 163 /* Block */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + return ts.forEachChild(node, traverse); + } + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function isAnyFunction(node) { + if (node) { + switch (node.kind) { + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + return true; + } + } + return false; + } + ts.isAnyFunction = isAnyFunction; + function isFunctionBlock(node) { + return node !== undefined && node.kind === 163 /* Block */ && isAnyFunction(node.parent); + } + ts.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node !== undefined && node.kind === 125 /* Method */ && node.parent.kind === 142 /* ObjectLiteralExpression */; + } + ts.isObjectLiteralMethod = isObjectLiteralMethod; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isAnyFunction(node)) { + return node; + } + } + } + ts.getContainingFunction = getContainingFunction; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 151 /* ArrowFunction */: + if (!includeArrowFunctions) { + continue; + } + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 189 /* ModuleDeclaration */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 188 /* EnumDeclaration */: + case 201 /* SourceFile */: + return node; + } + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return node; + } + } + } + ts.getSuperContainer = getSuperContainer; + function getInvokedExpression(node) { + if (node.kind === 147 /* TaggedTemplateExpression */) { + return node.tag; + } + return node.expression; + } + ts.getInvokedExpression = getInvokedExpression; + function isExpression(node) { + switch (node.kind) { + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + case 8 /* RegularExpressionLiteral */: + case 141 /* ArrayLiteralExpression */: + case 142 /* ObjectLiteralExpression */: + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 147 /* TaggedTemplateExpression */: + case 148 /* TypeAssertionExpression */: + case 149 /* ParenthesizedExpression */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 154 /* VoidExpression */: + case 152 /* DeleteExpression */: + case 153 /* TypeOfExpression */: + case 155 /* PrefixUnaryExpression */: + case 156 /* PostfixUnaryExpression */: + case 157 /* BinaryExpression */: + case 158 /* ConditionalExpression */: + case 159 /* TemplateExpression */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 161 /* OmittedExpression */: + return true; + case 120 /* QualifiedName */: + while (node.parent.kind === 120 /* QualifiedName */) { + node = node.parent; + } + return node.parent.kind === 135 /* TypeQuery */; + case 63 /* Identifier */: + if (node.parent.kind === 135 /* TypeQuery */) { + return true; + } + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + var parent = node.parent; + switch (parent.kind) { + case 183 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: + case 200 /* EnumMember */: + case 198 /* PropertyAssignment */: + return parent.initializer === node; + case 166 /* ExpressionStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 174 /* ReturnStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 178 /* ThrowStatement */: + case 176 /* SwitchStatement */: + return parent.expression === node; + case 170 /* ForStatement */: + return parent.initializer === node || parent.condition === node || parent.iterator === node; + case 171 /* ForInStatement */: + return parent.variable === node || parent.expression === node; + case 148 /* TypeAssertionExpression */: + return node === parent.expression; + case 162 /* TemplateSpan */: + return node === parent.expression; + default: + if (isExpression(parent)) { + return true; + } + } + } + return false; + } + ts.isExpression = isExpression; + function isExternalModuleImportDeclaration(node) { + return node.kind === 191 /* ImportDeclaration */ && node.moduleReference.kind === 193 /* ExternalModuleReference */; + } + ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; + function getExternalModuleImportDeclarationExpression(node) { + ts.Debug.assert(isExternalModuleImportDeclaration(node)); + return node.moduleReference.expression; + } + ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; + function isInternalModuleImportDeclaration(node) { + return node.kind === 191 /* ImportDeclaration */ && node.moduleReference.kind !== 193 /* ExternalModuleReference */; + } + ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; + function hasDotDotDotToken(node) { + return node && node.kind === 123 /* Parameter */ && node.dotDotDotToken !== undefined; + } + ts.hasDotDotDotToken = hasDotDotDotToken; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 123 /* Parameter */: + return node.questionToken !== undefined; + case 125 /* Method */: + return node.questionToken !== undefined; + case 199 /* ShorthandPropertyAssignment */: + case 198 /* PropertyAssignment */: + case 124 /* Property */: + return node.questionToken !== undefined; + } + } + return false; + } + ts.hasQuestionToken = hasQuestionToken; + function hasRestParameters(s) { + return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined; + } + ts.hasRestParameters = hasRestParameters; + function isLiteralKind(kind) { + return 6 /* FirstLiteralToken */ <= kind && kind <= 9 /* LastLiteralToken */; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 7 /* StringLiteral */ || kind === 9 /* NoSubstitutionTemplateLiteral */; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return 9 /* FirstTemplateToken */ <= kind && kind <= 12 /* LastTemplateToken */; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isInAmbientContext(node) { + while (node) { + if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) + return true; + node = node.parent; + } + return false; + } + ts.isInAmbientContext = isInAmbientContext; + function isDeclaration(node) { + switch (node.kind) { + case 122 /* TypeParameter */: + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + case 200 /* EnumMember */: + case 125 /* Method */: + case 184 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 188 /* EnumDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + return true; + } + return false; + } + ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + case 182 /* DebuggerStatement */: + case 168 /* DoStatement */: + case 166 /* ExpressionStatement */: + case 165 /* EmptyStatement */: + case 171 /* ForInStatement */: + case 170 /* ForStatement */: + case 167 /* IfStatement */: + case 177 /* LabeledStatement */: + case 174 /* ReturnStatement */: + case 176 /* SwitchStatement */: + case 92 /* ThrowKeyword */: + case 179 /* TryStatement */: + case 164 /* VariableStatement */: + case 169 /* WhileStatement */: + case 175 /* WithStatement */: + case 192 /* ExportAssignment */: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; + function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { + if (name.kind !== 63 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { + return false; + } + var parent = name.parent; + if (isDeclaration(parent) || parent.kind === 150 /* FunctionExpression */) { + return parent.name === name; + } + if (parent.kind === 197 /* CatchClause */) { + return parent.name === name; + } + return false; + } + ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; + function getClassBaseTypeNode(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 77 /* ExtendsKeyword */); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; + } + ts.getClassBaseTypeNode = getClassBaseTypeNode; + function getClassImplementedTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 100 /* ImplementsKeyword */); + return heritageClause ? heritageClause.types : undefined; + } + ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 77 /* ExtendsKeyword */); + return heritageClause ? heritageClause.types : undefined; + } + ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var i = 0, n = clauses.length; i < n; i++) { + if (clauses[i].token === kind) { + return clauses[i]; + } + } + } + return undefined; + } + ts.getHeritageClause = getHeritageClause; + function tryResolveScriptReference(program, sourceFile, reference) { + if (!program.getCompilerOptions().noResolve) { + var referenceFileName = ts.isRootedDiskPath(reference.filename) ? reference.filename : ts.combinePaths(ts.getDirectoryPath(sourceFile.filename), reference.filename); + referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, program.getCompilerHost().getCurrentDirectory()); + return program.getSourceFile(referenceFileName); + } + } + ts.tryResolveScriptReference = tryResolveScriptReference; + function getAncestor(node, kind) { + switch (kind) { + case 185 /* ClassDeclaration */: + while (node) { + switch (node.kind) { + case 185 /* ClassDeclaration */: + return node; + case 188 /* EnumDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + return undefined; + } + ts.getAncestor = getAncestor; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.exec(comment)) { + if (isNoDefaultLibRegEx.exec(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + if (matchResult) { + var start = commentRange.pos; + var end = commentRange.end; + return { + fileReference: { + pos: start, + end: end, + filename: matchResult[3] + }, + isNoDefaultLib: false + }; + } + else { + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; + function isKeyword(token) { + return 64 /* FirstKeyword */ <= token && token <= 119 /* LastKeyword */; + } + ts.isKeyword = isKeyword; + function isTrivia(token) { + return 2 /* FirstTriviaToken */ <= token && token <= 5 /* LastTriviaToken */; + } + ts.isTrivia = isTrivia; + function isModifier(token) { + switch (token) { + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + case 76 /* ExportKeyword */: + case 112 /* DeclareKeyword */: + case 68 /* ConstKeyword */: + return true; + } + return false; + } + ts.isModifier = isModifier; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nodeConstructors = new Array(204 /* Count */); + function getNodeConstructor(kind) { + return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); + } + ts.getNodeConstructor = getNodeConstructor; + function createRootNode(kind, pos, end, flags) { + var node = new (getNodeConstructor(kind))(); + node.pos = pos; + node.end = end; + node.flags = flags; + return node; + } + function forEachChild(node, cbNode, cbNodes) { + function child(node) { + if (node) { + return cbNode(node); + } + } + function children(nodes) { + if (nodes) { + if (cbNodes) { + return cbNodes(nodes); + } + for (var i = 0, len = nodes.length; i < len; i++) { + var result = cbNode(nodes[i]); + if (result) { + return result; + } + } + return undefined; + } + } + if (!node) { + return; + } + switch (node.kind) { + case 120 /* QualifiedName */: + return child(node.left) || child(node.right); + case 122 /* TypeParameter */: + return child(node.name) || child(node.constraint); + case 123 /* Parameter */: + return children(node.modifiers) || child(node.dotDotDotToken) || child(node.name) || child(node.questionToken) || child(node.type) || child(node.initializer); + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + return children(node.modifiers) || child(node.name) || child(node.questionToken) || child(node.type) || child(node.initializer); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return children(node.modifiers) || children(node.typeParameters) || children(node.parameters) || child(node.type); + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + return children(node.modifiers) || child(node.name) || child(node.questionToken) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); + case 132 /* TypeReference */: + return child(node.typeName) || children(node.typeArguments); + case 135 /* TypeQuery */: + return child(node.exprName); + case 136 /* TypeLiteral */: + return children(node.members); + case 137 /* ArrayType */: + return child(node.elementType); + case 138 /* TupleType */: + return children(node.elementTypes); + case 139 /* UnionType */: + return children(node.types); + case 140 /* ParenthesizedType */: + return child(node.type); + case 141 /* ArrayLiteralExpression */: + return children(node.elements); + case 142 /* ObjectLiteralExpression */: + return children(node.properties); + case 143 /* PropertyAccessExpression */: + return child(node.expression) || child(node.name); + case 144 /* ElementAccessExpression */: + return child(node.expression) || child(node.argumentExpression); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return child(node.expression) || children(node.typeArguments) || children(node.arguments); + case 147 /* TaggedTemplateExpression */: + return child(node.tag) || child(node.template); + case 148 /* TypeAssertionExpression */: + return child(node.type) || child(node.expression); + case 149 /* ParenthesizedExpression */: + return child(node.expression); + case 152 /* DeleteExpression */: + return child(node.expression); + case 153 /* TypeOfExpression */: + return child(node.expression); + case 154 /* VoidExpression */: + return child(node.expression); + case 155 /* PrefixUnaryExpression */: + return child(node.operand); + case 156 /* PostfixUnaryExpression */: + return child(node.operand); + case 157 /* BinaryExpression */: + return child(node.left) || child(node.right); + case 158 /* ConditionalExpression */: + return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return children(node.statements); + case 201 /* SourceFile */: + return children(node.statements) || child(node.endOfFileToken); + case 164 /* VariableStatement */: + return children(node.modifiers) || children(node.declarations); + case 166 /* ExpressionStatement */: + return child(node.expression); + case 167 /* IfStatement */: + return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); + case 168 /* DoStatement */: + return child(node.statement) || child(node.expression); + case 169 /* WhileStatement */: + return child(node.expression) || child(node.statement); + case 170 /* ForStatement */: + return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); + case 171 /* ForInStatement */: + return children(node.declarations) || child(node.variable) || child(node.expression) || child(node.statement); + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + return child(node.label); + case 174 /* ReturnStatement */: + return child(node.expression); + case 175 /* WithStatement */: + return child(node.expression) || child(node.statement); + case 176 /* SwitchStatement */: + return child(node.expression) || children(node.clauses); + case 194 /* CaseClause */: + return child(node.expression) || children(node.statements); + case 195 /* DefaultClause */: + return children(node.statements); + case 177 /* LabeledStatement */: + return child(node.label) || child(node.statement); + case 178 /* ThrowStatement */: + return child(node.expression); + case 179 /* TryStatement */: + return child(node.tryBlock) || child(node.catchClause) || child(node.finallyBlock); + case 197 /* CatchClause */: + return child(node.name) || child(node.type) || child(node.block); + case 183 /* VariableDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.type) || child(node.initializer); + case 185 /* ClassDeclaration */: + return children(node.modifiers) || child(node.name) || children(node.typeParameters) || children(node.heritageClauses) || children(node.members); + case 186 /* InterfaceDeclaration */: + return children(node.modifiers) || child(node.name) || children(node.typeParameters) || children(node.heritageClauses) || children(node.members); + case 187 /* TypeAliasDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.type); + case 188 /* EnumDeclaration */: + return children(node.modifiers) || child(node.name) || children(node.members); + case 200 /* EnumMember */: + return child(node.name) || child(node.initializer); + case 189 /* ModuleDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.body); + case 191 /* ImportDeclaration */: + return children(node.modifiers) || child(node.name) || child(node.moduleReference); + case 192 /* ExportAssignment */: + return children(node.modifiers) || child(node.exportName); + case 159 /* TemplateExpression */: + return child(node.head) || children(node.templateSpans); + case 162 /* TemplateSpan */: + return child(node.expression) || child(node.literal); + case 121 /* ComputedPropertyName */: + return child(node.expression); + case 196 /* HeritageClause */: + return children(node.types); + case 193 /* ExternalModuleReference */: + return child(node.expression); + } + } + ts.forEachChild = forEachChild; + function createCompilerHost(options) { + var currentDirectory; + var existingDirectories = {}; + function getCanonicalFileName(fileName) { + return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + } + var unsupportedFileEncodingErrorCode = -2147024809; + function getSourceFile(filename, languageVersion, onError) { + try { + var text = ts.sys.readFile(filename, options.charset); + } + catch (e) { + if (onError) { + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + } + text = ""; + } + return text !== undefined ? createSourceFile(filename, text, languageVersion, "0") : undefined; + } + function writeFile(fileName, data, writeByteOrderMark, onError) { + function directoryExists(directoryPath) { + if (ts.hasProperty(existingDirectories, directoryPath)) { + return true; + } + if (ts.sys.directoryExists(directoryPath)) { + existingDirectories[directoryPath] = true; + return true; + } + return false; + } + function ensureDirectoriesExist(directoryPath) { + if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + ts.sys.createDirectory(directoryPath); + } + } + try { + ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + catch (e) { + if (onError) { + onError(e.message); + } + } + } + return { + getSourceFile: getSourceFile, + getDefaultLibFilename: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), options.target === 2 /* ES6 */ ? "lib.es6.d.ts" : "lib.d.ts"); }, + writeFile: writeFile, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCanonicalFileName: getCanonicalFileName, + getNewLine: function () { return ts.sys.newLine; } + }; + } + ts.createCompilerHost = createCompilerHost; + var ParsingContext; + (function (ParsingContext) { + ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; + ParsingContext[ParsingContext["ModuleElements"] = 1] = "ModuleElements"; + ParsingContext[ParsingContext["BlockStatements"] = 2] = "BlockStatements"; + ParsingContext[ParsingContext["SwitchClauses"] = 3] = "SwitchClauses"; + ParsingContext[ParsingContext["SwitchClauseStatements"] = 4] = "SwitchClauseStatements"; + ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; + ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; + ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; + ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; + ParsingContext[ParsingContext["ArgumentExpressions"] = 10] = "ArgumentExpressions"; + ParsingContext[ParsingContext["ObjectLiteralMembers"] = 11] = "ObjectLiteralMembers"; + ParsingContext[ParsingContext["ArrayLiteralMembers"] = 12] = "ArrayLiteralMembers"; + ParsingContext[ParsingContext["Parameters"] = 13] = "Parameters"; + ParsingContext[ParsingContext["TypeParameters"] = 14] = "TypeParameters"; + ParsingContext[ParsingContext["TypeArguments"] = 15] = "TypeArguments"; + ParsingContext[ParsingContext["TupleElementTypes"] = 16] = "TupleElementTypes"; + ParsingContext[ParsingContext["HeritageClauses"] = 17] = "HeritageClauses"; + ParsingContext[ParsingContext["Count"] = 18] = "Count"; + })(ParsingContext || (ParsingContext = {})); + var Tristate; + (function (Tristate) { + Tristate[Tristate["False"] = 0] = "False"; + Tristate[Tristate["True"] = 1] = "True"; + Tristate[Tristate["Unknown"] = 2] = "Unknown"; + })(Tristate || (Tristate = {})); + function parsingContextErrors(context) { + switch (context) { + case 0 /* SourceElements */: return ts.Diagnostics.Declaration_or_statement_expected; + case 1 /* ModuleElements */: return ts.Diagnostics.Declaration_or_statement_expected; + case 2 /* BlockStatements */: return ts.Diagnostics.Statement_expected; + case 3 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected; + case 4 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected; + case 5 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected; + case 6 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected; + case 8 /* TypeReferences */: return ts.Diagnostics.Type_reference_expected; + case 9 /* VariableDeclarations */: return ts.Diagnostics.Variable_declaration_expected; + case 10 /* ArgumentExpressions */: return ts.Diagnostics.Argument_expression_expected; + case 11 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected; + case 12 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected; + case 13 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected; + case 14 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; + case 15 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 16 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; + case 17 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected; + } + } + ; + function modifierToFlag(token) { + switch (token) { + case 107 /* StaticKeyword */: return 128 /* Static */; + case 106 /* PublicKeyword */: return 16 /* Public */; + case 105 /* ProtectedKeyword */: return 64 /* Protected */; + case 104 /* PrivateKeyword */: return 32 /* Private */; + case 76 /* ExportKeyword */: return 1 /* Export */; + case 112 /* DeclareKeyword */: return 2 /* Ambient */; + case 68 /* ConstKeyword */: return 4096 /* Const */; + } + return 0; + } + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 63 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); + } + function isUseStrictPrologueDirective(sourceFile, node) { + ts.Debug.assert(ts.isPrologueDirective(node)); + var nodeText = ts.getSourceTextOfNodeFromSourceFile(sourceFile, node.expression); + return nodeText === '"use strict"' || nodeText === "'use strict'"; + } + function createSourceFile(filename, sourceText, languageVersion, version, isOpen) { + if (isOpen === void 0) { isOpen = false; } + var token; + var parsingContext; + var identifiers = {}; + var identifierCount = 0; + var nodeCount = 0; + var lineStarts; + var contextFlags = 0; + var parseErrorBeforeNextFinishedNode = false; + function setContextFlag(val, flag) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } + } + function setStrictModeContext(val) { + setContextFlag(val, 1 /* StrictMode */); + } + function setDisallowInContext(val) { + setContextFlag(val, 2 /* DisallowIn */); + } + function setYieldContext(val) { + setContextFlag(val, 4 /* Yield */); + } + function setGeneratorParameterContext(val) { + setContextFlag(val, 8 /* GeneratorParameter */); + } + function allowInAnd(func) { + if (contextFlags & 2 /* DisallowIn */) { + setDisallowInContext(false); + var result = func(); + setDisallowInContext(true); + return result; + } + return func(); + } + function disallowInAnd(func) { + if (contextFlags & 2 /* DisallowIn */) { + return func(); + } + setDisallowInContext(true); + var result = func(); + setDisallowInContext(false); + return result; + } + function doInYieldContext(func) { + if (contextFlags & 4 /* Yield */) { + return func(); + } + setYieldContext(true); + var result = func(); + setYieldContext(false); + return result; + } + function doOutsideOfYieldContext(func) { + if (contextFlags & 4 /* Yield */) { + setYieldContext(false); + var result = func(); + setYieldContext(true); + return result; + } + return func(); + } + function inYieldContext() { + return (contextFlags & 4 /* Yield */) !== 0; + } + function inStrictModeContext() { + return (contextFlags & 1 /* StrictMode */) !== 0; + } + function inGeneratorParameterContext() { + return (contextFlags & 8 /* GeneratorParameter */) !== 0; + } + function inDisallowInContext() { + return (contextFlags & 2 /* DisallowIn */) !== 0; + } + function getLineStarts() { + return lineStarts || (lineStarts = ts.computeLineStarts(sourceText)); + } + function getLineAndCharacterFromSourcePosition(position) { + return ts.getLineAndCharacterOfPosition(getLineStarts(), position); + } + function getPositionFromSourceLineAndCharacter(line, character) { + return ts.getPositionFromLineAndCharacter(getLineStarts(), line, character); + } + function parseErrorAtCurrentToken(message, arg0) { + var start = scanner.getTokenPos(); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); + } + function parseErrorAtPosition(start, length, message, arg0) { + var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); + if (!lastError || start !== lastError.start) { + sourceFile.parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)); + } + parseErrorBeforeNextFinishedNode = true; + } + function scanError(message) { + var pos = scanner.getTextPos(); + parseErrorAtPosition(pos, 0, message); + } + function getNodePos() { + return scanner.getStartPos(); + } + function getNodeEnd() { + return scanner.getStartPos(); + } + function nextToken() { + return token = scanner.scan(); + } + function getTokenPos(pos) { + return ts.skipTrivia(sourceText, pos); + } + function reScanGreaterToken() { + return token = scanner.reScanGreaterToken(); + } + function reScanSlashToken() { + return token = scanner.reScanSlashToken(); + } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } + function speculationHelper(callback, isLookAhead) { + var saveToken = token; + var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var saveContextFlags = contextFlags; + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + ts.Debug.assert(saveContextFlags === contextFlags); + if (!result || isLookAhead) { + token = saveToken; + sourceFile.parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryParse(callback) { + return speculationHelper(callback, false); + } + function isIdentifier() { + if (token === 63 /* Identifier */) { + return true; + } + if (token === 108 /* YieldKeyword */ && inYieldContext()) { + return false; + } + return inStrictModeContext() ? token > 108 /* LastFutureReservedWord */ : token > 99 /* LastReservedWord */; + } + function parseExpected(kind, diagnosticMessage, arg0) { + if (token === kind) { + nextToken(); + return true; + } + if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage, arg0); + } + else { + parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); + } + return false; + } + function parseOptional(t) { + if (token === t) { + nextToken(); + return true; + } + return false; + } + function parseOptionalToken(t) { + if (token === t) { + var node = createNode(t); + nextToken(); + return finishNode(node); + } + return undefined; + } + function canParseSemicolon() { + if (token === 21 /* SemicolonToken */) { + return true; + } + return token === 14 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + } + function parseSemicolon(diagnosticMessage) { + if (canParseSemicolon()) { + if (token === 21 /* SemicolonToken */) { + nextToken(); + } + return true; + } + else { + return parseExpected(21 /* SemicolonToken */, diagnosticMessage); + } + } + function createNode(kind, pos) { + nodeCount++; + var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(); + if (!(pos >= 0)) { + pos = scanner.getStartPos(); + } + node.pos = pos; + node.end = pos; + return node; + } + function finishNode(node) { + node.end = scanner.getStartPos(); + if (contextFlags) { + node.parserContextFlags = contextFlags; + } + if (parseErrorBeforeNextFinishedNode) { + parseErrorBeforeNextFinishedNode = false; + node.parserContextFlags |= 16 /* ContainsError */; + } + return node; + } + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + if (reportAtCurrentPosition) { + parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); + } + else { + parseErrorAtCurrentToken(diagnosticMessage, arg0); + } + var result = createNode(kind, scanner.getStartPos()); + result.text = ""; + return finishNode(result); + } + function internIdentifier(text) { + text = ts.escapeIdentifier(text); + return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); + } + function createIdentifier(isIdentifier, diagnosticMessage) { + identifierCount++; + if (isIdentifier) { + var node = createNode(63 /* Identifier */); + node.text = internIdentifier(scanner.getTokenValue()); + nextToken(); + return finishNode(node); + } + return createMissingNode(63 /* Identifier */, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + } + function parseIdentifier(diagnosticMessage) { + return createIdentifier(isIdentifier(), diagnosticMessage); + } + function parseIdentifierName() { + return createIdentifier(isIdentifierOrKeyword()); + } + function isLiteralPropertyName() { + return isIdentifierOrKeyword() || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; + } + function parsePropertyName() { + if (token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { + return parseLiteralNode(true); + } + if (token === 17 /* OpenBracketToken */) { + return parseComputedPropertyName(); + } + return parseIdentifierName(); + } + function parseComputedPropertyName() { + var node = createNode(121 /* ComputedPropertyName */); + parseExpected(17 /* OpenBracketToken */); + var yieldContext = inYieldContext(); + if (inGeneratorParameterContext()) { + setYieldContext(false); + } + node.expression = allowInAnd(parseExpression); + if (inGeneratorParameterContext()) { + setYieldContext(yieldContext); + } + parseExpected(18 /* CloseBracketToken */); + return finishNode(node); + } + function parseContextualModifier(t) { + return token === t && tryParse(nextTokenCanFollowModifier); + } + function nextTokenCanFollowModifier() { + nextToken(); + return canFollowModifier(); + } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); + } + function nextTokenCanFollowContextualModifier() { + if (token === 68 /* ConstKeyword */) { + return nextToken() === 75 /* EnumKeyword */; + } + nextToken(); + return canFollowModifier(); + } + function canFollowModifier() { + return token === 17 /* OpenBracketToken */ || token === 34 /* AsteriskToken */ || isLiteralPropertyName(); + } + function isListElement(kind, inErrorRecovery) { + switch (kind) { + case 0 /* SourceElements */: + case 1 /* ModuleElements */: + return isSourceElement(inErrorRecovery); + case 2 /* BlockStatements */: + case 4 /* SwitchClauseStatements */: + return isStatement(inErrorRecovery); + case 3 /* SwitchClauses */: + return token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; + case 5 /* TypeMembers */: + return isStartOfTypeMember(); + case 6 /* ClassMembers */: + return lookAhead(isClassMemberStart); + case 7 /* EnumMembers */: + return token === 17 /* OpenBracketToken */ || isLiteralPropertyName(); + case 11 /* ObjectLiteralMembers */: + return token === 17 /* OpenBracketToken */ || token === 34 /* AsteriskToken */ || isLiteralPropertyName(); + case 8 /* TypeReferences */: + return isIdentifier() && !isNotHeritageClauseTypeName(); + case 9 /* VariableDeclarations */: + case 14 /* TypeParameters */: + return isIdentifier(); + case 10 /* ArgumentExpressions */: + return token === 22 /* CommaToken */ || isStartOfExpression(); + case 12 /* ArrayLiteralMembers */: + return token === 22 /* CommaToken */ || isStartOfExpression(); + case 13 /* Parameters */: + return isStartOfParameter(); + case 15 /* TypeArguments */: + case 16 /* TupleElementTypes */: + return token === 22 /* CommaToken */ || isStartOfType(); + case 17 /* HeritageClauses */: + return isHeritageClause(); + } + ts.Debug.fail("Non-exhaustive case in 'isListElement'."); + } + function nextTokenIsIdentifier() { + nextToken(); + return isIdentifier(); + } + function isNotHeritageClauseTypeName() { + if (token === 100 /* ImplementsKeyword */ || token === 77 /* ExtendsKeyword */) { + return lookAhead(nextTokenIsIdentifier); + } + return false; + } + function isListTerminator(kind) { + if (token === 1 /* EndOfFileToken */) { + return true; + } + switch (kind) { + case 1 /* ModuleElements */: + case 2 /* BlockStatements */: + case 3 /* SwitchClauses */: + case 5 /* TypeMembers */: + case 6 /* ClassMembers */: + case 7 /* EnumMembers */: + case 11 /* ObjectLiteralMembers */: + return token === 14 /* CloseBraceToken */; + case 4 /* SwitchClauseStatements */: + return token === 14 /* CloseBraceToken */ || token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; + case 8 /* TypeReferences */: + return token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; + case 9 /* VariableDeclarations */: + return isVariableDeclaratorListTerminator(); + case 14 /* TypeParameters */: + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */ || token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; + case 10 /* ArgumentExpressions */: + return token === 16 /* CloseParenToken */ || token === 21 /* SemicolonToken */; + case 12 /* ArrayLiteralMembers */: + case 16 /* TupleElementTypes */: + return token === 18 /* CloseBracketToken */; + case 13 /* Parameters */: + return token === 16 /* CloseParenToken */ || token === 18 /* CloseBracketToken */ || token === 13 /* OpenBraceToken */; + case 15 /* TypeArguments */: + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */; + case 17 /* HeritageClauses */: + return token === 13 /* OpenBraceToken */ || token === 14 /* CloseBraceToken */; + } + } + function isVariableDeclaratorListTerminator() { + if (canParseSemicolon()) { + return true; + } + if (token === 84 /* InKeyword */) { + return true; + } + if (token === 31 /* EqualsGreaterThanToken */) { + return true; + } + return false; + } + function isInSomeParsingContext() { + for (var kind = 0; kind < 18 /* Count */; kind++) { + if (parsingContext & (1 << kind)) { + if (isListElement(kind, true) || isListTerminator(kind)) { + return true; + } + } + } + return false; + } + function parseList(kind, checkForStrictMode, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var savedStrictModeContext = inStrictModeContext(); + while (!isListTerminator(kind)) { + if (isListElement(kind, false)) { + var element = parseElement(); + result.push(element); + if (checkForStrictMode && !inStrictModeContext()) { + if (ts.isPrologueDirective(element)) { + if (isUseStrictPrologueDirective(sourceFile, element)) { + setStrictModeContext(true); + checkForStrictMode = false; + } + } + else { + checkForStrictMode = false; + } + } + continue; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + setStrictModeContext(savedStrictModeContext); + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function abortParsingListOrMoveToNextToken(kind) { + parseErrorAtCurrentToken(parsingContextErrors(kind)); + if (isInSomeParsingContext()) { + return true; + } + nextToken(); + return false; + } + function parseDelimitedList(kind, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var commaStart = -1; + while (true) { + if (isListElement(kind, false)) { + result.push(parseElement()); + commaStart = scanner.getTokenPos(); + if (parseOptional(22 /* CommaToken */)) { + continue; + } + commaStart = -1; + if (isListTerminator(kind)) { + break; + } + parseExpected(22 /* CommaToken */); + continue; + } + if (isListTerminator(kind)) { + break; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + if (commaStart >= 0) { + result.hasTrailingComma = true; + } + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function createMissingList() { + var pos = getNodePos(); + var result = []; + result.pos = pos; + result.end = pos; + return result; + } + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { + var result = parseDelimitedList(kind, parseElement); + parseExpected(close); + return result; + } + return createMissingList(); + } + function parseEntityName(allowReservedWords, diagnosticMessage) { + var entity = parseIdentifier(diagnosticMessage); + while (parseOptional(19 /* DotToken */)) { + var node = createNode(120 /* QualifiedName */, entity.pos); + node.left = entity; + node.right = parseRightSideOfDot(allowReservedWords); + entity = finishNode(node); + } + return entity; + } + function parseRightSideOfDot(allowIdentifierNames) { + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { + var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + if (matchesPattern) { + return createMissingNode(63 /* Identifier */, true, ts.Diagnostics.Identifier_expected); + } + } + return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); + } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function parseTemplateExpression() { + var template = createNode(159 /* TemplateExpression */); + template.head = parseLiteralNode(); + ts.Debug.assert(template.head.kind === 10 /* TemplateHead */, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (templateSpans[templateSpans.length - 1].literal.kind === 11 /* TemplateMiddle */); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(162 /* TemplateSpan */); + span.expression = allowInAnd(parseExpression); + var literal; + if (token === 14 /* CloseBraceToken */) { + reScanTemplateToken(); + literal = parseLiteralNode(); + } + else { + literal = createMissingNode(12 /* TemplateTail */, false, ts.Diagnostics._0_expected, ts.tokenToString(14 /* CloseBraceToken */)); + } + span.literal = literal; + return finishNode(span); + } + function parseLiteralNode(internName) { + var node = createNode(token); + var text = scanner.getTokenValue(); + node.text = internName ? internIdentifier(text) : text; + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + var tokenPos = scanner.getTokenPos(); + nextToken(); + finishNode(node); + if (node.kind === 6 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + node.flags |= 8192 /* OctalLiteral */; + } + return node; + } + function parseTypeReference() { + var node = createNode(132 /* TypeReference */); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); + if (!scanner.hasPrecedingLineBreak() && token === 23 /* LessThanToken */) { + node.typeArguments = parseBracketedList(15 /* TypeArguments */, parseType, 23 /* LessThanToken */, 24 /* GreaterThanToken */); + } + return finishNode(node); + } + function parseTypeQuery() { + var node = createNode(135 /* TypeQuery */); + parseExpected(95 /* TypeOfKeyword */); + node.exprName = parseEntityName(true); + return finishNode(node); + } + function parseTypeParameter() { + var node = createNode(122 /* TypeParameter */); + node.name = parseIdentifier(); + if (parseOptional(77 /* ExtendsKeyword */)) { + if (isStartOfType() || !isStartOfExpression()) { + node.constraint = parseType(); + } + else { + node.expression = parseUnaryExpressionOrHigher(); + } + } + return finishNode(node); + } + function parseTypeParameters() { + if (token === 23 /* LessThanToken */) { + return parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 23 /* LessThanToken */, 24 /* GreaterThanToken */); + } + } + function parseParameterType() { + if (parseOptional(50 /* ColonToken */)) { + return token === 7 /* StringLiteral */ ? parseLiteralNode(true) : parseType(); + } + return undefined; + } + function isStartOfParameter() { + return token === 20 /* DotDotDotToken */ || isIdentifier() || ts.isModifier(token); + } + function setModifiers(node, modifiers) { + if (modifiers) { + node.flags |= modifiers.flags; + node.modifiers = modifiers; + } + } + function parseParameter() { + var node = createNode(123 /* Parameter */); + setModifiers(node, parseModifiers()); + node.dotDotDotToken = parseOptionalToken(20 /* DotDotDotToken */); + node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifier) : parseIdentifier(); + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + nextToken(); + } + node.questionToken = parseOptionalToken(49 /* QuestionToken */); + node.type = parseParameterType(); + node.initializer = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseParameterInitializer) : parseParameterInitializer(); + return finishNode(node); + } + function parseParameterInitializer() { + return parseInitializer(true); + } + function fillSignature(returnToken, yieldAndGeneratorParameterContext, requireCompleteParameterList, signature) { + var returnTokenRequired = returnToken === 31 /* EqualsGreaterThanToken */; + signature.typeParameters = parseTypeParameters(); + signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList); + if (returnTokenRequired) { + parseExpected(returnToken); + signature.type = parseType(); + } + else if (parseOptional(returnToken)) { + signature.type = parseType(); + } + } + function parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList) { + if (parseExpected(15 /* OpenParenToken */)) { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(yieldAndGeneratorParameterContext); + setGeneratorParameterContext(yieldAndGeneratorParameterContext); + var result = parseDelimitedList(13 /* Parameters */, parseParameter); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + if (!parseExpected(16 /* CloseParenToken */) && requireCompleteParameterList) { + return undefined; + } + return result; + } + return requireCompleteParameterList ? undefined : createMissingList(); + } + function parseTypeMemberSemicolon() { + if (parseSemicolon()) { + return; + } + parseOptional(22 /* CommaToken */); + } + function parseSignatureMember(kind) { + var node = createNode(kind); + if (kind === 130 /* ConstructSignature */) { + parseExpected(86 /* NewKeyword */); + } + fillSignature(50 /* ColonToken */, false, false, node); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function isIndexSignature() { + if (token !== 17 /* OpenBracketToken */) { + return false; + } + return lookAhead(isUnambiguouslyIndexSignature); + } + function isUnambiguouslyIndexSignature() { + nextToken(); + if (token === 20 /* DotDotDotToken */ || token === 18 /* CloseBracketToken */) { + return true; + } + if (ts.isModifier(token)) { + nextToken(); + if (isIdentifier()) { + return true; + } + } + else if (!isIdentifier()) { + return false; + } + else { + nextToken(); + } + if (token === 50 /* ColonToken */ || token === 22 /* CommaToken */) { + return true; + } + if (token !== 49 /* QuestionToken */) { + return false; + } + nextToken(); + return token === 50 /* ColonToken */ || token === 22 /* CommaToken */ || token === 18 /* CloseBracketToken */; + } + function parseIndexSignatureDeclaration(fullStart, modifiers) { + var node = createNode(131 /* IndexSignature */, fullStart); + setModifiers(node, modifiers); + node.parameters = parseBracketedList(13 /* Parameters */, parseParameter, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); + node.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function parsePropertyOrMethodSignature() { + var fullStart = scanner.getStartPos(); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(49 /* QuestionToken */); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + var method = createNode(125 /* Method */, fullStart); + method.name = name; + method.questionToken = questionToken; + fillSignature(50 /* ColonToken */, false, false, method); + parseTypeMemberSemicolon(); + return finishNode(method); + } + else { + var property = createNode(124 /* Property */, fullStart); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(property); + } + } + function isStartOfTypeMember() { + switch (token) { + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 17 /* OpenBracketToken */: + return true; + default: + return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + } + } + function isTypeMemberWithLiteralPropertyName() { + nextToken(); + return token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */ || token === 49 /* QuestionToken */ || token === 50 /* ColonToken */ || canParseSemicolon(); + } + function parseTypeMember() { + switch (token) { + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + return parseSignatureMember(129 /* CallSignature */); + case 17 /* OpenBracketToken */: + return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined) : parsePropertyOrMethodSignature(); + case 86 /* NewKeyword */: + if (lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(130 /* ConstructSignature */); + } + case 7 /* StringLiteral */: + case 6 /* NumericLiteral */: + return parsePropertyOrMethodSignature(); + default: + if (isIdentifierOrKeyword()) { + return parsePropertyOrMethodSignature(); + } + } + } + function isStartOfConstructSignature() { + nextToken(); + return token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */; + } + function parseTypeLiteral() { + var node = createNode(136 /* TypeLiteral */); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseObjectTypeMembers() { + var members; + if (parseExpected(13 /* OpenBraceToken */)) { + members = parseList(5 /* TypeMembers */, false, parseTypeMember); + parseExpected(14 /* CloseBraceToken */); + } + else { + members = createMissingList(); + } + return members; + } + function parseTupleType() { + var node = createNode(138 /* TupleType */); + node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); + return finishNode(node); + } + function parseParenthesizedType() { + var node = createNode(140 /* ParenthesizedType */); + parseExpected(15 /* OpenParenToken */); + node.type = parseType(); + parseExpected(16 /* CloseParenToken */); + return finishNode(node); + } + function parseFunctionOrConstructorType(kind) { + var node = createNode(kind); + if (kind === 134 /* ConstructorType */) { + parseExpected(86 /* NewKeyword */); + } + fillSignature(31 /* EqualsGreaterThanToken */, false, false, node); + return finishNode(node); + } + function parseKeywordAndNoDot() { + var node = parseTokenNode(); + return token === 19 /* DotToken */ ? undefined : node; + } + function parseNonArrayType() { + switch (token) { + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + var node = tryParse(parseKeywordAndNoDot); + return node || parseTypeReference(); + case 97 /* VoidKeyword */: + return parseTokenNode(); + case 95 /* TypeOfKeyword */: + return parseTypeQuery(); + case 13 /* OpenBraceToken */: + return parseTypeLiteral(); + case 17 /* OpenBracketToken */: + return parseTupleType(); + case 15 /* OpenParenToken */: + return parseParenthesizedType(); + default: + return parseTypeReference(); + } + } + function isStartOfType() { + switch (token) { + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: + case 95 /* TypeOfKeyword */: + case 13 /* OpenBraceToken */: + case 17 /* OpenBracketToken */: + case 23 /* LessThanToken */: + case 86 /* NewKeyword */: + return true; + case 15 /* OpenParenToken */: + return lookAhead(isStartOfParenthesizedOrFunctionType); + default: + return isIdentifier(); + } + } + function isStartOfParenthesizedOrFunctionType() { + nextToken(); + return token === 16 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); + } + function parseArrayTypeOrHigher() { + var type = parseNonArrayType(); + while (!scanner.hasPrecedingLineBreak() && parseOptional(17 /* OpenBracketToken */)) { + parseExpected(18 /* CloseBracketToken */); + var node = createNode(137 /* ArrayType */, type.pos); + node.elementType = type; + type = finishNode(node); + } + return type; + } + function parseUnionTypeOrHigher() { + var type = parseArrayTypeOrHigher(); + if (token === 43 /* BarToken */) { + var types = [type]; + types.pos = type.pos; + while (parseOptional(43 /* BarToken */)) { + types.push(parseArrayTypeOrHigher()); + } + types.end = getNodeEnd(); + var node = createNode(139 /* UnionType */, type.pos); + node.types = types; + type = finishNode(node); + } + return type; + } + function isStartOfFunctionType() { + if (token === 23 /* LessThanToken */) { + return true; + } + return token === 15 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); + } + function isUnambiguouslyStartOfFunctionType() { + nextToken(); + if (token === 16 /* CloseParenToken */ || token === 20 /* DotDotDotToken */) { + return true; + } + if (isIdentifier() || ts.isModifier(token)) { + nextToken(); + if (token === 50 /* ColonToken */ || token === 22 /* CommaToken */ || token === 49 /* QuestionToken */ || token === 51 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { + return true; + } + if (token === 16 /* CloseParenToken */) { + nextToken(); + if (token === 31 /* EqualsGreaterThanToken */) { + return true; + } + } + } + return false; + } + function parseType() { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(false); + setGeneratorParameterContext(false); + var result = parseTypeWorker(); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + return result; + } + function parseTypeWorker() { + if (isStartOfFunctionType()) { + return parseFunctionOrConstructorType(133 /* FunctionType */); + } + if (token === 86 /* NewKeyword */) { + return parseFunctionOrConstructorType(134 /* ConstructorType */); + } + return parseUnionTypeOrHigher(); + } + function parseTypeAnnotation() { + return parseOptional(50 /* ColonToken */) ? parseType() : undefined; + } + function isStartOfExpression() { + switch (token) { + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 15 /* OpenParenToken */: + case 17 /* OpenBracketToken */: + case 13 /* OpenBraceToken */: + case 81 /* FunctionKeyword */: + case 86 /* NewKeyword */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: + case 95 /* TypeOfKeyword */: + case 97 /* VoidKeyword */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + case 23 /* LessThanToken */: + case 63 /* Identifier */: + case 108 /* YieldKeyword */: + return true; + default: + if (isBinaryOperator()) { + return true; + } + return isIdentifier(); + } + } + function isStartOfExpressionStatement() { + return token !== 13 /* OpenBraceToken */ && token !== 81 /* FunctionKeyword */ && isStartOfExpression(); + } + function parseExpression() { + var expr = parseAssignmentExpressionOrHigher(); + while (parseOptional(22 /* CommaToken */)) { + expr = makeBinaryExpression(expr, 22 /* CommaToken */, parseAssignmentExpressionOrHigher()); + } + return expr; + } + function parseInitializer(inParameter) { + if (token !== 51 /* EqualsToken */) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 13 /* OpenBraceToken */) || !isStartOfExpression()) { + return undefined; + } + } + parseExpected(51 /* EqualsToken */); + return parseAssignmentExpressionOrHigher(); + } + function parseAssignmentExpressionOrHigher() { + if (isYieldExpression()) { + return parseYieldExpression(); + } + var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + if (arrowExpression) { + return arrowExpression; + } + var expr = parseBinaryExpressionOrHigher(0); + if (expr.kind === 63 /* Identifier */ && token === 31 /* EqualsGreaterThanToken */) { + return parseSimpleArrowFunctionExpression(expr); + } + if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { + var operator = token; + nextToken(); + return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + } + return parseConditionalExpressionRest(expr); + } + function isYieldExpression() { + if (token === 108 /* YieldKeyword */) { + if (inYieldContext()) { + return true; + } + if (inStrictModeContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOnSameLine); + } + return false; + } + function nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); + } + function parseYieldExpression() { + var node = createNode(160 /* YieldExpression */); + nextToken(); + if (!scanner.hasPrecedingLineBreak() && (token === 34 /* AsteriskToken */ || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + else { + return finishNode(node); + } + } + function parseSimpleArrowFunctionExpression(identifier) { + ts.Debug.assert(token === 31 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(151 /* ArrowFunction */, identifier.pos); + var parameter = createNode(123 /* Parameter */, identifier.pos); + parameter.name = identifier; + finishNode(parameter); + node.parameters = [parameter]; + node.parameters.pos = parameter.pos; + node.parameters.end = parameter.end; + parseExpected(31 /* EqualsGreaterThanToken */); + node.body = parseArrowFunctionExpressionBody(); + return finishNode(node); + } + function tryParseParenthesizedArrowFunctionExpression() { + var triState = isParenthesizedArrowFunctionExpression(); + if (triState === 0 /* False */) { + return undefined; + } + var arrowFunction = triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + if (!arrowFunction) { + return undefined; + } + if (parseExpected(31 /* EqualsGreaterThanToken */) || token === 13 /* OpenBraceToken */) { + arrowFunction.body = parseArrowFunctionExpressionBody(); + } + else { + arrowFunction.body = parseIdentifier(); + } + return finishNode(arrowFunction); + } + function isParenthesizedArrowFunctionExpression() { + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + return lookAhead(isParenthesizedArrowFunctionExpressionWorker); + } + if (token === 31 /* EqualsGreaterThanToken */) { + return 1 /* True */; + } + return 0 /* False */; + } + function isParenthesizedArrowFunctionExpressionWorker() { + var first = token; + var second = nextToken(); + if (first === 15 /* OpenParenToken */) { + if (second === 16 /* CloseParenToken */) { + var third = nextToken(); + switch (third) { + case 31 /* EqualsGreaterThanToken */: + case 50 /* ColonToken */: + case 13 /* OpenBraceToken */: + return 1 /* True */; + default: + return 0 /* False */; + } + } + if (second === 20 /* DotDotDotToken */) { + return 1 /* True */; + } + if (!isIdentifier()) { + return 0 /* False */; + } + if (nextToken() === 50 /* ColonToken */) { + return 1 /* True */; + } + return 2 /* Unknown */; + } + else { + ts.Debug.assert(first === 23 /* LessThanToken */); + if (!isIdentifier()) { + return 0 /* False */; + } + return 2 /* Unknown */; + } + } + function parsePossibleParenthesizedArrowFunctionExpressionHead() { + return parseParenthesizedArrowFunctionExpressionHead(false); + } + function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { + var node = createNode(151 /* ArrowFunction */); + fillSignature(50 /* ColonToken */, false, !allowAmbiguity, node); + if (!node.parameters) { + return undefined; + } + if (!allowAmbiguity && token !== 31 /* EqualsGreaterThanToken */ && token !== 13 /* OpenBraceToken */) { + return undefined; + } + return node; + } + function parseArrowFunctionExpressionBody() { + if (token === 13 /* OpenBraceToken */) { + return parseFunctionBlock(false, false); + } + if (isStatement(true) && !isStartOfExpressionStatement() && token !== 81 /* FunctionKeyword */) { + return parseFunctionBlock(false, true); + } + return parseAssignmentExpressionOrHigher(); + } + function parseConditionalExpressionRest(leftOperand) { + if (!parseOptional(49 /* QuestionToken */)) { + return leftOperand; + } + var node = createNode(158 /* ConditionalExpression */, leftOperand.pos); + node.condition = leftOperand; + node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(50 /* ColonToken */); + node.whenFalse = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseBinaryExpressionOrHigher(precedence) { + var leftOperand = parseUnaryExpressionOrHigher(); + return parseBinaryExpressionRest(precedence, leftOperand); + } + function parseBinaryExpressionRest(precedence, leftOperand) { + while (true) { + reScanGreaterToken(); + var newPrecedence = getBinaryOperatorPrecedence(); + if (newPrecedence <= precedence) { + break; + } + if (token === 84 /* InKeyword */ && inDisallowInContext()) { + break; + } + var operator = token; + nextToken(); + leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + } + return leftOperand; + } + function isBinaryOperator() { + if (inDisallowInContext() && token === 84 /* InKeyword */) { + return false; + } + return getBinaryOperatorPrecedence() > 0; + } + function getBinaryOperatorPrecedence() { + switch (token) { + case 48 /* BarBarToken */: + return 1; + case 47 /* AmpersandAmpersandToken */: + return 2; + case 43 /* BarToken */: + return 3; + case 44 /* CaretToken */: + return 4; + case 42 /* AmpersandToken */: + return 5; + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + return 6; + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + case 85 /* InstanceOfKeyword */: + case 84 /* InKeyword */: + return 7; + case 39 /* LessThanLessThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + return 8; + case 32 /* PlusToken */: + case 33 /* MinusToken */: + return 9; + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + return 10; + } + return -1; + } + function makeBinaryExpression(left, operator, right) { + var node = createNode(157 /* BinaryExpression */, left.pos); + node.left = left; + node.operator = operator; + node.right = right; + return finishNode(node); + } + function parsePrefixUnaryExpression() { + var node = createNode(155 /* PrefixUnaryExpression */); + node.operator = token; + nextToken(); + node.operand = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseDeleteExpression() { + var node = createNode(152 /* DeleteExpression */); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseTypeOfExpression() { + var node = createNode(153 /* TypeOfExpression */); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseVoidExpression() { + var node = createNode(154 /* VoidExpression */); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseUnaryExpressionOrHigher() { + switch (token) { + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + return parsePrefixUnaryExpression(); + case 72 /* DeleteKeyword */: + return parseDeleteExpression(); + case 95 /* TypeOfKeyword */: + return parseTypeOfExpression(); + case 97 /* VoidKeyword */: + return parseVoidExpression(); + case 23 /* LessThanToken */: + return parseTypeAssertion(); + default: + return parsePostfixExpressionOrHigher(); + } + } + function parsePostfixExpressionOrHigher() { + var expression = parseLeftHandSideExpressionOrHigher(); + ts.Debug.assert(isLeftHandSideExpression(expression)); + if ((token === 37 /* PlusPlusToken */ || token === 38 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(156 /* PostfixUnaryExpression */, expression.pos); + node.operand = expression; + node.operator = token; + nextToken(); + return finishNode(node); + } + return expression; + } + function parseLeftHandSideExpressionOrHigher() { + var expression = token === 89 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); + return parseCallExpressionRest(expression); + } + function parseMemberExpressionOrHigher() { + var expression = parsePrimaryExpression(); + return parseMemberExpressionRest(expression); + } + function parseSuperExpression() { + var expression = parseTokenNode(); + if (token === 15 /* OpenParenToken */ || token === 19 /* DotToken */) { + return expression; + } + var node = createNode(143 /* PropertyAccessExpression */, expression.pos); + node.expression = expression; + parseExpected(19 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(true); + return finishNode(node); + } + function parseTypeAssertion() { + var node = createNode(148 /* TypeAssertionExpression */); + parseExpected(23 /* LessThanToken */); + node.type = parseType(); + parseExpected(24 /* GreaterThanToken */); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseMemberExpressionRest(expression) { + while (true) { + var dotOrBracketStart = scanner.getTokenPos(); + if (parseOptional(19 /* DotToken */)) { + var propertyAccess = createNode(143 /* PropertyAccessExpression */, expression.pos); + propertyAccess.expression = expression; + propertyAccess.name = parseRightSideOfDot(true); + expression = finishNode(propertyAccess); + continue; + } + if (parseOptional(17 /* OpenBracketToken */)) { + var indexedAccess = createNode(144 /* ElementAccessExpression */, expression.pos); + indexedAccess.expression = expression; + if (token !== 18 /* CloseBracketToken */) { + indexedAccess.argumentExpression = allowInAnd(parseExpression); + if (indexedAccess.argumentExpression.kind === 7 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 6 /* NumericLiteral */) { + var literal = indexedAccess.argumentExpression; + literal.text = internIdentifier(literal.text); + } + } + parseExpected(18 /* CloseBracketToken */); + expression = finishNode(indexedAccess); + continue; + } + if (token === 9 /* NoSubstitutionTemplateLiteral */ || token === 10 /* TemplateHead */) { + var tagExpression = createNode(147 /* TaggedTemplateExpression */, expression.pos); + tagExpression.tag = expression; + tagExpression.template = token === 9 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); + expression = finishNode(tagExpression); + continue; + } + return expression; + } + } + function parseCallExpressionRest(expression) { + while (true) { + expression = parseMemberExpressionRest(expression); + if (token === 23 /* LessThanToken */) { + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (!typeArguments) { + return expression; + } + var callExpr = createNode(145 /* CallExpression */, expression.pos); + callExpr.expression = expression; + callExpr.typeArguments = typeArguments; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + else if (token === 15 /* OpenParenToken */) { + var callExpr = createNode(145 /* CallExpression */, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + return expression; + } + } + function parseArgumentList() { + parseExpected(15 /* OpenParenToken */); + var result = parseDelimitedList(10 /* ArgumentExpressions */, parseArgumentExpression); + parseExpected(16 /* CloseParenToken */); + return result; + } + function parseTypeArgumentsInExpression() { + if (!parseOptional(23 /* LessThanToken */)) { + return undefined; + } + var typeArguments = parseDelimitedList(15 /* TypeArguments */, parseType); + if (!parseExpected(24 /* GreaterThanToken */)) { + return undefined; + } + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + } + function canFollowTypeArgumentsInExpression() { + switch (token) { + case 15 /* OpenParenToken */: + case 19 /* DotToken */: + case 16 /* CloseParenToken */: + case 18 /* CloseBracketToken */: + case 50 /* ColonToken */: + case 21 /* SemicolonToken */: + case 22 /* CommaToken */: + case 49 /* QuestionToken */: + case 27 /* EqualsEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 47 /* AmpersandAmpersandToken */: + case 48 /* BarBarToken */: + case 44 /* CaretToken */: + case 42 /* AmpersandToken */: + case 43 /* BarToken */: + case 14 /* CloseBraceToken */: + case 1 /* EndOfFileToken */: + return true; + default: + return false; + } + } + function parsePrimaryExpression() { + switch (token) { + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + return parseLiteralNode(); + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + return parseTokenNode(); + case 15 /* OpenParenToken */: + return parseParenthesizedExpression(); + case 17 /* OpenBracketToken */: + return parseArrayLiteralExpression(); + case 13 /* OpenBraceToken */: + return parseObjectLiteralExpression(); + case 81 /* FunctionKeyword */: + return parseFunctionExpression(); + case 86 /* NewKeyword */: + return parseNewExpression(); + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + if (reScanSlashToken() === 8 /* RegularExpressionLiteral */) { + return parseLiteralNode(); + } + break; + case 10 /* TemplateHead */: + return parseTemplateExpression(); + } + return parseIdentifier(ts.Diagnostics.Expression_expected); + } + function parseParenthesizedExpression() { + var node = createNode(149 /* ParenthesizedExpression */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + return finishNode(node); + } + function parseAssignmentExpressionOrOmittedExpression() { + return token === 22 /* CommaToken */ ? createNode(161 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); + } + function parseArrayLiteralElement() { + return parseAssignmentExpressionOrOmittedExpression(); + } + function parseArgumentExpression() { + return allowInAnd(parseAssignmentExpressionOrOmittedExpression); + } + function parseArrayLiteralExpression() { + var node = createNode(141 /* ArrayLiteralExpression */); + parseExpected(17 /* OpenBracketToken */); + if (scanner.hasPrecedingLineBreak()) + node.flags |= 256 /* MultiLine */; + node.elements = parseDelimitedList(12 /* ArrayLiteralMembers */, parseArrayLiteralElement); + parseExpected(18 /* CloseBracketToken */); + return finishNode(node); + } + function parseObjectLiteralElement() { + var fullStart = scanner.getStartPos(); + var initialToken = token; + if (parseContextualModifier(113 /* GetKeyword */) || parseContextualModifier(117 /* SetKeyword */)) { + var kind = initialToken === 113 /* GetKeyword */ ? 127 /* GetAccessor */ : 128 /* SetAccessor */; + return parseAccessorDeclaration(kind, fullStart, undefined); + } + var asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + var tokenIsIdentifier = isIdentifier(); + var nameToken = token; + var propertyName = parsePropertyName(); + if (asteriskToken || token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + return parseMethodDeclaration(fullStart, undefined, asteriskToken, propertyName, undefined, true); + } + var questionToken = parseOptionalToken(49 /* QuestionToken */); + if ((token === 22 /* CommaToken */ || token === 14 /* CloseBraceToken */) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(199 /* ShorthandPropertyAssignment */, fullStart); + shorthandDeclaration.name = propertyName; + shorthandDeclaration.questionToken = questionToken; + return finishNode(shorthandDeclaration); + } + else { + var propertyAssignment = createNode(198 /* PropertyAssignment */, fullStart); + propertyAssignment.name = propertyName; + propertyAssignment.questionToken = questionToken; + parseExpected(50 /* ColonToken */); + propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); + return finishNode(propertyAssignment); + } + } + function parseObjectLiteralExpression() { + var node = createNode(142 /* ObjectLiteralExpression */); + parseExpected(13 /* OpenBraceToken */); + if (scanner.hasPrecedingLineBreak()) { + node.flags |= 256 /* MultiLine */; + } + node.properties = parseDelimitedList(11 /* ObjectLiteralMembers */, parseObjectLiteralElement); + parseExpected(14 /* CloseBraceToken */); + return finishNode(node); + } + function parseFunctionExpression() { + var node = createNode(150 /* FunctionExpression */); + parseExpected(81 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); + fillSignature(50 /* ColonToken */, !!node.asteriskToken, false, node); + node.body = parseFunctionBlock(!!node.asteriskToken, false); + return finishNode(node); + } + function parseOptionalIdentifier() { + return isIdentifier() ? parseIdentifier() : undefined; + } + function parseNewExpression() { + var node = createNode(146 /* NewExpression */); + parseExpected(86 /* NewKeyword */); + node.expression = parseMemberExpressionOrHigher(); + node.typeArguments = tryParse(parseTypeArgumentsInExpression); + if (node.typeArguments || token === 15 /* OpenParenToken */) { + node.arguments = parseArgumentList(); + } + return finishNode(node); + } + function parseBlock(kind, ignoreMissingOpenBrace, checkForStrictMode) { + var node = createNode(kind); + if (parseExpected(13 /* OpenBraceToken */) || ignoreMissingOpenBrace) { + node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseFunctionBlock(allowYield, ignoreMissingOpenBrace) { + var savedYieldContext = inYieldContext(); + setYieldContext(allowYield); + var block = parseBlock(163 /* Block */, ignoreMissingOpenBrace, true); + setYieldContext(savedYieldContext); + return block; + } + function parseEmptyStatement() { + var node = createNode(165 /* EmptyStatement */); + parseExpected(21 /* SemicolonToken */); + return finishNode(node); + } + function parseIfStatement() { + var node = createNode(167 /* IfStatement */); + parseExpected(82 /* IfKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + node.thenStatement = parseStatement(); + node.elseStatement = parseOptional(74 /* ElseKeyword */) ? parseStatement() : undefined; + return finishNode(node); + } + function parseDoStatement() { + var node = createNode(168 /* DoStatement */); + parseExpected(73 /* DoKeyword */); + node.statement = parseStatement(); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + parseOptional(21 /* SemicolonToken */); + return finishNode(node); + } + function parseWhileStatement() { + var node = createNode(169 /* WhileStatement */); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + node.statement = parseStatement(); + return finishNode(node); + } + function parseForOrForInStatement() { + var pos = getNodePos(); + parseExpected(80 /* ForKeyword */); + parseExpected(15 /* OpenParenToken */); + if (token !== 21 /* SemicolonToken */) { + if (parseOptional(96 /* VarKeyword */)) { + var declarations = disallowInAnd(parseVariableDeclarationList); + } + else if (parseOptional(102 /* LetKeyword */)) { + var declarations = setFlag(disallowInAnd(parseVariableDeclarationList), 2048 /* Let */); + } + else if (parseOptional(68 /* ConstKeyword */)) { + var declarations = setFlag(disallowInAnd(parseVariableDeclarationList), 4096 /* Const */); + } + else { + var varOrInit = disallowInAnd(parseExpression); + } + } + var forOrForInStatement; + if (parseOptional(84 /* InKeyword */)) { + var forInStatement = createNode(171 /* ForInStatement */, pos); + if (declarations) { + forInStatement.declarations = declarations; + } + else { + forInStatement.variable = varOrInit; + } + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + forOrForInStatement = forInStatement; + } + else { + var forStatement = createNode(170 /* ForStatement */, pos); + if (declarations) { + forStatement.declarations = declarations; + } + if (varOrInit) { + forStatement.initializer = varOrInit; + } + parseExpected(21 /* SemicolonToken */); + if (token !== 21 /* SemicolonToken */ && token !== 16 /* CloseParenToken */) { + forStatement.condition = allowInAnd(parseExpression); + } + parseExpected(21 /* SemicolonToken */); + if (token !== 16 /* CloseParenToken */) { + forStatement.iterator = allowInAnd(parseExpression); + } + parseExpected(16 /* CloseParenToken */); + forOrForInStatement = forStatement; + } + forOrForInStatement.statement = parseStatement(); + return finishNode(forOrForInStatement); + } + function parseBreakOrContinueStatement(kind) { + var node = createNode(kind); + parseExpected(kind === 173 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); + if (!canParseSemicolon()) { + node.label = parseIdentifier(); + } + parseSemicolon(); + return finishNode(node); + } + function parseReturnStatement() { + var node = createNode(174 /* ReturnStatement */); + parseExpected(88 /* ReturnKeyword */); + if (!canParseSemicolon()) { + node.expression = allowInAnd(parseExpression); + } + parseSemicolon(); + return finishNode(node); + } + function parseWithStatement() { + var node = createNode(175 /* WithStatement */); + parseExpected(99 /* WithKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + node.statement = parseStatement(); + return finishNode(node); + } + function parseCaseClause() { + var node = createNode(194 /* CaseClause */); + parseExpected(65 /* CaseKeyword */); + node.expression = allowInAnd(parseExpression); + parseExpected(50 /* ColonToken */); + node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); + return finishNode(node); + } + function parseDefaultClause() { + var node = createNode(195 /* DefaultClause */); + parseExpected(71 /* DefaultKeyword */); + parseExpected(50 /* ColonToken */); + node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); + return finishNode(node); + } + function parseCaseOrDefaultClause() { + return token === 65 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + } + function parseSwitchStatement() { + var node = createNode(176 /* SwitchStatement */); + parseExpected(90 /* SwitchKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = allowInAnd(parseExpression); + parseExpected(16 /* CloseParenToken */); + parseExpected(13 /* OpenBraceToken */); + node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); + parseExpected(14 /* CloseBraceToken */); + return finishNode(node); + } + function parseThrowStatement() { + var node = createNode(178 /* ThrowStatement */); + parseExpected(92 /* ThrowKeyword */); + node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function parseTryStatement() { + var node = createNode(179 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */); + node.catchClause = token === 66 /* CatchKeyword */ ? parseCatchClause() : undefined; + node.finallyBlock = !node.catchClause || token === 79 /* FinallyKeyword */ ? parseTokenAndBlock(79 /* FinallyKeyword */) : undefined; + return finishNode(node); + } + function parseTokenAndBlock(token) { + var pos = getNodePos(); + parseExpected(token); + var result = parseBlock(token === 94 /* TryKeyword */ ? 180 /* TryBlock */ : 181 /* FinallyBlock */, false, false); + result.pos = pos; + return result; + } + function parseCatchClause() { + var result = createNode(197 /* CatchClause */); + parseExpected(66 /* CatchKeyword */); + parseExpected(15 /* OpenParenToken */); + result.name = parseIdentifier(); + result.type = parseTypeAnnotation(); + parseExpected(16 /* CloseParenToken */); + result.block = parseBlock(163 /* Block */, false, false); + return finishNode(result); + } + function parseDebuggerStatement() { + var node = createNode(182 /* DebuggerStatement */); + parseExpected(70 /* DebuggerKeyword */); + parseSemicolon(); + return finishNode(node); + } + function isLabel() { + return isIdentifier() && lookAhead(nextTokenIsColonToken); + } + function nextTokenIsColonToken() { + return nextToken() === 50 /* ColonToken */; + } + function parseLabeledStatement() { + var node = createNode(177 /* LabeledStatement */); + node.label = parseIdentifier(); + parseExpected(50 /* ColonToken */); + node.statement = parseStatement(); + return finishNode(node); + } + function parseExpressionStatement() { + var node = createNode(166 /* ExpressionStatement */); + node.expression = allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function isStatement(inErrorRecovery) { + switch (token) { + case 21 /* SemicolonToken */: + return !inErrorRecovery; + case 13 /* OpenBraceToken */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 81 /* FunctionKeyword */: + case 82 /* IfKeyword */: + case 73 /* DoKeyword */: + case 98 /* WhileKeyword */: + case 80 /* ForKeyword */: + case 69 /* ContinueKeyword */: + case 64 /* BreakKeyword */: + case 88 /* ReturnKeyword */: + case 99 /* WithKeyword */: + case 90 /* SwitchKeyword */: + case 92 /* ThrowKeyword */: + case 94 /* TryKeyword */: + case 70 /* DebuggerKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + return true; + case 68 /* ConstKeyword */: + var isConstEnum = lookAhead(nextTokenIsEnumKeyword); + return !isConstEnum; + case 101 /* InterfaceKeyword */: + case 67 /* ClassKeyword */: + case 114 /* ModuleKeyword */: + case 75 /* EnumKeyword */: + case 119 /* TypeKeyword */: + if (isDeclarationStart()) { + return false; + } + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) { + return false; + } + default: + return isStartOfExpression(); + } + } + function nextTokenIsEnumKeyword() { + nextToken(); + return token === 75 /* EnumKeyword */; + } + function nextTokenIsIdentifierOrKeywordOnSameLine() { + nextToken(); + return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + } + function parseStatement() { + switch (token) { + case 13 /* OpenBraceToken */: + return parseBlock(163 /* Block */, false, false); + case 96 /* VarKeyword */: + case 68 /* ConstKeyword */: + return parseVariableStatement(scanner.getStartPos(), undefined); + case 81 /* FunctionKeyword */: + return parseFunctionDeclaration(scanner.getStartPos(), undefined); + case 21 /* SemicolonToken */: + return parseEmptyStatement(); + case 82 /* IfKeyword */: + return parseIfStatement(); + case 73 /* DoKeyword */: + return parseDoStatement(); + case 98 /* WhileKeyword */: + return parseWhileStatement(); + case 80 /* ForKeyword */: + return parseForOrForInStatement(); + case 69 /* ContinueKeyword */: + return parseBreakOrContinueStatement(172 /* ContinueStatement */); + case 64 /* BreakKeyword */: + return parseBreakOrContinueStatement(173 /* BreakStatement */); + case 88 /* ReturnKeyword */: + return parseReturnStatement(); + case 99 /* WithKeyword */: + return parseWithStatement(); + case 90 /* SwitchKeyword */: + return parseSwitchStatement(); + case 92 /* ThrowKeyword */: + return parseThrowStatement(); + case 94 /* TryKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + return parseTryStatement(); + case 70 /* DebuggerKeyword */: + return parseDebuggerStatement(); + case 102 /* LetKeyword */: + if (isLetDeclaration()) { + return parseVariableStatement(scanner.getStartPos(), undefined); + } + default: + return isLabel() ? parseLabeledStatement() : parseExpressionStatement(); + } + } + function parseFunctionBlockOrSemicolon(isGenerator) { + if (token === 13 /* OpenBraceToken */) { + return parseFunctionBlock(isGenerator, false); + } + parseSemicolon(ts.Diagnostics.or_expected); + return undefined; + } + function parseVariableDeclaration() { + var node = createNode(183 /* VariableDeclaration */); + node.name = parseIdentifier(); + node.type = parseTypeAnnotation(); + node.initializer = parseInitializer(false); + return finishNode(node); + } + function setFlag(array, flag) { + for (var i = 0, n = array.length; i < n; i++) { + array[i].flags |= flag; + } + return array; + } + function parseVariableDeclarationList() { + return parseDelimitedList(9 /* VariableDeclarations */, parseVariableDeclaration); + } + function parseVariableStatement(fullStart, modifiers) { + var node = createNode(164 /* VariableStatement */, fullStart); + setModifiers(node, modifiers); + if (token === 102 /* LetKeyword */) { + node.flags |= 2048 /* Let */; + } + else if (token === 68 /* ConstKeyword */) { + node.flags |= 4096 /* Const */; + } + else { + ts.Debug.assert(token === 96 /* VarKeyword */); + } + nextToken(); + node.declarations = allowInAnd(parseVariableDeclarationList); + setFlag(node.declarations, node.flags); + parseSemicolon(); + return finishNode(node); + } + function parseFunctionDeclaration(fullStart, modifiers) { + var node = createNode(184 /* FunctionDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(81 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + node.name = parseIdentifier(); + fillSignature(50 /* ColonToken */, !!node.asteriskToken, false, node); + node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken); + return finishNode(node); + } + function parseConstructorDeclaration(pos, modifiers) { + var node = createNode(126 /* Constructor */, pos); + setModifiers(node, modifiers); + parseExpected(111 /* ConstructorKeyword */); + fillSignature(50 /* ColonToken */, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false); + return finishNode(node); + } + function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, requireBlock) { + var method = createNode(125 /* Method */, fullStart); + setModifiers(method, modifiers); + method.asteriskToken = asteriskToken; + method.name = name; + method.questionToken = questionToken; + fillSignature(50 /* ColonToken */, !!asteriskToken, false, method); + method.body = requireBlock ? parseFunctionBlock(!!asteriskToken, false) : parseFunctionBlockOrSemicolon(!!asteriskToken); + return finishNode(method); + } + function parsePropertyOrMethodDeclaration(fullStart, modifiers) { + var asteriskToken = parseOptionalToken(34 /* AsteriskToken */); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(49 /* QuestionToken */); + if (asteriskToken || token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, false); + } + else { + var property = createNode(124 /* Property */, fullStart); + setModifiers(property, modifiers); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + property.initializer = allowInAnd(parseNonParameterInitializer); + parseSemicolon(); + return finishNode(property); + } + } + function parseNonParameterInitializer() { + return parseInitializer(false); + } + function parseAccessorDeclaration(kind, fullStart, modifiers) { + var node = createNode(kind, fullStart); + setModifiers(node, modifiers); + node.name = parsePropertyName(); + fillSignature(50 /* ColonToken */, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false); + return finishNode(node); + } + function isClassMemberStart() { + var idToken; + while (ts.isModifier(token)) { + idToken = token; + nextToken(); + } + if (token === 34 /* AsteriskToken */) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (token === 17 /* OpenBracketToken */) { + return true; + } + if (idToken !== undefined) { + if (!ts.isKeyword(idToken) || idToken === 117 /* SetKeyword */ || idToken === 113 /* GetKeyword */) { + return true; + } + switch (token) { + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 50 /* ColonToken */: + case 51 /* EqualsToken */: + case 49 /* QuestionToken */: + return true; + default: + return canParseSemicolon(); + } + } + return false; + } + function parseModifiers() { + var flags = 0; + var modifiers; + while (true) { + var modifierStart = scanner.getStartPos(); + var modifierKind = token; + if (!parseAnyContextualModifier()) { + break; + } + if (!modifiers) { + modifiers = []; + modifiers.pos = modifierStart; + } + flags |= modifierToFlag(modifierKind); + modifiers.push(finishNode(createNode(modifierKind, modifierStart))); + } + if (modifiers) { + modifiers.flags = flags; + modifiers.end = scanner.getStartPos(); + } + return modifiers; + } + function parseClassElement() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (parseContextualModifier(113 /* GetKeyword */)) { + return parseAccessorDeclaration(127 /* GetAccessor */, fullStart, modifiers); + } + if (parseContextualModifier(117 /* SetKeyword */)) { + return parseAccessorDeclaration(128 /* SetAccessor */, fullStart, modifiers); + } + if (token === 111 /* ConstructorKeyword */) { + return parseConstructorDeclaration(fullStart, modifiers); + } + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(fullStart, modifiers); + } + if (isIdentifierOrKeyword() || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */ || token === 34 /* AsteriskToken */ || token === 17 /* OpenBracketToken */) { + return parsePropertyOrMethodDeclaration(fullStart, modifiers); + } + ts.Debug.fail("Should not have attempted to parse class member declaration."); + } + function parseClassDeclaration(fullStart, modifiers) { + var node = createNode(185 /* ClassDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(67 /* ClassKeyword */); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(true); + if (parseExpected(13 /* OpenBraceToken */)) { + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseHeritageClauses(isClassHeritageClause) { + if (isHeritageClause()) { + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + } + return undefined; + } + function parseHeritageClausesWorker() { + return parseList(17 /* HeritageClauses */, false, parseHeritageClause); + } + function parseHeritageClause() { + if (token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */) { + var node = createNode(196 /* HeritageClause */); + node.token = token; + nextToken(); + node.types = parseDelimitedList(8 /* TypeReferences */, parseTypeReference); + return finishNode(node); + } + return undefined; + } + function isHeritageClause() { + return token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; + } + function parseClassMembers() { + return parseList(6 /* ClassMembers */, false, parseClassElement); + } + function parseInterfaceDeclaration(fullStart, modifiers) { + var node = createNode(186 /* InterfaceDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(101 /* InterfaceKeyword */); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(false); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseTypeAliasDeclaration(fullStart, modifiers) { + var node = createNode(187 /* TypeAliasDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(119 /* TypeKeyword */); + node.name = parseIdentifier(); + parseExpected(51 /* EqualsToken */); + node.type = parseType(); + parseSemicolon(); + return finishNode(node); + } + function parseEnumMember() { + var node = createNode(200 /* EnumMember */, scanner.getStartPos()); + node.name = parsePropertyName(); + node.initializer = allowInAnd(parseNonParameterInitializer); + return finishNode(node); + } + function parseEnumDeclaration(fullStart, modifiers) { + var node = createNode(188 /* EnumDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(75 /* EnumKeyword */); + node.name = parseIdentifier(); + if (parseExpected(13 /* OpenBraceToken */)) { + node.members = parseDelimitedList(7 /* EnumMembers */, parseEnumMember); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseModuleBlock() { + var node = createNode(190 /* ModuleBlock */, scanner.getStartPos()); + if (parseExpected(13 /* OpenBraceToken */)) { + node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); + parseExpected(14 /* CloseBraceToken */); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseInternalModuleTail(fullStart, modifiers, flags) { + var node = createNode(189 /* ModuleDeclaration */, fullStart); + setModifiers(node, modifiers); + node.flags |= flags; + node.name = parseIdentifier(); + node.body = parseOptional(19 /* DotToken */) ? parseInternalModuleTail(getNodePos(), undefined, 1 /* Export */) : parseModuleBlock(); + return finishNode(node); + } + function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { + var node = createNode(189 /* ModuleDeclaration */, fullStart); + setModifiers(node, modifiers); + node.name = parseLiteralNode(true); + node.body = parseModuleBlock(); + return finishNode(node); + } + function parseModuleDeclaration(fullStart, modifiers) { + parseExpected(114 /* ModuleKeyword */); + return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + } + function isExternalModuleReference() { + return token === 115 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); + } + function nextTokenIsOpenParen() { + return nextToken() === 15 /* OpenParenToken */; + } + function parseImportDeclaration(fullStart, modifiers) { + var node = createNode(191 /* ImportDeclaration */, fullStart); + setModifiers(node, modifiers); + parseExpected(83 /* ImportKeyword */); + node.name = parseIdentifier(); + parseExpected(51 /* EqualsToken */); + node.moduleReference = parseModuleReference(); + parseSemicolon(); + return finishNode(node); + } + function parseModuleReference() { + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + } + function parseExternalModuleReference() { + var node = createNode(193 /* ExternalModuleReference */); + parseExpected(115 /* RequireKeyword */); + parseExpected(15 /* OpenParenToken */); + node.expression = parseExpression(); + if (node.expression.kind === 7 /* StringLiteral */) { + internIdentifier(node.expression.text); + } + parseExpected(16 /* CloseParenToken */); + return finishNode(node); + } + function parseExportAssignmentTail(fullStart, modifiers) { + var node = createNode(192 /* ExportAssignment */, fullStart); + setModifiers(node, modifiers); + node.exportName = parseIdentifier(); + parseSemicolon(); + return finishNode(node); + } + function isLetDeclaration() { + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + } + function isDeclarationStart() { + switch (token) { + case 96 /* VarKeyword */: + case 68 /* ConstKeyword */: + case 81 /* FunctionKeyword */: + return true; + case 102 /* LetKeyword */: + return isLetDeclaration(); + case 67 /* ClassKeyword */: + case 101 /* InterfaceKeyword */: + case 75 /* EnumKeyword */: + case 83 /* ImportKeyword */: + case 119 /* TypeKeyword */: + return lookAhead(nextTokenIsIdentifierOrKeyword); + case 114 /* ModuleKeyword */: + return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); + case 76 /* ExportKeyword */: + return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart); + case 112 /* DeclareKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + return lookAhead(nextTokenIsDeclarationStart); + } + } + function isIdentifierOrKeyword() { + return token >= 63 /* Identifier */; + } + function nextTokenIsIdentifierOrKeyword() { + nextToken(); + return isIdentifierOrKeyword(); + } + function nextTokenIsIdentifierOrKeywordOrStringLiteral() { + nextToken(); + return isIdentifierOrKeyword() || token === 7 /* StringLiteral */; + } + function nextTokenIsEqualsTokenOrDeclarationStart() { + nextToken(); + return token === 51 /* EqualsToken */ || isDeclarationStart(); + } + function nextTokenIsDeclarationStart() { + nextToken(); + return isDeclarationStart(); + } + function parseDeclaration() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (token === 76 /* ExportKeyword */) { + nextToken(); + if (parseOptional(51 /* EqualsToken */)) { + return parseExportAssignmentTail(fullStart, modifiers); + } + } + switch (token) { + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 68 /* ConstKeyword */: + return parseVariableStatement(fullStart, modifiers); + case 81 /* FunctionKeyword */: + return parseFunctionDeclaration(fullStart, modifiers); + case 67 /* ClassKeyword */: + return parseClassDeclaration(fullStart, modifiers); + case 101 /* InterfaceKeyword */: + return parseInterfaceDeclaration(fullStart, modifiers); + case 119 /* TypeKeyword */: + return parseTypeAliasDeclaration(fullStart, modifiers); + case 75 /* EnumKeyword */: + return parseEnumDeclaration(fullStart, modifiers); + case 114 /* ModuleKeyword */: + return parseModuleDeclaration(fullStart, modifiers); + case 83 /* ImportKeyword */: + return parseImportDeclaration(fullStart, modifiers); + default: + ts.Debug.fail("Mismatch between isDeclarationStart and parseDeclaration"); + } + } + function isSourceElement(inErrorRecovery) { + return isDeclarationStart() || isStatement(inErrorRecovery); + } + function parseSourceElement() { + return parseSourceElementOrModuleElement(); + } + function parseModuleElement() { + return parseSourceElementOrModuleElement(); + } + function parseSourceElementOrModuleElement() { + return isDeclarationStart() ? parseDeclaration() : parseStatement(); + } + function processReferenceComments() { + var triviaScanner = ts.createScanner(languageVersion, false, sourceText); + var referencedFiles = []; + var amdDependencies = []; + var amdModuleName; + while (true) { + var kind = triviaScanner.scan(); + if (kind === 5 /* WhitespaceTrivia */ || kind === 4 /* NewLineTrivia */ || kind === 3 /* MultiLineCommentTrivia */) { + continue; + } + if (kind !== 2 /* SingleLineCommentTrivia */) { + break; + } + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var comment = sourceText.substring(range.pos, range.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnosticMessage = referencePathMatchResult.diagnosticMessage; + if (fileReference) { + referencedFiles.push(fileReference); + } + if (diagnosticMessage) { + sourceFile.referenceDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); + } + } + else { + var amdModuleNameRegEx = /^\/\/\/\s* 0) { + syntacticDiagnostics = sourceFile.referenceDiagnostics.concat(sourceFile.parseDiagnostics); + } + else { + checkGrammar(sourceText, languageVersion, sourceFile); + syntacticDiagnostics = sourceFile.referenceDiagnostics.concat(sourceFile.grammarDiagnostics); + } + } + ts.Debug.assert(syntacticDiagnostics !== undefined); + return syntacticDiagnostics; + } + var rootNodeFlags = 0; + if (ts.fileExtensionIs(filename, ".d.ts")) { + rootNodeFlags = 1024 /* DeclarationFile */; + } + var sourceFile = createRootNode(201 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + sourceFile.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition; + sourceFile.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter; + sourceFile.getLineStarts = getLineStarts; + sourceFile.getSyntacticDiagnostics = getSyntacticDiagnostics; + sourceFile.filename = ts.normalizePath(filename); + sourceFile.text = sourceText; + sourceFile.referenceDiagnostics = []; + sourceFile.parseDiagnostics = []; + sourceFile.grammarDiagnostics = []; + sourceFile.semanticDiagnostics = []; + var referenceComments = processReferenceComments(); + sourceFile.referencedFiles = referenceComments.referencedFiles; + sourceFile.amdDependencies = referenceComments.amdDependencies; + sourceFile.amdModuleName = referenceComments.amdModuleName; + var scanner = ts.createScanner(languageVersion, true, sourceText, scanError); + nextToken(); + sourceFile.statements = parseList(0 /* SourceElements */, true, parseSourceElement); + ts.Debug.assert(token === 1 /* EndOfFileToken */); + sourceFile.endOfFileToken = parseTokenNode(); + sourceFile.externalModuleIndicator = getExternalModuleIndicator(); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.version = version; + sourceFile.isOpen = isOpen; + sourceFile.languageVersion = languageVersion; + sourceFile.identifiers = identifiers; + return sourceFile; + } + ts.createSourceFile = createSourceFile; + function isLeftHandSideExpression(expr) { + if (expr) { + switch (expr.kind) { + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 146 /* NewExpression */: + case 145 /* CallExpression */: + case 147 /* TaggedTemplateExpression */: + case 141 /* ArrayLiteralExpression */: + case 149 /* ParenthesizedExpression */: + case 142 /* ObjectLiteralExpression */: + case 150 /* FunctionExpression */: + case 63 /* Identifier */: + case 8 /* RegularExpressionLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 159 /* TemplateExpression */: + case 78 /* FalseKeyword */: + case 87 /* NullKeyword */: + case 91 /* ThisKeyword */: + case 93 /* TrueKeyword */: + case 89 /* SuperKeyword */: + return true; + } + } + return false; + } + function isAssignmentOperator(token) { + return token >= 51 /* FirstAssignment */ && token <= 62 /* LastAssignment */; + } + function checkGrammar(sourceText, languageVersion, file) { + var grammarDiagnostics = file.grammarDiagnostics; + var scanner = ts.createScanner(languageVersion, true, sourceText); + var inAmbientContext = ts.fileExtensionIs(file.filename, ".d.ts"); + var inFunctionBlock = false; + var parent; + visitNode(file); + function visitNode(node) { + var savedParent = parent; + node.parent = parent; + parent = node; + if (!checkModifiers(node)) { + var savedInFunctionBlock = inFunctionBlock; + if (ts.isFunctionBlock(node)) { + inFunctionBlock = true; + } + var savedInAmbientContext = inAmbientContext; + if (node.flags & 2 /* Ambient */) { + inAmbientContext = true; + } + checkNodeAndChildren(node); + inAmbientContext = savedInAmbientContext; + inFunctionBlock = savedInFunctionBlock; + } + parent = savedParent; + } + function checkNodeAndChildren(node) { + var nodeKind = node.kind; + if (inAmbientContext && checkForStatementInAmbientContext(node, nodeKind)) { + return; + } + if (checkNode(node, nodeKind)) { + return; + } + forEachChild(node, visitNode); + } + function checkNode(node, nodeKind) { + switch (nodeKind) { + case 151 /* ArrowFunction */: + case 129 /* CallSignature */: + case 134 /* ConstructorType */: + case 130 /* ConstructSignature */: + case 133 /* FunctionType */: + return checkAnySignatureDeclaration(node); + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + return checkBreakOrContinueStatement(node); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return checkCallOrNewExpression(node); + case 188 /* EnumDeclaration */: return checkEnumDeclaration(node); + case 157 /* BinaryExpression */: return checkBinaryExpression(node); + case 197 /* CatchClause */: return checkCatchClause(node); + case 185 /* ClassDeclaration */: return checkClassDeclaration(node); + case 121 /* ComputedPropertyName */: return checkComputedPropertyName(node); + case 126 /* Constructor */: return checkConstructor(node); + case 152 /* DeleteExpression */: return checkDeleteExpression(node); + case 144 /* ElementAccessExpression */: return checkElementAccessExpression(node); + case 192 /* ExportAssignment */: return checkExportAssignment(node); + case 193 /* ExternalModuleReference */: return checkExternalModuleReference(node); + case 171 /* ForInStatement */: return checkForInStatement(node); + case 170 /* ForStatement */: return checkForStatement(node); + case 184 /* FunctionDeclaration */: return checkFunctionDeclaration(node); + case 150 /* FunctionExpression */: return checkFunctionExpression(node); + case 127 /* GetAccessor */: return checkGetAccessor(node); + case 196 /* HeritageClause */: return checkHeritageClause(node); + case 131 /* IndexSignature */: return checkIndexSignature(node); + case 186 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); + case 177 /* LabeledStatement */: return checkLabeledStatement(node); + case 198 /* PropertyAssignment */: return checkPropertyAssignment(node); + case 125 /* Method */: return checkMethod(node); + case 189 /* ModuleDeclaration */: return checkModuleDeclaration(node); + case 142 /* ObjectLiteralExpression */: return checkObjectLiteralExpression(node); + case 6 /* NumericLiteral */: return checkNumericLiteral(node); + case 123 /* Parameter */: return checkParameter(node); + case 156 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); + case 155 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); + case 124 /* Property */: return checkProperty(node); + case 174 /* ReturnStatement */: return checkReturnStatement(node); + case 128 /* SetAccessor */: return checkSetAccessor(node); + case 201 /* SourceFile */: return checkSourceFile(node); + case 199 /* ShorthandPropertyAssignment */: return checkShorthandPropertyAssignment(node); + case 176 /* SwitchStatement */: return checkSwitchStatement(node); + case 147 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); + case 178 /* ThrowStatement */: return checkThrowStatement(node); + case 138 /* TupleType */: return checkTupleType(node); + case 122 /* TypeParameter */: return checkTypeParameter(node); + case 132 /* TypeReference */: return checkTypeReference(node); + case 183 /* VariableDeclaration */: return checkVariableDeclaration(node); + case 164 /* VariableStatement */: return checkVariableStatement(node); + case 175 /* WithStatement */: return checkWithStatement(node); + case 160 /* YieldExpression */: return checkYieldExpression(node); + } + } + function scanToken(pos) { + var start = ts.skipTrivia(sourceText, pos); + scanner.setTextPos(start); + scanner.scan(); + return start; + } + function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + var start = scanToken(node.pos); + grammarDiagnostics.push(ts.createFileDiagnostic(file, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + return true; + } + function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + scanToken(node.pos); + grammarDiagnostics.push(ts.createFileDiagnostic(file, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + return true; + } + function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + var span = ts.getErrorSpanForNode(node); + var start = span.end > span.pos ? ts.skipTrivia(file.text, span.pos) : span.pos; + var length = span.end - start; + grammarDiagnostics.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); + return true; + } + function grammarErrorAtPos(start, length, message, arg0, arg1, arg2) { + grammarDiagnostics.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); + return true; + } + function reportInvalidUseInStrictMode(node) { + var name = sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + return grammarErrorOnNode(node, ts.Diagnostics.Invalid_use_of_0_in_strict_mode, name); + } + function checkForStatementInAmbientContext(node, kind) { + switch (kind) { + case 163 /* Block */: + case 165 /* EmptyStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + case 174 /* ReturnStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 182 /* DebuggerStatement */: + case 177 /* LabeledStatement */: + case 166 /* ExpressionStatement */: + return grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + } + } + function checkAnySignatureDeclaration(node) { + return checkTypeParameterList(node.typeParameters) || checkParameterList(node.parameters); + } + function checkBinaryExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isEvalOrArgumentsIdentifier(node.left)) { + return reportInvalidUseInStrictMode(node.left); + } + } + } + } + function isIterationStatement(node, lookInLabeledStatements) { + switch (node.kind) { + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + return true; + case 177 /* LabeledStatement */: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); + } + return false; + } + function checkLabeledStatement(node) { + var current = node.parent; + while (current) { + if (ts.isAnyFunction(current)) { + break; + } + if (current.kind === 177 /* LabeledStatement */ && current.label.text === node.label.text) { + return grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceText, node.label)); + } + current = current.parent; + } + } + function checkBreakOrContinueStatement(node) { + var current = node; + while (current) { + if (ts.isAnyFunction(current)) { + return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); + } + switch (current.kind) { + case 177 /* LabeledStatement */: + if (node.label && current.label.text === node.label.text) { + var isMisplacedContinueLabel = node.kind === 172 /* ContinueStatement */ && !isIterationStatement(current.statement, true); + if (isMisplacedContinueLabel) { + return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); + } + return false; + } + break; + case 176 /* SwitchStatement */: + if (node.kind === 173 /* BreakStatement */ && !node.label) { + return false; + } + break; + default: + if (isIterationStatement(current, false) && !node.label) { + return false; + } + break; + } + current = current.parent; + } + if (node.label) { + var message = node.kind === 173 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + else { + var message = node.kind === 173 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + } + function checkCallOrNewExpression(node) { + return checkTypeArguments(node.typeArguments) || checkArguments(node.arguments); + } + function checkArguments(arguments) { + return checkForDisallowedTrailingComma(arguments) || checkForOmittedArgument(arguments); + } + function checkTypeArguments(typeArguments) { + return checkForDisallowedTrailingComma(typeArguments) || checkForAtLeastOneTypeArgument(typeArguments); + } + function checkForOmittedArgument(arguments) { + if (arguments) { + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === 161 /* OmittedExpression */) { + return grammarErrorAtPos(arg.pos, 0, ts.Diagnostics.Argument_expression_expected); + } + } + } + } + function checkForAtLeastOneTypeArgument(typeArguments) { + if (typeArguments && typeArguments.length === 0) { + var start = typeArguments.pos - "<".length; + var end = ts.skipTrivia(sourceText, typeArguments.end) + ">".length; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); + } + } + function checkForDisallowedTrailingComma(list) { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + } + } + function checkCatchClause(node) { + if (node.type) { + var colonStart = ts.skipTrivia(sourceText, node.name.end); + return grammarErrorAtPos(colonStart, ":".length, ts.Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + } + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.name)) { + return reportInvalidUseInStrictMode(node.name); + } + } + function checkClassDeclaration(node) { + return checkClassDeclarationHeritageClauses(node); + } + function checkClassDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + var seenImplementsClause = false; + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 2); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 77 /* ExtendsKeyword */) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause); + } + if (heritageClause.types.length > 1) { + return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 100 /* ImplementsKeyword */); + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); + } + seenImplementsClause = true; + } + } + } + return false; + } + function checkForAtLeastOneHeritageClause(types, listType) { + if (types && types.length === 0) { + return grammarErrorAtPos(types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType); + } + } + function checkConstructor(node) { + return checkAnySignatureDeclaration(node) || checkConstructorTypeParameters(node) || checkConstructorTypeAnnotation(node) || checkForBodyInAmbientContext(node.body, true); + } + function checkConstructorTypeParameters(node) { + if (node.typeParameters) { + return grammarErrorAtPos(node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + function checkConstructorTypeAnnotation(node) { + if (node.type) { + return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + function checkDeleteExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */ && node.expression.kind === 63 /* Identifier */) { + return grammarErrorOnNode(node.expression, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); + } + } + function checkEnumDeclaration(enumDecl) { + var enumIsConst = (enumDecl.flags & 4096 /* Const */) !== 0; + var hasError = false; + if (!enumIsConst) { + var inConstantEnumMemberSection = true; + for (var i = 0, n = enumDecl.members.length; i < n; i++) { + var node = enumDecl.members[i]; + if (node.name.kind === 121 /* ComputedPropertyName */) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (inAmbientContext) { + if (node.initializer && !isIntegerLiteral(node.initializer)) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; + } + } + else if (node.initializer) { + inConstantEnumMemberSection = isIntegerLiteral(node.initializer); + } + else if (!inConstantEnumMemberSection) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; + } + } + } + return hasError; + } + function isIntegerLiteral(expression) { + function isInteger(literalExpression) { + return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); + } + if (expression.kind === 155 /* PrefixUnaryExpression */) { + var unaryExpression = expression; + if (unaryExpression.operator === 32 /* PlusToken */ || unaryExpression.operator === 33 /* MinusToken */) { + expression = unaryExpression.operand; + } + } + if (expression.kind === 6 /* NumericLiteral */) { + return isInteger(expression); + } + return false; + } + function checkExportAssignment(node) { + if (node.flags & 243 /* Modifier */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); + } + } + function checkExternalModuleReference(node) { + if (node.expression.kind !== 7 /* StringLiteral */) { + return grammarErrorOnNode(node.expression, ts.Diagnostics.String_literal_expected); + } + } + function checkForInStatement(node) { + return checkVariableDeclarations(node.declarations) || checkForMoreThanOneDeclaration(node.declarations); + } + function checkForStatement(node) { + return checkVariableDeclarations(node.declarations); + } + function checkForMoreThanOneDeclaration(declarations) { + if (declarations && declarations.length > 1) { + return grammarErrorOnFirstToken(declarations[1], ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); + } + } + function checkFunctionDeclaration(node) { + return checkAnySignatureDeclaration(node) || checkFunctionName(node.name) || checkForBodyInAmbientContext(node.body, false) || checkForGenerator(node); + } + function checkForGenerator(node) { + if (node.asteriskToken) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_currently_supported); + } + } + function checkFunctionExpression(node) { + return checkAnySignatureDeclaration(node) || checkFunctionName(node.name) || checkForGenerator(node); + } + function checkFunctionName(name) { + if (name && name.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(name)) { + return reportInvalidUseInStrictMode(name); + } + } + function checkGetAccessor(node) { + return checkAnySignatureDeclaration(node) || checkAccessor(node); + } + function checkElementAccessExpression(node) { + if (!node.argumentExpression) { + if (node.parent.kind === 146 /* NewExpression */ && node.parent.expression === node) { + var start = ts.skipTrivia(sourceText, node.expression.end); + var end = node.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + } + else { + var start = node.end - "]".length; + var end = node.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Expression_expected); + } + } + } + function checkHeritageClause(node) { + return checkForDisallowedTrailingComma(node.types) || checkForAtLeastOneHeritageClause(node.types, ts.tokenToString(node.token)); + } + function checkIndexSignature(node) { + return checkIndexSignatureParameters(node) || checkForIndexSignatureModifiers(node); + } + function checkForIndexSignatureModifiers(node) { + if (node.flags & 243 /* Modifier */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); + } + } + function checkIndexSignatureParameters(node) { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + else { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + } + else if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); + } + else if (parameter.flags & 243 /* Modifier */) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); + } + else if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); + } + else if (!parameter.type) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); + } + else if (parameter.type.kind !== 118 /* StringKeyword */ && parameter.type.kind !== 116 /* NumberKeyword */) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + } + else if (!node.type) { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); + } + } + function checkInterfaceDeclaration(node) { + return checkInterfaceDeclarationHeritageClauses(node); + } + function checkInterfaceDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 1); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 77 /* ExtendsKeyword */) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 100 /* ImplementsKeyword */); + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + } + } + return false; + } + function checkMethod(node) { + if (checkAnySignatureDeclaration(node) || checkForBodyInAmbientContext(node.body, false) || checkForGenerator(node)) { + return true; + } + if (node.parent.kind === 185 /* ClassDeclaration */) { + if (checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + return true; + } + if (inAmbientContext) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + } + else if (!node.body) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + } + } + else if (node.parent.kind === 186 /* InterfaceDeclaration */) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + } + else if (node.parent.kind === 136 /* TypeLiteral */) { + return checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + } + } + function checkForBodyInAmbientContext(body, isConstructor) { + if (inAmbientContext && body && body.kind === 163 /* Block */) { + var diagnostic = isConstructor ? ts.Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : ts.Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; + return grammarErrorOnFirstToken(body, diagnostic); + } + } + function checkModuleDeclaration(node) { + return checkModuleDeclarationName(node) || checkModuleDeclarationStatements(node); + } + function checkModuleDeclarationName(node) { + if (!inAmbientContext && node.name.kind === 7 /* StringLiteral */) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + } + function checkModuleDeclarationStatements(node) { + if (node.name.kind === 63 /* Identifier */ && node.body.kind === 190 /* ModuleBlock */) { + var statements = node.body.statements; + for (var i = 0, n = statements.length; i < n; i++) { + var statement = statements[i]; + if (statement.kind === 192 /* ExportAssignment */) { + return grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + } + else if (ts.isExternalModuleImportDeclaration(statement)) { + return grammarErrorOnNode(ts.getExternalModuleImportDeclarationExpression(statement), ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + } + } + } + } + function checkObjectLiteralExpression(node) { + var seen = {}; + var Property = 1; + var GetAccessor = 2; + var SetAccesor = 4; + var GetOrSetAccessor = GetAccessor | SetAccesor; + var inStrictMode = (node.parserContextFlags & 1 /* StrictMode */) !== 0; + for (var i = 0, n = node.properties.length; i < n; i++) { + var prop = node.properties[i]; + var name = prop.name; + if (prop.kind === 161 /* OmittedExpression */ || name.kind === 121 /* ComputedPropertyName */) { + continue; + } + var currentKind; + if (prop.kind === 198 /* PropertyAssignment */ || prop.kind === 199 /* ShorthandPropertyAssignment */ || prop.kind === 125 /* Method */) { + currentKind = Property; + } + else if (prop.kind === 127 /* GetAccessor */) { + currentKind = GetAccessor; + } + else if (prop.kind === 128 /* SetAccessor */) { + currentKind = SetAccesor; + } + else { + ts.Debug.fail("Unexpected syntax kind:" + prop.kind); + } + if (!ts.hasProperty(seen, name.text)) { + seen[name.text] = currentKind; + } + else { + var existingKind = seen[name.text]; + if (currentKind === Property && existingKind === Property) { + if (inStrictMode) { + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + } + } + else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { + if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { + seen[name.text] = currentKind | existingKind; + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + } + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + } + } + } + } + function checkNumericLiteral(node) { + if (node.flags & 8192 /* OctalLiteral */) { + if (node.parserContextFlags & 1 /* StrictMode */) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); + } + else if (languageVersion >= 1 /* ES5 */) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + } + function checkModifiers(node) { + switch (node.kind) { + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 124 /* Property */: + case 125 /* Method */: + case 131 /* IndexSignature */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 189 /* ModuleDeclaration */: + case 188 /* EnumDeclaration */: + case 192 /* ExportAssignment */: + case 164 /* VariableStatement */: + case 184 /* FunctionDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 191 /* ImportDeclaration */: + case 123 /* Parameter */: + break; + default: + return false; + } + if (!node.modifiers) { + return; + } + var lastStatic, lastPrivate, lastProtected, lastDeclare; + var flags = 0; + for (var i = 0, n = node.modifiers.length; i < n; i++) { + var modifier = node.modifiers[i]; + switch (modifier.kind) { + case 106 /* PublicKeyword */: + case 105 /* ProtectedKeyword */: + case 104 /* PrivateKeyword */: + var text; + if (modifier.kind === 106 /* PublicKeyword */) { + text = "public"; + } + else if (modifier.kind === 105 /* ProtectedKeyword */) { + text = "protected"; + lastProtected = modifier; + } + else { + text = "private"; + lastPrivate = modifier; + } + if (flags & 112 /* AccessibilityModifier */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 128 /* Static */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (node.parent.kind === 190 /* ModuleBlock */ || node.parent.kind === 201 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + } + flags |= modifierToFlag(modifier.kind); + break; + case 107 /* StaticKeyword */: + if (flags & 128 /* Static */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); + } + else if (node.parent.kind === 190 /* ModuleBlock */ || node.parent.kind === 201 /* SourceFile */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + } + else if (node.kind === 123 /* Parameter */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + flags |= 128 /* Static */; + lastStatic = modifier; + break; + case 76 /* ExportKeyword */: + if (flags & 1 /* Export */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & 2 /* Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + } + else if (node.kind === 123 /* Parameter */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= 1 /* Export */; + break; + case 112 /* DeclareKeyword */: + if (flags & 2 /* Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + } + else if (node.kind === 123 /* Parameter */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } + else if (inAmbientContext && node.parent.kind === 190 /* ModuleBlock */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } + flags |= 2 /* Ambient */; + lastDeclare = modifier; + break; + } + } + if (node.kind === 126 /* Constructor */) { + if (flags & 128 /* Static */) { + return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + else if (flags & 64 /* Protected */) { + return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (flags & 32 /* Private */) { + return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); + } + } + else if (node.kind === 191 /* ImportDeclaration */ && flags & 2 /* Ambient */) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } + else if (node.kind === 186 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); + } + } + function checkParameter(node) { + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.name)) { + return reportInvalidUseInStrictMode(node.name); + } + } + function checkTypeParameterList(typeParameters) { + if (checkForDisallowedTrailingComma(typeParameters)) { + return true; + } + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var end = ts.skipTrivia(sourceText, typeParameters.end) + ">".length; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty); + } + } + function checkParameterList(parameters) { + if (checkForDisallowedTrailingComma(parameters)) { + return true; + } + var seenOptionalParameter = false; + var parameterCount = parameters.length; + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== (parameterCount - 1)) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } + else if (parameter.questionToken || parameter.initializer) { + seenOptionalParameter = true; + if (parameter.questionToken && parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } + else { + if (seenOptionalParameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } + } + function checkPostfixUnaryExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.operand)) { + return reportInvalidUseInStrictMode(node.operand); + } + } + function checkPrefixUnaryExpression(node) { + if (node.parserContextFlags & 1 /* StrictMode */) { + if ((node.operator === 37 /* PlusPlusToken */ || node.operator === 38 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(node.operand)) { + return reportInvalidUseInStrictMode(node.operand); + } + } + } + function checkProperty(node) { + if (node.parent.kind === 185 /* ClassDeclaration */) { + if (checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + return true; + } + } + else if (node.parent.kind === 186 /* InterfaceDeclaration */) { + if (checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + return true; + } + } + else if (node.parent.kind === 136 /* TypeLiteral */) { + if (checkForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + return true; + } + } + return checkForInitializerInAmbientContext(node); + } + function checkComputedPropertyName(node) { + return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_not_currently_supported); + if (languageVersion < 2 /* ES6 */) { + return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (node.expression.kind === 157 /* BinaryExpression */ && node.expression.operator === 22 /* CommaToken */) { + return grammarErrorOnNode(node.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } + } + function checkForDisallowedComputedProperty(node, message) { + if (node.kind === 121 /* ComputedPropertyName */) { + return grammarErrorOnNode(node, message); + } + } + function checkForInitializerInAmbientContext(node) { + if (inAmbientContext && node.initializer) { + return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + function checkPropertyAssignment(node) { + return checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); + } + function checkForInvalidQuestionMark(node, questionToken, message) { + if (questionToken) { + return grammarErrorOnNode(questionToken, message); + } + } + function checkReturnStatement(node) { + if (!inFunctionBlock) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + } + function checkSetAccessor(node) { + return checkAnySignatureDeclaration(node) || checkAccessor(node); + } + function checkAccessor(accessor) { + var kind = accessor.kind; + if (languageVersion < 1 /* ES5 */) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + else if (inAmbientContext) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); + } + else if (accessor.body === undefined) { + return grammarErrorAtPos(accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + else if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); + } + else if (kind === 127 /* GetAccessor */ && accessor.parameters.length) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + } + else if (kind === 128 /* SetAccessor */) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + else if (accessor.parameters.length !== 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + else { + var parameter = accessor.parameters[0]; + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + else if (parameter.flags & 243 /* Modifier */) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + else if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + } + } + function checkSourceFile(node) { + return inAmbientContext && checkTopLevelElementsForRequiredDeclareModifier(file); + } + function checkTopLevelElementsForRequiredDeclareModifier(file) { + for (var i = 0, n = file.statements.length; i < n; i++) { + var decl = file.statements[i]; + if (ts.isDeclaration(decl) || decl.kind === 164 /* VariableStatement */) { + if (checkTopLevelElementForRequiredDeclareModifier(decl)) { + return true; + } + } + } + } + function checkTopLevelElementForRequiredDeclareModifier(node) { + if (node.kind === 186 /* InterfaceDeclaration */ || node.kind === 191 /* ImportDeclaration */ || node.kind === 192 /* ExportAssignment */ || (node.flags & 2 /* Ambient */)) { + return false; + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); + } + function checkShorthandPropertyAssignment(node) { + return checkForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); + } + function checkSwitchStatement(node) { + var firstDefaultClause; + for (var i = 0, n = node.clauses.length; i < n; i++) { + var clause = node.clauses[i]; + if (clause.kind === 195 /* DefaultClause */) { + if (firstDefaultClause === undefined) { + firstDefaultClause = clause; + } + else { + var start = ts.skipTrivia(file.text, clause.pos); + var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + return grammarErrorAtPos(start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + } + } + } + } + function checkTaggedTemplateExpression(node) { + if (languageVersion < 2 /* ES6 */) { + return grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + function checkThrowStatement(node) { + if (node.expression === undefined) { + return grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); + } + } + function checkTupleType(node) { + return checkForDisallowedTrailingComma(node.elementTypes) || checkForAtLeastOneType(node); + } + function checkForAtLeastOneType(node) { + if (node.elementTypes.length === 0) { + return grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + } + function checkTypeParameter(node) { + if (node.expression) { + return grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); + } + } + function checkTypeReference(node) { + return checkTypeArguments(node.typeArguments); + } + function checkVariableDeclaration(node) { + if (inAmbientContext && node.initializer) { + var equalsPos = node.type ? ts.skipTrivia(sourceText, node.type.end) : ts.skipTrivia(sourceText, node.name.end); + return grammarErrorAtPos(equalsPos, "=".length, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + if (!inAmbientContext && !node.initializer && ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized); + } + if (node.parserContextFlags & 1 /* StrictMode */ && isEvalOrArgumentsIdentifier(node.name)) { + return reportInvalidUseInStrictMode(node.name); + } + } + function checkVariableDeclarations(declarations) { + if (declarations) { + if (checkForDisallowedTrailingComma(declarations)) { + return true; + } + if (!declarations.length) { + return grammarErrorAtPos(declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); + } + var decl = declarations[0]; + if (languageVersion < 2 /* ES6 */) { + if (ts.isLet(decl)) { + return grammarErrorOnFirstToken(decl, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (ts.isConst(decl)) { + return grammarErrorOnFirstToken(decl, ts.Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + } + } + function checkVariableStatement(node) { + return checkVariableDeclarations(node.declarations) || checkForDisallowedLetOrConstStatement(node); + } + function checkForDisallowedLetOrConstStatement(node) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (ts.isLet(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } + else if (ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } + } + function allowLetAndConstDeclarations(parent) { + switch (parent.kind) { + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 175 /* WithStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + return false; + case 177 /* LabeledStatement */: + return allowLetAndConstDeclarations(parent.parent); + } + return true; + } + function checkWithStatement(node) { + if (node.parserContextFlags & 1 /* StrictMode */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + function checkYieldExpression(node) { + if (!(node.parserContextFlags & 4 /* Yield */)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expressions_are_not_currently_supported); + } + } + function createProgram(rootNames, options, host) { + var program; + var files = []; + var filesByName = {}; + var errors = []; + var seenNoDefaultLib = options.noLib; + var commonSourceDirectory; + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!seenNoDefaultLib) { + processRootFile(host.getDefaultLibFilename(options), true); + } + verifyCompilerOptions(); + errors.sort(ts.compareDiagnostics); + program = { + getSourceFile: getSourceFile, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, + getCompilerHost: function () { return host; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeChecker: function (fullTypeCheckMode) { return ts.createTypeChecker(program, fullTypeCheckMode); }, + getCommonSourceDirectory: function () { return commonSourceDirectory; } + }; + return program; + function getSourceFile(filename) { + filename = host.getCanonicalFileName(filename); + return ts.hasProperty(filesByName, filename) ? filesByName[filename] : undefined; + } + function getDiagnostics(sourceFile) { + return sourceFile ? ts.filter(errors, function (e) { return e.file === sourceFile; }) : errors; + } + function getGlobalDiagnostics() { + return ts.filter(errors, function (e) { return !e.file; }); + } + function hasExtension(filename) { + return ts.getBaseFilename(filename).indexOf(".") >= 0; + } + function processRootFile(filename, isDefaultLib) { + processSourceFile(ts.normalizePath(filename), isDefaultLib); + } + function processSourceFile(filename, isDefaultLib, refFile, refPos, refEnd) { + if (refEnd !== undefined && refPos !== undefined) { + var start = refPos; + var length = refEnd - refPos; + } + var diagnostic; + if (hasExtension(filename)) { + if (!options.allowNonTsExtensions && !ts.fileExtensionIs(filename, ".ts")) { + diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + } + else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (refFile && host.getCanonicalFileName(filename) === host.getCanonicalFileName(refFile.filename)) { + diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + } + } + else { + if (options.allowNonTsExtensions && !findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (!findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + filename += ".ts"; + } + } + if (diagnostic) { + if (refFile) { + errors.push(ts.createFileDiagnostic(refFile, start, length, diagnostic, filename)); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnostic, filename)); + } + } + } + function findSourceFile(filename, isDefaultLib, refFile, refStart, refLength) { + var canonicalName = host.getCanonicalFileName(filename); + if (ts.hasProperty(filesByName, canonicalName)) { + return getSourceFileFromCache(filename, canonicalName, false); + } + else { + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(filename, host.getCurrentDirectory()); + var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); + if (ts.hasProperty(filesByName, canonicalAbsolutePath)) { + return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); + } + var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, function (hostErrorMessage) { + errors.push(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + }); + if (file) { + seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib; + filesByName[canonicalAbsolutePath] = file; + if (!options.noResolve) { + var basePath = ts.getDirectoryPath(filename); + processReferencedFiles(file, basePath); + processImportedModules(file, basePath); + } + if (isDefaultLib) { + files.unshift(file); + } + else { + files.push(file); + } + ts.forEach(file.getSyntacticDiagnostics(), function (e) { + errors.push(e); + }); + } + } + return file; + function getSourceFileFromCache(filename, canonicalName, useAbsolutePath) { + var file = filesByName[canonicalName]; + if (file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.filename, host.getCurrentDirectory()) : file.filename; + if (canonicalName !== sourceFileName) { + errors.push(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Filename_0_differs_from_already_included_filename_1_only_in_casing, filename, sourceFileName)); + } + } + return file; + } + } + function processReferencedFiles(file, basePath) { + ts.forEach(file.referencedFiles, function (ref) { + var referencedFilename = ts.isRootedDiskPath(ref.filename) ? ref.filename : ts.combinePaths(basePath, ref.filename); + processSourceFile(ts.normalizePath(referencedFilename), false, file, ref.pos, ref.end); + }); + } + function processImportedModules(file, basePath) { + ts.forEach(file.statements, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 7 /* StringLiteral */) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchPath = basePath; + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + if (findModuleSourceFile(searchName + ".ts", nameLiteral) || findModuleSourceFile(searchName + ".d.ts", nameLiteral)) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + } + } + else if (node.kind === 189 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 7 /* StringLiteral */) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + if (!tsFile) { + findModuleSourceFile(searchName + ".d.ts", nameLiteral); + } + } + } + }); + } + }); + function findModuleSourceFile(filename, nameLiteral) { + return findSourceFile(filename, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + } + } + function verifyCompilerOptions() { + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { + if (options.mapRoot) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + if (options.sourceRoot) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + return; + } + var firstExternalModule = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + if (firstExternalModule && options.module === 0 /* None */) { + var externalModuleErrorSpan = ts.getErrorSpanForNode(firstExternalModule.externalModuleIndicator); + var errorStart = ts.skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); + var errorLength = externalModuleErrorSpan.end - errorStart; + errors.push(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + } + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { + var commonPathComponents; + ts.forEach(files, function (sourceFile) { + if (!(sourceFile.flags & 1024 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + sourcePathComponents.pop(); + if (commonPathComponents) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + } + else { + commonPathComponents = sourcePathComponents; + } + } + }); + commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); + if (commonSourceDirectory) { + commonSourceDirectory += ts.directorySeparator; + } + } + } + } + ts.createProgram = createProgram; +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); + var ModuleInstanceState = ts.ModuleInstanceState; + function getModuleInstanceState(node) { + if (node.kind === 186 /* InterfaceDeclaration */) { + return 0 /* NonInstantiated */; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2 /* ConstEnumOnly */; + } + else if (node.kind === 191 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + return 0 /* NonInstantiated */; + } + else if (node.kind === 190 /* ModuleBlock */) { + var state = 0 /* NonInstantiated */; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0 /* NonInstantiated */: + return false; + case 2 /* ConstEnumOnly */: + state = 2 /* ConstEnumOnly */; + return false; + case 1 /* Instantiated */: + state = 1 /* Instantiated */; + return true; + } + }); + return state; + } + else if (node.kind === 189 /* ModuleDeclaration */) { + return getModuleInstanceState(node.body); + } + else { + return 1 /* Instantiated */; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + function hasComputedNameButNotSymbol(declaration) { + return declaration.name && declaration.name.kind === 121 /* ComputedPropertyName */; + } + ts.hasComputedNameButNotSymbol = hasComputedNameButNotSymbol; + function bindSourceFile(file) { + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var symbolCount = 0; + var Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + file.locals = {}; + container = blockScopeContainer = file; + bind(file); + file.symbolCount = symbolCount; + } + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolKind) { + symbol.flags |= symbolKind; + if (!symbol.declarations) + symbol.declarations = []; + symbol.declarations.push(node); + if (symbolKind & 1952 /* HasExports */ && !symbol.exports) + symbol.exports = {}; + if (symbolKind & 6240 /* HasMembers */ && !symbol.members) + symbol.members = {}; + node.symbol = symbol; + if (symbolKind & 107455 /* Value */ && !symbol.valueDeclaration) + symbol.valueDeclaration = node; + } + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 189 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { + return '"' + node.name.text + '"'; + } + ts.Debug.assert(!hasComputedNameButNotSymbol(node)); + return node.name.text; + } + switch (node.kind) { + case 134 /* ConstructorType */: + case 126 /* Constructor */: + return "__constructor"; + case 133 /* FunctionType */: + case 129 /* CallSignature */: + return "__call"; + case 130 /* ConstructSignature */: + return "__new"; + case 131 /* IndexSignature */: + return "__index"; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + function declareSymbol(symbols, parent, node, includes, excludes) { + if (hasComputedNameButNotSymbol(node)) { + return undefined; + } + var name = getDeclarationName(node); + if (name !== undefined) { + var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + var message = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + file.semanticDiagnostics.push(ts.createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); + }); + file.semanticDiagnostics.push(ts.createDiagnosticForNode(node.name, message, getDisplayName(node))); + symbol = createSymbol(0, name); + } + } + else { + symbol = createSymbol(0, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + if (node.kind === 185 /* ClassDeclaration */ && symbol.exports) { + var prototypeSymbol = createSymbol(4 /* Property */ | 536870912 /* Prototype */, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.semanticDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + return symbol; + } + function isAmbientContext(node) { + while (node) { + if (node.flags & 2 /* Ambient */) + return true; + node = node.parent; + } + return false; + } + function declareModuleMember(node, symbolKind, symbolExcludes) { + var exportKind = 0; + if (symbolKind & 107455 /* Value */) { + exportKind |= 4194304 /* ExportValue */; + } + if (symbolKind & 3152352 /* Type */) { + exportKind |= 8388608 /* ExportType */; + } + if (symbolKind & 1536 /* Namespace */) { + exportKind |= 16777216 /* ExportNamespace */; + } + if (node.flags & 1 /* Export */ || (node.kind !== 191 /* ImportDeclaration */ && isAmbientContext(container))) { + if (exportKind) { + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + node.localSymbol = local; + } + else { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + } + } + else { + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + } + } + function bindChildren(node, symbolKind, isBlockScopeContainer) { + if (symbolKind & 1041936 /* HasLocals */) { + node.locals = {}; + } + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + parent = node; + if (symbolKind & 1048560 /* IsContainer */) { + container = node; + if (lastContainer !== container && !container.nextContainer) { + if (lastContainer) { + lastContainer.nextContainer = container; + } + lastContainer = container; + } + } + if (isBlockScopeContainer) { + blockScopeContainer = node; + } + ts.forEachChild(node, bind); + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + switch (container.kind) { + case 189 /* ModuleDeclaration */: + declareModuleMember(node, symbolKind, symbolExcludes); + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolKind, symbolExcludes); + break; + } + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + break; + case 185 /* ClassDeclaration */: + if (node.flags & 128 /* Static */) { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + case 136 /* TypeLiteral */: + case 142 /* ObjectLiteralExpression */: + case 186 /* InterfaceDeclaration */: + declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); + break; + case 188 /* EnumDeclaration */: + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindConstructorDeclaration(node) { + bindDeclaration(node, 16384 /* Constructor */, 0, true); + ts.forEach(node.parameters, function (p) { + if (p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { + bindDeclaration(p, 4 /* Property */, 107455 /* PropertyExcludes */, false); + } + }); + } + function bindModuleDeclaration(node) { + if (node.name.kind === 7 /* StringLiteral */) { + bindDeclaration(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */, true); + } + else { + var state = getModuleInstanceState(node); + if (state === 0 /* NonInstantiated */) { + bindDeclaration(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + } + else { + bindDeclaration(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */, true); + if (state === 2 /* ConstEnumOnly */) { + node.symbol.constEnumOnlyModule = true; + } + else if (node.symbol.constEnumOnlyModule) { + node.symbol.constEnumOnlyModule = false; + } + } + } + } + function bindFunctionOrConstructorType(node) { + var symbolKind = node.kind === 133 /* FunctionType */ ? 131072 /* CallSignature */ : 262144 /* ConstructSignature */; + var symbol = createSymbol(symbolKind, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, false); + var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + typeLiteralSymbol.members = {}; + typeLiteralSymbol.members[node.kind === 133 /* FunctionType */ ? "__call" : "__new"] = symbol; + } + function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { + var symbol = createSymbol(symbolKind, name); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindCatchVariableDeclaration(node) { + var symbol = createSymbol(1 /* FunctionScopedVariable */, node.name.text || "__missing"); + addDeclarationToSymbol(symbol, node, 1 /* FunctionScopedVariable */); + var saveParent = parent; + var savedBlockScopeContainer = blockScopeContainer; + parent = blockScopeContainer = node; + ts.forEachChild(node, bind); + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindBlockScopedVariableDeclaration(node) { + switch (blockScopeContainer.kind) { + case 189 /* ModuleDeclaration */: + declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(container)) { + declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + } + declareSymbol(blockScopeContainer.locals, undefined, node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + } + bindChildren(node, 2 /* BlockScopedVariable */, false); + } + function bind(node) { + node.parent = parent; + switch (node.kind) { + case 122 /* TypeParameter */: + bindDeclaration(node, 1048576 /* TypeParameter */, 2103776 /* TypeParameterExcludes */, false); + break; + case 123 /* Parameter */: + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + break; + case 183 /* VariableDeclaration */: + if (node.flags & 6144 /* BlockScoped */) { + bindBlockScopedVariableDeclaration(node); + } + else { + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); + } + break; + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + bindDeclaration(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); + break; + case 200 /* EnumMember */: + bindDeclaration(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); + break; + case 129 /* CallSignature */: + bindDeclaration(node, 131072 /* CallSignature */, 0, false); + break; + case 130 /* ConstructSignature */: + bindDeclaration(node, 262144 /* ConstructSignature */, 0, true); + break; + case 125 /* Method */: + bindDeclaration(node, 8192 /* Method */, ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); + break; + case 131 /* IndexSignature */: + bindDeclaration(node, 524288 /* IndexSignature */, 0, false); + break; + case 184 /* FunctionDeclaration */: + bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); + break; + case 126 /* Constructor */: + bindConstructorDeclaration(node); + break; + case 127 /* GetAccessor */: + bindDeclaration(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); + break; + case 128 /* SetAccessor */: + bindDeclaration(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); + break; + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + bindFunctionOrConstructorType(node); + break; + case 136 /* TypeLiteral */: + bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); + break; + case 142 /* ObjectLiteralExpression */: + bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); + break; + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); + break; + case 197 /* CatchClause */: + bindCatchVariableDeclaration(node); + break; + case 185 /* ClassDeclaration */: + bindDeclaration(node, 32 /* Class */, 3258879 /* ClassExcludes */, false); + break; + case 186 /* InterfaceDeclaration */: + bindDeclaration(node, 64 /* Interface */, 3152288 /* InterfaceExcludes */, false); + break; + case 187 /* TypeAliasDeclaration */: + bindDeclaration(node, 2097152 /* TypeAlias */, 3152352 /* TypeAliasExcludes */, false); + break; + case 188 /* EnumDeclaration */: + if (ts.isConst(node)) { + bindDeclaration(node, 128 /* ConstEnum */, 3259263 /* ConstEnumExcludes */, false); + } + else { + bindDeclaration(node, 256 /* RegularEnum */, 3258623 /* RegularEnumExcludes */, false); + } + break; + case 189 /* ModuleDeclaration */: + bindModuleDeclaration(node); + break; + case 191 /* ImportDeclaration */: + bindDeclaration(node, 33554432 /* Import */, 33554432 /* ImportExcludes */, false); + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(node)) { + bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); + break; + } + case 163 /* Block */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 176 /* SwitchStatement */: + bindChildren(node, 0, true); + break; + default: + var saveParent = parent; + parent = node; + ts.forEachChild(node, bind); + parent = saveParent; + } + } + } + ts.bindSourceFile = bindSourceFile; +})(ts || (ts = {})); +var ts; +(function (ts) { + var indentStrings = ["", " "]; + function getIndentString(level) { + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; + } + ts.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; + } + function shouldEmitToOwnFile(sourceFile, compilerOptions) { + if (!ts.isDeclarationFile(sourceFile)) { + if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + return true; + } + return false; + } + return false; + } + ts.shouldEmitToOwnFile = shouldEmitToOwnFile; + function isExternalModuleOrDeclarationFile(sourceFile) { + return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); + } + ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function createTextWriter(newLine) { + var output = ""; + var indent = 0; + var lineStart = true; + var lineCount = 0; + var linePos = 0; + function write(s) { + if (s && s.length) { + if (lineStart) { + output += getIndentString(indent); + lineStart = false; + } + output += s; + } + } + function rawWrite(s) { + if (s !== undefined) { + if (lineStart) { + lineStart = false; + } + output += s; + } + } + function writeLiteral(s) { + if (s && s.length) { + write(s); + var lineStartsOfS = ts.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; + } + } + } + function writeLine() { + if (!lineStart) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; + } + } + function writeTextOfNode(sourceFile, node) { + write(ts.getSourceTextOfNodeFromSourceFile(sourceFile, node)); + } + return { + write: write, + rawWrite: rawWrite, + writeTextOfNode: writeTextOfNode, + writeLiteral: writeLiteral, + writeLine: writeLine, + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } + }; + } + function getLineOfLocalPosition(currentSourceFile, pos) { + return currentSourceFile.getLineAndCharacterFromPosition(pos).line; + } + function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + writer.writeLine(); + } + } + function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + var emitLeadingSpace = !trailingSeparator; + ts.forEach(comments, function (comment) { + if (emitLeadingSpace) { + writer.write(" "); + emitLeadingSpace = false; + } + writeComment(currentSourceFile, writer, comment, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + else if (trailingSeparator) { + writer.write(" "); + } + else { + emitLeadingSpace = true; + } + }); + } + function writeCommentRange(currentSourceFile, writer, comment, newLine) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); + var firstCommentLineIndent; + for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, 1); + if (pos !== comment.pos) { + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, 1), comment.pos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; + } + } + else { + writer.rawWrite(""); + } + } + writeTrimmedCurrentLine(pos, nextLineStart); + pos = nextLineStart; + } + } + else { + writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); + } + function writeTrimmedCurrentLine(pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + if (currentLineText) { + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + writer.writeLiteral(newLine); + } + } + function calculateIndent(pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { + if (currentSourceFile.text.charCodeAt(pos) === 9 /* tab */) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + currentLineIndent++; + } + } + return currentLineIndent; + } + } + function getFirstConstructorWithBody(node) { + return ts.forEach(node.members, function (member) { + if (member.kind === 126 /* Constructor */ && member.body) { + return member; + } + }); + } + function getAllAccessorDeclarations(node, accessor) { + var firstAccessor; + var getAccessor; + var setAccessor; + if (accessor.name.kind === 121 /* ComputedPropertyName */) { + firstAccessor = accessor; + if (accessor.kind === 127 /* GetAccessor */) { + getAccessor = accessor; + } + else if (accessor.kind === 128 /* SetAccessor */) { + setAccessor = accessor; + } + else { + ts.Debug.fail("Accessor has wrong kind"); + } + } + else { + ts.forEach(node.members, function (member) { + if ((member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 127 /* GetAccessor */ && !getAccessor) { + getAccessor = member; + } + if (member.kind === 128 /* SetAccessor */ && !setAccessor) { + setAccessor = member; + } + } + }); + } + return { + firstAccessor: firstAccessor, + getAccessor: getAccessor, + setAccessor: setAccessor + }; + } + function getSourceFilePathInNewDir(sourceFile, program, newDirPath) { + var compilerHost = program.getCompilerHost(); + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, compilerHost.getCurrentDirectory()); + sourceFilePath = sourceFilePath.replace(program.getCommonSourceDirectory(), ""); + return ts.combinePaths(newDirPath, sourceFilePath); + } + function getOwnEmitOutputFilePath(sourceFile, program, extension) { + var compilerOptions = program.getCompilerOptions(); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, program, compilerOptions.outDir)); + } + else { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.filename); + } + return emitOutputFilePathWithoutExtension + extension; + } + function writeFile(compilerHost, diagnostics, filename, data, writeByteOrderMark) { + compilerHost.writeFile(filename, data, writeByteOrderMark, function (hostErrorMessage) { + diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, filename, hostErrorMessage)); + }); + } + function emitDeclarations(program, resolver, diagnostics, jsFilePath, root) { + var newLine = program.getCompilerHost().getNewLine(); + var compilerOptions = program.getCompilerOptions(); + var compilerHost = program.getCompilerHost(); + var write; + var writeLine; + var increaseIndent; + var decreaseIndent; + var writeTextOfNode; + var writer = createAndSetNewTextWriterWithSymbolWriter(); + var enclosingDeclaration; + var currentSourceFile; + var reportedDeclarationError = false; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; + var aliasDeclarationEmitInfo = []; + function createAndSetNewTextWriterWithSymbolWriter() { + var writer = createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + return writer; + } + function setWriter(newWriter) { + writer = newWriter; + write = newWriter.write; + writeTextOfNode = newWriter.writeTextOfNode; + writeLine = newWriter.writeLine; + increaseIndent = newWriter.increaseIndent; + decreaseIndent = newWriter.decreaseIndent; + } + function writeAsychronousImportDeclarations(importDeclarations) { + var oldWriter = writer; + ts.forEach(importDeclarations, function (aliasToWrite) { + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + if (aliasEmitInfo) { + createAndSetNewTextWriterWithSymbolWriter(); + for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { + increaseIndent(); + } + writeImportDeclaration(aliasToWrite); + aliasEmitInfo.asynchronousOutput = writer.getText(); + } + }); + setWriter(oldWriter); + } + function handleSymbolAccessibilityError(symbolAccesibilityResult) { + if (symbolAccesibilityResult.accessibility === 0 /* Accessible */) { + if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { + writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); + } + } + else { + reportedDeclarationError = true; + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + if (errorInfo) { + if (errorInfo.typeName) { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + } + else { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + } + } + } + } + function trackSymbol(symbol, enclosingDeclaration, meaning) { + handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + } + function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (type) { + emitType(type); + } + else { + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } + } + function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (signature.type) { + emitType(signature.type); + } + else { + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } + } + function emitLines(nodes) { + for (var i = 0, n = nodes.length; i < n; i++) { + emitNode(nodes[i]); + } + } + function emitSeparatedList(nodes, separator, eachNodeEmitFn) { + var currentWriterPos = writer.getTextPos(); + for (var i = 0, n = nodes.length; i < n; i++) { + if (currentWriterPos !== writer.getTextPos()) { + write(separator); + } + currentWriterPos = writer.getTextPos(); + eachNodeEmitFn(nodes[i]); + } + } + function emitCommaList(nodes, eachNodeEmitFn) { + emitSeparatedList(nodes, ", ", eachNodeEmitFn); + } + function writeJsDocComments(declaration) { + if (declaration) { + var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + emitComments(currentSourceFile, writer, jsDocComments, true, newLine, writeCommentRange); + } + } + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + emitType(type); + } + function emitType(type) { + switch (type.kind) { + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: + case 7 /* StringLiteral */: + return writeTextOfNode(currentSourceFile, type); + case 132 /* TypeReference */: + return emitTypeReference(type); + case 135 /* TypeQuery */: + return emitTypeQuery(type); + case 137 /* ArrayType */: + return emitArrayType(type); + case 138 /* TupleType */: + return emitTupleType(type); + case 139 /* UnionType */: + return emitUnionType(type); + case 140 /* ParenthesizedType */: + return emitParenType(type); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + return emitSignatureDeclarationWithJsDocComments(type); + case 136 /* TypeLiteral */: + return emitTypeLiteral(type); + case 63 /* Identifier */: + return emitEntityName(type); + case 120 /* QualifiedName */: + return emitEntityName(type); + default: + ts.Debug.fail("Unknown type annotation: " + type.kind); + } + function emitEntityName(entityName) { + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 191 /* ImportDeclaration */ ? entityName.parent : enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + writeEntityName(entityName); + function writeEntityName(entityName) { + if (entityName.kind === 63 /* Identifier */) { + writeTextOfNode(currentSourceFile, entityName); + } + else { + var qualifiedName = entityName; + writeEntityName(qualifiedName.left); + write("."); + writeTextOfNode(currentSourceFile, qualifiedName.right); + } + } + } + function emitTypeReference(type) { + emitEntityName(type.typeName); + if (type.typeArguments) { + write("<"); + emitCommaList(type.typeArguments, emitType); + write(">"); + } + } + function emitTypeQuery(type) { + write("typeof "); + emitEntityName(type.exprName); + } + function emitArrayType(type) { + emitType(type.elementType); + write("[]"); + } + function emitTupleType(type) { + write("["); + emitCommaList(type.elementTypes, emitType); + write("]"); + } + function emitUnionType(type) { + emitSeparatedList(type.types, " | ", emitType); + } + function emitParenType(type) { + write("("); + emitType(type.type); + write(")"); + } + function emitTypeLiteral(type) { + write("{"); + if (type.members.length) { + writeLine(); + increaseIndent(); + emitLines(type.members); + decreaseIndent(); + } + write("}"); + } + } + function emitSourceFile(node) { + currentSourceFile = node; + enclosingDeclaration = node; + emitLines(node.statements); + } + function emitExportAssignment(node) { + write("export = "); + writeTextOfNode(currentSourceFile, node.exportName); + write(";"); + writeLine(); + } + function emitModuleElementDeclarationFlags(node) { + if (node.parent === currentSourceFile) { + if (node.flags & 1 /* Export */) { + write("export "); + } + if (node.kind !== 186 /* InterfaceDeclaration */) { + write("declare "); + } + } + } + function emitClassMemberDeclarationFlags(node) { + if (node.flags & 32 /* Private */) { + write("private "); + } + else if (node.flags & 64 /* Protected */) { + write("protected "); + } + if (node.flags & 128 /* Static */) { + write("static "); + } + } + function emitImportDeclaration(node) { + var nodeEmitInfo = { + declaration: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + hasWritten: resolver.isDeclarationVisible(node) + }; + aliasDeclarationEmitInfo.push(nodeEmitInfo); + if (nodeEmitInfo.hasWritten) { + writeImportDeclaration(node); + } + } + function writeImportDeclaration(node) { + emitJsDocComments(node); + if (node.flags & 1 /* Export */) { + write("export "); + } + write("import "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); + write(";"); + } + else { + write("require("); + writeTextOfNode(currentSourceFile, ts.getExternalModuleImportDeclarationExpression(node)); + write(");"); + } + writer.writeLine(); + function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; + } + } + function emitModuleDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("module "); + writeTextOfNode(currentSourceFile, node.name); + while (node.body.kind !== 190 /* ModuleBlock */) { + node = node.body; + write("."); + writeTextOfNode(currentSourceFile, node.name); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.body.statements); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitTypeAliasDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("type "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); + write(";"); + writeLine(); + } + function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: node.type, + typeName: node.name + }; + } + } + function emitEnumDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isConst(node)) { + write("const "); + } + write("enum "); + writeTextOfNode(currentSourceFile, node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + } + } + function emitEnumMemberDeclaration(node) { + emitJsDocComments(node); + writeTextOfNode(currentSourceFile, node.name); + var enumMemberValue = resolver.getEnumMemberValue(node); + if (enumMemberValue !== undefined) { + write(" = "); + write(enumMemberValue.toString()); + } + write(","); + writeLine(); + } + function emitTypeParameters(typeParameters) { + function emitTypeParameter(node) { + increaseIndent(); + emitJsDocComments(node); + decreaseIndent(); + writeTextOfNode(currentSourceFile, node.name); + if (node.constraint && (node.parent.kind !== 125 /* Method */ || !(node.parent.flags & 32 /* Private */))) { + write(" extends "); + if (node.parent.kind === 133 /* FunctionType */ || node.parent.kind === 134 /* ConstructorType */ || (node.parent.parent && node.parent.parent.kind === 136 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 125 /* Method */ || node.parent.kind === 133 /* FunctionType */ || node.parent.kind === 134 /* ConstructorType */ || node.parent.kind === 129 /* CallSignature */ || node.parent.kind === 130 /* ConstructSignature */); + emitType(node.constraint); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); + } + } + function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 185 /* ClassDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 186 /* InterfaceDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 130 /* ConstructSignature */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 129 /* CallSignature */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 125 /* Method */: + if (node.parent.flags & 128 /* Static */) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 184 /* FunctionDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + if (typeParameters) { + write("<"); + emitCommaList(typeParameters, emitTypeParameter); + write(">"); + } + } + function emitHeritageClause(typeReferences, isImplementsList) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); + } + function emitTypeOfTypeReference(node) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.parent.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.parent.parent.name + }; + } + } + } + function emitClassDeclaration(node) { + function emitParameterProperties(constructorDeclaration) { + if (constructorDeclaration) { + ts.forEach(constructorDeclaration.parameters, function (param) { + if (param.flags & 112 /* AccessibilityModifier */) { + emitPropertyDeclaration(param); + } + }); + } + } + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("class "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitHeritageClause([baseTypeNode], false); + } + emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + write(" {"); + writeLine(); + increaseIndent(); + emitParameterProperties(getFirstConstructorWithBody(node)); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitInterfaceDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("interface "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitPropertyDeclaration(node) { + emitJsDocComments(node); + emitClassMemberDeclarationFlags(node); + emitVariableDeclaration(node); + write(";"); + writeLine(); + } + function emitVariableDeclaration(node) { + if (node.kind !== 183 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + writeTextOfNode(currentSourceFile, node.name); + if (node.kind === 124 /* Property */ && ts.hasQuestionToken(node)) { + write("?"); + } + if (node.kind === 124 /* Property */ && node.parent.kind === 136 /* TypeLiteral */) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.flags & 32 /* Private */)) { + writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); + } + } + function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.kind === 183 /* VariableDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + } + else if (node.kind === 124 /* Property */) { + if (node.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + } + function emitTypeOfVariableDeclarationFromTypeLiteral(node) { + if (node.type) { + write(": "); + emitType(node.type); + } + } + function emitVariableStatement(node) { + var hasDeclarationWithEmit = ts.forEach(node.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + if (hasDeclarationWithEmit) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isLet(node)) { + write("let "); + } + else if (ts.isConst(node)) { + write("const "); + } + else { + write("var "); + } + emitCommaList(node.declarations, emitVariableDeclaration); + write(";"); + writeLine(); + } + } + function emitAccessorDeclaration(node) { + var accessors = getAllAccessorDeclarations(node.parent, node); + if (node === accessors.firstAccessor) { + emitJsDocComments(accessors.getAccessor); + emitJsDocComments(accessors.setAccessor); + emitClassMemberDeclarationFlags(node); + writeTextOfNode(currentSourceFile, node.name); + if (!(node.flags & 32 /* Private */)) { + var accessorWithTypeAnnotation = node; + var type = getTypeAnnotationFromAccessor(node); + if (!type) { + var anotherAccessor = node.kind === 127 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + type = getTypeAnnotationFromAccessor(anotherAccessor); + if (type) { + accessorWithTypeAnnotation = anotherAccessor; + } + } + writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); + } + write(";"); + writeLine(); + } + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 127 /* GetAccessor */ ? accessor.type : accessor.parameters[0].type; + } + } + function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (accessorWithTypeAnnotation.kind === 128 /* SetAccessor */) { + if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.parameters[0], + typeName: accessorWithTypeAnnotation.name + }; + } + else { + if (accessorWithTypeAnnotation.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.name, + typeName: undefined + }; + } + } + } + function emitFunctionDeclaration(node) { + if ((node.kind !== 184 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + emitJsDocComments(node); + if (node.kind === 184 /* FunctionDeclaration */) { + emitModuleElementDeclarationFlags(node); + } + else if (node.kind === 125 /* Method */) { + emitClassMemberDeclarationFlags(node); + } + if (node.kind === 184 /* FunctionDeclaration */) { + write("function "); + writeTextOfNode(currentSourceFile, node.name); + } + else if (node.kind === 126 /* Constructor */) { + write("constructor"); + } + else { + writeTextOfNode(currentSourceFile, node.name); + if (ts.hasQuestionToken(node)) { + write("?"); + } + } + emitSignatureDeclaration(node); + } + } + function emitSignatureDeclarationWithJsDocComments(node) { + emitJsDocComments(node); + emitSignatureDeclaration(node); + } + function emitSignatureDeclaration(node) { + if (node.kind === 130 /* ConstructSignature */ || node.kind === 134 /* ConstructorType */) { + write("new "); + } + emitTypeParameters(node.typeParameters); + if (node.kind === 131 /* IndexSignature */) { + write("["); + } + else { + write("("); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitCommaList(node.parameters, emitParameterDeclaration); + if (node.kind === 131 /* IndexSignature */) { + write("]"); + } + else { + write(")"); + } + var isFunctionTypeOrConstructorType = node.kind === 133 /* FunctionType */ || node.kind === 134 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 136 /* TypeLiteral */) { + if (node.type) { + write(isFunctionTypeOrConstructorType ? " => " : ": "); + emitType(node.type); + } + } + else if (node.kind !== 126 /* Constructor */ && !(node.flags & 32 /* Private */)) { + writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); + } + enclosingDeclaration = prevEnclosingDeclaration; + if (!isFunctionTypeOrConstructorType) { + write(";"); + writeLine(); + } + function getReturnTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 130 /* ConstructSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 129 /* CallSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 131 /* IndexSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 125 /* Method */: + if (node.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + } + else if (node.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + } + break; + case 184 /* FunctionDeclaration */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + break; + default: + ts.Debug.fail("This is unknown kind for signature: " + node.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node.name || node + }; + } + } + function emitParameterDeclaration(node) { + increaseIndent(); + emitJsDocComments(node); + if (node.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentSourceFile, node.name); + if (node.initializer || ts.hasQuestionToken(node)) { + write("?"); + } + decreaseIndent(); + if (node.parent.kind === 133 /* FunctionType */ || node.parent.kind === 134 /* ConstructorType */ || node.parent.parent.kind === 136 /* TypeLiteral */) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.parent.flags & 32 /* Private */)) { + writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); + } + function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 126 /* Constructor */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + break; + case 130 /* ConstructSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 129 /* CallSignature */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 125 /* Method */: + if (node.parent.flags & 128 /* Static */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 185 /* ClassDeclaration */) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 184 /* FunctionDeclaration */: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + function emitNode(node) { + switch (node.kind) { + case 126 /* Constructor */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + return emitFunctionDeclaration(node); + case 130 /* ConstructSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: + return emitSignatureDeclarationWithJsDocComments(node); + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return emitAccessorDeclaration(node); + case 164 /* VariableStatement */: + return emitVariableStatement(node); + case 124 /* Property */: + return emitPropertyDeclaration(node); + case 186 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 185 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 187 /* TypeAliasDeclaration */: + return emitTypeAliasDeclaration(node); + case 200 /* EnumMember */: + return emitEnumMemberDeclaration(node); + case 188 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 189 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 191 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 192 /* ExportAssignment */: + return emitExportAssignment(node); + case 201 /* SourceFile */: + return emitSourceFile(node); + } + } + var referencePathsOutput = ""; + function writeReferencePath(referencedFile) { + var declFileName = referencedFile.flags & 1024 /* DeclarationFile */ ? referencedFile.filename : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, program, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, false); + referencePathsOutput += "/// " + newLine; + } + if (root) { + if (!compilerOptions.noResolve) { + var addedGlobalFileReference = false; + ts.forEach(root.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(program, root, fileReference); + if (referencedFile && ((referencedFile.flags & 1024 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + writeReferencePath(referencedFile); + if (!isExternalModuleOrDeclarationFile(referencedFile)) { + addedGlobalFileReference = true; + } + } + }); + } + emitNode(root); + } + else { + var emittedReferencedFiles = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + if (!compilerOptions.noResolve) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(program, sourceFile, fileReference); + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + writeReferencePath(referencedFile); + emittedReferencedFiles.push(referencedFile); + } + }); + } + emitNode(sourceFile); + } + }); + } + return { + reportedDeclarationError: reportedDeclarationError, + aliasDeclarationEmitInfo: aliasDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencePathsOutput: referencePathsOutput + }; + } + function getDeclarationDiagnostics(program, resolver, targetSourceFile) { + var diagnostics = []; + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, program, ".js"); + emitDeclarations(program, resolver, diagnostics, jsFilePath, targetSourceFile); + return diagnostics; + } + ts.getDeclarationDiagnostics = getDeclarationDiagnostics; + function emitFiles(resolver, targetSourceFile) { + var program = resolver.getProgram(); + var compilerHost = program.getCompilerHost(); + var compilerOptions = program.getCompilerOptions(); + var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var diagnostics = []; + var newLine = program.getCompilerHost().getNewLine(); + function emitJavaScript(jsFilePath, root) { + var writer = createTextWriter(newLine); + var write = writer.write; + var writeTextOfNode = writer.writeTextOfNode; + var writeLine = writer.writeLine; + var increaseIndent = writer.increaseIndent; + var decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var extendsEmitted = false; + var writeEmittedFiles = writeJavaScriptFile; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { + } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { + } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { + } : emitLeadingCommentsOfLocalPosition; + var detachedCommentsInfo; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { + } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { + } : emitPinnedOrTripleSlashCommentsOfNode; + var writeComment = writeCommentRange; + var emit = emitNode; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; + var sourceMapData; + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1; + } + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine == lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = currentSourceFile.getLineAndCharacterFromPosition(pos); + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + var sourcesDirectoryPath = compilerOptions.sourceRoot ? program.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.filename, compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + sourceMapData.inputSourceFileNames.push(node.filename); + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + recordScopeNameStart(scopeName); + } + else if (node.kind === 184 /* FunctionDeclaration */ || node.kind === 150 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 189 /* ModuleDeclaration */ || node.kind === 185 /* ClassDeclaration */ || node.kind === 188 /* EnumDeclaration */) { + if (node.name) { + scopeName = node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + writeFile(compilerHost, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + sourceMapDataList.push(sourceMapData); + writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFilename(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + sourceMapDir = ts.getDirectoryPath(getSourceFilePathInNewDir(root, program, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(program.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithMap(node) { + if (node) { + if (node.kind != 201 /* SourceFile */) { + recordEmitNodeStartSpan(node); + emitNode(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNode(node); + } + } + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithMap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + writeFile(compilerHost, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitTrailingCommaIfPresent(nodeList, isMultiline) { + if (nodeList.hasTrailingComma) { + write(","); + if (isMultiline) { + writeLine(); + } + } + } + function emitCommaList(nodes, includeTrailingComma, count) { + if (!(count >= 0)) { + count = nodes.length; + } + if (nodes) { + for (var i = 0; i < count; i++) { + if (i) { + write(", "); + } + emit(nodes[i]); + } + if (includeTrailingComma) { + emitTrailingCommaIfPresent(nodes, false); + } + } + } + function emitMultiLineList(nodes, includeTrailingComma) { + if (nodes) { + for (var i = 0; i < nodes.length; i++) { + if (i) { + write(","); + } + writeLine(); + emit(nodes[i]); + } + if (includeTrailingComma) { + emitTrailingCommaIfPresent(nodes, true); + } + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(text) { + if (text.length <= 0) { + return false; + } + if (text.charCodeAt(1) === 66 /* B */ || text.charCodeAt(1) === 98 /* b */ || text.charCodeAt(1) === 79 /* O */ || text.charCodeAt(1) === 111 /* o */) { + return true; + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(); + if (compilerOptions.sourceMap && (node.kind === 7 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (compilerOptions.target < 2 /* ES6 */ && node.kind === 6 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { + write(node.text); + } + else { + write(text); + } + function getLiteralText() { + if (compilerOptions.target < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind)) { + return getTemplateLiteralAsStringLiteral(node); + } + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } + } + function getTemplateLiteralAsStringLiteral(node) { + return '"' + ts.escapeString(node.text) + '"'; + } + function emitTemplateExpression(node) { + if (compilerOptions.target >= 2 /* ES6 */) { + ts.forEachChild(node, emit); + return; + } + ts.Debug.assert(node.parent.kind !== 147 /* TaggedTemplateExpression */); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + emitLiteral(node.head); + ts.forEach(node.templateSpans, function (templateSpan) { + var needsParens = templateSpan.expression.kind !== 149 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + write(" + "); + if (needsParens) { + write("("); + } + emit(templateSpan.expression); + if (needsParens) { + write(")"); + } + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + }); + if (emitOuterParens) { + write(")"); + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return parent.expression === template; + case 149 /* ParenthesizedExpression */: + return false; + case 147 /* TaggedTemplateExpression */: + ts.Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6."); + default: + return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; + } + } + function comparePrecedenceToBinaryPlus(expression) { + ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); + switch (expression.kind) { + case 157 /* BinaryExpression */: + switch (expression.operator) { + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + return 1 /* GreaterThan */; + case 32 /* PlusToken */: + return 0 /* EqualTo */; + default: + return -1 /* LessThan */; + } + case 158 /* ConditionalExpression */: + return -1 /* LessThan */; + default: + return 1 /* GreaterThan */; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function emitExpressionForPropertyName(node) { + if (node.kind === 7 /* StringLiteral */) { + emitLiteral(node); + } + else if (node.kind === 121 /* ComputedPropertyName */) { + emit(node.expression); + } + else { + write("\""); + if (node.kind === 6 /* NumericLiteral */) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isNotExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + case 200 /* EnumMember */: + case 125 /* Method */: + case 184 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 150 /* FunctionExpression */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + return parent.name === node; + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + case 192 /* ExportAssignment */: + return false; + case 177 /* LabeledStatement */: + return node.parent.label === node; + case 197 /* CatchClause */: + return node.parent.name === node; + } + } + function emitExpressionIdentifier(node) { + var prefix = resolver.getExpressionNamePrefix(node); + if (prefix) { + write(prefix); + write("."); + } + writeTextOfNode(currentSourceFile, node); + } + function emitIdentifier(node) { + if (!isNotExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 16 /* SuperInstance */) { + write("_super.prototype"); + } + else if (flags & 32 /* SuperStatic */) { + write("_super"); + } + else { + write("super"); + } + } + function emitArrayLiteral(node) { + if (node.flags & 256 /* MultiLine */) { + write("["); + increaseIndent(); + emitMultiLineList(node.elements, true); + decreaseIndent(); + writeLine(); + write("]"); + } + else { + write("["); + emitCommaList(node.elements, true); + write("]"); + } + } + function emitObjectLiteral(node) { + if (!node.properties.length) { + write("{}"); + } + else if (node.flags & 256 /* MultiLine */) { + write("{"); + increaseIndent(); + emitMultiLineList(node.properties, compilerOptions.target >= 1 /* ES5 */); + decreaseIndent(); + writeLine(); + write("}"); + } + else { + write("{ "); + emitCommaList(node.properties, compilerOptions.target >= 1 /* ES5 */); + write(" }"); + } + } + function emitComputedPropertyName(node) { + write("["); + emit(node.expression); + write("]"); + } + function emitDownlevelMethod(node) { + if (!ts.isObjectLiteralMethod(node)) { + return; + } + emitLeadingComments(node); + emit(node.name); + write(": "); + write("function "); + emitSignatureAndBody(node); + emitTrailingComments(node); + } + function emitMethod(node) { + if (!ts.isObjectLiteralMethod(node)) { + return; + } + emitLeadingComments(node); + emit(node.name); + emitSignatureAndBody(node); + emitTrailingComments(node); + } + function emitPropertyAssignment(node) { + emitLeadingComments(node); + emit(node.name); + write(": "); + emit(node.initializer); + emitTrailingComments(node); + } + function emitDownlevelShorthandPropertyAssignment(node) { + emitLeadingComments(node); + emit(node.name); + write(": "); + emitExpressionIdentifier(node.name); + emitTrailingComments(node); + } + function emitShorthandPropertyAssignment(node) { + var prefix = resolver.getExpressionNamePrefix(node.name); + if (prefix) { + emitDownlevelShorthandPropertyAssignment(node); + } + else { + emitLeadingComments(node); + emit(node.name); + emitTrailingComments(node); + } + } + function tryEmitConstantValue(node) { + var constantValue = resolver.getConstantValue(node); + if (constantValue !== undefined) { + var propertyName = node.kind === 143 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(constantValue.toString() + " /* " + propertyName + " */"); + return true; + } + return false; + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("."); + emit(node.name); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function emitCallExpression(node) { + var superCall = false; + if (node.expression.kind === 89 /* SuperKeyword */) { + write("_super"); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 143 /* PropertyAccessExpression */ && node.expression.expression.kind === 89 /* SuperKeyword */; + } + if (superCall) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments, false); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments, false); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments, false); + write(")"); + } + } + function emitTaggedTemplateExpression(node) { + ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); + emit(node.tag); + write(" "); + emit(node.template); + } + function emitParenExpression(node) { + if (node.expression.kind === 148 /* TypeAssertionExpression */) { + var operand = node.expression.expression; + while (operand.kind == 148 /* TypeAssertionExpression */) { + operand = operand.expression; + } + if (operand.kind !== 155 /* PrefixUnaryExpression */ && operand.kind !== 154 /* VoidExpression */ && operand.kind !== 153 /* TypeOfExpression */ && operand.kind !== 152 /* DeleteExpression */ && operand.kind !== 156 /* PostfixUnaryExpression */ && operand.kind !== 146 /* NewExpression */ && !(operand.kind === 145 /* CallExpression */ && node.parent.kind === 146 /* NewExpression */) && !(operand.kind === 150 /* FunctionExpression */ && node.parent.kind === 145 /* CallExpression */)) { + emit(operand); + return; + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(72 /* DeleteKeyword */)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(97 /* VoidKeyword */)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(95 /* TypeOfKeyword */)); + write(" "); + emit(node.expression); + } + function emitPrefixUnaryExpression(node) { + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 155 /* PrefixUnaryExpression */) { + var operand = node.operand; + if (node.operator === 32 /* PlusToken */ && (operand.operator === 32 /* PlusToken */ || operand.operator === 37 /* PlusPlusToken */)) { + write(" "); + } + else if (node.operator === 33 /* MinusToken */ && (operand.operator === 33 /* MinusToken */ || operand.operator === 38 /* MinusMinusToken */)) { + write(" "); + } + } + emit(node.operand); + } + function emitPostfixUnaryExpression(node) { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + function emitBinaryExpression(node) { + emit(node.left); + if (node.operator !== 22 /* CommaToken */) + write(" "); + write(ts.tokenToString(node.operator)); + write(" "); + emit(node.right); + } + function emitConditionalExpression(node) { + emit(node.condition); + write(" ? "); + emit(node.whenTrue); + write(" : "); + emit(node.whenFalse); + } + function emitBlock(node) { + emitToken(13 /* OpenBraceToken */, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 190 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 189 /* ModuleDeclaration */); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 163 /* Block */) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + var isArrowExpression = node.expression.kind === 151 /* ArrowFunction */; + emitLeadingComments(node); + if (isArrowExpression) + write("("); + emit(node.expression); + if (isArrowExpression) + write(")"); + write(";"); + emitTrailingComments(node); + } + function emitIfStatement(node) { + emitLeadingComments(node); + var endPos = emitToken(82 /* IfKeyword */, node.pos); + write(" "); + endPos = emitToken(15 /* OpenParenToken */, endPos); + emit(node.expression); + emitToken(16 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(74 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 167 /* IfStatement */) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + emitTrailingComments(node); + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 163 /* Block */) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForStatement(node) { + var endPos = emitToken(80 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(15 /* OpenParenToken */, endPos); + if (node.declarations) { + if (node.declarations[0] && ts.isLet(node.declarations[0])) { + emitToken(102 /* LetKeyword */, endPos); + } + else if (node.declarations[0] && ts.isConst(node.declarations[0])) { + emitToken(68 /* ConstKeyword */, endPos); + } + else { + emitToken(96 /* VarKeyword */, endPos); + } + write(" "); + emitCommaList(node.declarations, false); + } + if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.iterator); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInStatement(node) { + var endPos = emitToken(80 /* ForKeyword */, node.pos); + write(" "); + endPos = emitToken(15 /* OpenParenToken */, endPos); + if (node.declarations) { + if (node.declarations.length >= 1) { + var decl = node.declarations[0]; + if (ts.isLet(decl)) { + emitToken(102 /* LetKeyword */, endPos); + } + else { + emitToken(96 /* VarKeyword */, endPos); + } + write(" "); + emit(decl); + } + } + else { + emit(node.variable); + } + write(" in "); + emit(node.expression); + emitToken(16 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 173 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitLeadingComments(node); + emitToken(88 /* ReturnKeyword */, node.pos); + emitOptional(" ", node.expression); + write(";"); + emitTrailingComments(node); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(90 /* SwitchKeyword */, node.pos); + write(" "); + emitToken(15 /* OpenParenToken */, endPos); + emit(node.expression); + endPos = emitToken(16 /* CloseParenToken */, node.expression.end); + write(" "); + emitToken(13 /* OpenBraceToken */, endPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.clauses.end); + } + function isOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 194 /* CaseClause */) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(66 /* CatchKeyword */, node.pos); + write(" "); + emitToken(15 /* OpenParenToken */, endPos); + emit(node.name); + emitToken(16 /* CloseParenToken */, node.name.end); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(70 /* DebuggerKeyword */, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 189 /* ModuleDeclaration */); + return node; + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (node.flags & 1 /* Export */) { + var container = getContainingModule(node); + write(container ? resolver.getLocalNameOfContainer(container) : "exports"); + write("."); + } + emitNode(node.name); + emitEnd(node.name); + } + function emitVariableDeclaration(node) { + emitLeadingComments(node); + emitModuleMemberName(node); + emitOptional(" = ", node.initializer); + emitTrailingComments(node); + } + function emitVariableStatement(node) { + emitLeadingComments(node); + if (!(node.flags & 1 /* Export */)) { + if (ts.isLet(node)) { + write("let "); + } + else if (ts.isConst(node)) { + write("const "); + } + else { + write("var "); + } + } + emitCommaList(node.declarations, false); + write(";"); + emitTrailingComments(node); + } + function emitParameter(node) { + emitLeadingComments(node); + emit(node.name); + emitTrailingComments(node); + } + function emitDefaultValueAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.initializer) { + writeLine(); + emitStart(param); + write("if ("); + emitNode(param.name); + write(" === void 0)"); + emitEnd(param); + write(" { "); + emitStart(param); + emitNode(param.name); + write(" = "); + emitNode(param.initializer); + emitEnd(param); + write("; }"); + } + }); + } + function emitRestParameter(node) { + if (ts.hasRestParameters(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNode(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var _i = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write("_i < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write("_i++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNode(restParam.name); + write("[_i - " + restIndex + "] = arguments[_i];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + emitLeadingComments(node); + write(node.kind === 127 /* GetAccessor */ ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + emitTrailingComments(node); + } + function emitFunctionDeclaration(node) { + if (!node.body) { + return emitPinnedOrTripleSlashComments(node); + } + if (node.kind !== 125 /* Method */) { + emitLeadingComments(node); + } + write("function "); + if (node.kind === 184 /* FunctionDeclaration */ || (node.kind === 150 /* FunctionExpression */ && node.name)) { + emit(node.name); + } + emitSignatureAndBody(node); + if (node.kind !== 125 /* Method */) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + emitCommaList(node.parameters, false, node.parameters.length - (ts.hasRestParameters(node) ? 1 : 0)); + } + write(")"); + decreaseIndent(); + } + function emitSignatureAndBody(node) { + emitSignatureParameters(node); + write(" {"); + scopeEmitStart(node); + increaseIndent(); + emitDetachedComments(node.body.kind === 163 /* Block */ ? node.body.statements : node.body); + var startIndex = 0; + if (node.body.kind === 163 /* Block */) { + startIndex = emitDirectivePrologues(node.body.statements, true); + } + var outPos = writer.getTextPos(); + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + if (node.body.kind !== 163 /* Block */ && outPos === writer.getTextPos()) { + decreaseIndent(); + write(" "); + emitStart(node.body); + write("return "); + emitNode(node.body); + emitEnd(node.body); + write("; "); + emitStart(node.body); + write("}"); + emitEnd(node.body); + } + else { + if (node.body.kind === 163 /* Block */) { + emitLinesStartingAt(node.body.statements, startIndex); + } + else { + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body); + write(";"); + emitTrailingComments(node.body); + } + writeLine(); + if (node.body.kind === 163 /* Block */) { + emitLeadingCommentsOfPosition(node.body.statements.end); + decreaseIndent(); + emitToken(14 /* CloseBraceToken */, node.body.statements.end); + } + else { + decreaseIndent(); + emitStart(node.body); + write("}"); + emitEnd(node.body); + } + } + scopeEmitEnd(); + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 166 /* ExpressionStatement */) { + var expr = statement.expression; + if (expr && expr.kind === 145 /* CallExpression */) { + var func = expr.expression; + if (func && func.kind === 89 /* SuperKeyword */) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112 /* AccessibilityModifier */) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNode(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 7 /* StringLiteral */ || memberName.kind === 6 /* NumericLiteral */) { + write("["); + emitNode(memberName); + write("]"); + } + else if (memberName.kind === 121 /* ComputedPropertyName */) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNode(memberName); + } + } + function emitMemberAssignments(node, staticFlag) { + ts.forEach(node.members, function (member) { + if (member.kind === 124 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + if (staticFlag) { + emitNode(node.name); + } + else { + write("this"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emit(member.initializer); + write(";"); + emitEnd(member); + emitTrailingComments(member); + } + }); + } + function emitMemberFunctions(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 125 /* Method */) { + if (!member.body) { + return emitPinnedOrTripleSlashComments(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128 /* Static */)) { + write(".prototype"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitStart(member); + emitFunctionDeclaration(member); + emitEnd(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) { + var accessors = getAllAccessorDeclarations(node, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128 /* Static */)) { + write(".prototype"); + } + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitClassDeclaration(node) { + emitLeadingComments(node); + write("var "); + emit(node.name); + write(" = (function ("); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emit(node.name); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructorOfClass(); + emitMemberFunctions(node); + emitMemberAssignments(node, 128 /* Static */); + writeLine(); + function emitClassReturnStatement() { + write("return "); + emitNode(node.name); + } + emitToken(14 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + write(";"); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.typeName); + } + write(");"); + emitEnd(node); + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + emitTrailingComments(node); + function emitConstructorOfClass() { + ts.forEach(node.members, function (member) { + if (member.kind === 126 /* Constructor */ && !member.body) { + emitPinnedOrTripleSlashComments(member); + } + }); + var ctor = getFirstConstructorWithBody(node); + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + write("function "); + emit(node.name); + emitSignatureParameters(ctor); + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeNode) { + var superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("_super.apply(this, arguments);"); + emitEnd(baseTypeNode); + } + } + emitMemberAssignments(node, 0); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) + statements = statements.slice(1); + emitLines(statements); + } + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(14 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + } + function emitInterfaceDeclaration(node) { + emitPinnedOrTripleSlashComments(node); + } + function emitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + if (isConstEnum && !compilerOptions.preserveConstEnums) { + return; + } + emitLeadingComments(node); + if (!(node.flags & 1 /* Export */)) { + emitStart(node); + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitEnumMemberDeclarations(isConstEnum); + decreaseIndent(); + writeLine(); + emitToken(14 /* CloseBraceToken */, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (node.flags & 1 /* Export */) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + 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 getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 189 /* ModuleDeclaration */) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function emitModuleDeclaration(node) { + var shouldEmit = ts.getModuleInstanceState(node) === 1 /* Instantiated */ || (ts.getModuleInstanceState(node) === 2 /* ConstEnumOnly */ && compilerOptions.preserveConstEnums); + if (!shouldEmit) { + return emitPinnedOrTripleSlashComments(node); + } + emitLeadingComments(node); + emitStart(node); + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 190 /* ModuleBlock */) { + emit(node.body); + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(14 /* CloseBraceToken */, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if (node.flags & 1 /* Export */) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + emitTrailingComments(node); + } + function emitImportDeclaration(node) { + var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); + if (!emitImportDeclaration) { + emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); + } + if (emitImportDeclaration) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 201 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.flags & 1 /* Export */) { + writeLine(); + emitLeadingComments(node); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + else { + writeLine(); + emitLeadingComments(node); + emitStart(node); + if (!(node.flags & 1 /* Export */)) + write("var "); + emitModuleMemberName(node); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emit(node.moduleReference); + } + else { + var literal = ts.getExternalModuleImportDeclarationExpression(node); + write("require("); + emitStart(literal); + emitLiteral(literal); + emitEnd(literal); + emitToken(16 /* CloseParenToken */, literal.end); + } + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + } + function getExternalImportDeclarations(node) { + var result = []; + ts.forEach(node.statements, function (statement) { + if (ts.isExternalModuleImportDeclaration(statement) && resolver.isReferencedImportDeclaration(statement)) { + result.push(statement); + } + }); + return result; + } + function getFirstExportAssignment(sourceFile) { + return ts.forEach(sourceFile.statements, function (node) { + if (node.kind === 192 /* ExportAssignment */) { + return node; + } + }); + } + function emitAMDModule(node, startIndex) { + var imports = getExternalImportDeclarations(node); + writeLine(); + write("define("); + if (node.amdModuleName) { + write("\"" + node.amdModuleName + "\", "); + } + write("[\"require\", \"exports\""); + ts.forEach(imports, function (imp) { + write(", "); + emitLiteral(ts.getExternalModuleImportDeclarationExpression(imp)); + }); + ts.forEach(node.amdDependencies, function (amdDependency) { + var text = "\"" + amdDependency + "\""; + write(", "); + write(text); + }); + write("], function (require, exports"); + ts.forEach(imports, function (imp) { + write(", "); + emit(imp.name); + }); + write(") {"); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignement = getFirstExportAssignment(node); + emitStart(exportAssignement); + write("return "); + emitStart(exportAssignement.exportName); + write(exportName); + emitEnd(exportAssignement.exportName); + write(";"); + emitEnd(exportAssignement); + } + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node, startIndex) { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignement = getFirstExportAssignment(node); + emitStart(exportAssignement); + write("module.exports = "); + emitStart(exportAssignement.exportName); + write(exportName); + emitEnd(exportAssignement.exportName); + write(";"); + emitEnd(exportAssignement); + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + return i; + } + } + return statements.length; + } + function emitSourceFile(node) { + currentSourceFile = node; + writeLine(); + emitDetachedComments(node); + var startIndex = emitDirectivePrologues(node.statements, false); + if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */) { + writeLine(); + write("var __extends = this.__extends || function (d, b) {"); + increaseIndent(); + writeLine(); + write("for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];"); + writeLine(); + write("function __() { this.constructor = d; }"); + writeLine(); + write("__.prototype = b.prototype;"); + writeLine(); + write("d.prototype = new __();"); + decreaseIndent(); + writeLine(); + write("};"); + extendsEmitted = true; + } + if (ts.isExternalModule(node)) { + if (compilerOptions.module === 2 /* AMD */) { + emitAMDModule(node, startIndex); + } + else { + emitCommonJSModule(node, startIndex); + } + } + else { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNode(node) { + if (!node) { + return; + } + if (node.flags & 2 /* Ambient */) { + return emitPinnedOrTripleSlashComments(node); + } + switch (node.kind) { + case 63 /* Identifier */: + return emitIdentifier(node); + case 123 /* Parameter */: + return emitParameter(node); + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return emitAccessor(node); + case 91 /* ThisKeyword */: + return emitThis(node); + case 89 /* SuperKeyword */: + return emitSuper(node); + case 87 /* NullKeyword */: + return write("null"); + case 93 /* TrueKeyword */: + return write("true"); + case 78 /* FalseKeyword */: + return write("false"); + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 8 /* RegularExpressionLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 11 /* TemplateMiddle */: + case 12 /* TemplateTail */: + return emitLiteral(node); + case 159 /* TemplateExpression */: + return emitTemplateExpression(node); + case 162 /* TemplateSpan */: + return emitTemplateSpan(node); + case 120 /* QualifiedName */: + return emitQualifiedName(node); + case 141 /* ArrayLiteralExpression */: + return emitArrayLiteral(node); + case 142 /* ObjectLiteralExpression */: + return emitObjectLiteral(node); + case 198 /* PropertyAssignment */: + return emitPropertyAssignment(node); + case 121 /* ComputedPropertyName */: + return emitComputedPropertyName(node); + case 143 /* PropertyAccessExpression */: + return emitPropertyAccess(node); + case 144 /* ElementAccessExpression */: + return emitIndexedAccess(node); + case 145 /* CallExpression */: + return emitCallExpression(node); + case 146 /* NewExpression */: + return emitNewExpression(node); + case 147 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 148 /* TypeAssertionExpression */: + return emit(node.expression); + case 149 /* ParenthesizedExpression */: + return emitParenExpression(node); + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return emitFunctionDeclaration(node); + case 152 /* DeleteExpression */: + return emitDeleteExpression(node); + case 153 /* TypeOfExpression */: + return emitTypeOfExpression(node); + case 154 /* VoidExpression */: + return emitVoidExpression(node); + case 155 /* PrefixUnaryExpression */: + return emitPrefixUnaryExpression(node); + case 156 /* PostfixUnaryExpression */: + return emitPostfixUnaryExpression(node); + case 157 /* BinaryExpression */: + return emitBinaryExpression(node); + case 158 /* ConditionalExpression */: + return emitConditionalExpression(node); + case 161 /* OmittedExpression */: + return; + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return emitBlock(node); + case 164 /* VariableStatement */: + return emitVariableStatement(node); + case 165 /* EmptyStatement */: + return write(";"); + case 166 /* ExpressionStatement */: + return emitExpressionStatement(node); + case 167 /* IfStatement */: + return emitIfStatement(node); + case 168 /* DoStatement */: + return emitDoStatement(node); + case 169 /* WhileStatement */: + return emitWhileStatement(node); + case 170 /* ForStatement */: + return emitForStatement(node); + case 171 /* ForInStatement */: + return emitForInStatement(node); + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + return emitBreakOrContinueStatement(node); + case 174 /* ReturnStatement */: + return emitReturnStatement(node); + case 175 /* WithStatement */: + return emitWithStatement(node); + case 176 /* SwitchStatement */: + return emitSwitchStatement(node); + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + return emitCaseOrDefaultClause(node); + case 177 /* LabeledStatement */: + return emitLabelledStatement(node); + case 178 /* ThrowStatement */: + return emitThrowStatement(node); + case 179 /* TryStatement */: + return emitTryStatement(node); + case 197 /* CatchClause */: + return emitCatchClause(node); + case 182 /* DebuggerStatement */: + return emitDebuggerStatement(node); + case 183 /* VariableDeclaration */: + return emitVariableDeclaration(node); + case 185 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 186 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 188 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 189 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 191 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 201 /* SourceFile */: + return emitSourceFile(node); + } + if (compilerOptions.target < 2 /* ES6 */) { + switch (node.kind) { + case 199 /* ShorthandPropertyAssignment */: + return emitDownlevelShorthandPropertyAssignment(node); + case 125 /* Method */: + return emitDownlevelMethod(node); + } + } + else { + ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Invalid ScriptTarget. We should emit as ES6 or above"); + switch (node.kind) { + case 199 /* ShorthandPropertyAssignment */: + return emitShorthandPropertyAssignment(node); + case 125 /* Method */: + return emitMethod(node); + } + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function getLeadingCommentsToEmit(node) { + if (node.parent.kind === 201 /* SourceFile */ || node.pos !== node.parent.pos) { + var leadingComments; + if (hasDetachedComments(node.pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; + } + } + function emitLeadingDeclarationComments(node) { + var leadingComments = getLeadingCommentsToEmit(node); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingDeclarationComments(node) { + if (node.parent.kind === 201 /* SourceFile */ || node.end !== node.parent.end) { + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + } + function emitLeadingCommentsOfLocalPosition(pos) { + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedCommentsAtPosition(node) { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var astLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (astLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitPinnedOrTripleSlashCommentsOfNode(node) { + var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); + function isPinnedOrTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */ && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + return true; + } + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, pinnedComments); + emitComments(currentSourceFile, writer, pinnedComments, true, newLine, writeComment); + } + if (compilerOptions.sourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + emit(root); + } + else { + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emit(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + } + function writeDeclarationFile(jsFilePath, sourceFile) { + var emitDeclarationResult = emitDeclarations(program, resolver, diagnostics, jsFilePath, sourceFile); + if (!emitDeclarationResult.reportedDeclarationError) { + var declarationOutput = emitDeclarationResult.referencePathsOutput; + var appliedSyncOutputPos = 0; + ts.forEach(emitDeclarationResult.aliasDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.asynchronousOutput) { + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += aliasEmitInfo.asynchronousOutput; + appliedSyncOutputPos = aliasEmitInfo.outputPos; + } + }); + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos); + writeFile(compilerHost, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); + } + } + var hasSemanticErrors = false; + var isEmitBlocked = false; + if (targetSourceFile === undefined) { + hasSemanticErrors = resolver.hasSemanticErrors(); + isEmitBlocked = resolver.isEmitBlocked(); + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, program, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + else { + if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + hasSemanticErrors = resolver.hasSemanticErrors(targetSourceFile); + isEmitBlocked = resolver.isEmitBlocked(targetSourceFile); + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, program, ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!shouldEmitToOwnFile(sourceFile, compilerOptions)) { + hasSemanticErrors = hasSemanticErrors || resolver.hasSemanticErrors(sourceFile); + isEmitBlocked = isEmitBlocked || resolver.isEmitBlocked(sourceFile); + } + }); + emitFile(compilerOptions.out); + } + } + function emitFile(jsFilePath, sourceFile) { + if (!isEmitBlocked) { + emitJavaScript(jsFilePath, sourceFile); + if (!hasSemanticErrors && compilerOptions.declaration) { + writeDeclarationFile(jsFilePath, sourceFile); + } + } + } + diagnostics.sort(ts.compareDiagnostics); + diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); + var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); + var emitResultStatus; + if (isEmitBlocked) { + emitResultStatus = 1 /* AllOutputGenerationSkipped */; + } + else if (hasEmitterError) { + emitResultStatus = 4 /* EmitErrorsEncountered */; + } + else if (hasSemanticErrors && compilerOptions.declaration) { + emitResultStatus = 3 /* DeclarationGenerationSkipped */; + } + else if (hasSemanticErrors && !compilerOptions.declaration) { + emitResultStatus = 2 /* JSGeneratedWithSemanticErrors */; + } + else { + emitResultStatus = 0 /* Succeeded */; + } + return { + emitResultStatus: emitResultStatus, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + } + ts.emitFiles = emitFiles; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nextSymbolId = 1; + var nextNodeId = 1; + var nextMergeId = 1; + function createTypeChecker(program, fullTypeCheck) { + var Symbol = ts.objectAllocator.getSymbolConstructor(); + var Type = ts.objectAllocator.getTypeConstructor(); + var Signature = ts.objectAllocator.getSignatureConstructor(); + var typeCount = 0; + var emptyArray = []; + var emptySymbols = {}; + var compilerOptions = program.getCompilerOptions(); + var checker = { + getProgram: function () { return program; }, + getNodeCount: function () { return ts.sum(program.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(program.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(program.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + emitFiles: invokeEmitter, + getDiagnostics: getDiagnostics, + getDeclarationDiagnostics: getDeclarationDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, + getPropertiesOfType: getPropertiesOfType, + getPropertyOfType: getPropertyOfType, + getSignaturesOfType: getSignaturesOfType, + getIndexTypeOfType: getIndexTypeOfType, + getReturnTypeOfSignature: getReturnTypeOfSignature, + getSymbolsInScope: getSymbolsInScope, + getSymbolAtLocation: getSymbolAtLocation, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getTypeAtLocation: getTypeAtLocation, + typeToString: typeToString, + getSymbolDisplayBuilder: getSymbolDisplayBuilder, + symbolToString: symbolToString, + getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, + getRootSymbols: getRootSymbols, + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName, + getResolvedSignature: getResolvedSignature, + getEnumMemberValue: getEnumMemberValue, + isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + isImplementationOfOverload: isImplementationOfOverload, + getAliasedSymbol: resolveImport, + hasEarlyErrors: hasEarlyErrors, + isEmitBlocked: isEmitBlocked + }; + var undefinedSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "undefined"); + var argumentsSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "arguments"); + var unknownSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "unknown"); + var resolvingSymbol = createSymbol(268435456 /* Transient */, "__resolving__"); + var anyType = createIntrinsicType(1 /* Any */, "any"); + var stringType = createIntrinsicType(2 /* String */, "string"); + var numberType = createIntrinsicType(4 /* Number */, "number"); + var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); + var voidType = createIntrinsicType(16 /* Void */, "void"); + var undefinedType = createIntrinsicType(32 /* Undefined */, "undefined"); + var nullType = createIntrinsicType(64 /* Null */, "null"); + var unknownType = createIntrinsicType(1 /* Any */, "unknown"); + var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); + var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); + var globals = {}; + var globalArraySymbol; + var globalObjectType; + var globalFunctionType; + var globalArrayType; + var globalStringType; + var globalNumberType; + var globalBooleanType; + var globalRegExpType; + var globalTemplateStringsArrayType; + var tupleTypes = {}; + var unionTypes = {}; + var stringLiteralTypes = {}; + var emitExtends = false; + var mergedSymbols = []; + var symbolLinks = []; + var nodeLinks = []; + var potentialThisCollisions = []; + var diagnostics = []; + var diagnosticsModified = false; + function addDiagnostic(diagnostic) { + diagnostics.push(diagnostic); + diagnosticsModified = true; + } + function error(location, message, arg0, arg1, arg2) { + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + addDiagnostic(diagnostic); + } + function createSymbol(flags, name) { + return new Symbol(flags, name); + } + function getExcludedSymbolFlags(flags) { + var result = 0; + if (flags & 2 /* BlockScopedVariable */) + result |= 107455 /* BlockScopedVariableExcludes */; + if (flags & 1 /* FunctionScopedVariable */) + result |= 107454 /* FunctionScopedVariableExcludes */; + if (flags & 4 /* Property */) + result |= 107455 /* PropertyExcludes */; + if (flags & 8 /* EnumMember */) + result |= 107455 /* EnumMemberExcludes */; + if (flags & 16 /* Function */) + result |= 106927 /* FunctionExcludes */; + if (flags & 32 /* Class */) + result |= 3258879 /* ClassExcludes */; + if (flags & 64 /* Interface */) + result |= 3152288 /* InterfaceExcludes */; + if (flags & 256 /* RegularEnum */) + result |= 3258623 /* RegularEnumExcludes */; + if (flags & 128 /* ConstEnum */) + result |= 3259263 /* ConstEnumExcludes */; + if (flags & 512 /* ValueModule */) + result |= 106639 /* ValueModuleExcludes */; + if (flags & 8192 /* Method */) + result |= 99263 /* MethodExcludes */; + if (flags & 32768 /* GetAccessor */) + result |= 41919 /* GetAccessorExcludes */; + if (flags & 65536 /* SetAccessor */) + result |= 74687 /* SetAccessorExcludes */; + if (flags & 1048576 /* TypeParameter */) + result |= 2103776 /* TypeParameterExcludes */; + if (flags & 2097152 /* TypeAlias */) + result |= 3152352 /* TypeAliasExcludes */; + if (flags & 33554432 /* Import */) + result |= 33554432 /* ImportExcludes */; + return result; + } + function recordMergedSymbol(target, source) { + if (!source.mergeId) + source.mergeId = nextMergeId++; + mergedSymbols[source.mergeId] = target; + } + function cloneSymbol(symbol) { + var result = createSymbol(symbol.flags | 134217728 /* Merged */, symbol.name); + result.declarations = symbol.declarations.slice(0); + result.parent = symbol.parent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = cloneSymbolTable(symbol.members); + if (symbol.exports) + result.exports = cloneSymbolTable(symbol.exports); + recordMergedSymbol(result, symbol); + return result; + } + function extendSymbol(target, source) { + if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } + target.flags |= source.flags; + if (!target.valueDeclaration && source.valueDeclaration) + target.valueDeclaration = source.valueDeclaration; + ts.forEach(source.declarations, function (node) { + target.declarations.push(node); + }); + if (source.members) { + if (!target.members) + target.members = {}; + extendSymbolTable(target.members, source.members); + } + if (source.exports) { + if (!target.exports) + target.exports = {}; + extendSymbolTable(target.exports, source.exports); + } + recordMergedSymbol(target, source); + } + else { + var message = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(source.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + ts.forEach(target.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + } + } + function cloneSymbolTable(symbolTable) { + var result = {}; + for (var id in symbolTable) { + if (ts.hasProperty(symbolTable, id)) { + result[id] = symbolTable[id]; + } + } + return result; + } + function extendSymbolTable(target, source) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (!ts.hasProperty(target, id)) { + target[id] = source[id]; + } + else { + var symbol = target[id]; + if (!(symbol.flags & 134217728 /* Merged */)) { + target[id] = symbol = cloneSymbol(symbol); + } + extendSymbol(symbol, source[id]); + } + } + } + } + function getSymbolLinks(symbol) { + if (symbol.flags & 268435456 /* Transient */) + return symbol; + if (!symbol.id) + symbol.id = nextSymbolId++; + return symbolLinks[symbol.id] || (symbolLinks[symbol.id] = {}); + } + function getNodeLinks(node) { + if (!node.id) + node.id = nextNodeId++; + return nodeLinks[node.id] || (nodeLinks[node.id] = {}); + } + function getSourceFile(node) { + return ts.getAncestor(node, 201 /* SourceFile */); + } + function isGlobalSourceFile(node) { + return node.kind === 201 /* SourceFile */ && !ts.isExternalModule(node); + } + function getSymbol(symbols, name, meaning) { + if (meaning && ts.hasProperty(symbols, name)) { + var symbol = symbols[name]; + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + if (symbol.flags & meaning) { + return symbol; + } + if (symbol.flags & 33554432 /* Import */) { + var target = resolveImport(symbol); + if (target === unknownSymbol || target.flags & meaning) { + return symbol; + } + } + } + } + function isDefinedBefore(node1, node2) { + var file1 = ts.getSourceFileOfNode(node1); + var file2 = ts.getSourceFileOfNode(node2); + if (file1 === file2) { + return node1.pos <= node2.pos; + } + if (!compilerOptions.out) { + return true; + } + var sourceFiles = program.getSourceFiles(); + return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); + } + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { + var result; + var lastLocation; + var propertyWithInvalidInitializer; + var errorLocation = location; + loop: while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = getSymbol(location.locals, name, meaning)) { + break loop; + } + } + switch (location.kind) { + case 201 /* SourceFile */: + if (!ts.isExternalModule(location)) + break; + case 189 /* ModuleDeclaration */: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 35653619 /* ModuleMember */)) { + break loop; + } + break; + case 188 /* EnumDeclaration */: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { + break loop; + } + break; + case 124 /* Property */: + if (location.parent.kind === 185 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + var ctor = findConstructorDeclaration(location.parent); + if (ctor && ctor.locals) { + if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { + propertyWithInvalidInitializer = location; + } + } + } + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 3152352 /* Type */)) { + if (lastLocation && lastLocation.flags & 128 /* Static */) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + return undefined; + } + break loop; + } + break; + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + break; + case 150 /* FunctionExpression */: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + var id = location.name; + if (id && name === id.text) { + result = location.symbol; + break loop; + } + break; + case 197 /* CatchClause */: + var id = location.name; + if (name === id.text) { + result = location.symbol; + break loop; + } + break; + } + lastLocation = location; + location = location.parent; + } + if (!result) { + result = getSymbol(globals, name, meaning); + } + if (!result) { + if (nameNotFoundMessage) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } + return undefined; + } + if (nameNotFoundMessage) { + if (propertyWithInvalidInitializer) { + var propertyName = propertyWithInvalidInitializer.name; + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return undefined; + } + if (result.flags & 2 /* BlockScopedVariable */) { + var declaration = ts.forEach(result.declarations, function (d) { return d.flags & 6144 /* BlockScoped */ ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isDefinedBefore(declaration, errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + } + return result; + } + function resolveImport(symbol) { + ts.Debug.assert((symbol.flags & 33554432 /* Import */) !== 0, "Should only get Imports here."); + var links = getSymbolLinks(symbol); + if (!links.target) { + links.target = resolvingSymbol; + var node = ts.getDeclarationOfKind(symbol, 191 /* ImportDeclaration */); + var target = node.moduleReference.kind === 193 /* ExternalModuleReference */ ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + if (links.target === resolvingSymbol) { + links.target = target || unknownSymbol; + } + else { + error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); + } + } + else if (links.target === resolvingSymbol) { + links.target = unknownSymbol; + } + return links.target; + } + function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { + if (!importDeclaration) { + importDeclaration = ts.getAncestor(entityName, 191 /* ImportDeclaration */); + ts.Debug.assert(importDeclaration !== undefined); + } + if (entityName.kind === 63 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (entityName.kind === 63 /* Identifier */ || entityName.parent.kind === 120 /* QualifiedName */) { + return resolveEntityName(importDeclaration, entityName, 1536 /* Namespace */); + } + else { + ts.Debug.assert(entityName.parent.kind === 191 /* ImportDeclaration */); + return resolveEntityName(importDeclaration, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */); + } + } + function getFullyQualifiedName(symbol) { + return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); + } + function resolveEntityName(location, name, meaning) { + if (ts.getFullWidth(name) === 0) { + return undefined; + } + if (name.kind === 63 /* Identifier */) { + var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + if (!symbol) { + return; + } + } + else if (name.kind === 120 /* QualifiedName */) { + var namespace = resolveEntityName(location, name.left, 1536 /* Namespace */); + if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) + return; + var symbol = getSymbol(namespace.exports, name.right.text, meaning); + if (!symbol) { + error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(name.right)); + return; + } + } + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + return symbol.flags & meaning ? symbol : resolveImport(symbol); + } + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + function resolveExternalModuleName(location, moduleReferenceExpression) { + if (moduleReferenceExpression.kind !== 7 /* StringLiteral */) { + return; + } + var moduleReferenceLiteral = moduleReferenceExpression; + var searchPath = ts.getDirectoryPath(getSourceFile(location).filename); + var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); + if (!moduleName) + return; + var isRelative = isExternalModuleNameRelative(moduleName); + if (!isRelative) { + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); + if (symbol) { + return getResolvedExportSymbol(symbol); + } + } + while (true) { + var filename = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + var sourceFile = program.getSourceFile(filename + ".ts") || program.getSourceFile(filename + ".d.ts"); + if (sourceFile || isRelative) + break; + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) + break; + searchPath = parentPath; + } + if (sourceFile) { + if (sourceFile.symbol) { + return getResolvedExportSymbol(sourceFile.symbol); + } + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.filename); + return; + } + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + } + function getResolvedExportSymbol(moduleSymbol) { + var symbol = getExportAssignmentSymbol(moduleSymbol); + if (symbol) { + if (symbol.flags & (107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */)) { + return symbol; + } + if (symbol.flags & 33554432 /* Import */) { + return resolveImport(symbol); + } + } + return moduleSymbol; + } + function getExportAssignmentSymbol(symbol) { + checkTypeOfExportAssignmentSymbol(symbol); + var symbolLinks = getSymbolLinks(symbol); + return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol; + } + function checkTypeOfExportAssignmentSymbol(containerSymbol) { + var symbolLinks = getSymbolLinks(containerSymbol); + if (!symbolLinks.exportAssignSymbol) { + var exportInformation = collectExportInformationForSourceFileOrModule(containerSymbol); + if (exportInformation.exportAssignments.length) { + if (exportInformation.exportAssignments.length > 1) { + ts.forEach(exportInformation.exportAssignments, function (node) { return error(node, ts.Diagnostics.A_module_cannot_have_more_than_one_export_assignment); }); + } + var node = exportInformation.exportAssignments[0]; + if (exportInformation.hasExportedMember) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + if (node.exportName.text) { + var meaning = 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */; + var exportSymbol = resolveName(node, node.exportName.text, meaning, ts.Diagnostics.Cannot_find_name_0, node.exportName); + } + } + symbolLinks.exportAssignSymbol = exportSymbol || unknownSymbol; + } + } + function collectExportInformationForSourceFileOrModule(symbol) { + var seenExportedMember = false; + var result = []; + ts.forEach(symbol.declarations, function (declaration) { + var block = (declaration.kind === 201 /* SourceFile */ ? declaration : declaration.body); + ts.forEach(block.statements, function (node) { + if (node.kind === 192 /* ExportAssignment */) { + result.push(node); + } + else { + seenExportedMember = seenExportedMember || (node.flags & 1 /* Export */) !== 0; + } + }); + }); + return { + hasExportedMember: seenExportedMember, + exportAssignments: result + }; + } + function getMergedSymbol(symbol) { + var merged; + return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; + } + function getSymbolOfNode(node) { + return getMergedSymbol(node.symbol); + } + function getParentOfSymbol(symbol) { + return getMergedSymbol(symbol.parent); + } + function getExportSymbolOfValueSymbolIfExported(symbol) { + return symbol && (symbol.flags & 4194304 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + } + function symbolIsValue(symbol) { + if (symbol.flags & 67108864 /* Instantiated */) { + return symbolIsValue(getSymbolLinks(symbol).target); + } + if (symbol.flags & 107455 /* Value */) { + return true; + } + if (symbol.flags & 33554432 /* Import */) { + return (resolveImport(symbol).flags & 107455 /* Value */) !== 0; + } + return false; + } + function findConstructorDeclaration(node) { + var members = node.members; + for (var i = 0; i < members.length; i++) { + var member = members[i]; + if (member.kind === 126 /* Constructor */ && member.body) { + return member; + } + } + } + function createType(flags) { + var result = new Type(checker, flags); + result.id = typeCount++; + return result; + } + function createIntrinsicType(kind, intrinsicName) { + var type = createType(kind); + type.intrinsicName = intrinsicName; + return type; + } + function createObjectType(kind, symbol) { + var type = createType(kind); + type.symbol = symbol; + return type; + } + function isReservedMemberName(name) { + return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */; + } + function getNamedMembers(members) { + var result; + for (var id in members) { + if (ts.hasProperty(members, id)) { + if (!isReservedMemberName(id)) { + if (!result) + result = []; + var symbol = members[id]; + if (symbolIsValue(symbol)) { + result.push(symbol); + } + } + } + } + return result || emptyArray; + } + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + type.members = members; + type.properties = getNamedMembers(members); + type.callSignatures = callSignatures; + type.constructSignatures = constructSignatures; + if (stringIndexType) + type.stringIndexType = stringIndexType; + if (numberIndexType) + type.numberIndexType = numberIndexType; + return type; + } + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + return setObjectTypeMembers(createObjectType(32768 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function isOptionalProperty(propertySymbol) { + return propertySymbol.valueDeclaration && ts.hasQuestionToken(propertySymbol.valueDeclaration) && propertySymbol.valueDeclaration.kind !== 123 /* Parameter */; + } + function forEachSymbolTableInScope(enclosingDeclaration, callback) { + var result; + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { + return result; + } + } + switch (location.kind) { + case 201 /* SourceFile */: + if (!ts.isExternalModule(location)) { + break; + } + case 189 /* ModuleDeclaration */: + if (result = callback(getSymbolOfNode(location).exports)) { + return result; + } + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + if (result = callback(getSymbolOfNode(location).members)) { + return result; + } + break; + } + } + return callback(globals); + } + function getQualifiedLeftMeaning(rightMeaning) { + return rightMeaning === 107455 /* Value */ ? 107455 /* Value */ : 1536 /* Namespace */; + } + function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { + function getAccessibleSymbolChainFromSymbolTable(symbols) { + function canQualifySymbol(symbolFromSymbolTable, meaning) { + if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { + return true; + } + var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); + return !!accessibleParent; + } + function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { + if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { + return !ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return hasExternalModuleSymbol(declaration); }) && canQualifySymbol(symbolFromSymbolTable, meaning); + } + } + if (isAccessible(ts.lookUp(symbols, symbol.name))) { + return [symbol]; + } + return ts.forEachValue(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 33554432 /* Import */) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } + } + } + }); + } + if (symbol) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } + } + function needsQualification(symbol, enclosingDeclaration, meaning) { + var qualify = false; + forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { + if (!ts.hasProperty(symbolTable, symbol.name)) { + return false; + } + var symbolFromSymbolTable = symbolTable[symbol.name]; + if (symbolFromSymbolTable === symbol) { + return true; + } + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 33554432 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + if (symbolFromSymbolTable.flags & meaning) { + qualify = true; + return true; + } + return false; + }); + return qualify; + } + function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { + if (symbol && enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { + var initialSymbol = symbol; + var meaningToLook = meaning; + while (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + if (accessibleSymbolChain) { + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + if (!hasAccessibleDeclarations) { + return { + accessibility: 1 /* NotAccessible */, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536 /* Namespace */) : undefined + }; + } + return hasAccessibleDeclarations; + } + meaningToLook = getQualifiedLeftMeaning(meaning); + symbol = getParentOfSymbol(symbol); + } + var symbolExternalModule = ts.forEach(initialSymbol.declarations, function (declaration) { return getExternalModuleContainer(declaration); }); + if (symbolExternalModule) { + var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + if (symbolExternalModule !== enclosingExternalModule) { + return { + accessibility: 2 /* CannotBeNamed */, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbolToString(symbolExternalModule) + }; + } + } + return { + accessibility: 1 /* NotAccessible */, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) + }; + } + return { accessibility: 0 /* Accessible */ }; + function getExternalModuleContainer(declaration) { + for (; declaration; declaration = declaration.parent) { + if (hasExternalModuleSymbol(declaration)) { + return getSymbolOfNode(declaration); + } + } + } + } + function hasExternalModuleSymbol(declaration) { + return (declaration.kind === 189 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 201 /* SourceFile */ && ts.isExternalModule(declaration)); + } + function hasVisibleDeclarations(symbol) { + var aliasesToMakeVisible; + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + return undefined; + } + return { accessibility: 0 /* Accessible */, aliasesToMakeVisible: aliasesToMakeVisible }; + function getIsDeclarationVisible(declaration) { + if (!isDeclarationVisible(declaration)) { + if (declaration.kind === 191 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + getNodeLinks(declaration).isVisible = true; + if (aliasesToMakeVisible) { + if (!ts.contains(aliasesToMakeVisible, declaration)) { + aliasesToMakeVisible.push(declaration); + } + } + else { + aliasesToMakeVisible = [declaration]; + } + return true; + } + return false; + } + return true; + } + } + function isEntityNameVisible(entityName, enclosingDeclaration) { + var meaning; + if (entityName.parent.kind === 135 /* TypeQuery */) { + meaning = 107455 /* Value */ | 4194304 /* ExportValue */; + } + else if (entityName.kind === 120 /* QualifiedName */ || entityName.parent.kind === 191 /* ImportDeclaration */) { + meaning = 1536 /* Namespace */; + } + else { + meaning = 3152352 /* Type */; + } + var firstIdentifier = getFirstIdentifier(entityName); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + return (symbol && hasVisibleDeclarations(symbol)) || { + accessibility: 1 /* NotAccessible */, + errorSymbolName: ts.getTextOfNode(firstIdentifier), + errorNode: firstIdentifier + }; + } + function writeKeyword(writer, kind) { + writer.writeKeyword(ts.tokenToString(kind)); + } + function writePunctuation(writer, kind) { + writer.writePunctuation(ts.tokenToString(kind)); + } + function writeSpace(writer) { + writer.writeSpace(" "); + } + function symbolToString(symbol, enclosingDeclaration, meaning) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function typeToString(type, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + var maxLength = compilerOptions.noErrorTruncation || flags & 4 /* NoTruncation */ ? undefined : 100; + if (maxLength && result.length >= maxLength) { + result = result.substr(0, maxLength - "...".length) + "..."; + } + return result; + } + function getTypeAliasForTypeLiteral(type) { + if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { + var node = type.symbol.declarations[0].parent; + while (node.kind === 140 /* ParenthesizedType */) { + node = node.parent; + } + if (node.kind === 187 /* TypeAliasDeclaration */) { + return getSymbolOfNode(node); + } + } + return undefined; + } + var _displayBuilder; + function getSymbolDisplayBuilder() { + function appendSymbolNameOnly(symbol, writer) { + if (symbol.declarations && symbol.declarations.length > 0) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + writer.writeSymbol(ts.declarationNameToString(declaration.name), symbol); + return; + } + } + writer.writeSymbol(symbol.name, symbol); + } + function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags) { + var parentSymbol; + function appendParentTypeArgumentsAndSymbolName(symbol) { + if (parentSymbol) { + if (flags & 1 /* WriteTypeParametersOrArguments */) { + if (symbol.flags & 67108864 /* Instantiated */) { + buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); + } + else { + buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + writePunctuation(writer, 19 /* DotToken */); + } + parentSymbol = symbol; + appendSymbolNameOnly(symbol, writer); + } + writer.trackSymbol(symbol, enclosingDeclaration, meaning); + function walkSymbol(symbol, meaning) { + if (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2 /* UseOnlyExternalAliasing */)); + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); + } + if (accessibleSymbolChain) { + for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { + appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + } + } + else { + if (!parentSymbol && ts.forEach(symbol.declarations, function (declaration) { return hasExternalModuleSymbol(declaration); })) { + return; + } + if (symbol.flags & 2048 /* TypeLiteral */ || symbol.flags & 4096 /* ObjectLiteral */) { + return; + } + appendParentTypeArgumentsAndSymbolName(symbol); + } + } + } + if (enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { + walkSymbol(symbol, meaning); + return; + } + return appendParentTypeArgumentsAndSymbolName(symbol); + } + function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, typeStack) { + var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */; + return writeType(type, globalFlags); + function writeType(type, flags) { + if (type.flags & 127 /* Intrinsic */) { + writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && (type.flags & 1 /* Any */) ? "any" : type.intrinsicName); + } + else if (type.flags & 4096 /* Reference */) { + writeTypeReference(type, flags); + } + else if (type.flags & (1024 /* Class */ | 2048 /* Interface */ | 128 /* Enum */ | 512 /* TypeParameter */)) { + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 3152352 /* Type */); + } + else if (type.flags & 8192 /* Tuple */) { + writeTupleType(type); + } + else if (type.flags & 16384 /* Union */) { + writeUnionType(type, flags); + } + else if (type.flags & 32768 /* Anonymous */) { + writeAnonymousType(type, flags); + } + else if (type.flags & 256 /* StringLiteral */) { + writer.writeStringLiteral(type.text); + } + else { + writePunctuation(writer, 13 /* OpenBraceToken */); + writeSpace(writer); + writePunctuation(writer, 20 /* DotDotDotToken */); + writeSpace(writer); + writePunctuation(writer, 14 /* CloseBraceToken */); + } + } + function writeTypeList(types, union) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + if (union) { + writeSpace(writer); + } + writePunctuation(writer, union ? 43 /* BarToken */ : 22 /* CommaToken */); + writeSpace(writer); + } + writeType(types[i], union ? 64 /* InElementType */ : 0 /* None */); + } + } + function writeTypeReference(type, flags) { + if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { + writeType(type.typeArguments[0], 64 /* InElementType */); + writePunctuation(writer, 17 /* OpenBracketToken */); + writePunctuation(writer, 18 /* CloseBracketToken */); + } + else { + buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, 3152352 /* Type */); + writePunctuation(writer, 23 /* LessThanToken */); + writeTypeList(type.typeArguments, false); + writePunctuation(writer, 24 /* GreaterThanToken */); + } + } + function writeTupleType(type) { + writePunctuation(writer, 17 /* OpenBracketToken */); + writeTypeList(type.elementTypes, false); + writePunctuation(writer, 18 /* CloseBracketToken */); + } + function writeUnionType(type, flags) { + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 15 /* OpenParenToken */); + } + writeTypeList(type.types, true); + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 16 /* CloseParenToken */); + } + } + function writeAnonymousType(type, flags) { + if (type.symbol && type.symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + writeTypeofSymbol(type); + } + else if (shouldWriteTypeOfFunctionSymbol()) { + writeTypeofSymbol(type); + } + else if (typeStack && ts.contains(typeStack, type)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 3152352 /* Type */); + } + else { + writeKeyword(writer, 109 /* AnyKeyword */); + } + } + else { + if (!typeStack) { + typeStack = []; + } + typeStack.push(type); + writeLiteralType(type, flags); + typeStack.pop(); + } + function shouldWriteTypeOfFunctionSymbol() { + if (type.symbol) { + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 201 /* SourceFile */ || declaration.parent.kind === 190 /* ModuleBlock */; })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); + } + } + } + } + function writeTypeofSymbol(type) { + writeKeyword(writer, 95 /* TypeOfKeyword */); + writeSpace(writer); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */); + } + function getIndexerParameterName(type, indexKind, fallbackName) { + var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); + if (!declaration) { + return fallbackName; + } + ts.Debug.assert(declaration.parameters.length !== 0); + return ts.declarationNameToString(declaration.parameters[0].name); + } + function writeLiteralType(type, flags) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + writePunctuation(writer, 13 /* OpenBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); + return; + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 15 /* OpenParenToken */); + } + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 16 /* CloseParenToken */); + } + return; + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 15 /* OpenParenToken */); + } + writeKeyword(writer, 86 /* NewKeyword */); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); + if (flags & 64 /* InElementType */) { + writePunctuation(writer, 16 /* CloseParenToken */); + } + return; + } + } + writePunctuation(writer, 13 /* OpenBraceToken */); + writer.writeLine(); + writer.increaseIndent(); + for (var i = 0; i < resolved.callSignatures.length; i++) { + buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + for (var i = 0; i < resolved.constructSignatures.length; i++) { + writeKeyword(writer, 86 /* NewKeyword */); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + if (resolved.stringIndexType) { + writePunctuation(writer, 17 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeKeyword(writer, 118 /* StringKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeType(resolved.stringIndexType, 0 /* None */); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + if (resolved.numberIndexType) { + writePunctuation(writer, 17 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeKeyword(writer, 116 /* NumberKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeType(resolved.numberIndexType, 0 /* None */); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + for (var i = 0; i < resolved.properties.length; i++) { + var p = resolved.properties[i]; + var t = getTypeOfSymbol(p); + if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { + var signatures = getSignaturesOfType(t, 0 /* Call */); + for (var j = 0; j < signatures.length; j++) { + buildSymbolDisplay(p, writer); + if (isOptionalProperty(p)) { + writePunctuation(writer, 49 /* QuestionToken */); + } + buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + } + else { + buildSymbolDisplay(p, writer); + if (isOptionalProperty(p)) { + writePunctuation(writer, 49 /* QuestionToken */); + } + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + writeType(t, 0 /* None */); + writePunctuation(writer, 21 /* SemicolonToken */); + writer.writeLine(); + } + } + writer.decreaseIndent(); + writePunctuation(writer, 14 /* CloseBraceToken */); + } + } + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + var targetSymbol = getTargetSymbol(symbol); + if (targetSymbol.flags & 32 /* Class */ || targetSymbol.flags & 64 /* Interface */) { + buildDisplayForTypeParametersAndDelimiters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); + } + } + function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, typeStack) { + appendSymbolNameOnly(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, 77 /* ExtendsKeyword */); + writeSpace(writer); + buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); + } + } + function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { + if (ts.hasDotDotDotToken(p.valueDeclaration)) { + writePunctuation(writer, 20 /* DotDotDotToken */); + } + appendSymbolNameOnly(p, writer); + if (ts.hasQuestionToken(p.valueDeclaration) || p.valueDeclaration.initializer) { + writePunctuation(writer, 49 /* QuestionToken */); + } + writePunctuation(writer, 50 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); + } + function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 23 /* LessThanToken */); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 22 /* CommaToken */); + writeSpace(writer); + } + buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 24 /* GreaterThanToken */); + } + } + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 23 /* LessThanToken */); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 22 /* CommaToken */); + writeSpace(writer); + } + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); + } + writePunctuation(writer, 24 /* GreaterThanToken */); + } + } + function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { + writePunctuation(writer, 15 /* OpenParenToken */); + for (var i = 0; i < parameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 22 /* CommaToken */); + writeSpace(writer); + } + buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 16 /* CloseParenToken */); + } + function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (flags & 8 /* WriteArrowStyleSignature */) { + writeSpace(writer); + writePunctuation(writer, 31 /* EqualsGreaterThanToken */); + } + else { + writePunctuation(writer, 50 /* ColonToken */); + } + writeSpace(writer); + buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); + } + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) { + buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, typeStack); + } + buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, typeStack); + buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack); + } + return _displayBuilder || (_displayBuilder = { + symbolToString: symbolToString, + typeToString: typeToString, + buildSymbolDisplay: buildSymbolDisplay, + buildTypeDisplay: buildTypeDisplay, + buildTypeParameterDisplay: buildTypeParameterDisplay, + buildParameterDisplay: buildParameterDisplay, + buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, + buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, + buildDisplayForTypeArgumentsAndDelimiters: buildDisplayForTypeArgumentsAndDelimiters, + buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, + buildSignatureDisplay: buildSignatureDisplay, + buildReturnTypeDisplay: buildReturnTypeDisplay + }); + } + function isDeclarationVisible(node) { + function getContainingExternalModule(node) { + for (; node; node = node.parent) { + if (node.kind === 189 /* ModuleDeclaration */) { + if (node.name.kind === 7 /* StringLiteral */) { + return node; + } + } + else if (node.kind === 201 /* SourceFile */) { + return ts.isExternalModule(node) ? node : undefined; + } + } + ts.Debug.fail("getContainingModule cant reach here"); + } + function isUsedInExportAssignment(node) { + var externalModule = getContainingExternalModule(node); + if (externalModule) { + var externalModuleSymbol = getSymbolOfNode(externalModule); + var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); + var resolvedExportSymbol; + var symbolOfNode = getSymbolOfNode(node); + if (isSymbolUsedInExportAssignment(symbolOfNode)) { + return true; + } + if (symbolOfNode.flags & 33554432 /* Import */) { + return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); + } + } + function isSymbolUsedInExportAssignment(symbol) { + if (exportAssignmentSymbol === symbol) { + return true; + } + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 33554432 /* Import */)) { + resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); + if (resolvedExportSymbol === symbol) { + return true; + } + return ts.forEach(resolvedExportSymbol.declarations, function (current) { + while (current) { + if (current === node) { + return true; + } + current = current.parent; + } + }); + } + } + } + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 183 /* VariableDeclaration */: + case 189 /* ModuleDeclaration */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 184 /* FunctionDeclaration */: + case 188 /* EnumDeclaration */: + case 191 /* ImportDeclaration */: + var parent = node.kind === 183 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 191 /* ImportDeclaration */ && parent.kind !== 201 /* SourceFile */ && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + } + return isDeclarationVisible(parent); + case 124 /* Property */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 125 /* Method */: + if (node.flags & (32 /* Private */ | 64 /* Protected */)) { + return false; + } + case 126 /* Constructor */: + case 130 /* ConstructSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: + case 123 /* Parameter */: + case 190 /* ModuleBlock */: + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 136 /* TypeLiteral */: + case 132 /* TypeReference */: + case 137 /* ArrayType */: + case 138 /* TupleType */: + case 139 /* UnionType */: + case 140 /* ParenthesizedType */: + return isDeclarationVisible(node.parent); + case 122 /* TypeParameter */: + case 201 /* SourceFile */: + return true; + default: + ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + } + } + if (node) { + var links = getNodeLinks(node); + if (links.isVisible === undefined) { + links.isVisible = !!determineIfDeclarationIsVisible(); + } + return links.isVisible; + } + } + function getTypeOfPrototypeProperty(prototype) { + var classType = getDeclaredTypeOfSymbol(prototype.parent); + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + } + function getTypeOfVariableOrParameterOrPropertyDeclaration(declaration) { + if (declaration.parent.kind === 171 /* ForInStatement */) { + return anyType; + } + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 123 /* Parameter */) { + var func = declaration.parent; + if (func.kind === 128 /* SetAccessor */ && !ts.hasComputedNameButNotSymbol(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 127 /* GetAccessor */); + if (getter) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + } + } + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; + } + } + if (declaration.initializer) { + var type = checkAndMarkExpression(declaration.initializer); + if (declaration.kind !== 198 /* PropertyAssignment */) { + var unwidenedType = type; + type = getWidenedType(type); + if (type !== unwidenedType) { + checkImplicitAny(type); + } + } + return type; + } + if (declaration.kind === 199 /* ShorthandPropertyAssignment */) { + var type = checkIdentifier(declaration.name); + return type; + } + var type = ts.hasDotDotDotToken(declaration) ? createArrayType(anyType) : anyType; + checkImplicitAny(type); + return type; + function checkImplicitAny(type) { + if (!fullTypeCheck || !compilerOptions.noImplicitAny) { + return; + } + if (getInnermostTypeOfNestedArrayTypes(type) !== anyType) { + return; + } + if (isPrivateWithinAmbient(declaration) || (declaration.kind === 123 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { + return; + } + switch (declaration.kind) { + case 124 /* Property */: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 123 /* Parameter */: + var diagnostic = ts.hasDotDotDotToken(declaration) ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + default: + var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + } + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeToString(type)); + } + } + function getTypeOfVariableOrParameterOrProperty(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + if (symbol.flags & 536870912 /* Prototype */) { + return links.type = getTypeOfPrototypeProperty(symbol); + } + var declaration = symbol.valueDeclaration; + if (declaration.kind === 197 /* CatchClause */) { + return links.type = anyType; + } + links.type = resolvingType; + var type = getTypeOfVariableOrParameterOrPropertyDeclaration(declaration); + if (links.type === resolvingType) { + links.type = type; + } + } + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } + } + return links.type; + } + function getSetAccessorTypeAnnotationNode(accessor) { + return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + } + function getAnnotatedAccessorType(accessor) { + if (accessor) { + if (accessor.kind === 127 /* GetAccessor */) { + return accessor.type && getTypeFromTypeNode(accessor.type); + } + else { + var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + } + } + return undefined; + } + function getTypeOfAccessors(symbol) { + var links = getSymbolLinks(symbol); + checkAndStoreTypeOfAccessors(symbol, links); + return links.type; + } + function checkAndStoreTypeOfAccessors(symbol, links) { + links = links || getSymbolLinks(symbol); + if (!links.type) { + links.type = resolvingType; + var getter = ts.getDeclarationOfKind(symbol, 127 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 128 /* SetAccessor */); + var type; + var getterReturnType = getAnnotatedAccessorType(getter); + if (getterReturnType) { + type = getterReturnType; + } + else { + var setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + type = setterParameterType; + } + else { + if (getter && getter.body) { + type = getReturnTypeFromBody(getter); + } + else { + if (compilerOptions.noImplicitAny) { + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); + } + type = anyType; + } + } + } + if (links.type === resolvingType) { + links.type = type; + } + } + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = ts.getDeclarationOfKind(symbol, 127 /* GetAccessor */); + error(getter, ts.Diagnostics._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, symbolToString(symbol)); + } + } + } + function getTypeOfFuncClassEnumModule(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = createObjectType(32768 /* Anonymous */, symbol); + } + return links.type; + } + function getTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + } + return links.type; + } + function getTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getTypeOfSymbol(resolveImport(symbol)); + } + return links.type; + } + function getTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + } + return links.type; + } + function getTypeOfSymbol(symbol) { + if (symbol.flags & 67108864 /* Instantiated */) { + return getTypeOfInstantiatedSymbol(symbol); + } + if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) { + return getTypeOfVariableOrParameterOrProperty(symbol); + } + if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + return getTypeOfFuncClassEnumModule(symbol); + } + if (symbol.flags & 8 /* EnumMember */) { + return getTypeOfEnumMember(symbol); + } + if (symbol.flags & 98304 /* Accessor */) { + return getTypeOfAccessors(symbol); + } + if (symbol.flags & 33554432 /* Import */) { + return getTypeOfImport(symbol); + } + return unknownType; + } + function getTargetType(type) { + return type.flags & 4096 /* Reference */ ? type.target : type; + } + function hasBaseType(type, checkBase) { + return check(type); + function check(type) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(target.baseTypes, check); + } + } + function getTypeParametersOfClassOrInterface(symbol) { + var result; + ts.forEach(symbol.declarations, function (node) { + if (node.kind === 186 /* InterfaceDeclaration */ || node.kind === 185 /* ClassDeclaration */) { + var declaration = node; + if (declaration.typeParameters && declaration.typeParameters.length) { + ts.forEach(declaration.typeParameters, function (node) { + var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!result) { + result = [tp]; + } + else if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + } + } + }); + return result; + } + function getDeclaredTypeOfClass(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(1024 /* Class */, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096 /* Reference */; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + var declaration = ts.getDeclarationOfKind(symbol, 185 /* ClassDeclaration */); + var baseTypeNode = ts.getClassBaseTypeNode(declaration); + if (baseTypeNode) { + var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & 1024 /* Class */) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); + } + } + else { + error(baseTypeNode, ts.Diagnostics.A_class_may_only_extend_another_class); + } + } + } + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = emptyArray; + type.declaredConstructSignatures = emptyArray; + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + } + return links.declaredType; + } + function getDeclaredTypeOfInterface(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(2048 /* Interface */, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096 /* Reference */; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 186 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { + var baseType = getTypeFromTypeReferenceNode(node); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & (1024 /* Class */ | 2048 /* Interface */)) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); + } + } + else { + error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + } + } + }); + } + }); + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + } + return links.declaredType; + } + function getDeclaredTypeOfTypeAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = resolvingType; + var declaration = ts.getDeclarationOfKind(symbol, 187 /* TypeAliasDeclaration */); + var type = getTypeFromTypeNode(declaration.type); + if (links.declaredType === resolvingType) { + links.declaredType = type; + } + } + else if (links.declaredType === resolvingType) { + links.declaredType = unknownType; + var declaration = ts.getDeclarationOfKind(symbol, 187 /* TypeAliasDeclaration */); + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfEnum(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(128 /* Enum */); + type.symbol = symbol; + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfTypeParameter(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(512 /* TypeParameter */); + type.symbol = symbol; + if (!ts.getDeclarationOfKind(symbol, 122 /* TypeParameter */).constraint) { + type.constraint = noConstraintType; + } + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = getDeclaredTypeOfSymbol(resolveImport(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfSymbol(symbol) { + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0); + if (symbol.flags & 32 /* Class */) { + return getDeclaredTypeOfClass(symbol); + } + if (symbol.flags & 64 /* Interface */) { + return getDeclaredTypeOfInterface(symbol); + } + if (symbol.flags & 2097152 /* TypeAlias */) { + return getDeclaredTypeOfTypeAlias(symbol); + } + if (symbol.flags & 384 /* Enum */) { + return getDeclaredTypeOfEnum(symbol); + } + if (symbol.flags & 1048576 /* TypeParameter */) { + return getDeclaredTypeOfTypeParameter(symbol); + } + if (symbol.flags & 33554432 /* Import */) { + return getDeclaredTypeOfImport(symbol); + } + return unknownType; + } + function createSymbolTable(symbols) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = symbol; + } + return result; + } + function createInstantiatedSymbolTable(symbols, mapper) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = instantiateSymbol(symbol, mapper); + } + return result; + } + function addInheritedMembers(symbols, baseSymbols) { + for (var i = 0; i < baseSymbols.length; i++) { + var s = baseSymbols[i]; + if (!ts.hasProperty(symbols, s.name)) { + symbols[s.name] = s; + } + } + } + function addInheritedSignatures(signatures, baseSignatures) { + if (baseSignatures) { + for (var i = 0; i < baseSignatures.length; i++) { + signatures.push(baseSignatures[i]); + } + } + } + function resolveClassOrInterfaceMembers(type) { + var members = type.symbol.members; + var callSignatures = type.declaredCallSignatures; + var constructSignatures = type.declaredConstructSignatures; + var stringIndexType = type.declaredStringIndexType; + var numberIndexType = type.declaredNumberIndexType; + if (type.baseTypes.length) { + members = createSymbolTable(type.declaredProperties); + ts.forEach(type.baseTypes, function (baseType) { + addInheritedMembers(members, getPropertiesOfObjectType(baseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0 /* Call */)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1 /* Construct */)); + stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0 /* String */); + numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1 /* Number */); + }); + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveTypeReferenceMembers(type) { + var target = type.target; + var mapper = createTypeMapper(target.typeParameters, type.typeArguments); + var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); + var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); + var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); + var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; + var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; + ts.forEach(target.baseTypes, function (baseType) { + var instantiatedBaseType = instantiateType(baseType, mapper); + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0 /* String */); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1 /* Number */); + }); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function createSignature(declaration, typeParameters, parameters, resolvedReturnType, minArgumentCount, hasRestParameter, hasStringLiterals) { + var sig = new Signature(checker); + sig.declaration = declaration; + sig.typeParameters = typeParameters; + sig.parameters = parameters; + sig.resolvedReturnType = resolvedReturnType; + sig.minArgumentCount = minArgumentCount; + sig.hasRestParameter = hasRestParameter; + sig.hasStringLiterals = hasStringLiterals; + return sig; + } + function cloneSignature(sig) { + return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + } + function getDefaultConstructSignatures(classType) { + if (classType.baseTypes.length) { + var baseType = classType.baseTypes[0]; + var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1 /* Construct */); + return ts.map(baseSignatures, function (baseSignature) { + var signature = baseType.flags & 4096 /* Reference */ ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + signature.typeParameters = classType.typeParameters; + signature.resolvedReturnType = classType; + return signature; + }); + } + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + function resolveTupleTypeMembers(type) { + var arrayType = resolveObjectOrUnionTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } + function signatureListsIdentical(s, t) { + if (s.length !== t.length) { + return false; + } + for (var i = 0; i < s.length; i++) { + if (!compareSignatures(s[i], t[i], false, compareTypes)) { + return false; + } + } + return true; + } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatures = signatureLists[0]; + for (var i = 0; i < signatures.length; i++) { + if (signatures[i].typeParameters) { + return emptyArray; + } + } + for (var i = 1; i < signatureLists.length; i++) { + if (!signatureListsIdentical(signatures, signatureLists[i])) { + return emptyArray; + } + } + var result = ts.map(signatures, cloneSignature); + for (var i = 0; i < result.length; i++) { + var s = result[i]; + s.resolvedReturnType = undefined; + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + } + return result; + } + function getUnionIndexType(types, kind) { + var indexTypes = []; + for (var i = 0; i < types.length; i++) { + var indexType = getIndexTypeOfType(types[i], kind); + if (!indexType) { + return undefined; + } + indexTypes.push(indexType); + } + return getUnionType(indexTypes); + } + function resolveUnionTypeMembers(type) { + var callSignatures = getUnionSignatures(type.types, 0 /* Call */); + var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */); + var stringIndexType = getUnionIndexType(type.types, 0 /* String */); + var numberIndexType = getUnionIndexType(type.types, 1 /* Number */); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveAnonymousTypeMembers(type) { + var symbol = type.symbol; + if (symbol.flags & 2048 /* TypeLiteral */) { + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); + var numberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + } + else { + var members = emptySymbols; + var callSignatures = emptyArray; + var constructSignatures = emptyArray; + if (symbol.flags & 1952 /* HasExports */) { + members = symbol.exports; + } + if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { + callSignatures = getSignaturesOfSymbol(symbol); + } + if (symbol.flags & 32 /* Class */) { + var classType = getDeclaredTypeOfClass(symbol); + constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + if (!constructSignatures.length) { + constructSignatures = getDefaultConstructSignatures(classType); + } + if (classType.baseTypes.length) { + members = createSymbolTable(getNamedMembers(members)); + addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); + } + } + var stringIndexType = undefined; + var numberIndexType = (symbol.flags & 384 /* Enum */) ? stringType : undefined; + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveObjectOrUnionTypeMembers(type) { + if (!type.members) { + if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { + resolveClassOrInterfaceMembers(type); + } + else if (type.flags & 32768 /* Anonymous */) { + resolveAnonymousTypeMembers(type); + } + else if (type.flags & 8192 /* Tuple */) { + resolveTupleTypeMembers(type); + } + else if (type.flags & 16384 /* Union */) { + resolveUnionTypeMembers(type); + } + else { + resolveTypeReferenceMembers(type); + } + } + return type; + } + function getPropertiesOfObjectType(type) { + if (type.flags & 48128 /* ObjectType */) { + return resolveObjectOrUnionTypeMembers(type).properties; + } + return emptyArray; + } + function getPropertyOfObjectType(type, name) { + if (type.flags & 48128 /* ObjectType */) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + } + } + function getPropertiesOfUnionType(type) { + var result = []; + ts.forEach(getPropertiesOfType(type.types[0]), function (prop) { + var unionProp = getPropertyOfUnionType(type, prop.name); + if (unionProp) { + result.push(unionProp); + } + }); + return result; + } + function getPropertiesOfType(type) { + if (type.flags & 16384 /* Union */) { + return getPropertiesOfUnionType(type); + } + return getPropertiesOfObjectType(getApparentType(type)); + } + function getApparentType(type) { + if (type.flags & 512 /* TypeParameter */) { + do { + type = getConstraintOfTypeParameter(type); + } while (type && type.flags & 512 /* TypeParameter */); + if (!type) { + type = emptyObjectType; + } + } + if (type.flags & 258 /* StringLike */) { + type = globalStringType; + } + else if (type.flags & 132 /* NumberLike */) { + type = globalNumberType; + } + else if (type.flags & 8 /* Boolean */) { + type = globalBooleanType; + } + return type; + } + function createUnionProperty(unionType, name) { + var types = unionType.types; + var props; + for (var i = 0; i < types.length; i++) { + var type = getApparentType(types[i]); + if (type !== unknownType) { + var prop = getPropertyOfType(type, name); + if (!prop) { + return undefined; + } + if (!props) { + props = [prop]; + } + else { + props.push(prop); + } + } + } + var propTypes = []; + var declarations = []; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (prop.declarations) { + declarations.push.apply(declarations, prop.declarations); + } + propTypes.push(getTypeOfSymbol(prop)); + } + var result = createSymbol(4 /* Property */ | 268435456 /* Transient */ | 1073741824 /* UnionProperty */, name); + result.unionType = unionType; + result.declarations = declarations; + result.type = getUnionType(propTypes); + return result; + } + function getPropertyOfUnionType(type, name) { + var properties = type.resolvedProperties || (type.resolvedProperties = {}); + if (ts.hasProperty(properties, name)) { + return properties[name]; + } + var property = createUnionProperty(type, name); + if (property) { + properties[name] = property; + } + return property; + } + function getPropertyOfType(type, name) { + if (type.flags & 16384 /* Union */) { + return getPropertyOfUnionType(type, name); + } + if (!(type.flags & 48128 /* ObjectType */)) { + type = getApparentType(type); + if (!(type.flags & 48128 /* ObjectType */)) { + return undefined; + } + } + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) + return symbol; + } + return getPropertyOfObjectType(globalObjectType, name); + } + function getSignaturesOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 /* ObjectType */ | 16384 /* Union */)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 /* Call */ ? resolved.callSignatures : resolved.constructSignatures; + } + return emptyArray; + } + function getSignaturesOfType(type, kind) { + return getSignaturesOfObjectOrUnionType(getApparentType(type), kind); + } + function getIndexTypeOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 /* ObjectType */ | 16384 /* Union */)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 /* String */ ? resolved.stringIndexType : resolved.numberIndexType; + } + } + function getIndexTypeOfType(type, kind) { + return getIndexTypeOfObjectOrUnionType(getApparentType(type), kind); + } + function getTypeParametersFromDeclaration(typeParameterDeclarations) { + var result = []; + ts.forEach(typeParameterDeclarations, function (node) { + var tp = getDeclaredTypeOfTypeParameter(node.symbol); + if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + return result; + } + function getSignatureFromDeclaration(declaration) { + var links = getNodeLinks(declaration); + if (!links.resolvedSignature) { + var classType = declaration.kind === 126 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var parameters = []; + var hasStringLiterals = false; + var minArgumentCount = -1; + for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var param = declaration.parameters[i]; + parameters.push(param.symbol); + if (param.type && param.type.kind === 7 /* StringLiteral */) { + hasStringLiterals = true; + } + if (minArgumentCount < 0) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + minArgumentCount = i; + } + } + } + if (minArgumentCount < 0) { + minArgumentCount = declaration.parameters.length; + } + var returnType; + if (classType) { + returnType = classType; + } + else if (declaration.type) { + returnType = getTypeFromTypeNode(declaration.type); + } + else { + if (declaration.kind === 127 /* GetAccessor */ && !ts.hasComputedNameButNotSymbol(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 128 /* SetAccessor */); + returnType = getAnnotatedAccessorType(setter); + } + if (!returnType && !declaration.body) { + returnType = anyType; + } + } + links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, minArgumentCount, ts.hasRestParameters(declaration), hasStringLiterals); + } + return links.resolvedSignature; + } + function getSignaturesOfSymbol(symbol) { + if (!symbol) + return emptyArray; + var result = []; + for (var i = 0, len = symbol.declarations.length; i < len; i++) { + var node = symbol.declarations[i]; + switch (node.kind) { + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + if (i > 0 && node.body) { + var previous = symbol.declarations[i - 1]; + if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { + break; + } + } + result.push(getSignatureFromDeclaration(node)); + } + } + return result; + } + function getReturnTypeOfSignature(signature) { + if (!signature.resolvedReturnType) { + signature.resolvedReturnType = resolvingType; + if (signature.target) { + var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + } + else if (signature.unionSignatures) { + var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + } + else { + var type = getReturnTypeFromBody(signature.declaration); + } + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = type; + } + } + else if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._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, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.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); + } + } + } + return signature.resolvedReturnType; + } + function getRestTypeOfSignature(signature) { + if (signature.hasRestParameter) { + var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + if (type.flags & 4096 /* Reference */ && type.target === globalArrayType) { + return type.typeArguments[0]; + } + } + return anyType; + } + function getSignatureInstantiation(signature, typeArguments) { + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + } + function getErasedSignature(signature) { + if (!signature.typeParameters) + return signature; + if (!signature.erasedSignatureCache) { + if (signature.target) { + signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); + } + else { + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); + } + } + return signature.erasedSignatureCache; + } + function getOrCreateTypeFromSignature(signature) { + if (!signature.isolatedSignatureType) { + var isConstructor = signature.declaration.kind === 126 /* Constructor */ || signature.declaration.kind === 130 /* ConstructSignature */; + var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); + type.members = emptySymbols; + type.properties = emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; + signature.isolatedSignatureType = type; + } + return signature.isolatedSignatureType; + } + function getIndexSymbol(symbol) { + return symbol.members["__index"]; + } + function getIndexDeclarationOfSymbol(symbol, kind) { + var syntaxKind = kind === 1 /* Number */ ? 116 /* NumberKeyword */ : 118 /* StringKeyword */; + var indexSymbol = getIndexSymbol(symbol); + if (indexSymbol) { + var len = indexSymbol.declarations.length; + for (var i = 0; i < len; i++) { + var node = indexSymbol.declarations[i]; + if (node.parameters.length === 1) { + var parameter = node.parameters[0]; + if (parameter && parameter.type && parameter.type.kind === syntaxKind) { + return node; + } + } + } + } + return undefined; + } + function getIndexTypeOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + } + function getConstraintOfTypeParameter(type) { + if (!type.constraint) { + if (type.target) { + var targetConstraint = getConstraintOfTypeParameter(type.target); + type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + } + else { + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 122 /* TypeParameter */).constraint); + } + } + return type.constraint === noConstraintType ? undefined : type.constraint; + } + function getTypeListId(types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) + result += ","; + result += types[i].id; + } + return result; + } + } + function createTypeReference(target, typeArguments) { + var id = getTypeListId(typeArguments); + var type = target.instantiations[id]; + if (!type) { + type = target.instantiations[id] = createObjectType(4096 /* Reference */, target.symbol); + type.target = target; + type.typeArguments = typeArguments; + } + return type; + } + function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { + var links = getNodeLinks(typeReferenceNode); + if (links.isIllegalTypeReferenceInConstraint !== undefined) { + return links.isIllegalTypeReferenceInConstraint; + } + var currentNode = typeReferenceNode; + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + currentNode = currentNode.parent; + } + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 122 /* TypeParameter */; + return links.isIllegalTypeReferenceInConstraint; + } + function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { + var typeParameterSymbol; + function check(n) { + if (n.kind === 132 /* TypeReference */ && n.typeName.kind === 63 /* Identifier */) { + var links = getNodeLinks(n); + if (links.isIllegalTypeReferenceInConstraint === undefined) { + var symbol = resolveName(typeParameter, n.typeName.text, 3152352 /* Type */, undefined, undefined); + if (symbol && (symbol.flags & 1048576 /* TypeParameter */)) { + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + } + } + if (links.isIllegalTypeReferenceInConstraint) { + error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); + } + } + ts.forEachChild(n, check); + } + if (typeParameter.constraint) { + typeParameterSymbol = getSymbolOfNode(typeParameter); + check(typeParameter.constraint); + } + } + function getTypeFromTypeReferenceNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var symbol = resolveEntityName(node, node.typeName, 3152352 /* Type */); + if (symbol) { + var type; + if ((symbol.flags & 1048576 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; + } + else { + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 /* Class */ | 2048 /* Interface */) && type.flags & 4096 /* Reference */) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } + } + } + } + links.resolvedType = type || unknownType; + } + return links.resolvedType; + } + function getTypeFromTypeQueryNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName)); + } + return links.resolvedType; + } + function getTypeOfGlobalSymbol(symbol, arity) { + function getTypeDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + switch (declaration.kind) { + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + return declaration; + } + } + } + if (!symbol) { + return emptyObjectType; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!(type.flags & 48128 /* ObjectType */)) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); + return emptyObjectType; + } + if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); + return emptyObjectType; + } + return type; + } + function getGlobalSymbol(name) { + return resolveName(undefined, name, 3152352 /* Type */, ts.Diagnostics.Cannot_find_global_type_0, name); + } + function getGlobalType(name) { + return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + } + function createArrayType(elementType) { + var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + } + function getTypeFromArrayTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + } + return links.resolvedType; + } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(8192 /* Tuple */); + type.elementTypes = elementTypes; + } + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } + function addTypeToSortedSet(sortedSet, type) { + if (type.flags & 16384 /* Union */) { + addTypesToSortedSet(sortedSet, type.types); + } + else { + var i = 0; + var id = type.id; + while (i < sortedSet.length && sortedSet[i].id < id) { + i++; + } + if (i === sortedSet.length || sortedSet[i].id !== id) { + sortedSet.splice(i, 0, type); + } + } + } + function addTypesToSortedSet(sortedTypes, types) { + for (var i = 0, len = types.length; i < len; i++) { + addTypeToSortedSet(sortedTypes, types[i]); + } + } + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + return true; + } + } + return false; + } + function removeSubtypes(types) { + var i = types.length; + while (i > 0) { + i--; + if (isSubtypeOfAny(types[i], types)) { + types.splice(i, 1); + } + } + } + function containsAnyType(types) { + for (var i = 0; i < types.length; i++) { + if (types[i].flags & 1 /* Any */) { + return true; + } + } + return false; + } + function removeAllButLast(types, typeToRemove) { + var i = types.length; + while (i > 0 && types.length > 1) { + i--; + if (types[i] === typeToRemove) { + types.splice(i, 1); + } + } + } + function getUnionType(types, noSubtypeReduction) { + if (types.length === 0) { + return emptyObjectType; + } + var sortedTypes = []; + addTypesToSortedSet(sortedTypes, types); + if (noSubtypeReduction) { + if (containsAnyType(sortedTypes)) { + return anyType; + } + removeAllButLast(sortedTypes, undefinedType); + removeAllButLast(sortedTypes, nullType); + } + else { + removeSubtypes(sortedTypes); + } + if (sortedTypes.length === 1) { + return sortedTypes[0]; + } + var id = getTypeListId(sortedTypes); + var type = unionTypes[id]; + if (!type) { + type = unionTypes[id] = createObjectType(16384 /* Union */); + type.types = sortedTypes; + } + return type; + } + function getTypeFromUnionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + } + return links.resolvedType; + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createObjectType(32768 /* Anonymous */, node.symbol); + } + return links.resolvedType; + } + function getStringLiteralType(node) { + if (ts.hasProperty(stringLiteralTypes, node.text)) { + return stringLiteralTypes[node.text]; + } + var type = stringLiteralTypes[node.text] = createType(256 /* StringLiteral */); + type.text = ts.getTextOfNode(node); + return type; + } + function getTypeFromStringLiteral(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getStringLiteralType(node); + } + return links.resolvedType; + } + function getTypeFromTypeNode(node) { + switch (node.kind) { + case 109 /* AnyKeyword */: + return anyType; + case 118 /* StringKeyword */: + return stringType; + case 116 /* NumberKeyword */: + return numberType; + case 110 /* BooleanKeyword */: + return booleanType; + case 97 /* VoidKeyword */: + return voidType; + case 7 /* StringLiteral */: + return getTypeFromStringLiteral(node); + case 132 /* TypeReference */: + return getTypeFromTypeReferenceNode(node); + case 135 /* TypeQuery */: + return getTypeFromTypeQueryNode(node); + case 137 /* ArrayType */: + return getTypeFromArrayTypeNode(node); + case 138 /* TupleType */: + return getTypeFromTupleTypeNode(node); + case 139 /* UnionType */: + return getTypeFromUnionTypeNode(node); + case 140 /* ParenthesizedType */: + return getTypeFromTypeNode(node.type); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 136 /* TypeLiteral */: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 63 /* Identifier */: + case 120 /* QualifiedName */: + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + default: + return unknownType; + } + } + function instantiateList(items, mapper, instantiator) { + if (items && items.length) { + var result = []; + for (var i = 0; i < items.length; i++) { + result.push(instantiator(items[i], mapper)); + } + return result; + } + return items; + } + function createUnaryTypeMapper(source, target) { + return function (t) { return t === source ? target : t; }; + } + function createBinaryTypeMapper(source1, target1, source2, target2) { + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + } + function createTypeMapper(sources, targets) { + switch (sources.length) { + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + } + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return targets[i]; + } + return t; + }; + } + function createUnaryTypeEraser(source) { + return function (t) { return t === source ? anyType : t; }; + } + function createBinaryTypeEraser(source1, source2) { + return function (t) { return t === source1 || t === source2 ? anyType : t; }; + } + function createTypeEraser(sources) { + switch (sources.length) { + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); + } + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return anyType; + } + return t; + }; + } + function createInferenceMapper(context) { + return function (t) { + for (var i = 0; i < context.typeParameters.length; i++) { + if (t === context.typeParameters[i]) { + return getInferredType(context, i); + } + } + return t; + }; + } + function identityMapper(type) { + return type; + } + function combineTypeMappers(mapper1, mapper2) { + return function (t) { return mapper2(mapper1(t)); }; + } + function instantiateTypeParameter(typeParameter, mapper) { + var result = createType(512 /* TypeParameter */); + result.symbol = typeParameter.symbol; + if (typeParameter.constraint) { + result.constraint = instantiateType(typeParameter.constraint, mapper); + } + else { + result.target = typeParameter; + result.mapper = mapper; + } + return result; + } + function instantiateSignature(signature, mapper, eraseTypeParameters) { + if (signature.typeParameters && !eraseTypeParameters) { + var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + } + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + result.target = signature; + result.mapper = mapper; + return result; + } + function instantiateSymbol(symbol, mapper) { + if (symbol.flags & 67108864 /* Instantiated */) { + var links = getSymbolLinks(symbol); + symbol = links.target; + mapper = combineTypeMappers(links.mapper, mapper); + } + var result = createSymbol(67108864 /* Instantiated */ | 268435456 /* Transient */ | symbol.flags, symbol.name); + result.declarations = symbol.declarations; + result.parent = symbol.parent; + result.target = symbol; + result.mapper = mapper; + if (symbol.valueDeclaration) { + result.valueDeclaration = symbol.valueDeclaration; + } + return result; + } + function instantiateAnonymousType(type, mapper) { + var result = createObjectType(32768 /* Anonymous */, type.symbol); + result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); + result.members = createSymbolTable(result.properties); + result.callSignatures = instantiateList(getSignaturesOfType(type, 0 /* Call */), mapper, instantiateSignature); + result.constructSignatures = instantiateList(getSignaturesOfType(type, 1 /* Construct */), mapper, instantiateSignature); + var stringIndexType = getIndexTypeOfType(type, 0 /* String */); + var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + if (stringIndexType) + result.stringIndexType = instantiateType(stringIndexType, mapper); + if (numberIndexType) + result.numberIndexType = instantiateType(numberIndexType, mapper); + return result; + } + function instantiateType(type, mapper) { + if (mapper !== identityMapper) { + if (type.flags & 512 /* TypeParameter */) { + return mapper(type); + } + if (type.flags & 32768 /* Anonymous */) { + return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; + } + if (type.flags & 4096 /* Reference */) { + return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); + } + if (type.flags & 8192 /* Tuple */) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } + if (type.flags & 16384 /* Union */) { + return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + } + } + return type; + } + function isContextSensitive(node) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + switch (node.kind) { + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return isContextSensitiveFunctionLikeDeclaration(node); + case 142 /* ObjectLiteralExpression */: + return ts.forEach(node.properties, isContextSensitive); + case 141 /* ArrayLiteralExpression */: + return ts.forEach(node.elements, isContextSensitive); + case 158 /* ConditionalExpression */: + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + case 157 /* BinaryExpression */: + return node.operator === 48 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 198 /* PropertyAssignment */: + return isContextSensitive(node.initializer); + case 125 /* Method */: + return isContextSensitiveFunctionLikeDeclaration(node); + } + return false; + } + function isContextSensitiveFunctionLikeDeclaration(node) { + return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); + } + function getTypeWithoutConstructors(type) { + if (type.flags & 48128 /* ObjectType */) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.constructSignatures.length) { + var result = createObjectType(32768 /* Anonymous */, type.symbol); + result.members = resolved.members; + result.properties = resolved.properties; + result.callSignatures = resolved.callSignatures; + result.constructSignatures = emptyArray; + type = result; + } + } + return type; + } + var subtypeRelation = {}; + var assignableRelation = {}; + var identityRelation = {}; + function isTypeIdenticalTo(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined); + } + function compareTypes(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + } + function isTypeSubtypeOf(source, target) { + return checkTypeSubtypeOf(source, target, undefined); + } + function isTypeAssignableTo(source, target) { + return checkTypeAssignableTo(source, target, undefined); + } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } + function checkTypeAssignableTo(source, target, errorNode, headMessage) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage); + } + function isSignatureAssignableTo(source, target) { + var sourceType = getOrCreateTypeFromSignature(source); + var targetType = getOrCreateTypeFromSignature(target); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + } + function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { + var errorInfo; + var sourceStack; + var targetStack; + var maybeStack; + var expandingFlags; + var depth = 0; + var overflow = false; + ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); + var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + if (overflow) { + error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + } + else if (errorInfo) { + if (containingMessageChain) { + errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); + } + addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); + } + return result !== 0 /* False */; + function reportError(message, arg0, arg1, arg2) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + } + function isRelatedTo(source, target, reportErrors, headMessage) { + var result; + if (relation === identityRelation) { + if (source === target) + return -1 /* True */; + } + else { + if (source === target) + return -1 /* True */; + if (target.flags & 1 /* Any */) + return -1 /* True */; + if (source === undefinedType) + return -1 /* True */; + if (source === nullType && target !== undefinedType) + return -1 /* True */; + if (source.flags & 128 /* Enum */ && target === numberType) + return -1 /* True */; + if (source.flags & 256 /* StringLiteral */ && target === stringType) + return -1 /* True */; + if (relation === assignableRelation) { + if (source.flags & 1 /* Any */) + return -1 /* True */; + if (source === numberType && target.flags & 128 /* Enum */) + return -1 /* True */; + } + } + if (source.flags & 16384 /* Union */) { + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; + } + } + else if (target.flags & 16384 /* Union */) { + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; + } + } + else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; + } + } + else { + var saveErrorInfo = errorInfo; + if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + 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))) { + errorInfo = saveErrorInfo; + return result; + } + } + if (reportErrors) { + headMessage = headMessage || ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + reportError(headMessage, typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + function typeRelatedToUnionType(source, target, reportErrors) { + var targetTypes = target.types; + for (var i = 0, len = targetTypes.length; i < len; i++) { + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; + } + } + return 0 /* False */; + } + function unionTypeRelatedToType(source, target, reportErrors) { + var result = -1 /* True */; + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + var related = isRelatedTo(sourceTypes[i], target, reportErrors); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function typesRelatedTo(sources, targets, reportErrors) { + var result = -1 /* True */; + for (var i = 0, len = sources.length; i < len; i++) { + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function typeParameterRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + if (source.symbol.name !== target.symbol.name) { + return 0 /* False */; + } + if (source.constraint === target.constraint) { + return -1 /* True */; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { + return 0 /* False */; + } + return isRelatedTo(source.constraint, target.constraint, reportErrors); + } + else { + while (true) { + var constraint = getConstraintOfTypeParameter(source); + if (constraint === target) + return -1 /* True */; + if (!(constraint && constraint.flags & 512 /* TypeParameter */)) + break; + source = constraint; + } + return 0 /* False */; + } + } + function objectTypeRelatedTo(source, target, reportErrors) { + if (overflow) { + return 0 /* False */; + } + var id = source.id + "," + target.id; + var related = relation[id]; + if (related !== undefined) { + return related ? -1 /* True */ : 0 /* False */; + } + if (depth > 0) { + for (var i = 0; i < depth; i++) { + if (maybeStack[i][id]) { + return 1 /* Maybe */; + } + } + if (depth === 100) { + overflow = true; + return 0 /* False */; + } + } + else { + sourceStack = []; + targetStack = []; + maybeStack = []; + expandingFlags = 0; + } + sourceStack[depth] = source; + targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = true; + depth++; + var saveExpandingFlags = expandingFlags; + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) + expandingFlags |= 1; + if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) + expandingFlags |= 2; + if (expandingFlags === 3) { + var result = 1 /* Maybe */; + } + else { + var result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); + } + } + } + } + } + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = result === -1 /* True */ || depth === 0 ? relation : maybeStack[depth - 1]; + for (var p in maybeCache) { + destinationCache[p] = maybeCache[p]; + } + } + else { + relation[id] = false; + } + return result; + } + function isDeeplyNestedGeneric(type, stack) { + if (type.flags & 4096 /* Reference */ && depth >= 10) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 /* Reference */ && t.target === target) { + count++; + if (count >= 10) + return true; + } + } + } + return false; + } + function propertiesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return propertiesIdenticalTo(source, target); + } + var result = -1 /* True */; + var properties = getPropertiesOfObjectType(target); + 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 || !isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return 0 /* False */; + } + } + else if (!(targetProp.flags & 536870912 /* Prototype */)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & 32 /* Private */ && targetFlags & 32 /* Private */) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); + } + } + return 0 /* False */; + } + } + else if (targetFlags & 64 /* Protected */) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return 0 /* False */; + } + } + else if (sourceFlags & 64 /* Protected */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0 /* False */; + } + result &= related; + if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + } + } + } + return result; + } + function propertiesIdenticalTo(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return 0 /* False */; + } + var result = -1 /* True */; + for (var i = 0, len = sourceProperties.length; i < len; ++i) { + var sourceProp = sourceProperties[i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp) { + return 0 /* False */; + } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function signaturesRelatedTo(source, target, kind, reportErrors) { + if (relation === identityRelation) { + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1 /* True */; + } + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var result = -1 /* True */; + var saveErrorInfo = errorInfo; + outer: for (var i = 0; i < targetSignatures.length; i++) { + var t = targetSignatures[i]; + if (!t.hasStringLiterals || target.flags & 65536 /* FromSignature */) { + var localErrors = reportErrors; + for (var j = 0; j < sourceSignatures.length; j++) { + var s = sourceSignatures[j]; + if (!s.hasStringLiterals || source.flags & 65536 /* FromSignature */) { + var related = signatureRelatedTo(s, t, localErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; + } + localErrors = false; + } + } + return 0 /* False */; + } + } + return result; + } + function signatureRelatedTo(source, target, reportErrors) { + if (source === target) { + return -1 /* True */; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0 /* False */; + } + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var checkCount; + if (source.hasRestParameter && target.hasRestParameter) { + checkCount = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + checkCount = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + checkCount = sourceMax; + } + else { + checkCount = sourceMax < targetMax ? sourceMax : targetMax; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1 /* True */; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var saveErrorInfo = errorInfo; + var related = isRelatedTo(s, t, reportErrors); + if (!related) { + related = isRelatedTo(t, s, false); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); + } + return 0 /* False */; + } + errorInfo = saveErrorInfo; + } + result &= related; + } + var t = getReturnTypeOfSignature(target); + if (t === voidType) + return result; + var s = getReturnTypeOfSignature(source); + return result & isRelatedTo(s, t, reportErrors); + } + function signaturesIdenticalTo(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return 0 /* False */; + } + var result = -1 /* True */; + for (var i = 0, len = sourceSignatures.length; i < len; ++i) { + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + if (!related) { + return 0 /* False */; + } + result &= related; + } + return result; + } + function stringIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(0 /* String */, source, target); + } + var targetType = getIndexTypeOfType(target, 0 /* String */); + if (targetType) { + var sourceType = getIndexTypeOfType(source, 0 /* String */); + if (!sourceType) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0 /* False */; + } + var related = isRelatedTo(sourceType, targetType, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0 /* False */; + } + return related; + } + return -1 /* True */; + } + function numberIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(1 /* Number */, source, target); + } + var targetType = getIndexTypeOfType(target, 1 /* Number */); + if (targetType) { + var sourceStringType = getIndexTypeOfType(source, 0 /* String */); + var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); + if (!(sourceStringType || sourceNumberType)) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0 /* False */; + } + if (sourceStringType && sourceNumberType) { + var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + } + else { + var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + } + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0 /* False */; + } + return related; + } + return -1 /* True */; + } + function indexTypesIdenticalTo(indexKind, source, target) { + var targetType = getIndexTypeOfType(target, indexKind); + var sourceType = getIndexTypeOfType(source, indexKind); + if (!sourceType && !targetType) { + return -1 /* True */; + } + if (sourceType && targetType) { + return isRelatedTo(sourceType, targetType); + } + return 0 /* False */; + } + } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1 /* True */; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0 /* False */; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0 /* False */; + } + } + else { + if (isOptionalProperty(sourceProp) !== isOptionalProperty(targetProp)) { + return 0 /* False */; + } + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + function compareSignatures(source, target, compareReturnTypes, compareTypes) { + if (source === target) { + return -1 /* True */; + } + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + return 0 /* False */; + } + var result = -1 /* True */; + if (source.typeParameters && target.typeParameters) { + if (source.typeParameters.length !== target.typeParameters.length) { + return 0 /* False */; + } + for (var i = 0, len = source.typeParameters.length; i < len; ++i) { + var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + if (!related) { + return 0 /* False */; + } + result &= related; + } + } + else if (source.typeParameters || source.typeParameters) { + return 0 /* False */; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { + return 0 /* False */; + } + result &= related; + } + if (compareReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; + } + function isSupertypeOfEach(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + return false; + } + return true; + } + function getCommonSupertype(types) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { + var bestSupertype; + var bestSupertypeDownfallType; + var bestSupertypeScore = 0; + for (var i = 0; i < types.length; i++) { + var score = 0; + var downfallType = undefined; + for (var j = 0; j < types.length; j++) { + if (isTypeSubtypeOf(types[j], types[i])) { + score++; + } + else if (!downfallType) { + downfallType = types[j]; + } + } + if (score > bestSupertypeScore) { + bestSupertype = types[i]; + bestSupertypeDownfallType = downfallType; + bestSupertypeScore = score; + } + if (bestSupertypeScore === types.length - 1) { + break; + } + } + 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; + } + function getInnermostTypeOfNestedArrayTypes(type) { + while (isArrayType(type)) { + type = type.typeArguments[0]; + } + return type; + } + function getWidenedType(type, suppressNoImplicitAnyErrors) { + if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + return anyType; + } + if (type.flags & 16384 /* Union */) { + return getWidenedTypeOfUnion(type); + } + if (isTypeOfObjectLiteral(type)) { + return getWidenedTypeOfObjectLiteral(type); + } + if (isArrayType(type)) { + return getWidenedTypeOfArrayLiteral(type); + } + return type; + function getWidenedTypeOfUnion(type) { + return getUnionType(ts.map(type.types, function (t) { return getWidenedType(t, suppressNoImplicitAnyErrors); })); + } + function getWidenedTypeOfObjectLiteral(type) { + var properties = getPropertiesOfObjectType(type); + if (properties.length) { + var widenedTypes = []; + var propTypeWasWidened = false; + ts.forEach(properties, function (p) { + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + propTypeWasWidened = true; + if (!suppressNoImplicitAnyErrors && compilerOptions.noImplicitAny && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(widenedType)); + } + } + widenedTypes.push(widenedType); + }); + if (propTypeWasWidened) { + var members = {}; + var index = 0; + ts.forEach(properties, function (p) { + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */ | p.flags, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedTypes[index++]; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + members[symbol.name] = symbol; + }); + var stringIndexType = getIndexTypeOfType(type, 0 /* String */); + var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + if (stringIndexType) + stringIndexType = getWidenedType(stringIndexType); + if (numberIndexType) + numberIndexType = getWidenedType(numberIndexType); + type = createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + } + } + return type; + } + function getWidenedTypeOfArrayLiteral(type) { + var elementType = type.typeArguments[0]; + var widenedType = getWidenedType(elementType, suppressNoImplicitAnyErrors); + type = elementType !== widenedType ? createArrayType(widenedType) : type; + return type; + } + } + function forEachMatchingParameterType(source, target, callback) { + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var count; + if (source.hasRestParameter && target.hasRestParameter) { + count = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + count = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + count = sourceMax; + } + else { + count = sourceMax < targetMax ? sourceMax : targetMax; + } + for (var i = 0; i < count; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + callback(s, t); + } + } + function createInferenceContext(typeParameters, inferUnionTypes) { + var inferences = []; + for (var i = 0; i < typeParameters.length; i++) { + inferences.push({ primary: undefined, secondary: undefined }); + } + return { + typeParameters: typeParameters, + inferUnionTypes: inferUnionTypes, + inferenceCount: 0, + inferences: inferences, + inferredTypes: new Array(typeParameters.length) + }; + } + function inferTypes(context, source, target) { + var sourceStack; + var targetStack; + var depth = 0; + var inferiority = 0; + inferFromTypes(source, target); + function isInProcess(source, target) { + for (var i = 0; i < depth; i++) { + if (source === sourceStack[i] && target === targetStack[i]) + return true; + } + return false; + } + function isWithinDepthLimit(type, stack) { + if (depth >= 5) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 /* Reference */ && t.target === target) + count++; + } + return count < 5; + } + return true; + } + function inferFromTypes(source, target) { + if (target.flags & 512 /* TypeParameter */) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (target === typeParameters[i]) { + var inferences = context.inferences[i]; + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) + candidates.push(source); + break; + } + } + } + else if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + var sourceTypes = source.typeArguments; + var targetTypes = target.typeArguments; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + else if (target.flags & 16384 /* Union */) { + var targetTypes = target.types; + var typeParameterCount = 0; + var typeParameter; + for (var i = 0; i < targetTypes.length; i++) { + var t = targetTypes[i]; + if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { + typeParameter = t; + typeParameterCount++; + } + else { + inferFromTypes(source, t); + } + } + if (typeParameterCount === 1) { + inferiority++; + inferFromTypes(source, typeParameter); + inferiority--; + } + } + else if (source.flags & 16384 /* Union */) { + var sourceTypes = source.types; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], target); + } + } + else if (source.flags & 48128 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */))) { + if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { + if (depth === 0) { + sourceStack = []; + targetStack = []; + } + sourceStack[depth] = source; + targetStack[depth] = target; + depth++; + inferFromProperties(source, target); + inferFromSignatures(source, target, 0 /* Call */); + inferFromSignatures(source, target, 1 /* Construct */); + inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */); + inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */); + inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */); + depth--; + } + } + } + function inferFromProperties(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfObjectType(source, targetProp.name); + if (sourceProp) { + inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + } + } + function inferFromSignatures(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var sourceLen = sourceSignatures.length; + var targetLen = targetSignatures.length; + var len = sourceLen < targetLen ? sourceLen : targetLen; + for (var i = 0; i < len; i++) { + inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); + } + } + function inferFromSignature(source, target) { + forEachMatchingParameterType(source, target, inferFromTypes); + inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + function inferFromIndexTypes(source, target, sourceKind, targetKind) { + var targetIndexType = getIndexTypeOfType(target, targetKind); + if (targetIndexType) { + var sourceIndexType = getIndexTypeOfType(source, sourceKind); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetIndexType); + } + } + } + } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } + function getInferredType(context, index) { + var inferredType = context.inferredTypes[index]; + if (!inferredType) { + var inferences = getInferenceCandidates(context, index); + if (inferences.length) { + var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; + } + else { + inferredType = emptyObjectType; + } + if (inferredType !== inferenceFailureType) { + var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + } + context.inferredTypes[index] = inferredType; + } + return inferredType; + } + function getInferredTypes(context) { + for (var i = 0; i < context.inferredTypes.length; i++) { + getInferredType(context, i); + } + return context.inferredTypes; + } + function hasAncestor(node, kind) { + return ts.getAncestor(node, kind) !== undefined; + } + function getResolvedSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 /* Value */ | 4194304 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + } + return links.resolvedSymbol; + } + function isInTypeQuery(node) { + while (node) { + switch (node.kind) { + case 135 /* TypeQuery */: + return true; + case 63 /* Identifier */: + case 120 /* QualifiedName */: + node = node.parent; + continue; + default: + return false; + } + } + ts.Debug.fail("should not get here"); + } + function subtractPrimitiveTypes(type, subtractMask) { + 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); })); + } + } + return type; + } + function isVariableAssignedWithin(symbol, node) { + var links = getNodeLinks(node); + if (links.assignmentChecks) { + var cachedResult = links.assignmentChecks[symbol.id]; + if (cachedResult !== undefined) { + return cachedResult; + } + } + else { + links.assignmentChecks = {}; + } + return links.assignmentChecks[symbol.id] = isAssignedIn(node); + function isAssignedInBinaryExpression(node) { + if (node.operator >= 51 /* FirstAssignment */ && node.operator <= 62 /* LastAssignment */) { + var n = node.left; + while (n.kind === 149 /* ParenthesizedExpression */) { + n = n.expression; + } + if (n.kind === 63 /* Identifier */ && getResolvedSymbol(n) === symbol) { + return true; + } + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedInVariableDeclaration(node) { + if (getSymbolOfNode(node) === symbol && node.initializer) { + return true; + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedIn(node) { + switch (node.kind) { + case 157 /* BinaryExpression */: + return isAssignedInBinaryExpression(node); + case 183 /* VariableDeclaration */: + return isAssignedInVariableDeclaration(node); + case 141 /* ArrayLiteralExpression */: + case 142 /* ObjectLiteralExpression */: + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 148 /* TypeAssertionExpression */: + case 149 /* ParenthesizedExpression */: + case 155 /* PrefixUnaryExpression */: + case 152 /* DeleteExpression */: + case 153 /* TypeOfExpression */: + case 154 /* VoidExpression */: + case 156 /* PostfixUnaryExpression */: + case 158 /* ConditionalExpression */: + case 163 /* Block */: + case 164 /* VariableStatement */: + case 166 /* ExpressionStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 174 /* ReturnStatement */: + case 175 /* WithStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + return ts.forEachChild(node, isAssignedIn); + } + return false; + } + } + function resolveLocation(node) { + var containerNodes = []; + for (var parent = node.parent; parent; parent = parent.parent) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { + containerNodes.unshift(parent); + } + } + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); + } + function getSymbolAtLocation(node) { + resolveLocation(node); + return getSymbolInfo(node); + } + function getTypeAtLocation(node) { + resolveLocation(node); + return getTypeOfNode(node); + } + function getTypeOfSymbolAtLocation(symbol, node) { + resolveLocation(node); + return getNarrowedTypeOfSymbol(symbol, node); + } + function getNarrowedTypeOfSymbol(symbol, node) { + var type = getTypeOfSymbol(symbol); + if (node && symbol.flags & 3 /* Variable */ && type.flags & (48128 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { + loop: while (node.parent) { + var child = node; + node = node.parent; + var narrowedType = type; + switch (node.kind) { + case 167 /* IfStatement */: + if (child !== node.expression) { + narrowedType = narrowType(type, node.expression, child === node.thenStatement); + } + break; + case 158 /* ConditionalExpression */: + if (child !== node.condition) { + narrowedType = narrowType(type, node.condition, child === node.whenTrue); + } + break; + case 157 /* BinaryExpression */: + if (child === node.right) { + if (node.operator === 47 /* AmpersandAmpersandToken */) { + narrowedType = narrowType(type, node.left, true); + } + else if (node.operator === 48 /* BarBarToken */) { + narrowedType = narrowType(type, node.left, false); + } + } + break; + case 201 /* SourceFile */: + case 189 /* ModuleDeclaration */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + break loop; + } + if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { + if (isVariableAssignedWithin(symbol, node)) { + break; + } + type = narrowedType; + } + } + } + return type; + function narrowTypeByEquality(type, expr, assumeTrue) { + if (expr.left.kind !== 153 /* TypeOfExpression */ || expr.right.kind !== 7 /* StringLiteral */) { + return type; + } + var left = expr.left; + var right = expr.right; + if (left.expression.kind !== 63 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + return type; + } + var t = right.text; + var checkType = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; + if (expr.operator === 30 /* ExclamationEqualsEqualsToken */) { + assumeTrue = !assumeTrue; + } + if (assumeTrue) { + return checkType === emptyObjectType ? subtractPrimitiveTypes(type, 2 /* String */ | 4 /* Number */ | 8 /* Boolean */) : checkType; + } + else { + return checkType === emptyObjectType ? type : subtractPrimitiveTypes(type, checkType.flags); + } + } + function narrowTypeByAnd(type, expr, assumeTrue) { + if (assumeTrue) { + return narrowType(narrowType(type, expr.left, true), expr.right, true); + } + else { + return getUnionType([ + narrowType(type, expr.left, false), + narrowType(narrowType(type, expr.left, true), expr.right, false) + ]); + } + } + function narrowTypeByOr(type, expr, assumeTrue) { + if (assumeTrue) { + return getUnionType([ + narrowType(type, expr.left, true), + narrowType(narrowType(type, expr.left, false), expr.right, true) + ]); + } + else { + return narrowType(narrowType(type, expr.left, false), expr.right, false); + } + } + function narrowTypeByInstanceof(type, expr, assumeTrue) { + if (!assumeTrue || expr.left.kind !== 63 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + return type; + } + var rightType = checkExpression(expr.right); + if (!isTypeSubtypeOf(rightType, globalFunctionType)) { + return type; + } + var prototypeProperty = getPropertyOfType(rightType, "prototype"); + if (!prototypeProperty) { + return type; + } + var prototypeType = getTypeOfSymbol(prototypeProperty); + return isTypeSubtypeOf(prototypeType, type) ? prototypeType : type; + } + function narrowType(type, expr, assumeTrue) { + switch (expr.kind) { + case 149 /* ParenthesizedExpression */: + return narrowType(type, expr.expression, assumeTrue); + case 157 /* BinaryExpression */: + var operator = expr.operator; + if (operator === 29 /* EqualsEqualsEqualsToken */ || operator === 30 /* ExclamationEqualsEqualsToken */) { + return narrowTypeByEquality(type, expr, assumeTrue); + } + else if (operator === 47 /* AmpersandAmpersandToken */) { + return narrowTypeByAnd(type, expr, assumeTrue); + } + else if (operator === 48 /* BarBarToken */) { + return narrowTypeByOr(type, expr, assumeTrue); + } + else if (operator === 85 /* InstanceOfKeyword */) { + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + break; + case 155 /* PrefixUnaryExpression */: + if (expr.operator === 45 /* ExclamationToken */) { + return narrowType(type, expr.operand, !assumeTrue); + } + break; + } + return type; + } + } + function checkIdentifier(node) { + var symbol = getResolvedSymbol(node); + if (symbol.flags & 33554432 /* Import */) { + getSymbolLinks(symbol).referenced = getSymbolLinks(symbol).referenced || (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol))); + } + checkCollisionWithCapturedSuperVariable(node, node); + checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithIndexVariableInGeneratedCode(node, node); + return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + } + function captureLexicalThis(node, container) { + var classNode = container.parent && container.parent.kind === 185 /* ClassDeclaration */ ? container.parent : undefined; + getNodeLinks(node).flags |= 2 /* LexicalThis */; + if (container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */) { + getNodeLinks(classNode).flags |= 4 /* CaptureThis */; + } + else { + getNodeLinks(container).flags |= 4 /* CaptureThis */; + } + } + function checkThisExpression(node) { + var container = ts.getThisContainer(node, true); + var needToCaptureLexicalThis = false; + if (container.kind === 151 /* ArrowFunction */) { + container = ts.getThisContainer(container, false); + needToCaptureLexicalThis = true; + } + switch (container.kind) { + case 189 /* ModuleDeclaration */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + break; + case 188 /* EnumDeclaration */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + break; + case 126 /* Constructor */: + if (isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + } + break; + case 124 /* Property */: + if (container.flags & 128 /* Static */) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + } + break; + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node, container); + } + var classNode = container.parent && container.parent.kind === 185 /* ClassDeclaration */ ? container.parent : undefined; + if (classNode) { + var symbol = getSymbolOfNode(classNode); + return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + } + return anyType; + } + function getSuperContainer(node) { + while (true) { + node = node.parent; + if (!node) + return node; + switch (node.kind) { + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return node; + } + } + } + function isInConstructorArgumentInitializer(node, constructorDecl) { + for (var n = node; n && n !== constructorDecl; n = n.parent) { + if (n.kind === 123 /* Parameter */) { + return true; + } + } + return false; + } + function checkSuperExpression(node) { + var isCallExpression = node.parent.kind === 145 /* CallExpression */ && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 185 /* ClassDeclaration */); + var baseClass; + if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); + baseClass = classType.baseTypes.length && classType.baseTypes[0]; + } + if (!baseClass) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + return unknownType; + } + var container = getSuperContainer(node); + if (container) { + var canUseSuperExpression = false; + if (isCallExpression) { + canUseSuperExpression = container.kind === 126 /* Constructor */; + } + else { + var needToCaptureLexicalThis = false; + while (container && container.kind === 151 /* ArrowFunction */) { + container = getSuperContainer(container); + needToCaptureLexicalThis = true; + } + if (container && container.parent && container.parent.kind === 185 /* ClassDeclaration */) { + if (container.flags & 128 /* Static */) { + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */; + } + else { + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */ || container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */; + } + } + } + if (canUseSuperExpression) { + var returnType; + if ((container.flags & 128 /* Static */) || isCallExpression) { + getNodeLinks(node).flags |= 32 /* SuperStatic */; + returnType = getTypeOfSymbol(baseClass.symbol); + } + else { + getNodeLinks(node).flags |= 16 /* SuperInstance */; + returnType = baseClass; + } + if (container.kind === 126 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + returnType = unknownType; + } + if (!isCallExpression && needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + return returnType; + } + } + if (isCallExpression) { + error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } + else { + error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + } + return unknownType; + } + function getContextuallyTypedParameterType(parameter) { + if (isFunctionExpressionOrArrowFunction(parameter.parent)) { + var func = parameter.parent; + if (isContextSensitive(func)) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameters(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + } + } + } + } + return undefined; + } + function getContextualTypeForInitializerExpression(node) { + var declaration = node.parent; + if (node === declaration.initializer) { + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 123 /* Parameter */) { + return getContextuallyTypedParameterType(declaration); + } + } + return undefined; + } + function getContextualTypeForReturnExpression(node) { + var func = ts.getContainingFunction(node); + if (func) { + if (func.type || func.kind === 126 /* Constructor */ || func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + } + var signature = getContextualSignatureForFunctionLikeDeclaration(func); + if (signature) { + return getReturnTypeOfSignature(signature); + } + } + return undefined; + } + function getContextualTypeForArgument(callTarget, arg) { + var args = getEffectiveCallArguments(callTarget); + var argIndex = ts.indexOf(args, arg); + if (argIndex >= 0) { + var signature = getResolvedSignature(callTarget); + return getTypeAtPosition(signature, argIndex); + } + return undefined; + } + function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { + if (template.parent.kind === 147 /* TaggedTemplateExpression */) { + return getContextualTypeForArgument(template.parent, substitutionExpression); + } + return undefined; + } + function getContextualTypeForBinaryOperand(node) { + var binaryExpression = node.parent; + var operator = binaryExpression.operator; + if (operator >= 51 /* FirstAssignment */ && operator <= 62 /* LastAssignment */) { + if (node === binaryExpression.right) { + return checkExpression(binaryExpression.left); + } + } + else if (operator === 48 /* BarBarToken */) { + var type = getContextualType(binaryExpression); + if (!type && node === binaryExpression.right) { + type = checkExpression(binaryExpression.left); + } + return type; + } + return undefined; + } + function applyToContextualType(type, mapper) { + if (!(type.flags & 16384 /* Union */)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var i = 0; i < types.length; i++) { + var t = mapper(types[i]); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; + } + function getTypeOfPropertyOfContextualType(type, name) { + return applyToContextualType(type, function (t) { + var prop = getPropertyOfObjectType(t, name); + return prop ? getTypeOfSymbol(prop) : undefined; + }); + } + function getIndexTypeOfContextualType(type, kind) { + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + } + function contextualTypeIsTupleType(type) { + return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getPropertyOfObjectType(t, "0"); }) : getPropertyOfObjectType(type, "0")); + } + function contextualTypeHasIndexSignature(type, kind) { + return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + } + function getContextualTypeForObjectLiteralMethod(node) { + ts.Debug.assert(ts.isObjectLiteralMethod(node)); + if (isInsideWithStatementBody(node)) { + return undefined; + } + return getContextualTypeForObjectLiteralElement(node); + } + 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 */); + } + return undefined; + } + function getContextualTypeForElementExpression(node) { + var arrayLiteral = node.parent; + var type = getContextualType(arrayLiteral); + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */); + } + return undefined; + } + function getContextualTypeForConditionalOperand(node) { + var conditional = node.parent; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + } + function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (node.contextualType) { + return node.contextualType; + } + var parent = node.parent; + switch (parent.kind) { + case 183 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: + return getContextualTypeForInitializerExpression(node); + case 151 /* ArrowFunction */: + case 174 /* ReturnStatement */: + return getContextualTypeForReturnExpression(node); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return getContextualTypeForArgument(parent, node); + case 148 /* TypeAssertionExpression */: + return getTypeFromTypeNode(parent.type); + case 157 /* BinaryExpression */: + return getContextualTypeForBinaryOperand(node); + case 198 /* PropertyAssignment */: + return getContextualTypeForObjectLiteralElement(parent); + case 141 /* ArrayLiteralExpression */: + return getContextualTypeForElementExpression(node); + case 158 /* ConditionalExpression */: + return getContextualTypeForConditionalOperand(node); + case 162 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 159 /* TemplateExpression */); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + } + return undefined; + } + function getNonGenericSignature(type) { + var signatures = getSignaturesOfObjectOrUnionType(type, 0 /* Call */); + if (signatures.length === 1) { + var signature = signatures[0]; + if (!signature.typeParameters) { + return signature; + } + } + } + function isFunctionExpressionOrArrowFunction(node) { + return node.kind === 150 /* FunctionExpression */ || node.kind === 151 /* ArrowFunction */; + } + function getContextualSignatureForFunctionLikeDeclaration(node) { + return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; + } + function getContextualSignature(node) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + if (!type) { + return undefined; + } + if (!(type.flags & 16384 /* Union */)) { + return getNonGenericSignature(type); + } + var signatureList; + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0 /* Call */).length > 1) { + return undefined; + } + var signature = getNonGenericSignature(types[i]); + if (signature) { + if (!signatureList) { + signatureList = [signature]; + } + else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + return undefined; + } + else { + signatureList.push(signature); + } + } + } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; + } + return result; + } + function isInferentialContext(mapper) { + return mapper && mapper !== identityMapper; + } + function checkArrayLiteral(node, contextualMapper) { + var elements = node.elements; + if (!elements.length) { + return createArrayType(undefinedType); + } + var elementTypes = ts.map(elements, function (e) { return checkExpression(e, contextualMapper); }); + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsTupleType(contextualType)) { + return createTupleType(elementTypes); + } + return createArrayType(getUnionType(elementTypes)); + } + function isNumericName(name) { + return (+name).toString() === name; + } + function checkObjectLiteral(node, contextualMapper) { + var members = node.symbol.members; + var properties = {}; + var contextualType = getContextualType(node); + 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]; + var type; + if (memberDecl.kind === 198 /* PropertyAssignment */) { + type = checkExpression(memberDecl.initializer, contextualMapper); + } + else if (memberDecl.kind === 125 /* Method */) { + type = checkObjectLiteralMethod(memberDecl, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 199 /* ShorthandPropertyAssignment */); + type = memberDecl.name.kind === 121 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); + } + var prop = createSymbol(4 /* Property */ | 268435456 /* 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 { + var getAccessor = ts.getDeclarationOfKind(member, 127 /* GetAccessor */); + if (getAccessor) { + checkAccessorDeclaration(getAccessor); + } + var setAccessor = ts.getDeclarationOfKind(member, 128 /* SetAccessor */); + if (setAccessor) { + checkAccessorDeclaration(setAccessor); + } + } + properties[member.name] = member; + } + } + var stringIndexType = getIndexType(0 /* String */); + var numberIndexType = getIndexType(1 /* Number */); + return createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); + 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); + } + } + } + } + return propTypes.length ? getUnionType(propTypes) : undefinedType; + } + return undefined; + } + } + function getDeclarationKindFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.kind : 124 /* Property */; + } + function getDeclarationFlagsFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 536870912 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + } + function checkClassPropertyAccess(node, left, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + return; + } + var enclosingClassDeclaration = ts.getAncestor(node, 185 /* ClassDeclaration */); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + if (flags & 32 /* Private */) { + if (declaringClass !== enclosingClass) { + error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + if (left.kind === 89 /* SuperKeyword */) { + return; + } + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + if (flags & 128 /* Static */) { + return; + } + if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } + } + function checkPropertyAccessExpression(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); + } + function checkQualifiedName(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); + } + function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { + var type = checkExpressionOrQualifiedName(left); + if (type === unknownType) + return type; + if (type !== anyType) { + var apparentType = getApparentType(getWidenedType(type)); + if (apparentType === unknownType) { + return unknownType; + } + var prop = getPropertyOfType(apparentType, right.text); + if (!prop) { + if (right.text) { + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + } + return unknownType; + } + getNodeLinks(node).resolvedSymbol = prop; + if (prop.parent && prop.parent.flags & 32 /* Class */) { + if (left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { + error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + } + else { + checkClassPropertyAccess(node, left, type, prop); + } + } + return getTypeOfSymbol(prop); + } + return anyType; + } + function isValidPropertyAccess(node, propertyName) { + var left = node.kind === 143 /* PropertyAccessExpression */ ? node.expression : node.left; + var type = checkExpressionOrQualifiedName(left); + if (type !== unknownType && type !== anyType) { + var prop = getPropertyOfType(getWidenedType(type), propertyName); + if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { + if (left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { + return false; + } + else { + var diagnosticsCount = diagnostics.length; + checkClassPropertyAccess(node, left, type, prop); + return diagnostics.length === diagnosticsCount; + } + } + } + return true; + } + function checkIndexedAccess(node) { + var objectType = getApparentType(checkExpression(node.expression)); + var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; + if (objectType === unknownType) { + return unknownType; + } + if (isConstEnumObjectType(objectType) && node.argumentExpression && node.argumentExpression.kind !== 7 /* StringLiteral */) { + error(node.argumentExpression, ts.Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string); + } + if (node.argumentExpression) { + if (node.argumentExpression.kind === 7 /* StringLiteral */ || node.argumentExpression.kind === 6 /* NumericLiteral */) { + var name = node.argumentExpression.text; + var prop = getPropertyOfType(objectType, name); + if (prop) { + getNodeLinks(node).resolvedSymbol = prop; + return getTypeOfSymbol(prop); + } + } + } + if (indexType.flags & (1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { + if (indexType.flags & (1 /* Any */ | 132 /* NumberLike */)) { + var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); + if (numberIndexType) { + return numberIndexType; + } + } + var stringIndexType = getIndexTypeOfType(objectType, 0 /* String */); + if (stringIndexType) { + return stringIndexType; + } + if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && objectType !== anyType) { + error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + } + return anyType; + } + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + return unknownType; + } + function resolveUntypedCall(node) { + if (node.kind === 147 /* TaggedTemplateExpression */) { + checkExpression(node.template); + } + else { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } + return anySignature; + } + function resolveErrorCall(node) { + resolveUntypedCall(node); + return unknownSignature; + } + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + if (node.kind === 147 /* TaggedTemplateExpression */) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 159 /* TemplateExpression */) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 9 /* NoSubstitutionTemplateLiteral */); + callIsIncomplete = !!templateLiteral.isUnterminated; + } + } + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 146 /* NewExpression */); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + } + ts.Debug.assert(adjustedArgCount !== undefined, "'adjustedArgCount' undefined"); + ts.Debug.assert(callIsIncomplete !== undefined, "'callIsIncomplete' undefined"); + return checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature); + function checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature) { + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; + } + } + function getSingleCallSignature(type) { + if (type.flags & 48128 /* ObjectType */) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + return resolved.callSignatures[0]; + } + } + return undefined; + } + function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { + var context = createInferenceContext(signature.typeParameters, true); + forEachMatchingParameterType(contextualSignature, signature, function (source, target) { + inferTypes(context, instantiateType(source, contextualMapper), target); + }); + return getSignatureInstantiation(signature, getInferredTypes(context)); + } + function inferTypeArguments(signature, args, excludeArgument) { + var typeParameters = signature.typeParameters; + var context = createInferenceContext(typeParameters, false); + var mapper = createInferenceMapper(context); + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 161 /* OmittedExpression */) { + continue; + } + if (!excludeArgument || excludeArgument[i] === undefined) { + var parameterType = getTypeAtPosition(signature, i); + if (i === 0 && args[i].parent.kind === 147 /* TaggedTemplateExpression */) { + inferTypes(context, globalTemplateStringsArrayType, parameterType); + continue; + } + inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); + } + } + if (excludeArgument) { + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 161 /* OmittedExpression */) { + continue; + } + if (excludeArgument[i] === false) { + var parameterType = getTypeAtPosition(signature, i); + inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); + } + } + } + var inferredTypes = getInferredTypes(context); + context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); + for (var i = 0; i < inferredTypes.length; i++) { + if (inferredTypes[i] === inferenceFailureType) { + inferredTypes[i] = unknownType; + } + } + return context; + } + function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors) { + var typeParameters = signature.typeParameters; + var typeArgumentsAreAssignable = true; + for (var i = 0; i < typeParameters.length; i++) { + var typeArgNode = typeArguments[i]; + var typeArgument = getTypeFromTypeNode(typeArgNode); + typeArgumentResultTypes[i] = typeArgument; + if (typeArgumentsAreAssignable) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + } + return typeArgumentsAreAssignable; + } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var argType; + if (arg.kind === 161 /* OmittedExpression */) { + continue; + } + var paramType = getTypeAtPosition(signature, i); + if (i === 0 && node.kind === 147 /* TaggedTemplateExpression */) { + argType = globalTemplateStringsArrayType; + } + else { + argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + } + var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); + if (!isValidArgument) { + return false; + } + } + return true; + } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 147 /* TaggedTemplateExpression */) { + var template = node.template; + args = [template]; + if (template.kind === 159 /* TemplateExpression */) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } + } + else { + args = node.arguments || emptyArray; + } + return args; + } + function resolveCall(node, signatures, candidatesOutArray) { + var isTaggedTemplate = node.kind === 147 /* TaggedTemplateExpression */; + var typeArguments = isTaggedTemplate ? undefined : node.typeArguments; + ts.forEach(typeArguments, checkSourceElement); + var candidates = candidatesOutArray || []; + collectCandidates(); + if (!candidates.length) { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + return resolveErrorCall(node); + } + var args = getEffectiveCallArguments(node); + var excludeArgument; + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { + if (isContextSensitive(args[i])) { + if (!excludeArgument) { + excludeArgument = new Array(args.length); + } + excludeArgument[i] = true; + } + } + var candidateForArgumentError; + var candidateForTypeArgumentError; + var resultOfFailedInference; + var result; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation); + } + if (!result) { + candidateForArgumentError = undefined; + candidateForTypeArgumentError = undefined; + resultOfFailedInference = undefined; + result = chooseOverload(candidates, assignableRelation); + } + if (result) { + return result; + } + if (candidateForArgumentError) { + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); + } + else if (candidateForTypeArgumentError) { + if (!isTaggedTemplate && node.typeArguments) { + checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true); + } + else { + ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); + var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); + reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + } + } + else { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + } + if (!fullTypeCheck) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (hasCorrectArity(node, args, candidates[i])) { + return candidates[i]; + } + } + } + return resolveErrorCall(node); + function chooseOverload(candidates, relation) { + for (var i = 0; i < candidates.length; i++) { + if (!hasCorrectArity(node, args, candidates[i])) { + continue; + } + var originalCandidate = candidates[i]; + var inferenceResult; + while (true) { + var candidate = originalCandidate; + if (candidate.typeParameters) { + var typeArgumentTypes; + var typeArgumentsAreValid; + if (typeArguments) { + typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + } + else { + inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; + typeArgumentTypes = inferenceResult.inferredTypes; + } + if (!typeArgumentsAreValid) { + break; + } + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + } + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + break; + } + var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + if (index < 0) { + return candidate; + } + excludeArgument[index] = false; + } + if (originalCandidate.typeParameters) { + var instantiatedCandidate = candidate; + if (typeArgumentsAreValid) { + candidateForArgumentError = instantiatedCandidate; + } + else { + candidateForTypeArgumentError = originalCandidate; + if (!typeArguments) { + resultOfFailedInference = inferenceResult; + } + } + } + else { + ts.Debug.assert(originalCandidate === candidate); + candidateForArgumentError = originalCandidate; + } + } + return undefined; + } + function collectCandidates() { + var result = candidates; + var lastParent; + var lastSymbol; + var cutoffPos = 0; + var pos; + ts.Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + pos++; + } + else { + lastParent = parent; + pos = cutoffPos; + } + } + else { + pos = cutoffPos = result.length; + lastParent = parent; + } + lastSymbol = symbol; + for (var j = result.length; j > pos; j--) { + result[j] = result[j - 1]; + } + result[pos] = signature; + } + } + } + function resolveCallExpression(node, candidatesOutArray) { + if (node.expression.kind === 89 /* SuperKeyword */) { + var superType = checkSuperExpression(node.expression); + if (superType !== unknownType) { + return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */), candidatesOutArray); + } + return resolveUntypedCall(node); + } + var funcType = checkExpression(node.expression); + var apparentType = getApparentType(funcType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */); + if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + if (constructSignatures.length) { + error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + } + else { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + } + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function resolveNewExpression(node, candidatesOutArray) { + var expressionType = checkExpression(node.expression); + if (expressionType === anyType) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + expressionType = getApparentType(expressionType); + if (expressionType === unknownType) { + return resolveErrorCall(node); + } + var constructSignatures = getSignaturesOfType(expressionType, 1 /* Construct */); + if (constructSignatures.length) { + return resolveCall(node, constructSignatures, candidatesOutArray); + } + var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); + if (callSignatures.length) { + var signature = resolveCall(node, callSignatures, candidatesOutArray); + if (getReturnTypeOfSignature(signature) !== voidType) { + error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + } + return signature; + } + error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); + return resolveErrorCall(node); + } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function getResolvedSignature(node, candidatesOutArray) { + var links = getNodeLinks(node); + if (!links.resolvedSignature || candidatesOutArray) { + links.resolvedSignature = anySignature; + if (node.kind === 145 /* CallExpression */) { + links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); + } + else if (node.kind === 146 /* NewExpression */) { + links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); + } + else if (node.kind === 147 /* TaggedTemplateExpression */) { + links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); + } + else { + ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); + } + } + return links.resolvedSignature; + } + function checkCallExpression(node) { + var signature = getResolvedSignature(node); + if (node.expression.kind === 89 /* SuperKeyword */) { + return voidType; + } + if (node.kind === 146 /* NewExpression */) { + var declaration = signature.declaration; + if (declaration && declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */ && declaration.kind !== 134 /* ConstructorType */) { + if (compilerOptions.noImplicitAny) { + error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + } + return anyType; + } + } + return getReturnTypeOfSignature(signature); + } + function checkTaggedTemplateExpression(node) { + return getReturnTypeOfSignature(getResolvedSignature(node)); + } + function checkTypeAssertion(node) { + var exprType = checkExpression(node.expression); + var targetType = getTypeFromTypeNode(node.type); + if (fullTypeCheck && targetType !== unknownType) { + var widenedType = getWidenedType(exprType, true); + if (!(isTypeAssignableTo(targetType, widenedType))) { + checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + } + } + return targetType; + } + function getTypeAtPosition(signature, pos) { + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + } + function assignContextualParameterTypes(signature, context, mapper) { + var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); + for (var i = 0; i < len; i++) { + var parameter = signature.parameters[i]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeAtPosition(context, i), mapper); + } + if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { + var parameter = signature.parameters[signature.parameters.length - 1]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + } + } + function getReturnTypeFromBody(func, contextualMapper) { + var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (func.body.kind !== 163 /* Block */) { + var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); + var widenedType = getWidenedType(unwidenedType); + if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + error(func, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeToString(widenedType)); + } + return widenedType; + } + var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); + if (types.length > 0) { + var commonType = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + if (!commonType) { + error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); + return unknownType; + } + var widenedType = getWidenedType(commonType); + if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + var typeName = typeToString(widenedType); + if (func.name) { + error(func, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(func.name), typeName); + } + else { + error(func, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); + } + } + return widenedType; + } + return voidType; + } + function checkAndAggregateReturnExpressionTypes(body, contextualMapper) { + var aggregatedTypes = []; + ts.forEachReturnStatement(body, function (returnStatement) { + var expr = returnStatement.expression; + if (expr) { + var type = checkAndMarkExpression(expr, contextualMapper); + if (!ts.contains(aggregatedTypes, type)) { + aggregatedTypes.push(type); + } + } + }); + return aggregatedTypes; + } + function bodyContainsAReturnStatement(funcBody) { + return ts.forEachReturnStatement(funcBody, function (returnStatement) { + return true; + }); + } + function bodyContainsSingleThrowStatement(body) { + return (body.statements.length === 1) && (body.statements[0].kind === 178 /* ThrowStatement */); + } + function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + if (!fullTypeCheck) { + return; + } + if (returnType === voidType || returnType === anyType) { + return; + } + if (!func.body || func.body.kind !== 163 /* Block */) { + return; + } + var bodyBlock = func.body; + if (bodyContainsAReturnStatement(bodyBlock)) { + return; + } + if (bodyContainsSingleThrowStatement(bodyBlock)) { + return; + } + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); + } + function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + if (contextualMapper === identityMapper) { + return anyFunctionType; + } + var links = getNodeLinks(node); + var type = getTypeOfSymbol(node.symbol); + if (!(links.flags & 64 /* ContextChecked */)) { + var contextualSignature = getContextualSignature(node); + if (!(links.flags & 64 /* ContextChecked */)) { + links.flags |= 64 /* ContextChecked */; + if (contextualSignature) { + var signature = getSignaturesOfType(type, 0 /* Call */)[0]; + if (isContextSensitive(node)) { + assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + } + if (!node.type) { + signature.resolvedReturnType = resolvingType; + var returnType = getReturnTypeFromBody(node, contextualMapper); + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = returnType; + } + } + } + checkSignatureDeclaration(node); + } + } + if (fullTypeCheck && node.kind !== 125 /* Method */) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + } + return type; + } + function checkFunctionExpressionOrObjectLiteralMethodBody(node) { + ts.Debug.assert(node.kind !== 125 /* Method */ || ts.isObjectLiteralMethod(node)); + if (node.type) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (node.body) { + if (node.body.kind === 163 /* Block */) { + checkSourceElement(node.body); + } + else { + var exprType = checkExpression(node.body); + if (node.type) { + checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + } + checkFunctionExpressionBodies(node.body); + } + } + } + function checkArithmeticOperandType(operand, type, diagnostic) { + if (!(type.flags & (1 /* Any */ | 132 /* NumberLike */))) { + error(operand, diagnostic); + return false; + } + return true; + } + function checkReferenceExpression(n, invalidReferenceMessage, constantVarianleMessage) { + function findSymbol(n) { + var symbol = getNodeLinks(n).resolvedSymbol; + return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + } + function isReferenceOrErrorExpression(n) { + switch (n.kind) { + case 63 /* Identifier */: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; + case 143 /* PropertyAccessExpression */: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; + case 144 /* ElementAccessExpression */: + return true; + case 149 /* ParenthesizedExpression */: + return isReferenceOrErrorExpression(n.expression); + default: + return false; + } + } + function isConstVariableReference(n) { + switch (n.kind) { + case 63 /* Identifier */: + case 143 /* PropertyAccessExpression */: + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; + case 144 /* ElementAccessExpression */: + var index = n.argumentExpression; + var symbol = findSymbol(n.expression); + if (symbol && index && index.kind === 7 /* StringLiteral */) { + var name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); + return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; + } + return false; + case 149 /* ParenthesizedExpression */: + return isConstVariableReference(n.expression); + default: + return false; + } + } + if (!isReferenceOrErrorExpression(n)) { + error(n, invalidReferenceMessage); + return false; + } + if (isConstVariableReference(n)) { + error(n, constantVarianleMessage); + return false; + } + return true; + } + function checkDeleteExpression(node) { + var operandType = checkExpression(node.expression); + return booleanType; + } + function checkTypeOfExpression(node) { + var operandType = checkExpression(node.expression); + return stringType; + } + function checkVoidExpression(node) { + var operandType = checkExpression(node.expression); + return undefinedType; + } + function checkPrefixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + switch (node.operator) { + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + return numberType; + case 45 /* ExclamationToken */: + return booleanType; + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + } + return numberType; + } + return unknownType; + } + function checkPostfixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + } + return numberType; + } + function isStructuredType(type) { + if (type.flags & 16384 /* Union */) { + return !ts.forEach(type.types, function (t) { return !isStructuredType(t); }); + } + return (type.flags & (48128 /* ObjectType */ | 512 /* TypeParameter */)) !== 0; + } + function isConstEnumObjectType(type) { + return type.flags & (48128 /* ObjectType */ | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128 /* ConstEnum */) !== 0; + } + function checkInstanceOfExpression(node, leftType, rightType) { + if (!(leftType.flags & 1 /* Any */ || isStructuredType(leftType))) { + 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))) { + error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + } + return booleanType; + } + function checkInExpression(node, leftType, rightType) { + if (leftType !== anyType && leftType !== stringType && leftType !== numberType) { + 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))) { + 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; + } + function checkBinaryExpression(node, contextualMapper) { + var operator = node.operator; + var leftType = checkExpression(node.left, contextualMapper); + var rightType = checkExpression(node.right, contextualMapper); + switch (operator) { + case 34 /* AsteriskToken */: + case 54 /* AsteriskEqualsToken */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 36 /* PercentToken */: + case 56 /* PercentEqualsToken */: + case 33 /* MinusToken */: + case 53 /* MinusEqualsToken */: + case 39 /* LessThanLessThanToken */: + case 57 /* LessThanLessThanEqualsToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: + if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + leftType = rightType; + if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + rightType = leftType; + var suggestedOperator; + if ((leftType.flags & 8 /* Boolean */) && (rightType.flags & 8 /* Boolean */) && (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { + error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operator), ts.tokenToString(suggestedOperator)); + } + else { + var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + if (leftOk && rightOk) { + checkAssignmentOperator(numberType); + } + } + return numberType; + case 32 /* PlusToken */: + case 52 /* PlusEqualsToken */: + if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + leftType = rightType; + if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + rightType = leftType; + var resultType; + if (leftType.flags & 132 /* NumberLike */ && rightType.flags & 132 /* NumberLike */) { + resultType = numberType; + } + else if (leftType.flags & 258 /* StringLike */ || rightType.flags & 258 /* StringLike */) { + resultType = stringType; + } + else if (leftType.flags & 1 /* Any */ || leftType === unknownType || rightType.flags & 1 /* Any */ || rightType === unknownType) { + resultType = anyType; + } + if (!resultType) { + reportOperatorError(); + return anyType; + } + if (operator === 52 /* PlusEqualsToken */) { + checkAssignmentOperator(resultType); + } + return resultType; + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + reportOperatorError(); + } + return booleanType; + case 85 /* InstanceOfKeyword */: + return checkInstanceOfExpression(node, leftType, rightType); + case 84 /* InKeyword */: + return checkInExpression(node, leftType, rightType); + case 47 /* AmpersandAmpersandToken */: + return rightType; + case 48 /* BarBarToken */: + return getUnionType([leftType, rightType]); + case 51 /* EqualsToken */: + checkAssignmentOperator(rightType); + return rightType; + case 22 /* CommaToken */: + return rightType; + } + function getSuggestedBooleanOperator(operator) { + switch (operator) { + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + return 48 /* BarBarToken */; + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + return 30 /* ExclamationEqualsEqualsToken */; + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: + return 47 /* AmpersandAmpersandToken */; + default: + return undefined; + } + } + function checkAssignmentOperator(valueType) { + if (fullTypeCheck && operator >= 51 /* FirstAssignment */ && operator <= 62 /* LastAssignment */) { + var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + if (ok) { + checkTypeAssignableTo(valueType, leftType, node.left, undefined); + } + } + } + function reportOperatorError() { + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + } + } + function checkConditionalExpression(node, contextualMapper) { + checkExpression(node.condition); + var type1 = checkExpression(node.whenTrue, contextualMapper); + var type2 = checkExpression(node.whenFalse, contextualMapper); + return getUnionType([type1, type2]); + } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } + function checkExpressionWithContextualType(node, contextualType, contextualMapper) { + var saveContextualType = node.contextualType; + node.contextualType = contextualType; + var result = checkExpression(node, contextualMapper); + node.contextualType = saveContextualType; + return result; + } + function checkAndMarkExpression(node, contextualMapper) { + var result = checkExpression(node, contextualMapper); + getNodeLinks(node).flags |= 1 /* TypeChecked */; + return result; + } + function checkObjectLiteralMethod(node, contextualMapper) { + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { + if (contextualMapper && contextualMapper !== identityMapper) { + var signature = getSingleCallSignature(type); + if (signature && signature.typeParameters) { + var contextualType = getContextualType(node); + if (contextualType) { + var contextualSignature = getSingleCallSignature(contextualType); + if (contextualSignature && !contextualSignature.typeParameters) { + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + } + } + } + } + return type; + } + function checkExpression(node, contextualMapper) { + return checkExpressionOrQualifiedName(node, contextualMapper); + } + function checkExpressionOrQualifiedName(node, contextualMapper) { + var type; + if (node.kind == 120 /* QualifiedName */) { + type = checkQualifiedName(node); + } + else { + var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 143 /* PropertyAccessExpression */ && node.parent.expression === node) || (node.parent.kind === 144 /* ElementAccessExpression */ && node.parent.expression === node) || ((node.kind === 63 /* Identifier */ || node.kind === 120 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + if (!ok) { + error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); + } + } + return type; + } + function checkExpressionWorker(node, contextualMapper) { + switch (node.kind) { + case 63 /* Identifier */: + return checkIdentifier(node); + case 91 /* ThisKeyword */: + return checkThisExpression(node); + case 89 /* SuperKeyword */: + return checkSuperExpression(node); + case 87 /* NullKeyword */: + return nullType; + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + return booleanType; + case 6 /* NumericLiteral */: + return numberType; + case 159 /* TemplateExpression */: + return checkTemplateExpression(node); + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + return stringType; + case 8 /* RegularExpressionLiteral */: + return globalRegExpType; + case 141 /* ArrayLiteralExpression */: + return checkArrayLiteral(node, contextualMapper); + case 142 /* ObjectLiteralExpression */: + return checkObjectLiteral(node, contextualMapper); + case 143 /* PropertyAccessExpression */: + return checkPropertyAccessExpression(node); + case 144 /* ElementAccessExpression */: + return checkIndexedAccess(node); + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return checkCallExpression(node); + case 147 /* TaggedTemplateExpression */: + return checkTaggedTemplateExpression(node); + case 148 /* TypeAssertionExpression */: + return checkTypeAssertion(node); + case 149 /* ParenthesizedExpression */: + return checkExpression(node.expression); + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 153 /* TypeOfExpression */: + return checkTypeOfExpression(node); + case 152 /* DeleteExpression */: + return checkDeleteExpression(node); + case 154 /* VoidExpression */: + return checkVoidExpression(node); + case 155 /* PrefixUnaryExpression */: + return checkPrefixUnaryExpression(node); + case 156 /* PostfixUnaryExpression */: + return checkPostfixUnaryExpression(node); + case 157 /* BinaryExpression */: + return checkBinaryExpression(node, contextualMapper); + case 158 /* ConditionalExpression */: + return checkConditionalExpression(node, contextualMapper); + case 161 /* OmittedExpression */: + return undefinedType; + } + return unknownType; + } + function checkTypeParameter(node) { + checkSourceElement(node.constraint); + if (fullTypeCheck) { + checkTypeParameterHasIllegalReferencesInConstraint(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); + } + } + function checkParameter(parameterDeclaration) { + checkVariableOrParameterDeclaration(parameterDeclaration); + if (fullTypeCheck) { + checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); + if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 126 /* Constructor */ && parameterDeclaration.parent.body)) { + error(parameterDeclaration, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + if (parameterDeclaration.dotDotDotToken) { + if (!isArrayType(getTypeOfSymbol(parameterDeclaration.symbol))) { + error(parameterDeclaration, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); + } + } + else { + if (parameterDeclaration.initializer && !parameterDeclaration.parent.body) { + error(parameterDeclaration, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + } + } + } + function checkReferencesInInitializer(n) { + if (n.kind === 63 /* Identifier */) { + var referencedSymbol = getNodeLinks(n).resolvedSymbol; + if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { + if (referencedSymbol.valueDeclaration.kind === 123 /* Parameter */) { + if (referencedSymbol.valueDeclaration === parameterDeclaration) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(parameterDeclaration.name)); + return; + } + var enclosingOrReferencedParameter = ts.forEach(parameterDeclaration.parent.parameters, function (p) { return p === parameterDeclaration || p === referencedSymbol.valueDeclaration ? p : undefined; }); + if (enclosingOrReferencedParameter === referencedSymbol.valueDeclaration) { + return; + } + } + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(parameterDeclaration.name), ts.declarationNameToString(n)); + } + } + else { + ts.forEachChild(n, checkReferencesInInitializer); + } + } + if (parameterDeclaration.initializer) { + checkReferencesInInitializer(parameterDeclaration.initializer); + } + } + function checkSignatureDeclaration(node) { + checkTypeParameters(node.typeParameters); + ts.forEach(node.parameters, checkParameter); + if (node.type) { + checkSourceElement(node.type); + } + if (fullTypeCheck) { + checkCollisionWithArgumentsInGeneratedCode(node); + if (compilerOptions.noImplicitAny && !node.type) { + switch (node.kind) { + case 130 /* ConstructSignature */: + error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + case 129 /* CallSignature */: + error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + } + } + } + checkSpecializedSignatureDeclaration(node); + } + function checkTypeForDuplicateIndexSignatures(node) { + if (node.kind === 186 /* InterfaceDeclaration */) { + var nodeSymbol = getSymbolOfNode(node); + if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { + return; + } + } + var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + if (indexSymbol) { + var seenNumericIndexer = false; + var seenStringIndexer = false; + for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { + var declaration = indexSymbol.declarations[i]; + if (declaration.parameters.length == 1 && declaration.parameters[0].type) { + switch (declaration.parameters[0].type.kind) { + case 118 /* StringKeyword */: + if (!seenStringIndexer) { + seenStringIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_string_index_signature); + } + break; + case 116 /* NumberKeyword */: + if (!seenNumericIndexer) { + seenNumericIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_number_index_signature); + } + break; + } + } + } + } + } + function checkPropertyDeclaration(node) { + if (fullTypeCheck) { + checkVariableOrParameterOrPropertyInFullTypeCheck(node); + } + } + function checkMethodDeclaration(node) { + checkFunctionLikeDeclaration(node); + } + function checkConstructorDeclaration(node) { + checkSignatureDeclaration(node); + checkSourceElement(node.body); + var symbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(symbol); + } + if (!node.body) { + return; + } + if (!fullTypeCheck) { + return; + } + function isSuperCallExpression(n) { + return n.kind === 145 /* CallExpression */ && n.expression.kind === 89 /* SuperKeyword */; + } + function containsSuperCall(n) { + if (isSuperCallExpression(n)) { + return true; + } + switch (n.kind) { + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + case 142 /* ObjectLiteralExpression */: return false; + default: return ts.forEachChild(n, containsSuperCall); + } + } + function markThisReferencesAsErrors(n) { + if (n.kind === 91 /* ThisKeyword */) { + error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + } + else if (n.kind !== 150 /* FunctionExpression */ && n.kind !== 184 /* FunctionDeclaration */) { + ts.forEachChild(n, markThisReferencesAsErrors); + } + } + function isInstancePropertyWithInitializer(n) { + return n.kind === 124 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; + } + if (ts.getClassBaseTypeNode(node.parent)) { + if (containsSuperCall(node.body)) { + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + if (superCallShouldBeFirst) { + var statements = node.body.statements; + if (!statements.length || statements[0].kind !== 166 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); + } + else { + markThisReferencesAsErrors(statements[0].expression); + } + } + } + else { + error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + } + } + } + function checkAccessorDeclaration(node) { + if (fullTypeCheck) { + if (node.kind === 127 /* GetAccessor */) { + if (!ts.isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); + } + } + if (!ts.hasComputedNameButNotSymbol(node)) { + var otherKind = node.kind === 127 /* GetAccessor */ ? 128 /* SetAccessor */ : 127 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); + if (otherAccessor) { + if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { + error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); + } + var currentAccessorType = getAnnotatedAccessorType(node); + var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + if (currentAccessorType && otherAccessorType) { + if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { + error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + } + } + } + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + } + } + checkFunctionLikeDeclaration(node); + } + function checkTypeReference(node) { + var type = getTypeFromTypeReferenceNode(node); + if (type !== unknownType && node.typeArguments) { + var len = node.typeArguments.length; + for (var i = 0; i < len; i++) { + checkSourceElement(node.typeArguments[i]); + var constraint = getConstraintOfTypeParameter(type.target.typeParameters[i]); + if (fullTypeCheck && constraint) { + var typeArgument = type.typeArguments[i]; + checkTypeAssignableTo(typeArgument, constraint, node, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + } + } + function checkTypeQuery(node) { + getTypeFromTypeQueryNode(node); + } + function checkTypeLiteral(node) { + ts.forEach(node.members, checkSourceElement); + if (fullTypeCheck) { + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkArrayType(node) { + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + ts.forEach(node.elementTypes, checkSourceElement); + } + function checkUnionType(node) { + ts.forEach(node.types, checkSourceElement); + } + function isPrivateWithinAmbient(node) { + return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); + } + function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { + if (!fullTypeCheck) { + return; + } + var signature = getSignatureFromDeclaration(signatureDeclarationNode); + if (!signature.hasStringLiterals) { + return; + } + if (signatureDeclarationNode.body) { + error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); + return; + } + var signaturesToCheck; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 186 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 129 /* CallSignature */ || signatureDeclarationNode.kind === 130 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 129 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); + var containingType = getDeclaredTypeOfSymbol(containingSymbol); + signaturesToCheck = getSignaturesOfType(containingType, signatureKind); + } + else { + signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); + } + for (var i = 0; i < signaturesToCheck.length; i++) { + var otherSignature = signaturesToCheck[i]; + if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { + return; + } + } + error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + } + function getEffectiveDeclarationFlags(n, flagsToCheck) { + var flags = n.flags; + if (n.parent.kind !== 186 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (!(flags & 2 /* Ambient */)) { + flags |= 1 /* Export */; + } + flags |= 2 /* Ambient */; + } + return flags & flagsToCheck; + } + function checkFunctionOrConstructorSymbol(symbol) { + if (!fullTypeCheck) { + return; + } + function getCanonicalOverload(overloads, implementation) { + var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; + return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; + } + function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { + var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + if (someButNotAllOverloadFlags !== 0) { + var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + ts.forEach(overloads, function (o) { + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; + if (deviation & 1 /* Export */) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + } + else if (deviation & 2 /* Ambient */) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + } + else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + } + }); + } + } + function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { + if (someHaveQuestionToken !== allHaveQuestionToken) { + var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + ts.forEach(overloads, function (o) { + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + if (deviation) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); + } + }); + } + } + var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */; + var someNodeFlags = 0; + var allNodeFlags = flagsToCheck; + var someHaveQuestionToken = false; + var allHaveQuestionToken = true; + var hasOverloads = false; + var bodyDeclaration; + var lastSeenNonAmbientDeclaration; + var previousDeclaration; + var declarations = symbol.declarations; + var isConstructor = (symbol.flags & 16384 /* Constructor */) !== 0; + function reportImplementationExpectedError(node) { + if (node.name && ts.getFullWidth(node.name) === 0) { + return; + } + var seen = false; + var subsequentNode = ts.forEachChild(node.parent, function (c) { + if (seen) { + return c; + } + else { + seen = c === node; + } + }); + if (subsequentNode) { + if (subsequentNode.kind === node.kind) { + var errorNode = subsequentNode.name || subsequentNode; + if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { + ts.Debug.assert(node.kind === 125 /* Method */); + ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); + var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode, diagnostic); + return; + } + else if (subsequentNode.body) { + error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + return; + } + } + } + var errorNode = node.name || node; + if (isConstructor) { + error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); + } + else { + error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + } + } + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536 /* Module */; + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; + for (var i = 0; i < declarations.length; i++) { + var node = declarations[i]; + var inAmbientContext = ts.isInAmbientContext(node); + var inAmbientContextOrInterface = node.parent.kind === 186 /* InterfaceDeclaration */ || node.parent.kind === 136 /* TypeLiteral */ || inAmbientContext; + if (inAmbientContextOrInterface) { + previousDeclaration = undefined; + } + if (node.kind === 184 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { + var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + someNodeFlags |= currentNodeFlags; + allNodeFlags &= currentNodeFlags; + someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node); + allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node); + if (node.body && bodyDeclaration) { + if (isConstructor) { + multipleConstructorImplementation = true; + } + else { + duplicateFunctionDeclaration = true; + } + } + else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); + } + if (node.body) { + if (!bodyDeclaration) { + bodyDeclaration = node; + } + } + else { + hasOverloads = true; + } + previousDeclaration = node; + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } + } + } + if (multipleConstructorImplementation) { + ts.forEach(declarations, function (declaration) { + error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + if (duplicateFunctionDeclaration) { + ts.forEach(declarations, function (declaration) { + error(declaration.name, ts.Diagnostics.Duplicate_function_implementation); + }); + } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); + } + if (hasOverloads) { + checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags); + checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); + if (bodyDeclaration) { + var signatures = getSignaturesOfSymbol(symbol); + var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + if (!bodySignature.hasStringLiterals) { + for (var i = 0, len = signatures.length; i < len; ++i) { + if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { + error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; + } + } + } + } + } + } + function checkExportsOnMergedDeclarations(node) { + if (!fullTypeCheck) { + return; + } + var symbol; + var symbol = node.localSymbol; + if (!symbol) { + symbol = getSymbolOfNode(node); + if (!(symbol.flags & 29360128 /* Export */)) { + return; + } + } + if (ts.getDeclarationOfKind(symbol, node.kind) !== node) { + return; + } + var exportedDeclarationSpaces = 0; + var nonExportedDeclarationSpaces = 0; + ts.forEach(symbol.declarations, function (d) { + var declarationSpaces = getDeclarationSpaces(d); + if (getEffectiveDeclarationFlags(d, 1 /* Export */)) { + exportedDeclarationSpaces |= declarationSpaces; + } + else { + nonExportedDeclarationSpaces |= declarationSpaces; + } + }); + var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + if (commonDeclarationSpace) { + ts.forEach(symbol.declarations, function (d) { + if (getDeclarationSpaces(d) & commonDeclarationSpace) { + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); + } + }); + } + function getDeclarationSpaces(d) { + switch (d.kind) { + case 186 /* InterfaceDeclaration */: + return 8388608 /* ExportType */; + case 189 /* ModuleDeclaration */: + return d.name.kind === 7 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 16777216 /* ExportNamespace */ | 4194304 /* ExportValue */ : 16777216 /* ExportNamespace */; + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + return 8388608 /* ExportType */ | 4194304 /* ExportValue */; + case 191 /* ImportDeclaration */: + var result = 0; + var target = resolveImport(getSymbolOfNode(d)); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); + return result; + default: + return 4194304 /* ExportValue */; + } + } + } + function checkFunctionDeclaration(node) { + checkFunctionLikeDeclaration(node); + if (fullTypeCheck) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + } + } + function checkFunctionLikeDeclaration(node) { + checkSignatureDeclaration(node); + if (!ts.hasComputedNameButNotSymbol(node)) { + var symbol = getSymbolOfNode(node); + var localSymbol = node.localSymbol || symbol; + var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(localSymbol); + } + if (symbol.parent) { + if (ts.getDeclarationOfKind(symbol, node.kind) === node) { + checkFunctionOrConstructorSymbol(symbol); + } + } + } + checkSourceElement(node.body); + if (node.type && !isAccessor(node.kind)) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (fullTypeCheck && compilerOptions.noImplicitAny && !node.body && !node.type) { + if (!isPrivateWithinAmbient(node)) { + var typeName = typeToString(anyType); + if (node.name) { + error(node, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(node.name), typeName); + } + else { + error(node, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); + } + } + } + } + function checkBlock(node) { + ts.forEach(node.statements, checkSourceElement); + if (ts.isFunctionBlock(node) || node.kind === 190 /* ModuleBlock */) { + checkFunctionExpressionBodies(node); + } + } + function checkCollisionWithArgumentsInGeneratedCode(node) { + if (!ts.hasRestParameters(node) || ts.isInAmbientContext(node) || !node.body) { + return; + } + ts.forEach(node.parameters, function (p) { + if (p.name && p.name.text === argumentsSymbol.name) { + error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + } + }); + } + function checkCollisionWithIndexVariableInGeneratedCode(node, name) { + if (!(name && name.text === "_i")) { + return; + } + if (node.kind === 123 /* Parameter */) { + if (node.parent.body && ts.hasRestParameters(node.parent) && !ts.isInAmbientContext(node)) { + error(node, ts.Diagnostics.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter); + } + return; + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol === unknownSymbol) { + return; + } + var current = node; + while (current) { + var definedOnCurrentLevel = ts.forEach(symbol.declarations, function (d) { return d.parent === current ? d : undefined; }); + if (definedOnCurrentLevel) { + return; + } + switch (current.kind) { + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 125 /* Method */: + case 151 /* ArrowFunction */: + case 126 /* Constructor */: + if (ts.hasRestParameters(current)) { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); + return; + } + break; + } + current = current.parent; + } + } + function needCollisionCheckForIdentifier(node, identifier, name) { + if (!identifier || identifier.text !== name) { + return false; + } + if (node.kind === 124 /* Property */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */) { + return false; + } + if (ts.isInAmbientContext(node)) { + return false; + } + if (node.kind === 123 /* Parameter */ && !node.parent.body) { + return false; + } + return true; + } + function checkCollisionWithCapturedThisVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_this")) { + potentialThisCollisions.push(node); + } + } + function checkIfThisIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { + var isDeclaration = node.kind !== 63 /* Identifier */; + if (isDeclaration) { + error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + } + return; + } + current = current.parent; + } + } + function checkCollisionWithCapturedSuperVariable(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "_super")) { + return; + } + var enclosingClass = ts.getAncestor(node, 185 /* ClassDeclaration */); + if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { + return; + } + if (ts.getClassBaseTypeNode(enclosingClass)) { + var isDeclaration = node.kind !== 63 /* Identifier */; + if (isDeclaration) { + error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); + } + } + } + function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { + return; + } + if (node.kind === 189 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + return; + } + var parent = node.kind === 183 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 201 /* SourceFile */ && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkCollisionWithConstDeclarations(node) { + if (node.initializer && (node.flags & 6144 /* BlockScoped */) === 0) { + var symbol = getSymbolOfNode(node); + if (symbol.flags & 1 /* FunctionScopedVariable */) { + var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, undefined, undefined); + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 4096 /* Const */) { + error(node, ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + } + } + } + } + } + function checkVariableOrParameterOrPropertyInFullTypeCheck(node) { + ts.Debug.assert(fullTypeCheck); + checkSourceElement(node.type); + if (ts.hasComputedNameButNotSymbol(node)) { + return node.initializer ? checkAndMarkExpression(node.initializer) : anyType; + } + var symbol = getSymbolOfNode(node); + var type; + if (symbol.valueDeclaration !== node) { + type = getTypeOfVariableOrParameterOrPropertyDeclaration(node); + } + else { + type = getTypeOfVariableOrParameterOrProperty(symbol); + } + if (node.initializer && !(getNodeLinks(node.initializer).flags & 1 /* TypeChecked */)) { + checkTypeAssignableTo(checkAndMarkExpression(node.initializer), type, node, undefined); + } + return type; + } + function checkVariableOrParameterDeclaration(node) { + if (fullTypeCheck) { + var type = checkVariableOrParameterOrPropertyInFullTypeCheck(node); + checkExportsOnMergedDeclarations(node); + if (node.initializer) { + checkCollisionWithConstDeclarations(node); + } + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + var symbol = getSymbolOfNode(node); + if (node !== symbol.valueDeclaration) { + var typeOfValueDeclaration = getTypeOfVariableOrParameterOrProperty(symbol); + if (typeOfValueDeclaration !== unknownType && type !== unknownType && !isTypeIdenticalTo(typeOfValueDeclaration, type)) { + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type)); + } + } + } + } + function checkVariableStatement(node) { + ts.forEach(node.declarations, checkVariableOrParameterDeclaration); + } + function checkExpressionStatement(node) { + checkExpression(node.expression); + } + function checkIfStatement(node) { + checkExpression(node.expression); + checkSourceElement(node.thenStatement); + checkSourceElement(node.elseStatement); + } + function checkDoStatement(node) { + checkSourceElement(node.statement); + checkExpression(node.expression); + } + function checkWhileStatement(node) { + checkExpression(node.expression); + checkSourceElement(node.statement); + } + function checkForStatement(node) { + if (node.declarations) + ts.forEach(node.declarations, checkVariableOrParameterDeclaration); + if (node.initializer) + checkExpression(node.initializer); + if (node.condition) + checkExpression(node.condition); + if (node.iterator) + checkExpression(node.iterator); + checkSourceElement(node.statement); + } + function checkForInStatement(node) { + if (node.declarations) { + if (node.declarations.length >= 1) { + var decl = node.declarations[0]; + checkVariableOrParameterDeclaration(decl); + if (decl.type) { + error(decl, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); + } + } + } + if (node.variable) { + var exprType = checkExpression(node.variable); + if (exprType !== anyType && exprType !== stringType) { + error(node.variable, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + } + else { + checkReferenceExpression(node.variable, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + } + } + var exprType = checkExpression(node.expression); + if (!(exprType.flags & 1 /* Any */ || isStructuredType(exprType))) { + 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); + } + function checkBreakOrContinueStatement(node) { + } + function checkReturnStatement(node) { + if (node.expression && !(getNodeLinks(node.expression).flags & 1 /* TypeChecked */)) { + var func = ts.getContainingFunction(node); + if (func) { + if (func.kind === 128 /* SetAccessor */) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } + } + else { + var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + var checkAssignability = func.type || (func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))); + if (checkAssignability) { + checkTypeAssignableTo(checkExpression(node.expression), returnType, node.expression, undefined); + } + else if (func.kind == 126 /* Constructor */) { + if (!isTypeAssignableTo(checkExpression(node.expression), returnType)) { + error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + } + } + } + } + } + } + function checkWithStatement(node) { + checkExpression(node.expression); + error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); + } + function checkSwitchStatement(node) { + var expressionType = checkExpression(node.expression); + ts.forEach(node.clauses, function (clause) { + if (fullTypeCheck && clause.kind === 194 /* CaseClause */) { + var caseClause = clause; + var caseType = checkExpression(caseClause.expression); + if (!isTypeAssignableTo(expressionType, caseType)) { + checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + } + } + ts.forEach(clause.statements, checkSourceElement); + }); + } + function checkLabeledStatement(node) { + checkSourceElement(node.statement); + } + function checkThrowStatement(node) { + if (node.expression) { + checkExpression(node.expression); + } + } + function checkTryStatement(node) { + checkBlock(node.tryBlock); + if (node.catchClause) + checkBlock(node.catchClause.block); + if (node.finallyBlock) + 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 */); + var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + 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 */); + }); + } + var errorNode; + if (stringIndexType && numberIndexType) { + errorNode = declaredNumberIndexer || declaredStringIndexer; + if (!errorNode && (type.flags & 2048 /* Interface */)) { + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0 /* String */) && getIndexTypeOfType(base, 1 /* Number */); }); + errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; + } + } + 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 checkTypeNameIsReserved(name, message) { + switch (name.text) { + case "any": + case "number": + case "boolean": + case "string": + case "void": + error(name, message, name.text); + } + } + function checkTypeParameters(typeParameterDeclarations) { + if (typeParameterDeclarations) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { + var node = typeParameterDeclarations[i]; + checkTypeParameter(node); + if (fullTypeCheck) { + for (var j = 0; j < i; j++) { + if (typeParameterDeclarations[j].symbol === node.symbol) { + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); + } + } + } + } + } + } + function checkClassDeclaration(node) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); + checkTypeParameters(node.typeParameters); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var staticType = getTypeOfSymbol(symbol); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitExtends = emitExtends || !ts.isInAmbientContext(node); + checkTypeReference(baseTypeNode); + } + if (type.baseTypes.length) { + if (fullTypeCheck) { + var baseType = type.baseTypes[0]; + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + var staticBaseType = getTypeOfSymbol(baseType.symbol); + checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); + if (baseType.symbol !== resolveEntityName(node, baseTypeNode.typeName, 107455 /* Value */)) { + error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); + } + checkKindsOfPropertyMemberOverrides(type, baseType); + } + checkExpressionOrQualifiedName(baseTypeNode.typeName); + } + var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (implementedTypeNodes) { + ts.forEach(implementedTypeNodes, function (typeRefNode) { + checkTypeReference(typeRefNode); + if (fullTypeCheck) { + var t = getTypeFromTypeReferenceNode(typeRefNode); + if (t !== unknownType) { + var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; + if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { + checkTypeAssignableTo(type, t, node.name, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + } + else { + error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); + } + } + } + }); + } + ts.forEach(node.members, checkSourceElement); + if (fullTypeCheck) { + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function getTargetSymbol(s) { + return s.flags & 67108864 /* Instantiated */ ? getSymbolLinks(s).target : s; + } + function checkKindsOfPropertyMemberOverrides(type, baseType) { + var baseProperties = getPropertiesOfObjectType(baseType); + for (var i = 0, len = baseProperties.length; i < len; ++i) { + var base = getTargetSymbol(baseProperties[i]); + if (base.flags & 536870912 /* Prototype */) { + continue; + } + var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + if (derived) { + var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { + continue; + } + if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { + continue; + } + if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & 98308 /* PropertyOrAccessor */) && (derived.flags & 98308 /* PropertyOrAccessor */))) { + continue; + } + var errorMessage; + if (base.flags & 8192 /* Method */) { + if (derived.flags & 98304 /* Accessor */) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; + } + else { + ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; + } + } + else if (base.flags & 4 /* Property */) { + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + } + else { + ts.Debug.assert((base.flags & 98304 /* Accessor */) !== 0); + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + } + error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + } + } + } + function isAccessor(kind) { + return kind === 127 /* GetAccessor */ || kind === 128 /* SetAccessor */; + } + function areTypeParametersIdentical(list1, list2) { + if (!list1 && !list2) { + return true; + } + if (!list1 || !list2 || list1.length !== list2.length) { + return false; + } + for (var i = 0, len = list1.length; i < len; i++) { + var tp1 = list1[i]; + var tp2 = list2[i]; + if (tp1.name.text !== tp2.name.text) { + return false; + } + if (!tp1.constraint && !tp2.constraint) { + continue; + } + if (!tp1.constraint || !tp2.constraint) { + return false; + } + if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + return false; + } + } + return true; + } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + if (!type.baseTypes.length || type.baseTypes.length === 1) { + return true; + } + var seen = {}; + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { prop: p, containingType: type }; + }); + var ok = true; + for (var i = 0, len = type.baseTypes.length; i < len; ++i) { + var base = type.baseTypes[i]; + var properties = getPropertiesOfObjectType(base); + for (var j = 0, proplen = properties.length; j < proplen; ++j) { + var prop = properties[j]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, program.getCompilerHost().getNewLine())); + } + } + } + } + return ok; + } + function checkInterfaceDeclaration(node) { + checkTypeParameters(node.typeParameters); + if (fullTypeCheck) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 186 /* InterfaceDeclaration */); + if (symbol.declarations.length > 1) { + if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); + } + } + if (node === firstInterfaceDecl) { + var type = getDeclaredTypeOfSymbol(symbol); + if (checkInheritedPropertiesAreIdentical(type, node.name)) { + ts.forEach(type.baseTypes, function (baseType) { + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + }); + checkIndexConstraints(type); + } + } + } + ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(node.members, checkSourceElement); + if (fullTypeCheck) { + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkTypeAliasDeclaration(node) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); + checkSourceElement(node.type); + } + function computeEnumMemberValues(node) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 128 /* EnumValuesComputed */)) { + var enumSymbol = getSymbolOfNode(node); + var enumType = getDeclaredTypeOfSymbol(enumSymbol); + var autoValue = 0; + var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConst(node); + ts.forEach(node.members, function (member) { + if (isNumericName(member.name.text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + var initializer = member.initializer; + if (initializer) { + autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); + if (autoValue === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + else if (ambient && !enumIsConst) { + autoValue = undefined; + } + if (autoValue !== undefined) { + getNodeLinks(member).enumMemberValue = autoValue++; + } + }); + nodeLinks.flags |= 128 /* EnumValuesComputed */; + } + function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { + return evalConstant(initializer); + function evalConstant(e) { + switch (e.kind) { + case 155 /* PrefixUnaryExpression */: + var value = evalConstant(e.operand); + if (value === undefined) { + return undefined; + } + switch (e.operator) { + case 32 /* PlusToken */: return value; + case 33 /* MinusToken */: return -value; + case 46 /* TildeToken */: return enumIsConst ? ~value : undefined; + } + return undefined; + case 157 /* BinaryExpression */: + if (!enumIsConst) { + return undefined; + } + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operator) { + case 43 /* BarToken */: return left | right; + case 42 /* AmpersandToken */: return left & right; + case 40 /* GreaterThanGreaterThanToken */: return left >> right; + case 41 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 39 /* LessThanLessThanToken */: return left << right; + case 44 /* CaretToken */: return left ^ right; + case 34 /* AsteriskToken */: return left * right; + case 35 /* SlashToken */: return left / right; + case 32 /* PlusToken */: return left + right; + case 33 /* MinusToken */: return left - right; + case 36 /* PercentToken */: return left % right; + } + return undefined; + case 6 /* NumericLiteral */: + return +e.text; + case 149 /* ParenthesizedExpression */: + return enumIsConst ? evalConstant(e.expression) : undefined; + case 63 /* Identifier */: + case 144 /* ElementAccessExpression */: + case 143 /* PropertyAccessExpression */: + if (!enumIsConst) { + return undefined; + } + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType; + var propertyName; + if (e.kind === 63 /* Identifier */) { + enumType = currentType; + propertyName = e.text; + } + else { + if (e.kind === 144 /* ElementAccessExpression */) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 7 /* StringLiteral */) { + return undefined; + } + var enumType = getTypeOfNode(e.expression); + propertyName = e.argumentExpression.text; + } + else { + var enumType = getTypeOfNode(e.expression); + propertyName = e.name.text; + } + if (enumType !== currentType) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType, propertyName); + if (!property || !(property.flags & 8 /* EnumMember */)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isDefinedBefore(propertyDecl, member)) { + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } + } + } + } + function checkEnumDeclaration(node) { + if (!fullTypeCheck) { + return; + } + checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + computeEnumMemberValues(node); + var enumSymbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); + if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + var enumIsConst = ts.isConst(node); + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } + var seenEnumMissingInitialInitializer = false; + ts.forEach(enumSymbol.declarations, function (declaration) { + if (declaration.kind !== 188 /* EnumDeclaration */) { + return false; + } + var enumDeclaration = declaration; + if (!enumDeclaration.members.length) { + return false; + } + var firstEnumMember = enumDeclaration.members[0]; + if (!firstEnumMember.initializer) { + if (seenEnumMissingInitialInitializer) { + error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + } + else { + seenEnumMissingInitialInitializer = true; + } + } + }); + } + } + function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if ((declaration.kind === 185 /* ClassDeclaration */ || (declaration.kind === 184 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + return declaration; + } + } + return undefined; + } + function checkModuleDeclaration(node) { + if (fullTypeCheck) { + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node)) { + var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + if (classOrFunc) { + if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + } + else if (node.pos < classOrFunc.pos) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + } + } + } + if (node.name.kind === 7 /* StringLiteral */) { + if (!isGlobalSourceFile(node.parent)) { + error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + } + if (isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name); + } + } + } + checkSourceElement(node.body); + } + function getFirstIdentifier(node) { + while (node.kind === 120 /* QualifiedName */) { + node = node.left; + } + return node; + } + function checkImportDeclaration(node) { + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + var symbol = getSymbolOfNode(node); + var target; + if (ts.isInternalModuleImportDeclaration(node)) { + target = resolveImport(symbol); + if (target !== unknownSymbol) { + if (target.flags & 107455 /* Value */) { + var moduleName = getFirstIdentifier(node.moduleReference); + if (resolveEntityName(node, moduleName, 107455 /* Value */ | 1536 /* Namespace */).flags & 1536 /* Namespace */) { + checkExpressionOrQualifiedName(node.moduleReference); + } + else { + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); + } + } + if (target.flags & 3152352 /* Type */) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); + } + } + } + else { + if (node.parent.kind === 201 /* SourceFile */) { + target = resolveImport(symbol); + } + else if (node.parent.kind === 190 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { + if (ts.getExternalModuleImportDeclarationExpression(node).kind === 7 /* StringLiteral */) { + if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { + error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + target = unknownSymbol; + } + else { + target = resolveImport(symbol); + } + } + else { + target = unknownSymbol; + } + } + else { + target = unknownSymbol; + } + } + if (target !== unknownSymbol) { + var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | (symbol.flags & 3152352 /* Type */ ? 3152352 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); + if (target.flags & excludedMeanings) { + error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); + } + } + } + function checkExportAssignment(node) { + var container = node.parent; + if (container.kind !== 201 /* SourceFile */) { + container = container.parent; + } + checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); + } + function checkSourceElement(node) { + if (!node) + return; + switch (node.kind) { + case 122 /* TypeParameter */: + return checkTypeParameter(node); + case 123 /* Parameter */: + return checkParameter(node); + case 124 /* Property */: + return checkPropertyDeclaration(node); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return checkSignatureDeclaration(node); + case 125 /* Method */: + return checkMethodDeclaration(node); + case 126 /* Constructor */: + return checkConstructorDeclaration(node); + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return checkAccessorDeclaration(node); + case 132 /* TypeReference */: + return checkTypeReference(node); + case 135 /* TypeQuery */: + return checkTypeQuery(node); + case 136 /* TypeLiteral */: + return checkTypeLiteral(node); + case 137 /* ArrayType */: + return checkArrayType(node); + case 138 /* TupleType */: + return checkTupleType(node); + case 139 /* UnionType */: + return checkUnionType(node); + case 140 /* ParenthesizedType */: + return checkSourceElement(node.type); + case 184 /* FunctionDeclaration */: + return checkFunctionDeclaration(node); + case 163 /* Block */: + case 190 /* ModuleBlock */: + return checkBlock(node); + case 164 /* VariableStatement */: + return checkVariableStatement(node); + case 166 /* ExpressionStatement */: + return checkExpressionStatement(node); + case 167 /* IfStatement */: + return checkIfStatement(node); + case 168 /* DoStatement */: + return checkDoStatement(node); + case 169 /* WhileStatement */: + return checkWhileStatement(node); + case 170 /* ForStatement */: + return checkForStatement(node); + case 171 /* ForInStatement */: + return checkForInStatement(node); + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + return checkBreakOrContinueStatement(node); + case 174 /* ReturnStatement */: + return checkReturnStatement(node); + case 175 /* WithStatement */: + return checkWithStatement(node); + case 176 /* SwitchStatement */: + return checkSwitchStatement(node); + case 177 /* LabeledStatement */: + return checkLabeledStatement(node); + case 178 /* ThrowStatement */: + return checkThrowStatement(node); + case 179 /* TryStatement */: + return checkTryStatement(node); + case 183 /* VariableDeclaration */: + return ts.Debug.fail("Checker encountered variable declaration"); + case 185 /* ClassDeclaration */: + return checkClassDeclaration(node); + case 186 /* InterfaceDeclaration */: + return checkInterfaceDeclaration(node); + case 187 /* TypeAliasDeclaration */: + return checkTypeAliasDeclaration(node); + case 188 /* EnumDeclaration */: + return checkEnumDeclaration(node); + case 189 /* ModuleDeclaration */: + return checkModuleDeclaration(node); + case 191 /* ImportDeclaration */: + return checkImportDeclaration(node); + case 192 /* ExportAssignment */: + return checkExportAssignment(node); + } + } + function checkFunctionExpressionBodies(node) { + switch (node.kind) { + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + checkFunctionExpressionOrObjectLiteralMethodBody(node); + break; + case 125 /* Method */: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + if (ts.isObjectLiteralMethod(node)) { + checkFunctionExpressionOrObjectLiteralMethodBody(node); + } + break; + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + break; + case 175 /* WithStatement */: + checkFunctionExpressionBodies(node.expression); + break; + case 123 /* Parameter */: + case 124 /* Property */: + case 141 /* ArrayLiteralExpression */: + case 142 /* ObjectLiteralExpression */: + case 198 /* PropertyAssignment */: + case 143 /* PropertyAccessExpression */: + case 144 /* ElementAccessExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 147 /* TaggedTemplateExpression */: + case 159 /* TemplateExpression */: + case 162 /* TemplateSpan */: + case 148 /* TypeAssertionExpression */: + case 149 /* ParenthesizedExpression */: + case 153 /* TypeOfExpression */: + case 154 /* VoidExpression */: + case 152 /* DeleteExpression */: + case 155 /* PrefixUnaryExpression */: + case 156 /* PostfixUnaryExpression */: + case 157 /* BinaryExpression */: + case 158 /* ConditionalExpression */: + case 163 /* Block */: + case 190 /* ModuleBlock */: + case 164 /* VariableStatement */: + case 166 /* ExpressionStatement */: + case 167 /* IfStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 172 /* ContinueStatement */: + case 173 /* BreakStatement */: + case 174 /* ReturnStatement */: + case 176 /* SwitchStatement */: + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + case 183 /* VariableDeclaration */: + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + case 200 /* EnumMember */: + case 201 /* SourceFile */: + ts.forEachChild(node, checkFunctionExpressionBodies); + break; + } + } + function checkSourceFile(node) { + var links = getNodeLinks(node); + if (!(links.flags & 1 /* TypeChecked */)) { + emitExtends = false; + potentialThisCollisions.length = 0; + ts.forEach(node.statements, checkSourceElement); + checkFunctionExpressionBodies(node); + if (ts.isExternalModule(node)) { + var symbol = getExportAssignmentSymbol(node.symbol); + if (symbol && symbol.flags & 33554432 /* Import */) { + getSymbolLinks(symbol).referenced = true; + } + } + if (potentialThisCollisions.length) { + ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); + potentialThisCollisions.length = 0; + } + if (emitExtends) { + links.flags |= 8 /* EmitExtends */; + } + links.flags |= 1 /* TypeChecked */; + } + } + function getSortedDiagnostics() { + ts.Debug.assert(fullTypeCheck, "diagnostics are available only in the full typecheck mode"); + if (diagnosticsModified) { + diagnostics.sort(ts.compareDiagnostics); + diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); + diagnosticsModified = false; + } + return diagnostics; + } + function getDiagnostics(sourceFile) { + if (sourceFile) { + checkSourceFile(sourceFile); + return ts.filter(getSortedDiagnostics(), function (d) { return d.file === sourceFile; }); + } + ts.forEach(program.getSourceFiles(), checkSourceFile); + return getSortedDiagnostics(); + } + function getDeclarationDiagnostics(targetSourceFile) { + var resolver = createResolver(); + checkSourceFile(targetSourceFile); + return ts.getDeclarationDiagnostics(program, resolver, targetSourceFile); + } + function getGlobalDiagnostics() { + return ts.filter(getSortedDiagnostics(), function (d) { return !d.file; }); + } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 175 /* WithStatement */ && node.parent.statement === node) { + return true; + } + node = node.parent; + } + } + return false; + } + function getSymbolsInScope(location, meaning) { + var symbols = {}; + var memberFlags = 0; + function copySymbol(symbol, meaning) { + if (symbol.flags & meaning) { + var id = symbol.name; + if (!isReservedMemberName(id) && !ts.hasProperty(symbols, id)) { + symbols[id] = symbol; + } + } + } + function copySymbols(source, meaning) { + if (meaning) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + copySymbol(source[id], meaning); + } + } + } + } + if (isInsideWithStatementBody(location)) { + return []; + } + while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + copySymbols(location.locals, meaning); + } + switch (location.kind) { + case 201 /* SourceFile */: + if (!ts.isExternalModule(location)) + break; + case 189 /* ModuleDeclaration */: + copySymbols(getSymbolOfNode(location).exports, meaning & 35653619 /* ModuleMember */); + break; + case 188 /* EnumDeclaration */: + copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + if (!(memberFlags & 128 /* Static */)) { + copySymbols(getSymbolOfNode(location).members, meaning & 3152352 /* Type */); + } + break; + case 150 /* FunctionExpression */: + if (location.name) { + copySymbol(location.symbol, meaning); + } + break; + case 197 /* CatchClause */: + if (location.name.text) { + copySymbol(location.symbol, meaning); + } + break; + } + memberFlags = location.flags; + location = location.parent; + } + copySymbols(globals, meaning); + return ts.mapToArray(symbols); + } + function isTypeDeclarationName(name) { + return name.kind == 63 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + } + function isTypeDeclaration(node) { + switch (node.kind) { + case 122 /* TypeParameter */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 188 /* EnumDeclaration */: + return true; + } + } + function isTypeReferenceIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 120 /* QualifiedName */) + node = node.parent; + return node.parent && node.parent.kind === 132 /* TypeReference */; + } + function isTypeNode(node) { + if (132 /* FirstTypeNode */ <= node.kind && node.kind <= 140 /* LastTypeNode */) { + return true; + } + switch (node.kind) { + case 109 /* AnyKeyword */: + case 116 /* NumberKeyword */: + case 118 /* StringKeyword */: + case 110 /* BooleanKeyword */: + return true; + case 97 /* VoidKeyword */: + return node.parent.kind !== 154 /* VoidExpression */; + case 7 /* StringLiteral */: + return node.parent.kind === 123 /* Parameter */; + case 63 /* Identifier */: + if (node.parent.kind === 120 /* QualifiedName */ && node.parent.right === node) { + node = node.parent; + } + case 120 /* QualifiedName */: + ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 120 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + var parent = node.parent; + if (parent.kind === 135 /* TypeQuery */) { + return false; + } + if (132 /* FirstTypeNode */ <= parent.kind && parent.kind <= 140 /* LastTypeNode */) { + return true; + } + switch (parent.kind) { + case 122 /* TypeParameter */: + return node === parent.constraint; + case 124 /* Property */: + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + return node === parent.type; + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 126 /* Constructor */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return node === parent.type; + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return node === parent.type; + case 148 /* TypeAssertionExpression */: + return node === parent.type; + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 147 /* TaggedTemplateExpression */: + return false; + } + } + return false; + } + function isInRightSideOfImportOrExportAssignment(node) { + while (node.parent.kind === 120 /* QualifiedName */) { + node = node.parent; + } + if (node.parent.kind === 191 /* ImportDeclaration */) { + return node.parent.moduleReference === node; + } + if (node.parent.kind === 192 /* ExportAssignment */) { + return node.parent.exportName === node; + } + return false; + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 120 /* QualifiedName */ && node.parent.right === node) || (node.parent.kind === 143 /* PropertyAccessExpression */ && node.parent.name === node); + } + function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { + return getSymbolOfNode(entityName.parent); + } + if (entityName.parent.kind === 192 /* ExportAssignment */) { + return resolveEntityName(entityName.parent.parent, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */ | 33554432 /* Import */); + } + if (entityName.kind !== 143 /* PropertyAccessExpression */) { + if (isInRightSideOfImportOrExportAssignment(entityName)) { + return getSymbolOfPartOfRightHandSideOfImport(entityName); + } + } + if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (ts.isExpression(entityName)) { + if (ts.getFullWidth(entityName) === 0) { + return undefined; + } + if (entityName.kind === 63 /* Identifier */) { + var meaning = 107455 /* Value */ | 33554432 /* Import */; + return resolveEntityName(entityName, entityName, meaning); + } + else if (entityName.kind === 143 /* PropertyAccessExpression */) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkPropertyAccessExpression(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + else if (entityName.kind === 120 /* QualifiedName */) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkQualifiedName(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + } + else if (isTypeReferenceIdentifier(entityName)) { + var meaning = entityName.parent.kind === 132 /* TypeReference */ ? 3152352 /* Type */ : 1536 /* Namespace */; + meaning |= 33554432 /* Import */; + return resolveEntityName(entityName, entityName, meaning); + } + return undefined; + } + function getSymbolInfo(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getSymbolOfNode(node.parent); + } + if (node.kind === 63 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 192 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + } + switch (node.kind) { + case 63 /* Identifier */: + case 143 /* PropertyAccessExpression */: + case 120 /* QualifiedName */: + return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + var type = checkExpression(node); + return type.symbol; + case 111 /* ConstructorKeyword */: + var constructorDeclaration = node.parent; + if (constructorDeclaration && constructorDeclaration.kind === 126 /* Constructor */) { + return constructorDeclaration.parent.symbol; + } + return undefined; + case 7 /* StringLiteral */: + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + var importSymbol = getSymbolOfNode(node.parent.parent); + var moduleType = getTypeOfSymbol(importSymbol); + return moduleType ? moduleType.symbol : undefined; + } + case 6 /* NumericLiteral */: + if (node.parent.kind == 144 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + var objectType = checkExpression(node.parent.expression); + if (objectType === unknownType) + return undefined; + var apparentType = getApparentType(objectType); + if (apparentType === unknownType) + return undefined; + return getPropertyOfType(apparentType, node.text); + } + break; + } + return undefined; + } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 199 /* ShorthandPropertyAssignment */) { + return resolveEntityName(location, location.name, 107455 /* Value */); + } + return undefined; + } + function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; + } + if (ts.isExpression(node)) { + return getTypeOfExpression(node); + } + if (isTypeNode(node)) { + return getTypeFromTypeNode(node); + } + if (isTypeDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getDeclaredTypeOfSymbol(symbol); + } + if (isTypeDeclarationName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + } + if (ts.isDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getTypeOfSymbol(symbol); + } + if (isInRightSideOfImportOrExportAssignment(node)) { + var symbol = getSymbolInfo(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + } + return unknownType; + } + function getTypeOfExpression(expr) { + if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + expr = expr.parent; + } + return checkExpression(expr); + } + function getAugmentedPropertiesOfType(type) { + var type = getApparentType(type); + var propsByName = createSymbolTable(getPropertiesOfType(type)); + if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { + ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { + if (!ts.hasProperty(propsByName, p.name)) { + propsByName[p.name] = p; + } + }); + } + return getNamedMembers(propsByName); + } + function getRootSymbols(symbol) { + if (symbol.flags & 1073741824 /* UnionProperty */) { + var symbols = []; + var name = symbol.name; + ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { + symbols.push(getPropertyOfType(t, name)); + }); + return symbols; + } + else if (symbol.flags & 268435456 /* Transient */) { + var target = getSymbolLinks(symbol).target; + if (target) { + return [target]; + } + } + return [symbol]; + } + function isExternalModuleSymbol(symbol) { + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 201 /* SourceFile */; + } + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + var symbolWithRelevantName = node.locals[name]; + if (symbolWithRelevantName.flags & (107455 /* Value */ | 4194304 /* ExportValue */)) { + return false; + } + if (symbolWithRelevantName.flags & 33554432 /* Import */) { + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 191 /* ImportDeclaration */); + if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { + return false; + } + } + } + } + return true; + } + function getLocalNameOfContainer(container) { + var links = getNodeLinks(container); + if (!links.localModuleName) { + var prefix = ""; + var name = ts.unescapeIdentifier(container.name.text); + while (!isUniqueLocalName(ts.escapeIdentifier(prefix + name), container)) { + prefix += "_"; + } + links.localModuleName = prefix + ts.getTextOfNode(container.name); + } + return links.localModuleName; + } + function getLocalNameForSymbol(symbol, location) { + var node = location; + while (node) { + if ((node.kind === 189 /* ModuleDeclaration */ || node.kind === 188 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + return getLocalNameOfContainer(node); + } + node = node.parent; + } + ts.Debug.fail("getLocalNameForSymbol failed"); + } + function getExpressionNamePrefix(node) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol) { + var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (symbol !== exportSymbol && !(exportSymbol.flags & 944 /* ExportHasLocal */)) { + symbol = exportSymbol; + } + if (symbol.parent) { + return isExternalModuleSymbol(symbol.parent) ? "exports" : getLocalNameForSymbol(getParentOfSymbol(symbol), node.parent); + } + } + } + function getExportAssignmentName(node) { + var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); + return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; + } + function isTopLevelValueImportWithEntityName(node) { + if (node.parent.kind !== 201 /* SourceFile */ || !ts.isInternalModuleImportDeclaration(node)) { + return false; + } + return isImportResolvedToValue(getSymbolOfNode(node)); + } + function hasSemanticErrors(sourceFile) { + return getDiagnostics(sourceFile).length > 0 || getGlobalDiagnostics().length > 0; + } + function isEmitBlocked(sourceFile) { + return program.getDiagnostics(sourceFile).length !== 0 || hasEarlyErrors(sourceFile) || (compilerOptions.noEmitOnError && getDiagnostics(sourceFile).length !== 0); + } + function hasEarlyErrors(sourceFile) { + return ts.forEach(getDiagnostics(sourceFile), function (d) { return d.isEarly; }); + } + function isImportResolvedToValue(symbol) { + var target = resolveImport(symbol); + return target !== unknownSymbol && target.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } + function isReferencedImportDeclaration(node) { + var symbol = getSymbolOfNode(node); + if (getSymbolLinks(symbol).referenced) { + return true; + } + if (node.flags & 1 /* Export */) { + return isImportResolvedToValue(symbol); + } + return false; + } + function isImplementationOfOverload(node) { + if (node.body) { + var symbol = getSymbolOfNode(node); + var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + } + return false; + } + function getNodeCheckFlags(node) { + return getNodeLinks(node).flags; + } + function getEnumMemberValue(node) { + computeEnumMemberValues(node.parent); + return getNodeLinks(node).enumMemberValue; + } + function getConstantValue(node) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && (symbol.flags & 8 /* EnumMember */)) { + var declaration = symbol.valueDeclaration; + var constantValue; + if (declaration.kind === 200 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + return constantValue; + } + } + return undefined; + } + function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { + var symbol = getSymbolOfNode(declaration); + var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* CallSignature */ | 262144 /* ConstructSignature */)) ? getTypeOfSymbol(symbol) : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + } + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { + var signature = getSignatureFromDeclaration(signatureDeclaration); + getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); + } + function createResolver() { + return { + getProgram: function () { return program; }, + getLocalNameOfContainer: getLocalNameOfContainer, + getExpressionNamePrefix: getExpressionNamePrefix, + getExportAssignmentName: getExportAssignmentName, + isReferencedImportDeclaration: isReferencedImportDeclaration, + getNodeCheckFlags: getNodeCheckFlags, + getEnumMemberValue: getEnumMemberValue, + isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, + hasSemanticErrors: hasSemanticErrors, + isEmitBlocked: isEmitBlocked, + isDeclarationVisible: isDeclarationVisible, + isImplementationOfOverload: isImplementationOfOverload, + writeTypeOfDeclaration: writeTypeOfDeclaration, + writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, + isSymbolAccessible: isSymbolAccessible, + isEntityNameVisible: isEntityNameVisible, + getConstantValue: getConstantValue + }; + } + function invokeEmitter(targetSourceFile) { + var resolver = createResolver(); + return ts.emitFiles(resolver, targetSourceFile); + } + function initializeTypeChecker() { + ts.forEach(program.getSourceFiles(), function (file) { + ts.bindSourceFile(file); + ts.forEach(file.semanticDiagnostics, addDiagnostic); + }); + ts.forEach(program.getSourceFiles(), function (file) { + if (!ts.isExternalModule(file)) { + extendSymbolTable(globals, file.locals); + } + }); + getSymbolLinks(undefinedSymbol).type = undefinedType; + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(unknownSymbol).type = unknownType; + globals[undefinedSymbol.name] = undefinedSymbol; + globalArraySymbol = getGlobalSymbol("Array"); + globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); + globalObjectType = getGlobalType("Object"); + globalFunctionType = getGlobalType("Function"); + globalStringType = getGlobalType("String"); + globalNumberType = getGlobalType("Number"); + globalBooleanType = getGlobalType("Boolean"); + globalRegExpType = getGlobalType("RegExp"); + globalTemplateStringsArrayType = compilerOptions.target >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; + } + initializeTypeChecker(); + return checker; + } + ts.createTypeChecker = createTypeChecker; +})(ts || (ts = {})); +var ts; +(function (ts) { + var OutliningElementsCollector; + (function (OutliningElementsCollector) { + function collectElements(sourceFile) { + var elements = []; + var collapseText = "..."; + function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { + if (hintSpanNode && startElement && endElement) { + var span = { + textSpan: ts.TextSpan.fromBounds(startElement.pos, endElement.end), + hintSpan: ts.TextSpan.fromBounds(hintSpanNode.getStart(), hintSpanNode.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span); + } + } + function autoCollapse(node) { + switch (node.kind) { + case 190 /* ModuleBlock */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + return false; + } + return true; + } + var depth = 0; + var maxDepth = 20; + function walk(n) { + if (depth > maxDepth) { + return; + } + switch (n.kind) { + case 163 /* Block */: + if (!ts.isFunctionBlock(n)) { + var parent = n.parent; + var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); + if (parent.kind === 168 /* DoStatement */ || parent.kind === 171 /* ForInStatement */ || parent.kind === 170 /* ForStatement */ || parent.kind === 167 /* IfStatement */ || parent.kind === 169 /* WhileStatement */ || parent.kind === 175 /* WithStatement */ || parent.kind === 197 /* CatchClause */) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + } + else { + var span = ts.TextSpan.fromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span, + hintSpan: span, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); + } + break; + } + case 190 /* ModuleBlock */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); + addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 142 /* ObjectLiteralExpression */: + case 176 /* SwitchStatement */: + var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); + addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); + break; + case 141 /* ArrayLiteralExpression */: + var openBracket = ts.findChildOfKind(n, 17 /* OpenBracketToken */, sourceFile); + var closeBracket = ts.findChildOfKind(n, 18 /* CloseBracketToken */, sourceFile); + addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); + break; + } + depth++; + ts.forEachChild(n, walk); + depth--; + } + walk(sourceFile); + return elements; + } + OutliningElementsCollector.collectElements = collectElements; + })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigationBar; + (function (NavigationBar) { + function getNavigationBarItems(sourceFile) { + var hasGlobalNode = false; + return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); + function getIndent(node) { + var indent = hasGlobalNode ? 1 : 0; + var current = node.parent; + while (current) { + switch (current.kind) { + case 189 /* ModuleDeclaration */: + do { + current = current.parent; + } while (current.kind === 189 /* ModuleDeclaration */); + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + case 186 /* InterfaceDeclaration */: + case 184 /* FunctionDeclaration */: + indent++; + } + current = current.parent; + } + return indent; + } + function getChildNodes(nodes) { + var childNodes = []; + for (var i = 0, n = nodes.length; i < n; i++) { + var node = nodes[i]; + if (node.kind === 185 /* ClassDeclaration */ || node.kind === 188 /* EnumDeclaration */ || node.kind === 186 /* InterfaceDeclaration */ || node.kind === 189 /* ModuleDeclaration */ || node.kind === 184 /* FunctionDeclaration */) { + childNodes.push(node); + } + else if (node.kind === 164 /* VariableStatement */) { + childNodes.push.apply(childNodes, node.declarations); + } + } + return sortNodes(childNodes); + } + function getTopLevelNodes(node) { + var topLevelNodes = []; + topLevelNodes.push(node); + addTopLevelNodes(node.statements, topLevelNodes); + return topLevelNodes; + } + function sortNodes(nodes) { + return nodes.slice(0).sort(function (n1, n2) { + if (n1.name && n2.name) { + return n1.name.text.localeCompare(n2.name.text); + } + else if (n1.name) { + return 1; + } + else if (n2.name) { + return -1; + } + else { + return n1.kind - n2.kind; + } + }); + } + function addTopLevelNodes(nodes, topLevelNodes) { + nodes = sortNodes(nodes); + for (var i = 0, n = nodes.length; i < n; i++) { + var node = nodes[i]; + switch (node.kind) { + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + case 186 /* InterfaceDeclaration */: + topLevelNodes.push(node); + break; + case 189 /* ModuleDeclaration */: + var moduleDeclaration = node; + topLevelNodes.push(node); + addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); + break; + case 184 /* FunctionDeclaration */: + var functionDeclaration = node; + if (isTopLevelFunctionDeclaration(functionDeclaration)) { + topLevelNodes.push(node); + addTopLevelNodes(functionDeclaration.body.statements, topLevelNodes); + } + break; + } + } + } + function isTopLevelFunctionDeclaration(functionDeclaration) { + if (functionDeclaration.kind === 184 /* FunctionDeclaration */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 163 /* Block */) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 184 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + return true; + } + if (!ts.isFunctionBlock(functionDeclaration.parent)) { + return true; + } + } + } + return false; + } + function getItemsWorker(nodes, createItem) { + var items = []; + var keyToItem = {}; + for (var i = 0, n = nodes.length; i < n; i++) { + var child = nodes[i]; + var item = createItem(child); + if (item !== undefined) { + if (item.text.length > 0) { + var key = item.text + "-" + item.kind + "-" + item.indent; + var itemWithSameName = keyToItem[key]; + if (itemWithSameName) { + merge(itemWithSameName, item); + } + else { + keyToItem[key] = item; + items.push(item); + } + } + } + } + return items; + } + function merge(target, source) { + target.spans.push.apply(target.spans, source.spans); + if (source.childItems) { + if (!target.childItems) { + target.childItems = []; + } + outer: for (var i = 0, n = source.childItems.length; i < n; i++) { + var sourceChild = source.childItems[i]; + for (var j = 0, m = target.childItems.length; j < m; j++) { + var targetChild = target.childItems[j]; + if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { + merge(targetChild, sourceChild); + continue outer; + } + } + target.childItems.push(sourceChild); + } + } + } + function createChildItem(node) { + switch (node.kind) { + case 123 /* Parameter */: + if ((node.flags & 243 /* Modifier */) === 0) { + return undefined; + } + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 125 /* Method */: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 127 /* GetAccessor */: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 128 /* SetAccessor */: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 131 /* IndexSignature */: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 200 /* EnumMember */: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 129 /* CallSignature */: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 130 /* ConstructSignature */: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 124 /* Property */: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 184 /* FunctionDeclaration */: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); + case 183 /* VariableDeclaration */: + 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); + } + else { + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.variableElement); + } + case 126 /* Constructor */: + return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + } + return undefined; + function createItem(node, name, scriptElementKind) { + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + } + } + function isEmpty(text) { + return !text || text.trim() === ""; + } + function getNavigationBarItem(text, kind, kindModifiers, spans, childItems, indent) { + if (childItems === void 0) { childItems = []; } + if (indent === void 0) { indent = 0; } + if (isEmpty(text)) { + return undefined; + } + return { + text: text, + kind: kind, + kindModifiers: kindModifiers, + spans: spans, + childItems: childItems, + indent: indent, + bolded: false, + grayed: false + }; + } + function createTopLevelItem(node) { + switch (node.kind) { + case 201 /* SourceFile */: + return createSourceFileItem(node); + case 185 /* ClassDeclaration */: + return createClassItem(node); + case 188 /* EnumDeclaration */: + return createEnumItem(node); + case 186 /* InterfaceDeclaration */: + return createIterfaceItem(node); + case 189 /* ModuleDeclaration */: + return createModuleItem(node); + case 184 /* FunctionDeclaration */: + return createFunctionItem(node); + } + return undefined; + function getModuleName(moduleDeclaration) { + if (moduleDeclaration.name.kind === 7 /* StringLiteral */) { + return getTextOfNode(moduleDeclaration.name); + } + var result = []; + result.push(moduleDeclaration.name.text); + while (moduleDeclaration.body && moduleDeclaration.body.kind === 189 /* ModuleDeclaration */) { + moduleDeclaration = moduleDeclaration.body; + result.push(moduleDeclaration.name.text); + } + return result.join("."); + } + function createModuleItem(node) { + var moduleName = getModuleName(node); + var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createFunctionItem(node) { + if (node.name && node.body && node.body.kind === 163 /* Block */) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } + function createSourceFileItem(node) { + var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + if (childItems === undefined || childItems.length === 0) { + return undefined; + } + hasGlobalNode = true; + var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFilename(ts.removeFileExtension(ts.normalizePath(node.filename)))) + "\"" : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + } + function createClassItem(node) { + var childItems; + if (node.members) { + var constructor = ts.forEach(node.members, function (member) { + return member.kind === 126 /* Constructor */ && member; + }); + var nodes = removeComputedProperties(node); + if (constructor) { + nodes.push.apply(nodes, constructor.parameters); + } + var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + } + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createEnumItem(node) { + var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createIterfaceItem(node) { + var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + } + function removeComputedProperties(node) { + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 121 /* ComputedPropertyName */; }); + } + function getInnermostModule(node) { + while (node.body.kind === 189 /* ModuleDeclaration */) { + node = node.body; + } + return node; + } + function getNodeSpan(node) { + return node.kind === 201 /* SourceFile */ ? ts.TextSpan.fromBounds(node.getFullStart(), node.getEnd()) : ts.TextSpan.fromBounds(node.getStart(), node.getEnd()); + } + function getTextOfNode(node) { + return ts.getTextOfNodeFromSourceText(sourceFile.text, node); + } + } + NavigationBar.getNavigationBarItems = getNavigationBarItems; + })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var SignatureHelp; + (function (SignatureHelp) { + var emptyArray = []; + var ArgumentListKind; + (function (ArgumentListKind) { + ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; + ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; + ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + })(ArgumentListKind || (ArgumentListKind = {})); + function getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken) { + var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); + if (!startingToken) { + return undefined; + } + var argumentInfo = getContainingArgumentInfo(startingToken); + cancellationToken.throwIfCancellationRequested(); + if (!argumentInfo) { + return undefined; + } + var call = argumentInfo.invocation; + var candidates = []; + var resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates); + cancellationToken.throwIfCancellationRequested(); + if (!candidates.length) { + return undefined; + } + return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); + function getImmediatelyContainingArgumentInfo(node) { + if (node.parent.kind === 145 /* CallExpression */ || node.parent.kind === 146 /* NewExpression */) { + var callExpression = node.parent; + if (node.kind === 23 /* LessThanToken */ || node.kind === 15 /* OpenParenToken */) { + var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + ts.Debug.assert(list !== undefined); + return { + kind: isTypeArgList ? 0 /* TypeArguments */ : 1 /* CallArguments */, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: 0, + argumentCount: getCommaBasedArgCount(list) + }; + } + var listItemInfo = ts.findListItemInfo(node); + if (listItemInfo) { + var list = listItemInfo.list; + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; + return { + kind: isTypeArgList ? 0 /* TypeArguments */ : 1 /* CallArguments */, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: argumentIndex, + argumentCount: getCommaBasedArgCount(list) + }; + } + } + else if (node.kind === 9 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 147 /* TaggedTemplateExpression */) { + if (ts.isInsideTemplateLiteral(node, position)) { + return getArgumentListInfoForTemplate(node.parent, 0); + } + } + else if (node.kind === 10 /* TemplateHead */ && node.parent.parent.kind === 147 /* TaggedTemplateExpression */) { + var templateExpression = node.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 159 /* TemplateExpression */); + var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + else if (node.parent.kind === 162 /* TemplateSpan */ && node.parent.parent.parent.kind === 147 /* TaggedTemplateExpression */) { + var templateSpan = node.parent; + var templateExpression = templateSpan.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 159 /* TemplateExpression */); + if (node.kind === 12 /* TemplateTail */ && position >= node.getEnd() && !node.isUnterminated) { + return undefined; + } + var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); + var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + return undefined; + } + function getCommaBasedArgCount(argumentsList) { + return argumentsList.getChildCount() === 0 ? 0 : 1 + ts.countWhere(argumentsList.getChildren(), function (arg) { return arg.kind === 22 /* CommaToken */; }); + } + function getArgumentIndexForTemplatePiece(spanIndex, node) { + ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); + if (ts.isTemplateLiteralKind(node.kind)) { + if (ts.isInsideTemplateLiteral(node, position)) { + return 0; + } + return spanIndex + 2; + } + return spanIndex + 1; + } + function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { + var argumentCount = tagExpression.template.kind === 9 /* NoSubstitutionTemplateLiteral */ ? 1 : tagExpression.template.templateSpans.length + 1; + return { + kind: 2 /* TaggedTemplateArguments */, + invocation: tagExpression, + argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression), + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + } + function getApplicableSpanForArguments(argumentsList) { + var applicableSpanStart = argumentsList.getFullStart(); + var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false); + return new ts.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getApplicableSpanForTaggedTemplate(taggedTemplate) { + var template = taggedTemplate.template; + var applicableSpanStart = template.getStart(); + var applicableSpanEnd = template.getEnd(); + if (template.kind === 159 /* TemplateExpression */) { + var lastSpan = ts.lastOrUndefined(template.templateSpans); + if (lastSpan.literal.getFullWidth() === 0) { + applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); + } + } + return new ts.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getContainingArgumentInfo(node) { + for (var n = node; n.kind !== 201 /* SourceFile */; n = n.parent) { + if (ts.isFunctionBlock(n)) { + return undefined; + } + if (n.pos < n.parent.pos || n.end > n.parent.end) { + ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); + } + var argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (argumentInfo) { + return argumentInfo; + } + } + return undefined; + } + function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) { + var children = parent.getChildren(sourceFile); + var indexOfOpenerToken = children.indexOf(openerToken); + ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); + return children[indexOfOpenerToken + 1]; + } + function selectBestInvalidOverloadIndex(candidates, argumentCount) { + var maxParamsSignatureIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { + return i; + } + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsSignatureIndex = i; + } + } + return maxParamsSignatureIndex; + } + function createSignatureHelpItems(candidates, bestSignature, argumentListInfo) { + var applicableSpan = argumentListInfo.argumentsSpan; + var isTypeParameterList = argumentListInfo.kind === 0 /* TypeArguments */; + var invocation = argumentListInfo.invocation; + var callTarget = ts.getInvokedExpression(invocation); + var callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget); + var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeInfoResolver, callTargetSymbol, undefined, undefined); + var items = ts.map(candidates, function (candidateSignature) { + var signatureHelpParameters; + var prefixDisplayParts = []; + var suffixDisplayParts = []; + if (callTargetDisplayParts) { + prefixDisplayParts.push.apply(prefixDisplayParts, callTargetDisplayParts); + } + if (isTypeParameterList) { + prefixDisplayParts.push(ts.punctuationPart(23 /* LessThanToken */)); + var typeParameters = candidateSignature.typeParameters; + signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(24 /* GreaterThanToken */)); + var parameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); }); + suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); + } + else { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); + prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); + prefixDisplayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + var parameters = candidateSignature.parameters; + signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + } + var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); }); + suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); + return { + isVariadic: candidateSignature.hasRestParameter, + prefixDisplayParts: prefixDisplayParts, + suffixDisplayParts: suffixDisplayParts, + separatorDisplayParts: [ts.punctuationPart(22 /* CommaToken */), ts.spacePart()], + parameters: signatureHelpParameters, + documentation: candidateSignature.getDocumentationComment() + }; + }); + var argumentIndex = argumentListInfo.argumentIndex; + var argumentCount = argumentListInfo.argumentCount; + var selectedItemIndex = candidates.indexOf(bestSignature); + if (selectedItemIndex < 0) { + selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); + } + return { + items: items, + applicableSpan: applicableSpan, + selectedItemIndex: selectedItemIndex, + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + function createSignatureHelpParameterForParameter(parameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); }); + var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); + return { + name: parameter.name, + documentation: parameter.getDocumentationComment(), + displayParts: displayParts, + isOptional: isOptional + }; + } + function createSignatureHelpParameterForTypeParameter(typeParameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); }); + return { + name: typeParameter.symbol.name, + documentation: emptyArray, + displayParts: displayParts, + isOptional: false + }; + } + } + } + SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; + })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 1); + var lineStarts = sourceFile.getLineStarts(); + var lineIndex = line - 1; + if (lineIndex === lineStarts.length - 1) { + return sourceFile.text.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 1); + return sourceFile.getLineStarts()[line - 1]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; + function getStartLinePositionForPosition(position, sourceFile) { + var lineStarts = sourceFile.getLineStarts(); + var line = sourceFile.getLineAndCharacterFromPosition(position).line; + return lineStarts[line - 1]; + } + ts.getStartLinePositionForPosition = getStartLinePositionForPosition; + function rangeContainsRange(r1, r2) { + return startEndContainsRange(r1.pos, r1.end, r2); + } + ts.rangeContainsRange = rangeContainsRange; + function startEndContainsRange(start, end, range) { + return start <= range.pos && end >= range.end; + } + ts.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range, start, end) { + return range.pos <= start && range.end >= end; + } + ts.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + function findListItemInfo(node) { + var list = findContainingList(node); + if (!list) { + return undefined; + } + var children = list.getChildren(); + var listItemIndex = ts.indexOf(children, node); + return { + listItemIndex: listItemIndex, + list: list + }; + } + ts.findListItemInfo = findListItemInfo; + function findChildOfKind(n, kind, sourceFile) { + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + } + ts.findChildOfKind = findChildOfKind; + function findContainingList(node) { + var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { + if (c.kind === 203 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + return c; + } + }); + return syntaxList; + } + ts.findContainingList = findContainingList; + function getTouchingWord(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + } + ts.getTouchingWord = getTouchingWord; + function getTouchingPropertyName(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + } + ts.getTouchingPropertyName = getTouchingPropertyName; + function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { + return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition); + } + ts.getTouchingToken = getTouchingToken; + function getTokenAtPosition(sourceFile, position) { + return getTokenAtPositionWorker(sourceFile, position, true, undefined); + } + ts.getTokenAtPosition = getTokenAtPosition; + function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition) { + var current = sourceFile; + outer: while (true) { + if (isToken(current)) { + return current; + } + for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + var child = current.getChildAt(i); + var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); + if (start <= position) { + var end = child.getEnd(); + if (position < end || (position === end && child.kind === 1 /* EndOfFileToken */)) { + current = child; + continue outer; + } + else if (includeItemAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, child); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } + } + } + } + return current; + } + } + function findTokenOnLeftOfPosition(file, position) { + var tokenAtPosition = getTokenAtPosition(file, position); + if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + return findPrecedingToken(position, file); + } + ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; + function findNextToken(previousToken, parent) { + return find(parent); + function find(n) { + if (isToken(n) && n.pos === previousToken.end) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + return undefined; + } + } + ts.findNextToken = findNextToken; + function findPrecedingToken(position, sourceFile, startNode) { + return find(startNode || sourceFile); + function findRightmostToken(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + function find(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + if (nodeHasTokens(child)) { + if (position <= child.end) { + if (child.getStart(sourceFile) >= position) { + var candidate = findRightmostChildNodeWithTokens(children, i); + return candidate && findRightmostToken(candidate); + } + else { + return find(child); + } + } + } + } + ts.Debug.assert(startNode !== undefined || n.kind === 201 /* SourceFile */); + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + } + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { + for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + ts.findPrecedingToken = findPrecedingToken; + function nodeHasTokens(n) { + return n.getWidth() !== 0; + } + function getNodeModifiers(node) { + var flags = node.flags; + var result = []; + if (flags & 32 /* Private */) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 64 /* Protected */) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 16 /* Public */) + result.push(ts.ScriptElementKindModifier.publicMemberModifier); + if (flags & 128 /* Static */) + result.push(ts.ScriptElementKindModifier.staticModifier); + if (flags & 1 /* Export */) + result.push(ts.ScriptElementKindModifier.exportedModifier); + if (ts.isInAmbientContext(node)) + result.push(ts.ScriptElementKindModifier.ambientModifier); + return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; + } + ts.getNodeModifiers = getNodeModifiers; + function getTypeArgumentOrTypeParameterList(node) { + if (node.kind === 132 /* TypeReference */ || node.kind === 145 /* CallExpression */) { + return node.typeArguments; + } + if (ts.isAnyFunction(node) || node.kind === 185 /* ClassDeclaration */ || node.kind === 186 /* InterfaceDeclaration */) { + return node.typeParameters; + } + return undefined; + } + ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; + function isToken(n) { + return n.kind >= 0 /* FirstToken */ && n.kind <= 119 /* LastToken */; + } + ts.isToken = isToken; + function isWord(kind) { + return kind === 63 /* Identifier */ || ts.isKeyword(kind); + } + function isPropertyName(kind) { + return kind === 7 /* StringLiteral */ || kind === 6 /* NumericLiteral */ || isWord(kind); + } + function isComment(kind) { + return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; + } + ts.isComment = isComment; + function isPunctuation(kind) { + return 13 /* FirstPunctuation */ <= kind && kind <= 62 /* LastPunctuation */; + } + ts.isPunctuation = isPunctuation; + function isInsideTemplateLiteral(node, position) { + return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + } + ts.isInsideTemplateLiteral = isInsideTemplateLiteral; + function compareDataObjects(dst, src) { + for (var e in dst) { + if (typeof dst[e] === "object") { + if (!compareDataObjects(dst[e], src[e])) { + return false; + } + } + else if (typeof dst[e] !== "function") { + if (dst[e] !== src[e]) { + return false; + } + } + } + return true; + } + ts.compareDataObjects = compareDataObjects; +})(ts || (ts = {})); +var ts; +(function (ts) { + function isFirstDeclarationOfSymbolParameter(symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 123 /* Parameter */; + } + ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter() { + var displayParts; + var lineStart; + var indent; + resetWriter(); + return { + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, 5 /* keyword */); }, + writeOperator: function (text) { return writeKind(text, 12 /* operator */); }, + writePunctuation: function (text) { return writeKind(text, 15 /* punctuation */); }, + writeSpace: function (text) { return writeKind(text, 16 /* space */); }, + writeStringLiteral: function (text) { return writeKind(text, 8 /* stringLiteral */); }, + writeParameter: function (text) { return writeKind(text, 13 /* parameterName */); }, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: function () { + indent++; + }, + decreaseIndent: function () { + indent--; + }, + clear: resetWriter, + trackSymbol: function () { + } + }; + function writeIndent() { + if (lineStart) { + var indentString = ts.getIndentString(indent); + if (indentString) { + displayParts.push(displayPart(indentString, 16 /* space */)); + } + lineStart = false; + } + } + function writeKind(text, kind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + function writeSymbol(text, symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + function resetWriter() { + displayParts = []; + lineStart = true; + indent = 0; + } + } + function symbolPart(text, symbol) { + return displayPart(text, displayPartKind(symbol), symbol); + function displayPartKind(symbol) { + var flags = symbol.flags; + if (flags & 3 /* Variable */) { + return isFirstDeclarationOfSymbolParameter(symbol) ? 13 /* parameterName */ : 9 /* localName */; + } + else if (flags & 4 /* Property */) { + return 14 /* propertyName */; + } + else if (flags & 32768 /* GetAccessor */) { + return 14 /* propertyName */; + } + else if (flags & 65536 /* SetAccessor */) { + return 14 /* propertyName */; + } + else if (flags & 8 /* EnumMember */) { + return 19 /* enumMemberName */; + } + else if (flags & 16 /* Function */) { + return 20 /* functionName */; + } + else if (flags & 32 /* Class */) { + return 1 /* className */; + } + else if (flags & 64 /* Interface */) { + return 4 /* interfaceName */; + } + else if (flags & 384 /* Enum */) { + return 2 /* enumName */; + } + else if (flags & 1536 /* Module */) { + return 11 /* moduleName */; + } + else if (flags & 8192 /* Method */) { + return 10 /* methodName */; + } + else if (flags & 1048576 /* TypeParameter */) { + return 18 /* typeParameterName */; + } + else if (flags & 2097152 /* TypeAlias */) { + return 0 /* aliasName */; + } + else if (flags & 33554432 /* Import */) { + return 0 /* aliasName */; + } + return 17 /* text */; + } + } + ts.symbolPart = symbolPart; + function displayPart(text, kind, symbol) { + return { + text: text, + kind: ts.SymbolDisplayPartKind[kind] + }; + } + ts.displayPart = displayPart; + function spacePart() { + return displayPart(" ", 16 /* space */); + } + ts.spacePart = spacePart; + function keywordPart(kind) { + return displayPart(ts.tokenToString(kind), 5 /* keyword */); + } + ts.keywordPart = keywordPart; + function punctuationPart(kind) { + return displayPart(ts.tokenToString(kind), 15 /* punctuation */); + } + ts.punctuationPart = punctuationPart; + function operatorPart(kind) { + return displayPart(ts.tokenToString(kind), 12 /* operator */); + } + ts.operatorPart = operatorPart; + function textPart(text) { + return displayPart(text, 17 /* text */); + } + ts.textPart = textPart; + function lineBreakPart() { + return displayPart("\n", 6 /* lineBreak */); + } + ts.lineBreakPart = lineBreakPart; + function mapToDisplayParts(writeDisplayParts) { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + ts.mapToDisplayParts = mapToDisplayParts; + function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + }); + } + ts.typeToDisplayParts = typeToDisplayParts; + function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { + return mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + ts.symbolToDisplayParts = symbolToDisplayParts; + function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + }); + } + ts.signatureToDisplayParts = signatureToDisplayParts; +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var scanner = ts.createScanner(2 /* Latest */, false); + var ScanAction; + (function (ScanAction) { + ScanAction[ScanAction["Scan"] = 0] = "Scan"; + ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; + ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; + ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + })(ScanAction || (ScanAction = {})); + function getFormattingScanner(sourceFile, startPos, endPos) { + scanner.setText(sourceFile.text); + scanner.setTextPos(startPos); + var wasNewLine = true; + var leadingTrivia; + var trailingTrivia; + var savedPos; + var lastScanAction; + var lastTokenInfo; + return { + advance: advance, + readTokenInfo: readTokenInfo, + isOnToken: isOnToken, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + close: function () { + lastTokenInfo = undefined; + scanner.setText(undefined); + } + }; + function advance() { + lastTokenInfo = undefined; + var isStarted = scanner.getStartPos() !== startPos; + if (isStarted) { + if (trailingTrivia) { + ts.Debug.assert(trailingTrivia.length !== 0); + wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4 /* NewLineTrivia */; + } + else { + wasNewLine = false; + } + } + leadingTrivia = undefined; + trailingTrivia = undefined; + if (!isStarted) { + scanner.scan(); + } + var t; + var pos = scanner.getStartPos(); + while (pos < endPos) { + var t = scanner.getToken(); + if (!ts.isTrivia(t)) { + break; + } + scanner.scan(); + var item = { + pos: pos, + end: scanner.getStartPos(), + kind: t + }; + pos = scanner.getStartPos(); + if (!leadingTrivia) { + leadingTrivia = []; + } + leadingTrivia.push(item); + } + savedPos = scanner.getStartPos(); + } + function shouldRescanGreaterThanToken(container) { + if (container.kind !== 157 /* BinaryExpression */) { + return false; + } + switch (container.operator) { + case 26 /* GreaterThanEqualsToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + return true; + } + return false; + } + function shouldRescanSlashToken(container) { + return container.kind === 8 /* RegularExpressionLiteral */; + } + function shouldRescanTemplateToken(container) { + return container.kind === 11 /* TemplateMiddle */ || container.kind === 12 /* TemplateTail */; + } + function startsWithSlashToken(t) { + return t === 35 /* SlashToken */ || t === 55 /* SlashEqualsToken */; + } + function readTokenInfo(n) { + if (!isOnToken()) { + return { + leadingTrivia: leadingTrivia, + trailingTrivia: undefined, + token: undefined + }; + } + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 /* RescanGreaterThanToken */ : shouldRescanSlashToken(n) ? 2 /* RescanSlashToken */ : shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ : 0 /* Scan */; + if (lastTokenInfo && expectedScanAction === lastScanAction) { + return fixTokenKind(lastTokenInfo, n); + } + if (scanner.getStartPos() !== savedPos) { + ts.Debug.assert(lastTokenInfo !== undefined); + scanner.setTextPos(savedPos); + scanner.scan(); + } + var currentToken = scanner.getToken(); + if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 24 /* GreaterThanToken */) { + currentToken = scanner.reScanGreaterToken(); + ts.Debug.assert(n.operator === currentToken); + lastScanAction = 1 /* RescanGreaterThanToken */; + } + else if (expectedScanAction === 2 /* RescanSlashToken */ && startsWithSlashToken(currentToken)) { + currentToken = scanner.reScanSlashToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 2 /* RescanSlashToken */; + } + else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 14 /* CloseBraceToken */) { + currentToken = scanner.reScanTemplateToken(); + lastScanAction = 3 /* RescanTemplateToken */; + } + else { + lastScanAction = 0 /* Scan */; + } + var token = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + while (scanner.getStartPos() < endPos) { + currentToken = scanner.scan(); + if (!ts.isTrivia(currentToken)) { + break; + } + var trivia = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (!trailingTrivia) { + trailingTrivia = []; + } + trailingTrivia.push(trivia); + if (currentToken === 4 /* NewLineTrivia */) { + scanner.scan(); + break; + } + } + lastTokenInfo = { + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia, + token: token + }; + return fixTokenKind(lastTokenInfo, n); + } + function isOnToken() { + var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); + var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current); + } + function fixTokenKind(tokenInfo, container) { + if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { + tokenInfo.token.kind = container.kind; + } + return tokenInfo; + } + } + formatting.getFormattingScanner = getFormattingScanner; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingContext = (function () { + function FormattingContext(sourceFile, formattingRequestKind) { + this.sourceFile = sourceFile; + this.formattingRequestKind = formattingRequestKind; + } + FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { + ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null"); + ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null"); + ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null"); + ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null"); + ts.Debug.assert(commonParent !== undefined, "commonParent is null"); + this.currentTokenSpan = currentRange; + this.currentTokenParent = currentTokenParent; + this.nextTokenSpan = nextRange; + this.nextTokenParent = nextTokenParent; + this.contextNode = commonParent; + this.contextNodeAllOnSameLine = undefined; + this.nextNodeAllOnSameLine = undefined; + this.tokensAreOnSameLine = undefined; + this.contextNodeBlockIsOnOneLine = undefined; + this.nextNodeBlockIsOnOneLine = undefined; + }; + FormattingContext.prototype.ContextNodeAllOnSameLine = function () { + if (this.contextNodeAllOnSameLine === undefined) { + this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); + } + return this.contextNodeAllOnSameLine; + }; + FormattingContext.prototype.NextNodeAllOnSameLine = function () { + if (this.nextNodeAllOnSameLine === undefined) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeAllOnSameLine; + }; + FormattingContext.prototype.TokensAreOnSameLine = function () { + if (this.tokensAreOnSameLine === undefined) { + var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + this.tokensAreOnSameLine = (startLine == endLine); + } + return this.tokensAreOnSameLine; + }; + FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { + if (this.contextNodeBlockIsOnOneLine === undefined) { + this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); + } + return this.contextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { + if (this.nextNodeBlockIsOnOneLine === undefined) { + this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NodeIsOnOneLine = function (node) { + var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + return startLine == endLine; + }; + FormattingContext.prototype.BlockIsOnOneLine = function (node) { + var openBrace = ts.findChildOfKind(node, 13 /* OpenBraceToken */, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 14 /* CloseBraceToken */, this.sourceFile); + if (openBrace && closeBrace) { + var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + return startLine === endLine; + } + return false; + }; + return FormattingContext; + })(); + formatting.FormattingContext = FormattingContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (FormattingRequestKind) { + FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; + FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; + FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; + FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; + FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; + })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); + var FormattingRequestKind = formatting.FormattingRequestKind; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rule = (function () { + function Rule(Descriptor, Operation, Flag) { + if (Flag === void 0) { Flag = 0 /* None */; } + this.Descriptor = Descriptor; + this.Operation = Operation; + this.Flag = Flag; + } + Rule.prototype.toString = function () { + return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + }; + return Rule; + })(); + formatting.Rule = Rule; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (RuleAction) { + RuleAction[RuleAction["Ignore"] = 1] = "Ignore"; + RuleAction[RuleAction["Space"] = 2] = "Space"; + RuleAction[RuleAction["NewLine"] = 4] = "NewLine"; + RuleAction[RuleAction["Delete"] = 8] = "Delete"; + })(formatting.RuleAction || (formatting.RuleAction = {})); + var RuleAction = formatting.RuleAction; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleDescriptor = (function () { + function RuleDescriptor(LeftTokenRange, RightTokenRange) { + this.LeftTokenRange = LeftTokenRange; + this.RightTokenRange = RightTokenRange; + } + RuleDescriptor.prototype.toString = function () { + return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + }; + RuleDescriptor.create1 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create2 = function (left, right) { + return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create3 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right); + }; + RuleDescriptor.create4 = function (left, right) { + return new RuleDescriptor(left, right); + }; + return RuleDescriptor; + })(); + formatting.RuleDescriptor = RuleDescriptor; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (RuleFlags) { + RuleFlags[RuleFlags["None"] = 0] = "None"; + RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; + })(formatting.RuleFlags || (formatting.RuleFlags = {})); + var RuleFlags = formatting.RuleFlags; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperation = (function () { + function RuleOperation() { + this.Context = null; + this.Action = null; + } + RuleOperation.prototype.toString = function () { + return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + }; + RuleOperation.create1 = function (action) { + return RuleOperation.create2(formatting.RuleOperationContext.Any, action); + }; + RuleOperation.create2 = function (context, action) { + var result = new RuleOperation(); + result.Context = context; + result.Action = action; + return result; + }; + return RuleOperation; + })(); + formatting.RuleOperation = RuleOperation; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperationContext = (function () { + function RuleOperationContext() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i - 0] = arguments[_i]; + } + this.customContextChecks = funcs; + } + RuleOperationContext.prototype.IsAny = function () { + return this == RuleOperationContext.Any; + }; + RuleOperationContext.prototype.InContext = function (context) { + if (this.IsAny()) { + return true; + } + for (var i = 0, len = this.customContextChecks.length; i < len; i++) { + if (!this.customContextChecks[i](context)) { + return false; + } + } + return true; + }; + RuleOperationContext.Any = new RuleOperationContext(); + return RuleOperationContext; + })(); + formatting.RuleOperationContext = RuleOperationContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rules = (function () { + function Rules() { + this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); + this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 49 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(50 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQMark = new formatting.Rule(formatting.RuleDescriptor.create3(49 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* CloseBraceToken */, 74 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* CloseBraceToken */, 98 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 18 /* CloseBracketToken */, 22 /* CommaToken */, 21 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([63 /* Identifier */, 3 /* MultiLineCommentTrivia */]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 73 /* DoKeyword */, 94 /* TryKeyword */, 79 /* FinallyKeyword */, 74 /* ElseKeyword */]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(13 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(13 /* OpenBraceToken */, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(13 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 37 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 38 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(37 /* PlusPlusToken */, 32 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(32 /* PlusToken */, 32 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(32 /* PlusToken */, 37 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(38 /* MinusMinusToken */, 33 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(33 /* MinusToken */, 33 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(33 /* MinusToken */, 38 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([96 /* VarKeyword */, 92 /* ThrowKeyword */, 86 /* NewKeyword */, 72 /* DeleteKeyword */, 88 /* ReturnKeyword */, 95 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext), 8 /* Delete */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(81 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(97 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* ReturnKeyword */, 21 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 73 /* DoKeyword */, 74 /* ElseKeyword */, 65 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([94 /* TryKeyword */, 79 /* FinallyKeyword */]), 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([113 /* GetKeyword */, 117 /* SetKeyword */]), 63 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(111 /* ConstructorKeyword */, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([114 /* ModuleKeyword */, 115 /* RequireKeyword */]), 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([67 /* ClassKeyword */, 112 /* DeclareKeyword */, 75 /* EnumKeyword */, 76 /* ExportKeyword */, 77 /* ExtendsKeyword */, 113 /* GetKeyword */, 100 /* ImplementsKeyword */, 83 /* ImportKeyword */, 101 /* InterfaceKeyword */, 114 /* ModuleKeyword */, 104 /* PrivateKeyword */, 106 /* PublicKeyword */, 117 /* SetKeyword */, 107 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([77 /* ExtendsKeyword */, 100 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(7 /* StringLiteral */, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(31 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(20 /* DotDotDotToken */, 63 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(49 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 22 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 23 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseParenToken */, 23 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* LessThanToken */, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([15 /* OpenParenToken */, 17 /* OpenBracketToken */, 24 /* GreaterThanToken */, 22 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(13 /* OpenBraceToken */, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, + this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, + this.SpaceAfterColon, + this.NoSpaceBeforeQMark, + this.SpaceAfterQMark, + this.NoSpaceBeforeDot, + this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, + this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, + this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, + this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, + this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, + this.SpaceBeforeCloseBrace, + this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, + this.SpaceBetweenCloseBraceAndElse, + this.SpaceBetweenCloseBraceAndWhile, + this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, + this.NewLineAfterOpenBraceInBlockContext, + this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, + this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, + this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, + this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, + this.SpaceBeforeOpenBraceInFunction, + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, + this.SpaceAfterTryFinally + ]; + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenParenToken */, 16 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(81 /* FunctionKeyword */, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(81 /* FunctionKeyword */, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + } + Rules.prototype.getRuleName = function (rule) { + var o = this; + for (var name in o) { + if (o[name] === rule) { + return name; + } + } + throw new Error("Unknown rule"); + }; + Rules.IsForContext = function (context) { + return context.contextNode.kind === 170 /* ForStatement */; + }; + Rules.IsNotForContext = function (context) { + return !Rules.IsForContext(context); + }; + Rules.IsBinaryOpContext = function (context) { + switch (context.contextNode.kind) { + case 157 /* BinaryExpression */: + case 158 /* ConditionalExpression */: + return true; + case 191 /* ImportDeclaration */: + case 183 /* VariableDeclaration */: + case 123 /* Parameter */: + case 200 /* EnumMember */: + case 124 /* Property */: + return context.currentTokenSpan.kind === 51 /* EqualsToken */ || context.nextTokenSpan.kind === 51 /* EqualsToken */; + case 171 /* ForInStatement */: + return context.currentTokenSpan.kind === 84 /* InKeyword */ || context.nextTokenSpan.kind === 84 /* InKeyword */; + } + return false; + }; + Rules.IsNotBinaryOpContext = function (context) { + return !Rules.IsBinaryOpContext(context); + }; + Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { + return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + }; + Rules.IsBeforeMultilineBlockContext = function (context) { + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + }; + Rules.IsMultilineBlockContext = function (context) { + return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsSingleLineBlockContext = function (context) { + return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.contextNode); + }; + Rules.IsBeforeBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.nextTokenParent); + }; + Rules.NodeIsBlockContext = function (node) { + if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) { + return true; + } + switch (node.kind) { + case 163 /* Block */: + case 176 /* SwitchStatement */: + case 142 /* ObjectLiteralExpression */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return true; + } + return false; + }; + Rules.IsFunctionDeclContext = function (context) { + switch (context.contextNode.kind) { + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 129 /* CallSignature */: + case 150 /* FunctionExpression */: + case 126 /* Constructor */: + case 151 /* ArrowFunction */: + case 186 /* InterfaceDeclaration */: + return true; + } + return false; + }; + Rules.IsTypeScriptDeclWithBlockContext = function (context) { + return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); + }; + Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { + switch (node.kind) { + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 136 /* TypeLiteral */: + case 189 /* ModuleDeclaration */: + return true; + } + return false; + }; + Rules.IsAfterCodeBlockContext = function (context) { + switch (context.currentTokenParent.kind) { + case 185 /* ClassDeclaration */: + case 189 /* ModuleDeclaration */: + case 188 /* EnumDeclaration */: + case 163 /* Block */: + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + case 176 /* SwitchStatement */: + return true; + } + return false; + }; + Rules.IsControlDeclContext = function (context) { + switch (context.contextNode.kind) { + case 167 /* IfStatement */: + case 176 /* SwitchStatement */: + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 169 /* WhileStatement */: + case 179 /* TryStatement */: + case 168 /* DoStatement */: + case 175 /* WithStatement */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + return true; + default: + return false; + } + }; + Rules.IsObjectContext = function (context) { + return context.contextNode.kind === 142 /* ObjectLiteralExpression */; + }; + Rules.IsFunctionCallContext = function (context) { + return context.contextNode.kind === 145 /* CallExpression */; + }; + Rules.IsNewContext = function (context) { + return context.contextNode.kind === 146 /* NewExpression */; + }; + Rules.IsFunctionCallOrNewContext = function (context) { + return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); + }; + Rules.IsSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine(); + }; + Rules.IsNotFormatOnEnter = function (context) { + return context.formattingRequestKind != 2 /* FormatOnEnter */; + }; + Rules.IsModuleDeclContext = function (context) { + return context.contextNode.kind === 189 /* ModuleDeclaration */; + }; + Rules.IsObjectTypeContext = function (context) { + return context.contextNode.kind === 136 /* TypeLiteral */; + }; + Rules.IsTypeArgumentOrParameter = function (token, parent) { + if (token.kind !== 23 /* LessThanToken */ && token.kind !== 24 /* GreaterThanToken */) { + return false; + } + switch (parent.kind) { + case 132 /* TypeReference */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 125 /* Method */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return true; + default: + return false; + } + }; + Rules.IsTypeArgumentOrParameterContext = function (context) { + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsVoidOpContext = function (context) { + return context.currentTokenSpan.kind === 97 /* VoidKeyword */ && context.currentTokenParent.kind === 154 /* VoidExpression */; + }; + return Rules; + })(); + formatting.Rules = Rules; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesMap = (function () { + function RulesMap() { + this.map = []; + this.mapRowLength = 0; + } + RulesMap.create = function (rules) { + var result = new RulesMap(); + result.Initialize(rules); + return result; + }; + RulesMap.prototype.Initialize = function (rules) { + this.mapRowLength = 119 /* LastToken */ + 1; + this.map = new Array(this.mapRowLength * this.mapRowLength); + var rulesBucketConstructionStateList = new Array(this.map.length); + this.FillRules(rules, rulesBucketConstructionStateList); + return this.map; + }; + RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) { + var _this = this; + rules.forEach(function (rule) { + _this.FillRule(rule, rulesBucketConstructionStateList); + }); + }; + RulesMap.prototype.GetRuleBucketIndex = function (row, column) { + var rulesBucketIndex = (row * this.mapRowLength) + column; + return rulesBucketIndex; + }; + RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { + var _this = this; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { + rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { + var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); + var rulesBucket = _this.map[rulesBucketIndex]; + if (rulesBucket == undefined) { + rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket(); + } + rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex); + }); + }); + }; + RulesMap.prototype.GetRule = function (context) { + var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); + var bucket = this.map[bucketIndex]; + if (bucket != null) { + for (var i = 0, len = bucket.Rules().length; i < len; i++) { + var rule = bucket.Rules()[i]; + if (rule.Operation.Context.InContext(context)) + return rule; + } + } + return null; + }; + return RulesMap; + })(); + formatting.RulesMap = RulesMap; + var MaskBitSize = 5; + var Mask = 0x1f; + (function (RulesPosition) { + RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; + RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; + RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific"; + RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; + RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; + RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; + })(formatting.RulesPosition || (formatting.RulesPosition = {})); + var RulesPosition = formatting.RulesPosition; + var RulesBucketConstructionState = (function () { + function RulesBucketConstructionState() { + this.rulesInsertionIndexBitmap = 0; + } + RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) { + var index = 0; + var pos = 0; + var indexBitmap = this.rulesInsertionIndexBitmap; + while (pos <= maskPosition) { + index += (indexBitmap & Mask); + indexBitmap >>= MaskBitSize; + pos += MaskBitSize; + } + return index; + }; + RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) { + var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; + value++; + ts.Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); + var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); + temp |= value << maskPosition; + this.rulesInsertionIndexBitmap = temp; + }; + return RulesBucketConstructionState; + })(); + formatting.RulesBucketConstructionState = RulesBucketConstructionState; + var RulesBucket = (function () { + function RulesBucket() { + this.rules = []; + } + RulesBucket.prototype.Rules = function () { + return this.rules; + }; + RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { + var position; + if (rule.Operation.Action == 1 /* Ignore */) { + position = specificTokens ? 0 /* IgnoreRulesSpecific */ : RulesPosition.IgnoreRulesAny; + } + else if (!rule.Operation.Context.IsAny()) { + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + } + else { + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + } + var state = constructionState[rulesBucketIndex]; + if (state === undefined) { + state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); + } + var index = state.GetInsertionIndex(position); + this.rules.splice(index, 0, rule); + state.IncreaseInsertionIndex(position); + }; + return RulesBucket; + })(); + formatting.RulesBucket = RulesBucket; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Shared; + (function (Shared) { + var TokenRangeAccess = (function () { + function TokenRangeAccess(from, to, except) { + this.tokens = []; + for (var token = from; token <= to; token++) { + if (except.indexOf(token) < 0) { + this.tokens.push(token); + } + } + } + TokenRangeAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenRangeAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenRangeAccess; + })(); + Shared.TokenRangeAccess = TokenRangeAccess; + var TokenValuesAccess = (function () { + function TokenValuesAccess(tks) { + this.tokens = tks && tks.length ? tks : []; + } + TokenValuesAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenValuesAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenValuesAccess; + })(); + Shared.TokenValuesAccess = TokenValuesAccess; + var TokenSingleValueAccess = (function () { + function TokenSingleValueAccess(token) { + this.token = token; + } + TokenSingleValueAccess.prototype.GetTokens = function () { + return [this.token]; + }; + TokenSingleValueAccess.prototype.Contains = function (tokenValue) { + return tokenValue == this.token; + }; + return TokenSingleValueAccess; + })(); + Shared.TokenSingleValueAccess = TokenSingleValueAccess; + var TokenAllAccess = (function () { + function TokenAllAccess() { + } + TokenAllAccess.prototype.GetTokens = function () { + var result = []; + for (var token = 0 /* FirstToken */; token <= 119 /* LastToken */; token++) { + result.push(token); + } + return result; + }; + TokenAllAccess.prototype.Contains = function (tokenValue) { + return true; + }; + TokenAllAccess.prototype.toString = function () { + return "[allTokens]"; + }; + return TokenAllAccess; + })(); + Shared.TokenAllAccess = TokenAllAccess; + var TokenRange = (function () { + function TokenRange(tokenAccess) { + this.tokenAccess = tokenAccess; + } + TokenRange.FromToken = function (token) { + return new TokenRange(new TokenSingleValueAccess(token)); + }; + TokenRange.FromTokens = function (tokens) { + return new TokenRange(new TokenValuesAccess(tokens)); + }; + TokenRange.FromRange = function (f, to, except) { + if (except === void 0) { except = []; } + return new TokenRange(new TokenRangeAccess(f, to, except)); + }; + TokenRange.AllTokens = function () { + return new TokenRange(new TokenAllAccess()); + }; + TokenRange.prototype.GetTokens = function () { + return this.tokenAccess.GetTokens(); + }; + TokenRange.prototype.Contains = function (token) { + return this.tokenAccess.Contains(token); + }; + TokenRange.prototype.toString = function () { + return this.tokenAccess.toString(); + }; + TokenRange.Any = TokenRange.AllTokens(); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); + TokenRange.Keywords = TokenRange.FromRange(64 /* FirstKeyword */, 119 /* LastKeyword */); + TokenRange.Operators = TokenRange.FromRange(21 /* FirstOperator */, 62 /* LastOperator */); + TokenRange.BinaryOperators = TokenRange.FromRange(23 /* FirstBinaryOperator */, 62 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([84 /* InKeyword */, 85 /* InstanceOfKeyword */]); + TokenRange.ReservedKeywords = TokenRange.FromRange(100 /* FirstFutureReservedWord */, 108 /* LastFutureReservedWord */); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([37 /* PlusPlusToken */, 38 /* MinusMinusToken */, 46 /* TildeToken */, 45 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([6 /* NumericLiteral */, 63 /* Identifier */, 15 /* OpenParenToken */, 17 /* OpenBracketToken */, 13 /* OpenBraceToken */, 91 /* ThisKeyword */, 86 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 15 /* OpenParenToken */, 91 /* ThisKeyword */, 86 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 16 /* CloseParenToken */, 18 /* CloseBracketToken */, 86 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 15 /* OpenParenToken */, 91 /* ThisKeyword */, 86 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 16 /* CloseParenToken */, 18 /* CloseBracketToken */, 86 /* NewKeyword */]); + TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); + TokenRange.TypeNames = TokenRange.FromTokens([63 /* Identifier */, 116 /* NumberKeyword */, 118 /* StringKeyword */, 110 /* BooleanKeyword */, 97 /* VoidKeyword */, 109 /* AnyKeyword */]); + return TokenRange; + })(); + Shared.TokenRange = TokenRange; + })(Shared = formatting.Shared || (formatting.Shared = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesProvider = (function () { + function RulesProvider(logger) { + this.logger = logger; + this.globalRules = new formatting.Rules(); + } + RulesProvider.prototype.getRuleName = function (rule) { + return this.globalRules.getRuleName(rule); + }; + RulesProvider.prototype.getRuleByName = function (name) { + return this.globalRules[name]; + }; + RulesProvider.prototype.getRulesMap = function () { + return this.rulesMap; + }; + RulesProvider.prototype.ensureUpToDate = function (options) { + if (this.options == null || !ts.compareDataObjects(this.options, options)) { + var activeRules = this.createActiveRules(options); + var rulesMap = formatting.RulesMap.create(activeRules); + this.activeRules = activeRules; + this.rulesMap = rulesMap; + this.options = ts.clone(options); + } + }; + RulesProvider.prototype.createActiveRules = function (options) { + var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.InsertSpaceAfterCommaDelimiter) { + rules.push(this.globalRules.SpaceAfterComma); + } + else { + rules.push(this.globalRules.NoSpaceAfterComma); + } + if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { + rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); + } + else { + rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); + } + if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { + rules.push(this.globalRules.SpaceAfterKeywordInControl); + } + else { + rules.push(this.globalRules.NoSpaceAfterKeywordInControl); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { + rules.push(this.globalRules.SpaceAfterOpenParen); + rules.push(this.globalRules.SpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenParen); + rules.push(this.globalRules.NoSpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + if (options.InsertSpaceAfterSemicolonInForStatements) { + rules.push(this.globalRules.SpaceAfterSemicolonInFor); + } + else { + rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); + } + if (options.InsertSpaceBeforeAndAfterBinaryOperators) { + rules.push(this.globalRules.SpaceBeforeBinaryOperator); + rules.push(this.globalRules.SpaceAfterBinaryOperator); + } + else { + rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); + rules.push(this.globalRules.NoSpaceAfterBinaryOperator); + } + if (options.PlaceOpenBraceOnNewLineForControlBlocks) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); + } + if (options.PlaceOpenBraceOnNewLineForFunctions) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); + rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); + } + rules = rules.concat(this.globalRules.LowPriorityCommonRules); + return rules; + }; + return RulesProvider; + })(); + formatting.RulesProvider = RulesProvider; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Constants; + (function (Constants) { + Constants[Constants["Unknown"] = -1] = "Unknown"; + })(Constants || (Constants = {})); + function formatOnEnter(position, sourceFile, rulesProvider, options) { + var line = sourceFile.getLineAndCharacterFromPosition(position).line; + ts.Debug.assert(line >= 2); + var span = { + pos: ts.getStartPositionOfLine(line - 1, sourceFile), + end: ts.getEndLinePosition(line, sourceFile) + 1 + }; + return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */); + } + formatting.formatOnEnter = formatOnEnter; + function formatOnSemicolon(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 21 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); + } + formatting.formatOnSemicolon = formatOnSemicolon; + function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 14 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); + } + formatting.formatOnClosingCurly = formatOnClosingCurly; + function formatDocument(sourceFile, rulesProvider, options) { + var span = { + pos: 0, + end: sourceFile.text.length + }; + return formatSpan(span, sourceFile, options, rulesProvider, 0 /* FormatDocument */); + } + formatting.formatDocument = formatDocument; + function formatSelection(start, end, sourceFile, rulesProvider, options) { + var span = { + pos: ts.getStartLinePositionForPosition(start, sourceFile), + end: end + }; + return formatSpan(span, sourceFile, options, rulesProvider, 1 /* FormatSelection */); + } + formatting.formatSelection = formatSelection; + function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { + var parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!parent) { + return []; + } + var span = { + pos: ts.getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + end: parent.end + }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } + function findOutermostParent(position, expectedTokenKind, sourceFile) { + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken || precedingToken.kind !== expectedTokenKind) { + return undefined; + } + var current = precedingToken; + while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + current = current.parent; + } + return current; + } + function isListElement(parent, node) { + switch (parent.kind) { + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + return ts.rangeContainsRange(parent.members, node); + case 189 /* ModuleDeclaration */: + var body = parent.body; + return body && body.kind === 163 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 201 /* SourceFile */: + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return ts.rangeContainsRange(parent.statements, node); + case 197 /* CatchClause */: + return ts.rangeContainsRange(parent.block.statements, node); + } + return false; + } + function findEnclosingNode(range, sourceFile) { + return find(sourceFile); + function find(n) { + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + if (candidate) { + var result = find(candidate); + if (result) { + return result; + } + } + return n; + } + } + function prepareRangeContainsErrorFunction(errors, originalRange) { + if (!errors.length) { + return rangeHasNoErrors; + } + var sorted = errors.filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }).sort(function (e1, e2) { return e1.start - e2.start; }); + if (!sorted.length) { + return rangeHasNoErrors; + } + var index = 0; + return function (r) { + while (true) { + if (index >= sorted.length) { + return false; + } + var error = sorted[index]; + if (r.end <= error.start) { + return false; + } + if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + return true; + } + index++; + } + }; + function rangeHasNoErrors(r) { + return false; + } + } + function getScanStartPosition(enclosingNode, originalRange, sourceFile) { + var start = enclosingNode.getStart(sourceFile); + if (start === originalRange.pos && enclosingNode.end === originalRange.end) { + return start; + } + var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); + return precedingToken ? precedingToken.end : enclosingNode.pos; + } + function getOwnOrInheritedDelta(n, options, sourceFile) { + var previousLine = -1 /* Unknown */; + var childKind = 0 /* Unknown */; + while (n) { + var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + if (previousLine !== -1 /* Unknown */ && line !== previousLine) { + break; + } + if (formatting.SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + return options.IndentSize; + } + previousLine = line; + childKind = n.kind; + n = n.parent; + } + return 0; + } + function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { + var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); + var enclosingNode = findEnclosingNode(originalRange, sourceFile); + var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); + var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + var previousRangeHasError; + var previousRange; + var previousParent; + var previousRangeStartLine; + var edits = []; + formattingScanner.advance(); + if (formattingScanner.isOnToken()) { + var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); + processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); + } + formattingScanner.close(); + return edits; + function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (inheritedIndentation !== -1 /* Unknown */) { + return inheritedIndentation; + } + } + else { + var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; + var startLinePosition = ts.getStartLinePositionForPosition(startPos, sourceFile); + var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + if (startLine !== parentStartLine || startPos === column) { + return column; + } + } + return -1 /* Unknown */; + } + function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { + var indentation = inheritedIndentation; + if (indentation === -1 /* Unknown */) { + if (isSomeBlock(node.kind)) { + if (isSomeBlock(parent.kind) || parent.kind === 201 /* SourceFile */ || parent.kind === 194 /* CaseClause */ || parent.kind === 195 /* DefaultClause */) { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + else { + indentation = parentDynamicIndentation.getIndentation(); + } + } + else { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + } + } + var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */) ? options.IndentSize : 0; + if (effectiveParentStartLine === startLine) { + indentation = parentDynamicIndentation.getIndentation(); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + } + return { + indentation: indentation, + delta: delta + }; + } + function getDynamicIndentation(node, nodeStartLine, indentation, delta) { + return { + getIndentationForComment: function (kind) { + switch (kind) { + case 14 /* CloseBraceToken */: + case 18 /* CloseBracketToken */: + return indentation + delta; + } + return indentation; + }, + getIndentationForToken: function (line, kind) { + switch (kind) { + case 13 /* OpenBraceToken */: + case 14 /* CloseBraceToken */: + case 17 /* OpenBracketToken */: + case 18 /* CloseBracketToken */: + case 74 /* ElseKeyword */: + case 98 /* WhileKeyword */: + return indentation; + default: + return nodeStartLine !== line ? indentation + delta : indentation; + } + }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, + recomputeIndentation: function (lineAdded) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (lineAdded) { + indentation += options.IndentSize; + } + else { + indentation -= options.IndentSize; + } + if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */)) { + delta = options.IndentSize; + } + else { + delta = 0; + } + } + } + }; + } + function processNode(node, contextNode, nodeStartLine, indentation, delta) { + if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { + return; + } + var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); + var childContextNode = contextNode; + ts.forEachChild(node, function (child) { + processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, false); + }, function (nodes) { + processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); + }); + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > node.end) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + } + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, isListItem) { + var childStartPos = child.getStart(sourceFile); + var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childIndentationAmount = -1 /* Unknown */; + if (isListItem) { + childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); + if (childIndentationAmount !== -1 /* Unknown */) { + inheritedIndentation = childIndentationAmount; + } + } + if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { + return inheritedIndentation; + } + if (child.getFullWidth() === 0) { + return inheritedIndentation; + } + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > childStartPos) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + } + if (!formattingScanner.isOnToken()) { + return inheritedIndentation; + } + if (ts.isToken(child)) { + var tokenInfo = formattingScanner.readTokenInfo(child); + ts.Debug.assert(tokenInfo.token.end === child.end); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + return inheritedIndentation; + } + var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); + processNode(child, childContextNode, childStart.line, childIndentation.indentation, childIndentation.delta); + childContextNode = node; + return inheritedIndentation; + } + function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { + var listStartToken = getOpenTokenForList(parent, nodes); + var listEndToken = getCloseTokenForOpenToken(listStartToken); + var listDynamicIndentation = parentDynamicIndentation; + var startLine = parentStartLine; + if (listStartToken !== 0 /* Unknown */) { + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.end > nodes.pos) { + break; + } + else if (tokenInfo.token.kind === listStartToken) { + startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + var indentation = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + else { + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + } + } + } + var inheritedIndentation = -1 /* Unknown */; + for (var i = 0, len = nodes.length; i < len; ++i) { + inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + } + if (listEndToken !== 0 /* Unknown */) { + if (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + } + } + } + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); + var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + var indentToken = false; + if (currentTokenInfo.leadingTrivia) { + processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); + } + var lineAdded; + var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); + var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + if (isTokenInRange) { + var rangeHasError = rangeContainsError(currentTokenInfo.token); + var prevStartLine = previousRangeStartLine; + lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); + if (rangeHasError) { + indentToken = false; + } + else { + if (lineAdded !== undefined) { + indentToken = lineAdded; + } + else { + indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine; + } + } + } + if (currentTokenInfo.trailingTrivia) { + processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); + } + if (indentToken) { + var indentNextTokenOrTrivia = true; + if (currentTokenInfo.leadingTrivia) { + for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { + var triviaItem = currentTokenInfo.leadingTrivia[i]; + if (!ts.rangeContainsRange(originalRange, triviaItem)) { + continue; + } + var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + switch (triviaItem.kind) { + case 3 /* MultiLineCommentTrivia */: + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + indentNextTokenOrTrivia = false; + break; + case 2 /* SingleLineCommentTrivia */: + if (indentNextTokenOrTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, commentIndentation, false); + indentNextTokenOrTrivia = false; + } + break; + case 4 /* NewLineTrivia */: + indentNextTokenOrTrivia = true; + break; + } + } + } + if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { + var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); + } + } + formattingScanner.advance(); + childContextNode = parent; + } + } + function processTrivia(trivia, parent, contextNode, dynamicIndentation) { + for (var i = 0, len = trivia.length; i < len; ++i) { + var triviaItem = trivia[i]; + if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { + var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); + } + } + } + function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) { + var rangeHasError = rangeContainsError(range); + var lineAdded; + if (!rangeHasError && !previousRangeHasError) { + if (!previousRange) { + var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); + } + else { + lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + } + } + previousRange = range; + previousParent = parent; + previousRangeStartLine = rangeStart.line; + previousRangeHasError = rangeHasError; + return lineAdded; + } + function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) { + formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); + var rule = rulesProvider.getRulesMap().GetRule(formattingContext); + var trimTrailingWhitespaces; + var lineAdded; + if (rule) { + applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); + if (rule.Operation.Action & (2 /* Space */ | 8 /* Delete */) && currentStartLine !== previousStartLine) { + lineAdded = false; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(false); + } + } + else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) { + lineAdded = true; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(true); + } + } + trimTrailingWhitespaces = (rule.Operation.Action & (4 /* NewLine */ | 2 /* Space */)) && rule.Flag !== 1 /* CanDeleteNewLines */; + } + else { + trimTrailingWhitespaces = true; + } + if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) { + trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem); + } + return lineAdded; + } + function insertIndentation(pos, indentation, lineAdded) { + var indentationString = getIndentationString(indentation, options); + if (lineAdded) { + recordReplace(pos, 0, indentationString); + } + else { + var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); + if (indentation !== tokenStart.character - 1) { + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + } + } + } + function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { + var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + if (startLine === endLine) { + if (!firstLineIsIndented) { + insertIndentation(commentRange.pos, indentation, false); + } + return; + } + else { + var parts = []; + var startPos = commentRange.pos; + for (var line = startLine; line < endLine; ++line) { + var endOfLine = ts.getEndLinePosition(line, sourceFile); + parts.push({ pos: startPos, end: endOfLine }); + startPos = ts.getStartPositionOfLine(line + 1, sourceFile); + } + parts.push({ pos: startPos, end: commentRange.end }); + } + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); + if (indentation === nonWhitespaceColumnInFirstPart) { + return; + } + var startIndex = 0; + if (firstLineIsIndented) { + startIndex = 1; + startLine++; + } + var delta = indentation - nonWhitespaceColumnInFirstPart; + for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceColumn(parts[i].pos, parts[i].end, sourceFile, options); + var newIndentation = nonWhitespaceColumn + delta; + if (newIndentation > 0) { + var indentationString = getIndentationString(newIndentation, options); + recordReplace(startLinePos, nonWhitespaceColumn, indentationString); + } + else { + recordDelete(startLinePos, nonWhitespaceColumn); + } + } + } + function trimTrailingWhitespacesForLines(line1, line2, range) { + for (var line = line1; line < line2; ++line) { + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var lineEndPosition = ts.getEndLinePosition(line, sourceFile); + if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + continue; + } + var pos = lineEndPosition; + while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== lineEndPosition) { + ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); + recordDelete(pos + 1, lineEndPosition - pos); + } + } + } + function newTextChange(start, len, newText) { + return { span: new ts.TextSpan(start, len), newText: newText }; + } + function recordDelete(start, len) { + if (len) { + edits.push(newTextChange(start, len, "")); + } + } + function recordReplace(start, len, newText) { + if (len || newText) { + edits.push(newTextChange(start, len, newText)); + } + } + function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) { + var between; + switch (rule.Operation.Action) { + case 1 /* Ignore */: + return; + case 8 /* Delete */: + if (previousRange.end !== currentRange.pos) { + recordDelete(previousRange.end, currentRange.pos - previousRange.end); + } + break; + case 4 /* NewLine */: + if (rule.Flag !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) { + return; + } + var lineDelta = currentStartLine - previousStartLine; + if (lineDelta !== 1) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); + } + break; + case 2 /* Space */: + if (rule.Flag !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) { + return; + } + var posDelta = currentRange.pos - previousRange.end; + if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32 /* space */) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "); + } + break; + } + } + } + function isSomeBlock(kind) { + switch (kind) { + case 163 /* Block */: + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return true; + } + return false; + } + function getOpenTokenForList(node, list) { + switch (node.kind) { + case 126 /* Constructor */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 125 /* Method */: + case 151 /* ArrowFunction */: + if (node.typeParameters === list) { + return 23 /* LessThanToken */; + } + else if (node.parameters === list) { + return 15 /* OpenParenToken */; + } + break; + case 145 /* CallExpression */: + case 146 /* NewExpression */: + if (node.typeArguments === list) { + return 23 /* LessThanToken */; + } + else if (node.arguments === list) { + return 15 /* OpenParenToken */; + } + break; + case 132 /* TypeReference */: + if (node.typeArguments === list) { + return 23 /* LessThanToken */; + } + } + return 0 /* Unknown */; + } + function getCloseTokenForOpenToken(kind) { + switch (kind) { + case 15 /* OpenParenToken */: + return 16 /* CloseParenToken */; + case 23 /* LessThanToken */: + return 24 /* GreaterThanToken */; + } + return 0 /* Unknown */; + } + var internedTabsIndentation; + var internedSpacesIndentation; + function getIndentationString(indentation, options) { + if (!options.ConvertTabsToSpaces) { + var tabs = Math.floor(indentation / options.TabSize); + var spaces = indentation - tabs * options.TabSize; + var tabString; + if (!internedTabsIndentation) { + internedTabsIndentation = []; + } + if (internedTabsIndentation[tabs] === undefined) { + internedTabsIndentation[tabs] = tabString = repeat('\t', tabs); + } + else { + tabString = internedTabsIndentation[tabs]; + } + return spaces ? tabString + repeat(" ", spaces) : tabString; + } + else { + var spacesString; + var quotient = Math.floor(indentation / options.IndentSize); + var remainder = indentation % options.IndentSize; + if (!internedSpacesIndentation) { + internedSpacesIndentation = []; + } + if (internedSpacesIndentation[quotient] === undefined) { + spacesString = repeat(" ", options.IndentSize * quotient); + internedSpacesIndentation[quotient] = spacesString; + } + else { + spacesString = internedSpacesIndentation[quotient]; + } + return remainder ? spacesString + repeat(" ", remainder) : spacesString; + } + function repeat(value, count) { + var s = ""; + for (var i = 0; i < count; ++i) { + s += value; + } + return s; + } + } + formatting.getIndentationString = getIndentationString; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var SmartIndenter; + (function (SmartIndenter) { + function getIndentation(position, sourceFile, options) { + if (position > sourceFile.text.length) { + return 0; + } + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken) { + return 0; + } + if ((precedingToken.kind === 7 /* StringLiteral */ || precedingToken.kind === 8 /* RegularExpressionLiteral */) && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { + return 0; + } + var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + if (precedingToken.kind === 22 /* CommaToken */ && precedingToken.parent.kind !== 157 /* BinaryExpression */) { + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + var previous; + var current = precedingToken; + var currentStart; + var indentationDelta; + while (current) { + if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0 /* Unknown */)) { + currentStart = getStartLineAndCharacterForNode(current, sourceFile); + if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { + indentationDelta = 0; + } + else { + indentationDelta = lineAtPosition !== currentStart.line ? options.IndentSize : 0; + } + break; + } + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + previous = current; + current = current.parent; + } + if (!current) { + return 0; + } + return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + } + SmartIndenter.getIndentation = getIndentation; + function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { + var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); + } + SmartIndenter.getIndentationForNode = getIndentationForNode; + function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { + var parent = current.parent; + var parentStart; + while (parent) { + var useActualIndentation = true; + if (ignoreActualIndentationRange) { + var start = current.getStart(sourceFile); + useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; + } + if (useActualIndentation) { + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + parentStart = getParentStart(parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + if (useActualIndentation) { + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + indentationDelta += options.IndentSize; + } + current = parent; + currentStart = parentStart; + parent = current.parent; + } + return indentationDelta; + } + function getParentStart(parent, child, sourceFile) { + var containingList = getContainingList(child, sourceFile); + if (containingList) { + return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + } + return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + } + function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { + var commaItemInfo = ts.findListItemInfo(commaToken); + ts.Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0); + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } + function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 201 /* SourceFile */ || !parentAndChildShareLine); + if (!useActualIndentation) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { + var nextToken = ts.findNextToken(precedingToken, current); + if (!nextToken) { + return false; + } + if (nextToken.kind === 13 /* OpenBraceToken */) { + return true; + } + else if (nextToken.kind === 14 /* CloseBraceToken */) { + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine; + } + return false; + } + function getStartLineAndCharacterForNode(n, sourceFile) { + return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + } + function positionBelongsToNode(candidate, position, sourceFile) { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { + if (parent.kind === 167 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 74 /* ElseKeyword */, sourceFile); + ts.Debug.assert(elseKeyword !== undefined); + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + return false; + } + SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getContainingList(node, sourceFile) { + if (node.parent) { + switch (node.parent.kind) { + case 132 /* TypeReference */: + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + return node.parent.typeArguments; + } + break; + case 142 /* ObjectLiteralExpression */: + return node.parent.properties; + case 141 /* ArrayLiteralExpression */: + return node.parent.elements; + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 125 /* Method */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + case 146 /* NewExpression */: + case 145 /* CallExpression */: + var start = node.getStart(sourceFile); + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + return node.parent.arguments; + } + break; + } + } + return undefined; + } + function getActualIndentationForListItem(node, sourceFile, options) { + var containingList = getContainingList(node, sourceFile); + return containingList ? getActualIndentationFromList(containingList) : -1; + function getActualIndentationFromList(list) { + var index = ts.indexOf(list, node); + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + } + } + function deriveActualIndentationFromList(list, index, sourceFile, options) { + ts.Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; --i) { + if (list[i].kind === 22 /* CommaToken */) { + continue; + } + var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { + var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); + } + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { + var column = 0; + for (var pos = startPos; pos < endPos; ++pos) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch)) { + return column; + } + if (ch === 9 /* tab */) { + column += options.TabSize + (column % options.TabSize); + } + else { + column++; + } + } + return column; + } + SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeContentIsAlwaysIndented(kind) { + switch (kind) { + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 141 /* ArrayLiteralExpression */: + case 163 /* Block */: + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + case 142 /* ObjectLiteralExpression */: + case 136 /* TypeLiteral */: + case 176 /* SwitchStatement */: + case 195 /* DefaultClause */: + case 194 /* CaseClause */: + case 149 /* ParenthesizedExpression */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + case 164 /* VariableStatement */: + case 183 /* VariableDeclaration */: + case 192 /* ExportAssignment */: + case 174 /* ReturnStatement */: + case 158 /* ConditionalExpression */: + return true; + } + return false; + } + function shouldIndentChildNode(parent, child) { + if (nodeContentIsAlwaysIndented(parent)) { + return true; + } + switch (parent) { + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + case 171 /* ForInStatement */: + case 170 /* ForStatement */: + case 167 /* IfStatement */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 125 /* Method */: + case 151 /* ArrowFunction */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + return child !== 163 /* Block */; + default: + return false; + } + } + SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = children[children.length - 1]; + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === 21 /* SemicolonToken */ && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function isCompletedNode(n, sourceFile) { + if (n.getFullWidth() === 0) { + return false; + } + switch (n.kind) { + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 142 /* ObjectLiteralExpression */: + case 163 /* Block */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + case 176 /* SwitchStatement */: + return nodeEndsWith(n, 14 /* CloseBraceToken */, sourceFile); + case 197 /* CatchClause */: + return isCompletedNode(n.block, sourceFile); + case 149 /* ParenthesizedExpression */: + case 129 /* CallSignature */: + case 145 /* CallExpression */: + case 130 /* ConstructSignature */: + return nodeEndsWith(n, 16 /* CloseParenToken */, sourceFile); + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 125 /* Method */: + case 151 /* ArrowFunction */: + return !n.body || isCompletedNode(n.body, sourceFile); + case 189 /* ModuleDeclaration */: + return n.body && isCompletedNode(n.body, sourceFile); + case 167 /* IfStatement */: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 166 /* ExpressionStatement */: + return isCompletedNode(n.expression, sourceFile); + case 141 /* ArrayLiteralExpression */: + return nodeEndsWith(n, 18 /* CloseBracketToken */, sourceFile); + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + return false; + case 169 /* WhileStatement */: + return isCompletedNode(n.statement, sourceFile); + case 168 /* DoStatement */: + var hasWhileKeyword = ts.findChildOfKind(n, 98 /* WhileKeyword */, sourceFile); + if (hasWhileKeyword) { + return nodeEndsWith(n, 16 /* CloseParenToken */, sourceFile); + } + return isCompletedNode(n.statement, sourceFile); + default: + return true; + } + } + })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +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 ts; +(function (ts) { + ts.servicesVersion = "0.4"; + var ScriptSnapshot; + (function (ScriptSnapshot) { + var StringScriptSnapshot = (function () { + function StringScriptSnapshot(text) { + this.text = text; + this._lineStartPositions = undefined; + } + StringScriptSnapshot.prototype.getText = function (start, end) { + return this.text.substring(start, end); + }; + StringScriptSnapshot.prototype.getLength = function () { + return this.text.length; + }; + StringScriptSnapshot.prototype.getLineStartPositions = function () { + if (!this._lineStartPositions) { + this._lineStartPositions = ts.computeLineStarts(this.text); + } + return this._lineStartPositions; + }; + StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { + throw new Error("not yet implemented"); + }; + return StringScriptSnapshot; + })(); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot.fromString = fromString; + })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); + var scanner = ts.createScanner(2 /* Latest */, true); + var emptyArray = []; + function createNode(kind, pos, end, flags, parent) { + var node = new (ts.getNodeConstructor(kind))(); + node.pos = pos; + node.end = end; + node.flags = flags; + node.parent = parent; + return node; + } + var NodeObject = (function () { + function NodeObject() { + } + NodeObject.prototype.getSourceFile = function () { + return ts.getSourceFileOfNode(this); + }; + NodeObject.prototype.getStart = function (sourceFile) { + return ts.getTokenPosOfNode(this, sourceFile); + }; + NodeObject.prototype.getFullStart = function () { + return this.pos; + }; + NodeObject.prototype.getEnd = function () { + return this.end; + }; + NodeObject.prototype.getWidth = function (sourceFile) { + return this.getEnd() - this.getStart(sourceFile); + }; + NodeObject.prototype.getFullWidth = function () { + return this.end - this.getFullStart(); + }; + NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) { + return this.getStart(sourceFile) - this.pos; + }; + NodeObject.prototype.getFullText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + }; + NodeObject.prototype.getText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd()); + }; + NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end) { + scanner.setTextPos(pos); + while (pos < end) { + var token = scanner.scan(); + var textPos = scanner.getTextPos(); + nodes.push(createNode(token, pos, textPos, 512 /* Synthetic */, this)); + pos = textPos; + } + return pos; + }; + NodeObject.prototype.createSyntaxList = function (nodes) { + var list = createNode(203 /* SyntaxList */, nodes.pos, nodes.end, 512 /* Synthetic */, this); + list._children = []; + var pos = nodes.pos; + for (var i = 0, len = nodes.length; i < len; i++) { + var node = nodes[i]; + if (pos < node.pos) { + pos = this.addSyntheticNodes(list._children, pos, node.pos); + } + list._children.push(node); + pos = node.end; + } + if (pos < nodes.end) { + this.addSyntheticNodes(list._children, pos, nodes.end); + } + return list; + }; + NodeObject.prototype.createChildren = function (sourceFile) { + var _this = this; + if (this.kind >= 120 /* FirstNode */) { + scanner.setText((sourceFile || this.getSourceFile()).text); + var children = []; + var pos = this.pos; + var processNode = function (node) { + if (pos < node.pos) { + pos = _this.addSyntheticNodes(children, pos, node.pos); + } + children.push(node); + pos = node.end; + }; + var processNodes = function (nodes) { + if (pos < nodes.pos) { + pos = _this.addSyntheticNodes(children, pos, nodes.pos); + } + children.push(_this.createSyntaxList(nodes)); + pos = nodes.end; + }; + ts.forEachChild(this, processNode, processNodes); + if (pos < this.end) { + this.addSyntheticNodes(children, pos, this.end); + } + scanner.setText(undefined); + } + this._children = children || emptyArray; + }; + NodeObject.prototype.getChildCount = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children.length; + }; + NodeObject.prototype.getChildAt = function (index, sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children[index]; + }; + NodeObject.prototype.getChildren = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children; + }; + NodeObject.prototype.getFirstToken = function (sourceFile) { + var children = this.getChildren(); + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.kind < 120 /* FirstNode */) { + return child; + } + return child.getFirstToken(sourceFile); + } + }; + NodeObject.prototype.getLastToken = function (sourceFile) { + var children = this.getChildren(sourceFile); + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + if (child.kind < 120 /* FirstNode */) { + return child; + } + return child.getLastToken(sourceFile); + } + }; + return NodeObject; + })(); + var SymbolObject = (function () { + function SymbolObject(flags, name) { + this.flags = flags; + this.name = name; + } + SymbolObject.prototype.getFlags = function () { + return this.flags; + }; + SymbolObject.prototype.getName = function () { + return this.name; + }; + SymbolObject.prototype.getDeclarations = function () { + return this.declarations; + }; + SymbolObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & 4 /* Property */)); + } + return this.documentationComment; + }; + return SymbolObject; + })(); + function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { + var documentationComment = []; + var docComments = getJsDocCommentsSeparatedByNewLines(); + ts.forEach(docComments, function (docComment) { + if (documentationComment.length) { + documentationComment.push(ts.lineBreakPart()); + } + documentationComment.push(docComment); + }); + return documentationComment; + function getJsDocCommentsSeparatedByNewLines() { + var paramTag = "@param"; + var jsDocCommentParts = []; + ts.forEach(declarations, function (declaration) { + var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); + if (canUseParsedParamTagComments && declaration.kind === 123 /* 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 === 189 /* ModuleDeclaration */ && declaration.body.kind === 189 /* ModuleDeclaration */) { + return; + } + while (declaration.kind === 189 /* ModuleDeclaration */ && declaration.parent.kind === 189 /* ModuleDeclaration */) { + declaration = declaration.parent; + } + ts.forEach(getJsDocCommentTextRange(declaration.kind === 183 /* VariableDeclaration */ ? declaration.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) { + return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { + return { + pos: jsDocComment.pos + "/*".length, + end: jsDocComment.end - "*/".length + }; + }); + } + function consumeWhiteSpacesOnTheLine(pos, end, sourceFile, maxSpacesToRemove) { + if (maxSpacesToRemove !== undefined) { + end = Math.min(end, pos + maxSpacesToRemove); + } + for (; pos < end; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch) || ts.isLineBreak(ch)) { + return pos; + } + } + return end; + } + function consumeLineBreaks(pos, end, sourceFile) { + while (pos < end && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function isName(pos, end, sourceFile, name) { + return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + } + function isParamTag(pos, end, sourceFile) { + return isName(pos, end, sourceFile, paramTag); + } + function pushDocCommentLineText(docComments, text, blankLineCount) { + while (blankLineCount--) + docComments.push(ts.textPart("")); + docComments.push(ts.textPart(text)); + } + function getCleanedJsDocComment(pos, end, sourceFile) { + var spacesToRemoveAfterAsterisk; + var docComments = []; + var blankLineCount = 0; + var isInParamTag = false; + while (pos < end) { + var docCommentTextOfLine = ""; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); + if (pos < end && sourceFile.text.charCodeAt(pos) === 42 /* asterisk */) { + var lineStartPos = pos + 1; + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); + if (spacesToRemoveAfterAsterisk === undefined && pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + spacesToRemoveAfterAsterisk = pos - lineStartPos; + } + } + else if (spacesToRemoveAfterAsterisk === undefined) { + spacesToRemoveAfterAsterisk = 0; + } + while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + var ch = sourceFile.text.charAt(pos); + if (ch === "@") { + if (isParamTag(pos, end, sourceFile)) { + isInParamTag = true; + pos += paramTag.length; + continue; + } + else { + isInParamTag = false; + } + } + if (!isInParamTag) { + docCommentTextOfLine += ch; + } + pos++; + } + pos = consumeLineBreaks(pos, end, sourceFile); + if (docCommentTextOfLine) { + pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + blankLineCount = 0; + } + else if (!isInParamTag && docComments.length) { + blankLineCount++; + } + } + return docComments; + } + function getCleanedParamJsDocComment(pos, end, sourceFile) { + var paramHelpStringMargin; + var paramDocComments = []; + while (pos < end) { + if (isParamTag(pos, end, sourceFile)) { + var blankLineCount = 0; + var recordedParamTag = false; + pos = consumeWhiteSpaces(pos + paramTag.length); + if (pos >= end) { + break; + } + if (sourceFile.text.charCodeAt(pos) === 123 /* openBrace */) { + pos++; + for (var curlies = 1; pos < end; pos++) { + var charCode = sourceFile.text.charCodeAt(pos); + if (charCode === 123 /* openBrace */) { + curlies++; + continue; + } + if (charCode === 125 /* closeBrace */) { + curlies--; + if (curlies === 0) { + pos++; + break; + } + else { + continue; + } + } + if (charCode === 64 /* at */) { + break; + } + } + pos = consumeWhiteSpaces(pos); + if (pos >= end) { + break; + } + } + if (isName(pos, end, sourceFile, name)) { + pos = consumeWhiteSpaces(pos + name.length); + if (pos >= end) { + break; + } + var paramHelpString = ""; + var firstLineParamHelpStringPos = pos; + while (pos < end) { + var ch = sourceFile.text.charCodeAt(pos); + if (ts.isLineBreak(ch)) { + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + paramHelpString = ""; + blankLineCount = 0; + recordedParamTag = true; + } + else if (recordedParamTag) { + blankLineCount++; + } + setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); + continue; + } + if (ch === 64 /* at */) { + break; + } + paramHelpString += sourceFile.text.charAt(pos); + pos++; + } + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + } + paramHelpStringMargin = undefined; + } + if (sourceFile.text.charCodeAt(pos) === 64 /* at */) { + continue; + } + } + pos++; + } + return paramDocComments; + function consumeWhiteSpaces(pos) { + while (pos < end && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos) { + pos = consumeLineBreaks(pos, end, sourceFile); + if (pos >= end) { + return; + } + if (paramHelpStringMargin === undefined) { + paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + } + var startOfLinePos = pos; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); + if (pos >= end) { + return; + } + var consumedSpaces = pos - startOfLinePos; + if (consumedSpaces < paramHelpStringMargin) { + var ch = sourceFile.text.charCodeAt(pos); + if (ch === 42 /* asterisk */) { + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); + } + } + } + } + } + } + var TypeObject = (function () { + function TypeObject(checker, flags) { + this.checker = checker; + this.flags = flags; + } + TypeObject.prototype.getFlags = function () { + return this.flags; + }; + TypeObject.prototype.getSymbol = function () { + return this.symbol; + }; + TypeObject.prototype.getProperties = function () { + return this.checker.getPropertiesOfType(this); + }; + TypeObject.prototype.getProperty = function (propertyName) { + return this.checker.getPropertyOfType(this, propertyName); + }; + TypeObject.prototype.getApparentProperties = function () { + return this.checker.getAugmentedPropertiesOfType(this); + }; + TypeObject.prototype.getCallSignatures = function () { + return this.checker.getSignaturesOfType(this, 0 /* Call */); + }; + TypeObject.prototype.getConstructSignatures = function () { + return this.checker.getSignaturesOfType(this, 1 /* Construct */); + }; + TypeObject.prototype.getStringIndexType = function () { + return this.checker.getIndexTypeOfType(this, 0 /* String */); + }; + TypeObject.prototype.getNumberIndexType = function () { + return this.checker.getIndexTypeOfType(this, 1 /* Number */); + }; + return TypeObject; + })(); + var SignatureObject = (function () { + function SignatureObject(checker) { + this.checker = checker; + } + SignatureObject.prototype.getDeclaration = function () { + return this.declaration; + }; + SignatureObject.prototype.getTypeParameters = function () { + return this.typeParameters; + }; + SignatureObject.prototype.getParameters = function () { + return this.parameters; + }; + SignatureObject.prototype.getReturnType = function () { + return this.checker.getReturnTypeOfSignature(this); + }; + SignatureObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + } + return this.documentationComment; + }; + return SignatureObject; + })(); + var SourceFileObject = (function (_super) { + __extends(SourceFileObject, _super); + function SourceFileObject() { + _super.apply(this, arguments); + } + SourceFileObject.prototype.getScriptSnapshot = function () { + return this.scriptSnapshot; + }; + SourceFileObject.prototype.getNamedDeclarations = function () { + if (!this.namedDeclarations) { + var sourceFile = this; + var namedDeclarations = []; + ts.forEachChild(sourceFile, function visit(node) { + switch (node.kind) { + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + var functionDeclaration = node; + if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { + var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; + if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { + if (functionDeclaration.body && !lastDeclaration.body) { + namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; + } + } + else { + namedDeclarations.push(functionDeclaration); + } + ts.forEachChild(node, visit); + } + break; + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 188 /* EnumDeclaration */: + case 189 /* ModuleDeclaration */: + case 191 /* ImportDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 136 /* TypeLiteral */: + if (node.name) { + namedDeclarations.push(node); + } + case 126 /* Constructor */: + case 164 /* VariableStatement */: + case 190 /* ModuleBlock */: + ts.forEachChild(node, visit); + break; + case 163 /* Block */: + if (ts.isFunctionBlock(node)) { + ts.forEachChild(node, visit); + } + break; + case 123 /* Parameter */: + if (!(node.flags & 112 /* AccessibilityModifier */)) { + break; + } + case 183 /* VariableDeclaration */: + case 200 /* EnumMember */: + case 124 /* Property */: + namedDeclarations.push(node); + break; + } + }); + this.namedDeclarations = namedDeclarations; + } + return this.namedDeclarations; + }; + SourceFileObject.prototype.update = function (scriptSnapshot, version, isOpen, textChangeRange) { + if (textChangeRange && ts.Debug.shouldAssert(1 /* Normal */)) { + var oldText = this.scriptSnapshot; + var newText = scriptSnapshot; + ts.Debug.assert((oldText.getLength() - textChangeRange.span().length() + textChangeRange.newLength()) === newText.getLength()); + if (ts.Debug.shouldAssert(3 /* VeryAggressive */)) { + var oldTextPrefix = oldText.getText(0, textChangeRange.span().start()); + var newTextPrefix = newText.getText(0, textChangeRange.span().start()); + ts.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.getText(textChangeRange.span().end(), oldText.getLength()); + var newTextSuffix = newText.getText(textChangeRange.newSpan().end(), newText.getLength()); + ts.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + return SourceFileObject.createSourceFileObject(this.filename, scriptSnapshot, this.languageVersion, version, isOpen); + }; + SourceFileObject.createSourceFileObject = function (filename, scriptSnapshot, languageVersion, version, isOpen) { + var newSourceFile = ts.createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), languageVersion, version, isOpen); + newSourceFile.scriptSnapshot = scriptSnapshot; + return newSourceFile; + }; + return SourceFileObject; + })(NodeObject); + var TextSpan = (function () { + function TextSpan(start, length) { + ts.Debug.assert(start >= 0, "start"); + ts.Debug.assert(length >= 0, "length"); + this._start = start; + this._length = length; + } + TextSpan.prototype.toJSON = function (key) { + return { start: this._start, length: this._length }; + }; + TextSpan.prototype.start = function () { + return this._start; + }; + TextSpan.prototype.length = function () { + return this._length; + }; + TextSpan.prototype.end = function () { + return this._start + this._length; + }; + TextSpan.prototype.isEmpty = function () { + return this._length === 0; + }; + TextSpan.prototype.containsPosition = function (position) { + return position >= this._start && position < this.end(); + }; + TextSpan.prototype.containsTextSpan = function (span) { + return span._start >= this._start && span.end() <= this.end(); + }; + TextSpan.prototype.overlapsWith = function (span) { + var overlapStart = Math.max(this._start, span._start); + var overlapEnd = Math.min(this.end(), span.end()); + return overlapStart < overlapEnd; + }; + TextSpan.prototype.overlap = function (span) { + var overlapStart = Math.max(this._start, span._start); + var overlapEnd = Math.min(this.end(), span.end()); + if (overlapStart < overlapEnd) { + return TextSpan.fromBounds(overlapStart, overlapEnd); + } + return undefined; + }; + TextSpan.prototype.intersectsWithTextSpan = function (span) { + return span._start <= this.end() && span.end() >= this._start; + }; + TextSpan.prototype.intersectsWith = function (start, length) { + var end = start + length; + return start <= this.end() && end >= this._start; + }; + TextSpan.prototype.intersectsWithPosition = function (position) { + return position <= this.end() && position >= this._start; + }; + TextSpan.prototype.intersection = function (span) { + var intersectStart = Math.max(this._start, span._start); + var intersectEnd = Math.min(this.end(), span.end()); + if (intersectStart <= intersectEnd) { + return TextSpan.fromBounds(intersectStart, intersectEnd); + } + return undefined; + }; + TextSpan.fromBounds = function (start, end) { + ts.Debug.assert(start >= 0); + ts.Debug.assert(end - start >= 0); + return new TextSpan(start, end - start); + }; + return TextSpan; + })(); + ts.TextSpan = TextSpan; + var TextChangeRange = (function () { + function TextChangeRange(span, newLength) { + ts.Debug.assert(newLength >= 0, "newLength"); + this._span = span; + this._newLength = newLength; + } + TextChangeRange.prototype.span = function () { + return this._span; + }; + TextChangeRange.prototype.newLength = function () { + return this._newLength; + }; + TextChangeRange.prototype.newSpan = function () { + return new TextSpan(this.span().start(), this.newLength()); + }; + TextChangeRange.prototype.isUnchanged = function () { + return this.span().isEmpty() && this.newLength() === 0; + }; + TextChangeRange.collapseChangesAcrossMultipleVersions = function (changes) { + if (changes.length === 0) { + return TextChangeRange.unchanged; + } + if (changes.length === 1) { + return changes[0]; + } + var change0 = changes[0]; + var oldStartN = change0.span().start(); + var oldEndN = change0.span().end(); + var newEndN = oldStartN + change0.newLength(); + for (var i = 1; i < changes.length; i++) { + var nextChange = changes[i]; + var oldStart1 = oldStartN; + var oldEnd1 = oldEndN; + var newEnd1 = newEndN; + var oldStart2 = nextChange.span().start(); + var oldEnd2 = nextChange.span().end(); + var newEnd2 = oldStart2 + nextChange.newLength(); + oldStartN = Math.min(oldStart1, oldStart2); + oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); + newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + } + return new TextChangeRange(TextSpan.fromBounds(oldStartN, oldEndN), newEndN - oldStartN); + }; + TextChangeRange.unchanged = new TextChangeRange(new TextSpan(0, 0), 0); + return TextChangeRange; + })(); + ts.TextChangeRange = TextChangeRange; + var TextChange = (function () { + function TextChange() { + } + return TextChange; + })(); + ts.TextChange = TextChange; + (function (SymbolDisplayPartKind) { + SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword"; + SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak"; + SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator"; + SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation"; + SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space"; + SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text"; + SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; + })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var SymbolDisplayPartKind = ts.SymbolDisplayPartKind; + (function (OutputFileType) { + OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; + OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; + OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; + })(ts.OutputFileType || (ts.OutputFileType = {})); + var OutputFileType = ts.OutputFileType; + (function (EndOfLineState) { + EndOfLineState[EndOfLineState["Start"] = 0] = "Start"; + EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + })(ts.EndOfLineState || (ts.EndOfLineState = {})); + var EndOfLineState = ts.EndOfLineState; + (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["NumberLiteral"] = 6] = "NumberLiteral"; + TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral"; + TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral"; + })(ts.TokenClass || (ts.TokenClass = {})); + var TokenClass = ts.TokenClass; + var ScriptElementKind = (function () { + function ScriptElementKind() { + } + ScriptElementKind.unknown = ""; + ScriptElementKind.keyword = "keyword"; + ScriptElementKind.scriptElement = "script"; + ScriptElementKind.moduleElement = "module"; + ScriptElementKind.classElement = "class"; + ScriptElementKind.interfaceElement = "interface"; + ScriptElementKind.typeElement = "type"; + ScriptElementKind.enumElement = "enum"; + ScriptElementKind.variableElement = "var"; + ScriptElementKind.localVariableElement = "local var"; + ScriptElementKind.functionElement = "function"; + ScriptElementKind.localFunctionElement = "local function"; + ScriptElementKind.memberFunctionElement = "method"; + ScriptElementKind.memberGetAccessorElement = "getter"; + ScriptElementKind.memberSetAccessorElement = "setter"; + ScriptElementKind.memberVariableElement = "property"; + ScriptElementKind.constructorImplementationElement = "constructor"; + ScriptElementKind.callSignatureElement = "call"; + ScriptElementKind.indexSignatureElement = "index"; + ScriptElementKind.constructSignatureElement = "construct"; + ScriptElementKind.parameterElement = "parameter"; + ScriptElementKind.typeParameterElement = "type parameter"; + ScriptElementKind.primitiveType = "primitive type"; + ScriptElementKind.label = "label"; + ScriptElementKind.alias = "alias"; + ScriptElementKind.constElement = "const"; + ScriptElementKind.letElement = "let"; + return ScriptElementKind; + })(); + ts.ScriptElementKind = ScriptElementKind; + var ScriptElementKindModifier = (function () { + function ScriptElementKindModifier() { + } + ScriptElementKindModifier.none = ""; + ScriptElementKindModifier.publicMemberModifier = "public"; + ScriptElementKindModifier.privateMemberModifier = "private"; + ScriptElementKindModifier.protectedMemberModifier = "protected"; + ScriptElementKindModifier.exportedModifier = "export"; + ScriptElementKindModifier.ambientModifier = "declare"; + ScriptElementKindModifier.staticModifier = "static"; + return ScriptElementKindModifier; + })(); + ts.ScriptElementKindModifier = ScriptElementKindModifier; + var ClassificationTypeNames = (function () { + function ClassificationTypeNames() { + } + ClassificationTypeNames.comment = "comment"; + ClassificationTypeNames.identifier = "identifier"; + ClassificationTypeNames.keyword = "keyword"; + ClassificationTypeNames.numericLiteral = "number"; + ClassificationTypeNames.operator = "operator"; + ClassificationTypeNames.stringLiteral = "string"; + ClassificationTypeNames.whiteSpace = "whitespace"; + ClassificationTypeNames.text = "text"; + ClassificationTypeNames.punctuation = "punctuation"; + ClassificationTypeNames.className = "class name"; + ClassificationTypeNames.enumName = "enum name"; + ClassificationTypeNames.interfaceName = "interface name"; + ClassificationTypeNames.moduleName = "module name"; + ClassificationTypeNames.typeParameterName = "type parameter name"; + ClassificationTypeNames.typeAlias = "type alias name"; + return ClassificationTypeNames; + })(); + ts.ClassificationTypeNames = ClassificationTypeNames; + var MatchKind; + (function (MatchKind) { + MatchKind[MatchKind["none"] = 0] = "none"; + MatchKind[MatchKind["exact"] = 1] = "exact"; + MatchKind[MatchKind["substring"] = 2] = "substring"; + MatchKind[MatchKind["prefix"] = 3] = "prefix"; + })(MatchKind || (MatchKind = {})); + function displayPartsToString(displayParts) { + if (displayParts) { + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + } + return ""; + } + ts.displayPartsToString = displayPartsToString; + function isLocalVariableOrFunction(symbol) { + if (symbol.parent) { + return false; + } + return ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 150 /* FunctionExpression */) { + return true; + } + if (declaration.kind !== 183 /* VariableDeclaration */ && declaration.kind !== 184 /* FunctionDeclaration */) { + return false; + } + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 201 /* SourceFile */ || parent.kind === 190 /* ModuleBlock */) { + return false; + } + } + return true; + }); + } + function getDefaultCompilerOptions() { + return { + target: 2 /* Latest */, + module: 0 /* None */ + }; + } + ts.getDefaultCompilerOptions = getDefaultCompilerOptions; + var OperationCanceledException = (function () { + function OperationCanceledException() { + } + return OperationCanceledException; + })(); + ts.OperationCanceledException = OperationCanceledException; + var CancellationTokenObject = (function () { + function CancellationTokenObject(cancellationToken) { + this.cancellationToken = cancellationToken; + } + CancellationTokenObject.prototype.isCancellationRequested = function () { + return this.cancellationToken && this.cancellationToken.isCancellationRequested(); + }; + CancellationTokenObject.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new OperationCanceledException(); + } + }; + CancellationTokenObject.None = new CancellationTokenObject(null); + return CancellationTokenObject; + })(); + ts.CancellationTokenObject = CancellationTokenObject; + var HostCache = (function () { + function HostCache(host) { + this.host = host; + this.filenameToEntry = {}; + var filenames = host.getScriptFileNames(); + for (var i = 0, n = filenames.length; i < n; i++) { + var filename = filenames[i]; + this.filenameToEntry[ts.normalizeSlashes(filename)] = { + filename: filename, + version: host.getScriptVersion(filename), + isOpen: host.getScriptIsOpen(filename) + }; + } + this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); + } + HostCache.prototype.compilationSettings = function () { + return this._compilationSettings; + }; + HostCache.prototype.getEntry = function (filename) { + filename = ts.normalizeSlashes(filename); + return ts.lookUp(this.filenameToEntry, filename); + }; + HostCache.prototype.contains = function (filename) { + return !!this.getEntry(filename); + }; + HostCache.prototype.getHostfilename = function (filename) { + var hostCacheEntry = this.getEntry(filename); + if (hostCacheEntry) { + return hostCacheEntry.filename; + } + return filename; + }; + HostCache.prototype.getFilenames = function () { + var _this = this; + var fileNames = []; + ts.forEachKey(this.filenameToEntry, function (key) { + if (ts.hasProperty(_this.filenameToEntry, key)) + fileNames.push(key); + }); + return fileNames; + }; + HostCache.prototype.getVersion = function (filename) { + return this.getEntry(filename).version; + }; + HostCache.prototype.isOpen = function (filename) { + return this.getEntry(filename).isOpen; + }; + HostCache.prototype.getScriptSnapshot = function (filename) { + var file = this.getEntry(filename); + if (!file.sourceText) { + file.sourceText = this.host.getScriptSnapshot(file.filename); + } + return file.sourceText; + }; + HostCache.prototype.getChangeRange = function (filename, lastKnownVersion, oldScriptSnapshot) { + var currentVersion = this.getVersion(filename); + if (lastKnownVersion === currentVersion) { + return TextChangeRange.unchanged; + } + var scriptSnapshot = this.getScriptSnapshot(filename); + return scriptSnapshot.getChangeRange(oldScriptSnapshot); + }; + return HostCache; + })(); + var SyntaxTreeCache = (function () { + function SyntaxTreeCache(host) { + this.host = host; + this.currentFilename = ""; + this.currentFileVersion = null; + this.currentSourceFile = null; + } + SyntaxTreeCache.prototype.initialize = function (filename) { + var start = new Date().getTime(); + this.hostCache = new HostCache(this.host); + this.host.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); + var version = this.hostCache.getVersion(filename); + var sourceFile; + if (this.currentFilename !== filename) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); + var start = new Date().getTime(); + sourceFile = createSourceFileFromScriptSnapshot(filename, scriptSnapshot, getDefaultCompilerOptions(), version, true); + this.host.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + fixupParentReferences(sourceFile); + this.host.log("SyntaxTreeCache.Initialize: fixupParentRefs : " + (new Date().getTime() - start)); + } + else if (this.currentFileVersion !== version) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); + var editRange = this.hostCache.getChangeRange(filename, this.currentFileVersion, this.currentSourceFile.getScriptSnapshot()); + var start = new Date().getTime(); + sourceFile = !editRange ? createSourceFileFromScriptSnapshot(filename, scriptSnapshot, getDefaultCompilerOptions(), version, true) : this.currentSourceFile.update(scriptSnapshot, version, true, editRange); + this.host.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + fixupParentReferences(sourceFile); + this.host.log("SyntaxTreeCache.Initialize: fixupParentRefs : " + (new Date().getTime() - start)); + } + if (sourceFile) { + this.currentFileVersion = version; + this.currentFilename = filename; + this.currentSourceFile = sourceFile; + } + function fixupParentReferences(sourceFile) { + var parent = sourceFile; + function walk(n) { + n.parent = parent; + var saveParent = parent; + parent = n; + ts.forEachChild(n, walk); + parent = saveParent; + } + ts.forEachChild(sourceFile, walk); + } + }; + SyntaxTreeCache.prototype.getCurrentSourceFile = function (filename) { + this.initialize(filename); + return this.currentSourceFile; + }; + SyntaxTreeCache.prototype.getCurrentScriptSnapshot = function (filename) { + return this.getCurrentSourceFile(filename).getScriptSnapshot(); + }; + return SyntaxTreeCache; + })(); + function createSourceFileFromScriptSnapshot(filename, scriptSnapshot, settings, version, isOpen) { + return SourceFileObject.createSourceFileObject(filename, scriptSnapshot, settings.target, version, isOpen); + } + function createDocumentRegistry() { + var buckets = {}; + function getKeyFromCompilationSettings(settings) { + return "_" + settings.target; + } + function getBucketForCompilationSettings(settings, createIfMissing) { + var key = getKeyFromCompilationSettings(settings); + var bucket = ts.lookUp(buckets, key); + if (!bucket && createIfMissing) { + buckets[key] = bucket = {}; + } + return bucket; + } + function reportStats() { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var entries = ts.lookUp(buckets, name); + var sourceFiles = []; + for (var i in entries) { + var entry = entries[i]; + sourceFiles.push({ + name: i, + refCount: entry.refCount, + references: entry.owners.slice(0) + }); + } + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, null, 2); + } + function acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen) { + var bucket = getBucketForCompilationSettings(compilationSettings, true); + var entry = ts.lookUp(bucket, filename); + if (!entry) { + var sourceFile = createSourceFileFromScriptSnapshot(filename, scriptSnapshot, compilationSettings, version, isOpen); + bucket[filename] = entry = { + sourceFile: sourceFile, + refCount: 0, + owners: [] + }; + } + entry.refCount++; + return entry.sourceFile; + } + function updateDocument(sourceFile, filename, compilationSettings, scriptSnapshot, version, isOpen, textChangeRange) { + var bucket = getBucketForCompilationSettings(compilationSettings, false); + ts.Debug.assert(bucket !== undefined); + var entry = ts.lookUp(bucket, filename); + ts.Debug.assert(entry !== undefined); + if (entry.sourceFile.isOpen === isOpen && entry.sourceFile.version === version) { + return entry.sourceFile; + } + entry.sourceFile = entry.sourceFile.update(scriptSnapshot, version, isOpen, textChangeRange); + return entry.sourceFile; + } + function releaseDocument(filename, compilationSettings) { + var bucket = getBucketForCompilationSettings(compilationSettings, false); + ts.Debug.assert(bucket !== undefined); + var entry = ts.lookUp(bucket, filename); + entry.refCount--; + ts.Debug.assert(entry.refCount >= 0); + if (entry.refCount === 0) { + delete bucket[filename]; + } + } + return { + acquireDocument: acquireDocument, + updateDocument: updateDocument, + releaseDocument: releaseDocument, + reportStats: reportStats + }; + } + ts.createDocumentRegistry = createDocumentRegistry; + function preProcessFile(sourceText, readImportFiles) { + if (readImportFiles === void 0) { readImportFiles = true; } + var referencedFiles = []; + var importedFiles = []; + var isNoDefaultLib = false; + function processTripleSlashDirectives() { + var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); + ts.forEach(commentRanges, function (commentRange) { + var comment = sourceText.substring(commentRange.pos, commentRange.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); + if (referencePathMatchResult) { + isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var fileReference = referencePathMatchResult.fileReference; + if (fileReference) { + referencedFiles.push(fileReference); + } + } + }); + } + function processImport() { + scanner.setText(sourceText); + var token = scanner.scan(); + while (token !== 1 /* EndOfFileToken */) { + if (token === 83 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 63 /* Identifier */) { + token = scanner.scan(); + if (token === 51 /* EqualsToken */) { + token = scanner.scan(); + if (token === 115 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 15 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 7 /* StringLiteral */) { + var importPath = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + importedFiles.push({ + filename: importPath, + pos: pos, + end: pos + importPath.length + }); + } + } + } + } + } + } + token = scanner.scan(); + } + scanner.setText(undefined); + } + if (readImportFiles) { + processImport(); + } + processTripleSlashDirectives(); + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + } + ts.preProcessFile = preProcessFile; + function getTargetLabel(referenceNode, labelName) { + while (referenceNode) { + if (referenceNode.kind === 177 /* LabeledStatement */ && referenceNode.label.text === labelName) { + return referenceNode.label; + } + referenceNode = referenceNode.parent; + } + return undefined; + } + function isJumpStatementTarget(node) { + return node.kind === 63 /* Identifier */ && (node.parent.kind === 173 /* BreakStatement */ || node.parent.kind === 172 /* ContinueStatement */) && node.parent.label === node; + } + function isLabelOfLabeledStatement(node) { + return node.kind === 63 /* Identifier */ && node.parent.kind === 177 /* LabeledStatement */ && node.parent.label === node; + } + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 177 /* LabeledStatement */; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; + } + } + return false; + } + function isLabelName(node) { + return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); + } + function isRightSideOfQualifiedName(node) { + return node.parent.kind === 120 /* QualifiedName */ && node.parent.right === node; + } + function isRightSideOfPropertyAccess(node) { + return node && node.parent && node.parent.kind === 143 /* PropertyAccessExpression */ && node.parent.name === node; + } + function isCallExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 145 /* CallExpression */ && node.parent.expression === node; + } + function isNewExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 146 /* NewExpression */ && node.parent.expression === node; + } + function isNameOfModuleDeclaration(node) { + return node.parent.kind === 189 /* ModuleDeclaration */ && node.parent.name === node; + } + function isNameOfFunctionDeclaration(node) { + return node.kind === 63 /* Identifier */ && ts.isAnyFunction(node.parent) && node.parent.name === node; + } + function isNameOfPropertyAssignment(node) { + return (node.kind === 63 /* Identifier */ || node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) && (node.parent.kind === 198 /* PropertyAssignment */ || node.parent.kind === 199 /* ShorthandPropertyAssignment */) && node.parent.name === node; + } + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { + if (node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) { + switch (node.parent.kind) { + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 200 /* EnumMember */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 189 /* ModuleDeclaration */: + return node.parent.name === node; + case 144 /* ElementAccessExpression */: + return node.parent.argumentExpression === node; + } + } + return false; + } + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 7 /* StringLiteral */) { + return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); + } + return false; + } + function isInsideComment(sourceFile, token, position) { + return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + function isInsideCommentRange(comments) { + return ts.forEach(comments, function (comment) { + if (comment.pos < position && position < comment.end) { + return true; + } + else if (position === comment.end) { + var text = sourceFile.text; + var width = comment.end - comment.pos; + if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47 /* slash */) { + return true; + } + else { + return !(text.charCodeAt(comment.end - 1) === 47 /* slash */ && text.charCodeAt(comment.end - 2) === 42 /* asterisk */); + } + } + return false; + }); + } + } + var SemanticMeaning; + (function (SemanticMeaning) { + SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; + SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; + SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; + SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; + SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; + })(SemanticMeaning || (SemanticMeaning = {})); + var BreakContinueSearchType; + (function (BreakContinueSearchType) { + BreakContinueSearchType[BreakContinueSearchType["None"] = 0] = "None"; + BreakContinueSearchType[BreakContinueSearchType["Unlabeled"] = 1] = "Unlabeled"; + BreakContinueSearchType[BreakContinueSearchType["Labeled"] = 2] = "Labeled"; + BreakContinueSearchType[BreakContinueSearchType["All"] = 3] = "All"; + })(BreakContinueSearchType || (BreakContinueSearchType = {})); + var keywordCompletions = []; + for (var i = 64 /* FirstKeyword */; i <= 119 /* LastKeyword */; i++) { + keywordCompletions.push({ + name: ts.tokenToString(i), + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none + }); + } + function createLanguageService(host, documentRegistry) { + var syntaxTreeCache = new SyntaxTreeCache(host); + var ruleProvider; + var hostCache; + var program; + var typeInfoResolver; + var fullTypeCheckChecker_doNotAccessDirectly; + var useCaseSensitivefilenames = false; + var sourceFilesByName = {}; + var documentRegistry = documentRegistry; + var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var activeCompletionSession; + var writer = undefined; + if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { + ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); + } + function getCanonicalFileName(filename) { + return useCaseSensitivefilenames ? filename : filename.toLowerCase(); + } + function getSourceFile(filename) { + return ts.lookUp(sourceFilesByName, getCanonicalFileName(filename)); + } + function getFullTypeCheckChecker() { + return fullTypeCheckChecker_doNotAccessDirectly || (fullTypeCheckChecker_doNotAccessDirectly = program.getTypeChecker(true)); + } + function getRuleProvider(options) { + if (!ruleProvider) { + ruleProvider = new ts.formatting.RulesProvider(host); + } + ruleProvider.ensureUpToDate(options); + return ruleProvider; + } + function createCompilerHost() { + return { + getSourceFile: function (filename, languageVersion) { + var sourceFile = getSourceFile(filename); + return sourceFile && sourceFile.getSourceFile(); + }, + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: function (filename) { return useCaseSensitivefilenames ? filename : filename.toLowerCase(); }, + useCaseSensitiveFileNames: function () { return useCaseSensitivefilenames; }, + getNewLine: function () { return "\r\n"; }, + getDefaultLibFilename: function (options) { + return host.getDefaultLibFilename(options); + }, + writeFile: function (filename, data, writeByteOrderMark) { + writer(filename, data, writeByteOrderMark); + }, + getCurrentDirectory: function () { + return host.getCurrentDirectory(); + } + }; + } + function sourceFileUpToDate(sourceFile) { + return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.filename) && sourceFile.isOpen === hostCache.isOpen(sourceFile.filename); + } + function programUpToDate() { + if (!program) { + return false; + } + var hostFilenames = hostCache.getFilenames(); + if (program.getSourceFiles().length !== hostFilenames.length) { + return false; + } + for (var i = 0, n = hostFilenames.length; i < n; i++) { + if (!sourceFileUpToDate(program.getSourceFile(hostFilenames[i]))) { + return false; + } + } + return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + } + function synchronizeHostData() { + hostCache = new HostCache(host); + if (programUpToDate()) { + return; + } + var compilationSettings = hostCache.compilationSettings(); + var oldProgram = program; + if (oldProgram) { + var oldSettings = program.getCompilerOptions(); + var settingsChangeAffectsSyntax = oldSettings.target !== compilationSettings.target || oldSettings.module !== compilationSettings.module; + var changesInCompilationSettingsAffectSyntax = oldSettings && compilationSettings && !ts.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)]; + } + } + } + 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 = getSourceFile(filename); + if (sourceFile) { + if (sourceFileUpToDate(sourceFile)) { + continue; + } + var textChangeRange = null; + if (sourceFile.isOpen && isOpen) { + textChangeRange = hostCache.getChangeRange(filename, sourceFile.version, sourceFile.getScriptSnapshot()); + } + sourceFile = documentRegistry.updateDocument(sourceFile, filename, compilationSettings, scriptSnapshot, version, isOpen, textChangeRange); + } + else { + sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen); + } + sourceFilesByName[getCanonicalFileName(filename)] = sourceFile; + } + program = ts.createProgram(hostfilenames, compilationSettings, createCompilerHost()); + typeInfoResolver = program.getTypeChecker(false); + fullTypeCheckChecker_doNotAccessDirectly = undefined; + } + function cleanupSemanticCache() { + if (program) { + typeInfoResolver = program.getTypeChecker(false); + fullTypeCheckChecker_doNotAccessDirectly = undefined; + } + } + function dispose() { + if (program) { + ts.forEach(program.getSourceFiles(), function (f) { + documentRegistry.releaseDocument(f.filename, program.getCompilerOptions()); + }); + } + } + function getSyntacticDiagnostics(filename) { + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + return program.getDiagnostics(getSourceFile(filename)); + } + function getSemanticDiagnostics(filename) { + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + var compilerOptions = program.getCompilerOptions(); + var checker = getFullTypeCheckChecker(); + var targetSourceFile = getSourceFile(filename); + var allDiagnostics = checker.getDiagnostics(targetSourceFile); + if (compilerOptions.declaration) { + allDiagnostics = allDiagnostics.concat(checker.getDeclarationDiagnostics(targetSourceFile)); + } + return allDiagnostics; + } + function getCompilerOptionsDiagnostics() { + synchronizeHostData(); + return program.getGlobalDiagnostics(); + } + function getValidCompletionEntryDisplayName(symbol, target) { + var displayName = symbol.getName(); + if (displayName && displayName.length > 0) { + var firstCharCode = displayName.charCodeAt(0); + if ((symbol.flags & 1536 /* Namespace */) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { + return undefined; + } + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { + displayName = displayName.substring(1, displayName.length - 1); + } + var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); + for (var i = 1, n = displayName.length; isValid && i < n; i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + } + if (isValid) { + return ts.unescapeIdentifier(displayName); + } + } + return undefined; + } + function createCompletionEntry(symbol, typeChecker, location) { + var displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); + if (!displayName) { + return undefined; + } + return { + name: displayName, + kind: getSymbolKind(symbol, typeChecker, location), + kindModifiers: getSymbolModifiers(symbol) + }; + } + function getCompletionsAtPosition(filename, position) { + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + var syntacticStart = new Date().getTime(); + var sourceFile = getSourceFile(filename); + var start = new Date().getTime(); + var currentToken = ts.getTokenAtPosition(sourceFile, position); + host.log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var insideComment = isInsideComment(sourceFile, currentToken, position); + host.log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); + if (insideComment) { + host.log("Returning an empty list because completion was inside a comment."); + return undefined; + } + var start = new Date().getTime(); + var previousToken = ts.findPrecedingToken(position, sourceFile); + host.log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); + if (previousToken && position <= previousToken.end && previousToken.kind === 63 /* Identifier */) { + var start = new Date().getTime(); + previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); + host.log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + } + if (previousToken && isCompletionListBlocker(previousToken)) { + host.log("Returning an empty list because completion was requested in an invalid position."); + return undefined; + } + var node; + var isRightOfDot; + if (previousToken && previousToken.kind === 19 /* DotToken */ && previousToken.parent.kind === 143 /* PropertyAccessExpression */) { + node = previousToken.parent.expression; + isRightOfDot = true; + } + else if (previousToken && previousToken.kind === 19 /* DotToken */ && previousToken.parent.kind === 120 /* QualifiedName */) { + node = previousToken.parent.left; + isRightOfDot = true; + } + else { + node = currentToken; + isRightOfDot = false; + } + activeCompletionSession = { + filename: filename, + position: position, + entries: [], + symbols: {}, + typeChecker: typeInfoResolver + }; + host.log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); + var location = ts.getTouchingPropertyName(sourceFile, position); + var semanticStart = new Date().getTime(); + if (isRightOfDot) { + var symbols = []; + var isMemberCompletion = true; + if (node.kind === 63 /* Identifier */ || node.kind === 120 /* QualifiedName */ || node.kind === 143 /* PropertyAccessExpression */) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol && symbol.flags & 33554432 /* Import */) { + symbol = typeInfoResolver.getAliasedSymbol(symbol); + } + if (symbol && symbol.flags & 1952 /* HasExports */) { + ts.forEachValue(symbol.exports, function (symbol) { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + } + var type = typeInfoResolver.getTypeAtLocation(node); + if (type) { + ts.forEach(type.getApparentProperties(), function (symbol) { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + } + else { + var containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken); + if (containingObjectLiteral) { + isMemberCompletion = true; + var contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); + if (!contextualType) { + return undefined; + } + var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); + if (contextualTypeMembers && contextualTypeMembers.length > 0) { + var filteredMembers = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); + getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); + } + } + else { + isMemberCompletion = false; + var symbolMeanings = 3152352 /* Type */ | 107455 /* Value */ | 1536 /* Namespace */ | 33554432 /* Import */; + var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + } + } + if (!isMemberCompletion) { + Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions); + } + host.log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); + return { + isMemberCompletion: isMemberCompletion, + entries: activeCompletionSession.entries + }; + function getCompletionEntriesFromSymbols(symbols, session) { + var start = new Date().getTime(); + ts.forEach(symbols, function (symbol) { + var entry = createCompletionEntry(symbol, session.typeChecker, location); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!ts.lookUp(session.symbols, id)) { + session.entries.push(entry); + session.symbols[id] = symbol; + } + } + }); + host.log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + } + function isCompletionListBlocker(previousToken) { + var start = new Date().getTime(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + host.log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + return result; + } + function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { + if (previousToken.kind === 7 /* StringLiteral */ || previousToken.kind === 8 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(previousToken.kind)) { + var start = previousToken.getStart(); + var end = previousToken.getEnd(); + if (start < position && position < end) { + return true; + } + else if (position === end) { + return !!previousToken.isUnterminated; + } + } + return false; + } + function getContainingObjectLiteralApplicableForCompletion(previousToken) { + if (previousToken) { + var parent = previousToken.parent; + switch (previousToken.kind) { + case 13 /* OpenBraceToken */: + case 22 /* CommaToken */: + if (parent && parent.kind === 142 /* ObjectLiteralExpression */) { + return parent; + } + break; + } + } + return undefined; + } + function isFunction(kind) { + switch (kind) { + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + return true; + } + return false; + } + function isIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 22 /* CommaToken */: + return containingNodeKind === 183 /* VariableDeclaration */ || containingNodeKind === 164 /* VariableStatement */ || containingNodeKind === 188 /* EnumDeclaration */ || isFunction(containingNodeKind); + case 15 /* OpenParenToken */: + return containingNodeKind === 197 /* CatchClause */ || isFunction(containingNodeKind); + case 13 /* OpenBraceToken */: + return containingNodeKind === 188 /* EnumDeclaration */ || containingNodeKind === 186 /* InterfaceDeclaration */; + case 21 /* SemicolonToken */: + return containingNodeKind === 124 /* Property */ && previousToken.parent.parent.kind === 186 /* InterfaceDeclaration */; + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 107 /* StaticKeyword */: + case 20 /* DotDotDotToken */: + return containingNodeKind === 123 /* Parameter */; + case 67 /* ClassKeyword */: + case 114 /* ModuleKeyword */: + case 75 /* EnumKeyword */: + case 101 /* InterfaceKeyword */: + case 81 /* FunctionKeyword */: + case 96 /* VarKeyword */: + case 113 /* GetKeyword */: + case 117 /* SetKeyword */: + case 83 /* ImportKeyword */: + return true; + } + switch (previousToken.getText()) { + case "class": + case "interface": + case "enum": + case "module": + case "function": + case "var": + return true; + } + } + return false; + } + function isRightOfIllegalDot(previousToken) { + if (previousToken && previousToken.kind === 6 /* NumericLiteral */) { + var text = previousToken.getFullText(); + return text.charAt(text.length - 1) === "."; + } + return false; + } + function filterContextualMembersList(contextualMemberSymbols, existingMembers) { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + var existingMemberNames = {}; + ts.forEach(existingMembers, function (m) { + if (m.kind !== 198 /* PropertyAssignment */ && m.kind !== 199 /* ShorthandPropertyAssignment */) { + return; + } + if (m.getStart() <= position && position <= m.getEnd()) { + return; + } + existingMemberNames[m.name.text] = true; + }); + var filteredMembers = []; + ts.forEach(contextualMemberSymbols, function (s) { + if (!existingMemberNames[s.name]) { + filteredMembers.push(s); + } + }); + return filteredMembers; + } + } + function getCompletionEntryDetails(filename, position, entryName) { + filename = ts.normalizeSlashes(filename); + var sourceFile = getSourceFile(filename); + var session = activeCompletionSession; + if (!session || session.filename !== filename || session.position !== position) { + return undefined; + } + var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); + if (symbol) { + var location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); + ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getSourceFile(filename), location, session.typeChecker, location, 7 /* All */); + return { + name: entryName, + kind: displayPartsDocumentationsAndSymbolKind.symbolKind, + kindModifiers: completionEntry.kindModifiers, + displayParts: displayPartsDocumentationsAndSymbolKind.displayParts, + documentation: displayPartsDocumentationsAndSymbolKind.documentation + }; + } + else { + return { + name: entryName, + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none, + displayParts: [ts.displayPart(entryName, 5 /* keyword */)], + documentation: undefined + }; + } + } + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 201 /* SourceFile */: + case 125 /* Method */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 185 /* ClassDeclaration */: + case 186 /* InterfaceDeclaration */: + case 188 /* EnumDeclaration */: + case 189 /* ModuleDeclaration */: + return node; + } + } + } + function getSymbolKind(symbol, typeResolver, location) { + var flags = symbol.getFlags(); + if (flags & 32 /* Class */) + return ScriptElementKind.classElement; + if (flags & 384 /* Enum */) + return ScriptElementKind.enumElement; + if (flags & 2097152 /* TypeAlias */) + return ScriptElementKind.typeElement; + if (flags & 64 /* Interface */) + return ScriptElementKind.interfaceElement; + if (flags & 1048576 /* TypeParameter */) + return ScriptElementKind.typeParameterElement; + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location); + if (result === ScriptElementKind.unknown) { + if (flags & 1048576 /* TypeParameter */) + return ScriptElementKind.typeParameterElement; + if (flags & 8 /* EnumMember */) + return ScriptElementKind.variableElement; + if (flags & 33554432 /* Import */) + return ScriptElementKind.alias; + if (flags & 1536 /* Module */) + return ScriptElementKind.moduleElement; + } + return result; + } + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location) { + if (typeResolver.isUndefinedSymbol(symbol)) { + return ScriptElementKind.variableElement; + } + if (typeResolver.isArgumentsSymbol(symbol)) { + return ScriptElementKind.localVariableElement; + } + if (flags & 3 /* Variable */) { + if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { + return ScriptElementKind.parameterElement; + } + else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { + return ScriptElementKind.constElement; + } + else if (ts.forEach(symbol.declarations, function (declaration) { return ts.isLet(declaration); })) { + return ScriptElementKind.letElement; + } + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; + } + if (flags & 16 /* Function */) + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; + if (flags & 32768 /* GetAccessor */) + return ScriptElementKind.memberGetAccessorElement; + if (flags & 65536 /* SetAccessor */) + return ScriptElementKind.memberSetAccessorElement; + if (flags & 8192 /* Method */) + return ScriptElementKind.memberFunctionElement; + if (flags & 16384 /* Constructor */) + return ScriptElementKind.constructorImplementationElement; + if (flags & 4 /* Property */) { + if (flags & 1073741824 /* UnionProperty */) { + var unionPropertyKind = ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + var rootSymbolFlags = rootSymbol.getFlags(); + if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) { + return ScriptElementKind.memberVariableElement; + } + ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */)); + }); + if (!unionPropertyKind) { + var typeOfUnionProperty = typeInfoResolver.getTypeOfSymbolAtLocation(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return ScriptElementKind.memberFunctionElement; + } + return ScriptElementKind.memberVariableElement; + } + return unionPropertyKind; + } + return ScriptElementKind.memberVariableElement; + } + return ScriptElementKind.unknown; + } + function getTypeKind(type) { + var flags = type.getFlags(); + if (flags & 128 /* Enum */) + return ScriptElementKind.enumElement; + if (flags & 1024 /* Class */) + return ScriptElementKind.classElement; + if (flags & 2048 /* Interface */) + return ScriptElementKind.interfaceElement; + if (flags & 512 /* TypeParameter */) + return ScriptElementKind.typeParameterElement; + if (flags & 127 /* Intrinsic */) + return ScriptElementKind.primitiveType; + if (flags & 256 /* StringLiteral */) + return ScriptElementKind.primitiveType; + return ScriptElementKind.unknown; + } + function getNodeKind(node) { + switch (node.kind) { + case 189 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 185 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 186 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 187 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 188 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 183 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : node.flags & 2048 /* Let */ ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 184 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 127 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 128 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 125 /* Method */: return ScriptElementKind.memberFunctionElement; + case 124 /* Property */: return ScriptElementKind.memberVariableElement; + case 131 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 130 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 129 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 126 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 122 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 200 /* EnumMember */: return ScriptElementKind.variableElement; + case 123 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + function getSymbolModifiers(symbol) { + return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; + } + function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { + if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } + var displayParts = []; + var documentation; + var symbolFlags = symbol.flags; + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); + var hasAddedSymbolInfo; + if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 33554432 /* Import */) { + if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { + symbolKind = ScriptElementKind.memberVariableElement; + } + var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + if (type) { + if (location.parent && location.parent.kind === 143 /* PropertyAccessExpression */) { + var right = location.parent.name; + if (right === location || (right && right.getFullWidth() === 0)) { + location = location.parent; + } + } + var callExpression; + if (location.kind === 145 /* CallExpression */ || location.kind === 146 /* NewExpression */) { + callExpression = location; + } + else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { + callExpression = location.parent; + } + if (callExpression) { + var candidateSignatures = []; + signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures); + if (!signature && candidateSignatures.length) { + signature = candidateSignatures[0]; + } + var useConstructSignatures = callExpression.kind === 146 /* NewExpression */ || callExpression.expression.kind === 89 /* SuperKeyword */; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + if (!ts.contains(allSignatures, signature.target || signature)) { + signature = allSignatures.length ? allSignatures[0] : undefined; + } + if (signature) { + if (useConstructSignatures && (symbolFlags & 32 /* Class */)) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else if (symbolFlags & 33554432 /* Import */) { + symbolKind = ScriptElementKind.alias; + displayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + displayParts.push(ts.textPart(symbolKind)); + displayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(86 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + addFullSymbolName(symbol); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + switch (symbolKind) { + case ScriptElementKind.memberVariableElement: + case ScriptElementKind.variableElement: + case ScriptElementKind.constElement: + case ScriptElementKind.letElement: + case ScriptElementKind.parameterElement: + case ScriptElementKind.localVariableElement: + displayParts.push(ts.punctuationPart(50 /* ColonToken */)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(86 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + if (!(type.flags & 32768 /* Anonymous */)) { + displayParts.push.apply(displayParts, ts.symbolToDisplayParts(typeResolver, type.symbol, enclosingDeclaration, undefined, 1 /* WriteTypeParametersOrArguments */)); + } + addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); + break; + default: + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || (location.kind === 111 /* ConstructorKeyword */ && location.parent.kind === 126 /* Constructor */)) { + var signature; + var functionDeclaration = location.parent; + var allSignatures = functionDeclaration.kind === 126 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { + signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); + } + else { + signature = allSignatures[0]; + } + if (functionDeclaration.kind === 126 /* Constructor */) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else { + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 129 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); + } + addSignatureDisplayParts(signature, allSignatures); + hasAddedSymbolInfo = true; + } + } + } + if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { + displayParts.push(ts.keywordPart(67 /* ClassKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(101 /* InterfaceKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 2097152 /* TypeAlias */) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(119 /* TypeKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(51 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); + } + if (symbolFlags & 384 /* Enum */) { + addNewLineIfDisplayPartsExist(); + if (ts.forEach(symbol.declarations, function (declaration) { return ts.isConstEnumDeclaration(declaration); })) { + displayParts.push(ts.keywordPart(68 /* ConstKeyword */)); + displayParts.push(ts.spacePart()); + } + displayParts.push(ts.keywordPart(75 /* EnumKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 1536 /* Module */) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(114 /* ModuleKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if ((symbolFlags & 1048576 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + displayParts.push(ts.textPart("type parameter")); + displayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(84 /* InKeyword */)); + displayParts.push(ts.spacePart()); + if (symbol.parent) { + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 122 /* TypeParameter */).parent; + var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + if (signatureDeclaration.kind === 130 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(86 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + else if (signatureDeclaration.kind !== 129 /* CallSignature */ && signatureDeclaration.name) { + addFullSymbolName(signatureDeclaration.symbol); + } + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); + } + } + if (symbolFlags & 8 /* EnumMember */) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === 200 /* EnumMember */) { + var constantValue = typeResolver.getEnumMemberValue(declaration); + if (constantValue !== undefined) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(51 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.displayPart(constantValue.toString(), 7 /* numericLiteral */)); + } + } + } + if (symbolFlags & 33554432 /* Import */) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(83 /* ImportKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 191 /* ImportDeclaration */) { + var importDeclaration = declaration; + if (ts.isExternalModuleImportDeclaration(importDeclaration)) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(51 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(115 /* RequireKeyword */)); + displayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportDeclarationExpression(importDeclaration)), 8 /* stringLiteral */)); + displayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + } + else { + var internalAliasSymbol = typeResolver.getSymbolAtLocation(importDeclaration.moduleReference); + if (internalAliasSymbol) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(51 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ScriptElementKind.unknown) { + if (type) { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || symbolKind === ScriptElementKind.localVariableElement) { + displayParts.push(ts.punctuationPart(50 /* ColonToken */)); + displayParts.push(ts.spacePart()); + if (type.symbol && type.symbol.flags & 1048576 /* TypeParameter */) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + else { + displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); + } + } + else if (symbolFlags & 16 /* Function */ || symbolFlags & 8192 /* Method */ || symbolFlags & 16384 /* Constructor */ || symbolFlags & 917504 /* Signature */ || symbolFlags & 98304 /* Accessor */ || symbolKind === ScriptElementKind.memberFunctionElement) { + var allSignatures = type.getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(symbol, typeResolver, location); + } + } + if (!documentation) { + documentation = symbol.getDocumentationComment(); + } + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + function addNewLineIfDisplayPartsExist() { + if (displayParts.length) { + displayParts.push(ts.lineBreakPart()); + } + } + function addFullSymbolName(symbol, enclosingDeclaration) { + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); + displayParts.push.apply(displayParts, fullSymbolDisplayParts); + } + function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { + addNewLineIfDisplayPartsExist(); + if (symbolKind) { + displayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + displayParts.push(ts.textPart(symbolKind)); + displayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + } + function addSignatureDisplayParts(signature, allSignatures, flags) { + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); + if (allSignatures.length > 1) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + displayParts.push(ts.operatorPart(32 /* PlusToken */)); + displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), 7 /* numericLiteral */)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + } + documentation = signature.getDocumentationComment(); + } + function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + } + function getQuickInfoAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + switch (node.kind) { + case 63 /* Identifier */: + case 143 /* PropertyAccessExpression */: + case 120 /* QualifiedName */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + var type = typeInfoResolver.getTypeAtLocation(node); + if (type) { + return { + kind: ScriptElementKind.unknown, + kindModifiers: ScriptElementKindModifier.none, + textSpan: new TextSpan(node.getStart(), node.getWidth()), + displayParts: ts.typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + }; + } + } + return undefined; + } + var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: getSymbolModifiers(symbol), + textSpan: new TextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation + }; + } + function getDefinitionAtPosition(filename, position) { + function getDefinitionInfo(node, symbolKind, symbolName, containerName) { + return { + fileName: node.getSourceFile().filename, + textSpan: TextSpan.fromBounds(node.getStart(), node.getEnd()), + kind: symbolKind, + name: symbolName, + containerKind: undefined, + containerName: containerName + }; + } + function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + var declarations = []; + var definition; + ts.forEach(signatureDeclarations, function (d) { + if ((selectConstructors && d.kind === 126 /* Constructor */) || (!selectConstructors && (d.kind === 184 /* FunctionDeclaration */ || d.kind === 125 /* Method */))) { + declarations.push(d); + if (d.body) + definition = d; + } + }); + if (definition) { + result.push(getDefinitionInfo(definition, symbolKind, symbolName, containerName)); + return true; + } + else if (declarations.length) { + result.push(getDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + return true; + } + return false; + } + function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isNewExpressionTarget(location) || location.kind === 111 /* ConstructorKeyword */) { + if (symbol.flags & 32 /* Class */) { + var classDeclaration = symbol.getDeclarations()[0]; + ts.Debug.assert(classDeclaration && classDeclaration.kind === 185 /* ClassDeclaration */); + return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); + } + } + return false; + } + function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) { + return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result); + } + return false; + } + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + var sourceFile = getSourceFile(filename); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + if (isJumpStatementTarget(node)) { + var labelName = node.text; + var label = getTargetLabel(node.parent, node.text); + return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + } + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [{ + fileName: referenceFile.filename, + textSpan: TextSpan.fromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: comment.filename, + containerName: undefined, + containerKind: undefined + }]; + } + return undefined; + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + return undefined; + } + var result = []; + if (node.parent.kind === 199 /* ShorthandPropertyAssignment */) { + var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + var shorthandDeclarations = shorthandSymbol.getDeclarations(); + var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver); + var shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol); + var shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node); + ts.forEach(shorthandDeclarations, function (declaration) { + result.push(getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName)); + }); + return result; + } + var declarations = symbol.getDeclarations(); + var symbolName = typeInfoResolver.symbolToString(symbol); + var symbolKind = getSymbolKind(symbol, typeInfoResolver); + var containerSymbol = symbol.parent; + var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + ts.forEach(declarations, function (declaration) { + result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); + }); + } + return result; + } + function getOccurrencesAtPosition(filename, position) { + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + var sourceFile = getSourceFile(filename); + var node = ts.getTouchingWord(sourceFile, position); + if (!node) { + return undefined; + } + if (node.kind === 63 /* Identifier */ || node.kind === 91 /* ThisKeyword */ || node.kind === 89 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [sourceFile], false, false); + } + switch (node.kind) { + case 82 /* IfKeyword */: + case 74 /* ElseKeyword */: + if (hasKind(node.parent, 167 /* IfStatement */)) { + return getIfElseOccurrences(node.parent); + } + break; + case 88 /* ReturnKeyword */: + if (hasKind(node.parent, 174 /* ReturnStatement */)) { + return getReturnOccurrences(node.parent); + } + break; + case 92 /* ThrowKeyword */: + if (hasKind(node.parent, 178 /* ThrowStatement */)) { + return getThrowOccurrences(node.parent); + } + break; + case 94 /* TryKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + if (hasKind(parent(parent(node)), 179 /* TryStatement */)) { + return getTryCatchFinallyOccurrences(node.parent.parent); + } + break; + case 90 /* SwitchKeyword */: + if (hasKind(node.parent, 176 /* SwitchStatement */)) { + return getSwitchCaseDefaultOccurrences(node.parent); + } + break; + case 65 /* CaseKeyword */: + case 71 /* DefaultKeyword */: + if (hasKind(parent(parent(node)), 176 /* SwitchStatement */)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent); + } + break; + case 64 /* BreakKeyword */: + case 69 /* ContinueKeyword */: + if (hasKind(node.parent, 173 /* BreakStatement */) || hasKind(node.parent, 172 /* ContinueStatement */)) { + return getBreakOrContinueStatementOccurences(node.parent); + } + break; + case 80 /* ForKeyword */: + if (hasKind(node.parent, 170 /* ForStatement */) || hasKind(node.parent, 171 /* ForInStatement */)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 98 /* WhileKeyword */: + case 73 /* DoKeyword */: + if (hasKind(node.parent, 169 /* WhileStatement */) || hasKind(node.parent, 168 /* DoStatement */)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 111 /* ConstructorKeyword */: + if (hasKind(node.parent, 126 /* Constructor */)) { + return getConstructorOccurrences(node.parent); + } + break; + case 113 /* GetKeyword */: + case 117 /* SetKeyword */: + if (hasKind(node.parent, 127 /* GetAccessor */) || hasKind(node.parent, 128 /* SetAccessor */)) { + return getGetAndSetOccurrences(node.parent); + } + default: + if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 164 /* VariableStatement */)) { + return getModifierOccurrences(node.kind, node.parent); + } + } + return undefined; + function getIfElseOccurrences(ifStatement) { + var keywords = []; + while (hasKind(ifStatement.parent, 167 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 82 /* IfKeyword */); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 74 /* ElseKeyword */)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 167 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 74 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldHighlightNextKeyword = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { + shouldHighlightNextKeyword = false; + break; + } + } + if (shouldHighlightNextKeyword) { + result.push({ + fileName: filename, + textSpan: TextSpan.fromBounds(elseKeyword.getStart(), ifKeyword.end), + isWriteAccess: false + }); + i++; + continue; + } + } + result.push(getReferenceEntryFromNode(keywords[i])); + } + return result; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 163 /* Block */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 88 /* ReturnKeyword */); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 92 /* ThrowKeyword */); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 92 /* ThrowKeyword */); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 88 /* ReturnKeyword */); + }); + } + return ts.map(keywords, getReferenceEntryFromNode); + } + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 178 /* ThrowStatement */) { + statementAccumulator.push(node); + } + else if (node.kind === 179 /* TryStatement */) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); + } + else { + aggregate(tryStatement.tryBlock); + } + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent = child.parent; + if (ts.isFunctionBlock(parent) || parent.kind === 201 /* SourceFile */) { + return parent; + } + if (parent.kind === 179 /* TryStatement */) { + var tryStatement = parent; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } + } + child = parent; + } + return undefined; + } + function getTryCatchFinallyOccurrences(tryStatement) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 94 /* TryKeyword */); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 66 /* CatchKeyword */); + } + if (tryStatement.finallyBlock) { + pushKeywordIf(keywords, tryStatement.finallyBlock.getFirstToken(), 79 /* FinallyKeyword */); + } + return ts.map(keywords, getReferenceEntryFromNode); + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 80 /* ForKeyword */, 98 /* WhileKeyword */, 73 /* DoKeyword */)) { + if (loopNode.kind === 168 /* DoStatement */) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 98 /* WhileKeyword */)) { + break; + } + } + } + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 64 /* BreakKeyword */, 69 /* ContinueKeyword */); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 90 /* SwitchKeyword */); + ts.forEach(switchStatement.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 65 /* CaseKeyword */, 71 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 64 /* BreakKeyword */); + } + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 168 /* DoStatement */: + case 169 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 176 /* SwitchStatement */: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 173 /* BreakStatement */ || node.kind === 172 /* ContinueStatement */) { + statementAccumulator.push(node); + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 176 /* SwitchStatement */: + if (statement.kind === 172 /* ContinueStatement */) { + continue; + } + case 170 /* ForStatement */: + case 171 /* ForInStatement */: + case 169 /* WhileStatement */: + case 168 /* DoStatement */: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; + } + break; + default: + if (ts.isAnyFunction(node)) { + return undefined; + } + break; + } + } + return undefined; + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 111 /* ConstructorKeyword */); + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 127 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 128 /* SetAccessor */); + return ts.map(keywords, getReferenceEntryFromNode); + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 113 /* GetKeyword */, 117 /* SetKeyword */); }); + } + } + } + function getModifierOccurrences(modifier, declaration) { + var container = declaration.parent; + if (declaration.flags & 112 /* AccessibilityModifier */) { + if (!(container.kind === 185 /* ClassDeclaration */ || (declaration.kind === 123 /* Parameter */ && hasKind(container, 126 /* Constructor */)))) { + return undefined; + } + } + else if (declaration.flags & 128 /* Static */) { + if (container.kind !== 185 /* ClassDeclaration */) { + return undefined; + } + } + else if (declaration.flags & (1 /* Export */ | 2 /* Ambient */)) { + if (!(container.kind === 190 /* ModuleBlock */ || container.kind === 201 /* SourceFile */)) { + return undefined; + } + } + else { + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 190 /* ModuleBlock */: + case 201 /* SourceFile */: + nodes = container.statements; + break; + case 126 /* Constructor */: + nodes = container.parameters.concat(container.parent.members); + break; + case 185 /* ClassDeclaration */: + nodes = container.members; + if (modifierFlag & 112 /* AccessibilityModifier */) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 126 /* Constructor */ && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); + } + } + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (node.modifiers && node.flags & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); + function getFlagFromModifier(modifier) { + switch (modifier) { + case 106 /* PublicKeyword */: + return 16 /* Public */; + case 104 /* PrivateKeyword */: + return 32 /* Private */; + case 105 /* ProtectedKeyword */: + return 64 /* Protected */; + case 107 /* StaticKeyword */: + return 128 /* Static */; + case 76 /* ExportKeyword */: + return 1 /* Export */; + case 112 /* DeclareKeyword */: + return 2 /* Ambient */; + default: + ts.Debug.fail(); + } + } + } + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + function parent(node) { + return node && node.parent; + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + } + function findRenameLocations(fileName, position, findInStrings, findInComments) { + return findReferences(fileName, position, findInStrings, findInComments); + } + function getReferencesAtPosition(fileName, position) { + return findReferences(fileName, position, false, false); + } + function findReferences(fileName, position, findInStrings, findInComments) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + if (node.kind !== 63 /* Identifier */ && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + return undefined; + } + ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 6 /* NumericLiteral */ || node.kind === 7 /* StringLiteral */); + return getReferencesForNode(node, program.getSourceFiles(), findInStrings, findInComments); + } + function getReferencesForNode(node, sourceFiles, findInStrings, findInComments) { + if (isLabelName(node)) { + if (isJumpStatementTarget(node)) { + var labelDefinition = getTargetLabel(node.parent, node.text); + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; + } + else { + return getLabelReferencesInNode(node.parent, node); + } + } + if (node.kind === 91 /* ThisKeyword */) { + return getReferencesForThisKeyword(node, sourceFiles); + } + if (node.kind === 89 /* SuperKeyword */) { + return getReferencesForSuperKeyword(node); + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + return [getReferenceEntryFromNode(node)]; + } + var declarations = symbol.declarations; + if (!declarations || !declarations.length) { + return undefined; + } + var result; + var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); + var declaredName = getDeclaredName(symbol); + var scope = getSymbolScope(symbol); + if (scope) { + result = []; + 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); + } + }); + } + return result; + function getDeclaredName(symbol) { + var name = typeInfoResolver.symbolToString(symbol); + return stripQuotes(name); + } + function getInternedName(symbol, declarations) { + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 150 /* FunctionExpression */ ? d : undefined; }); + if (functionExpression && functionExpression.name) { + var name = functionExpression.name.text; + } + else { + var name = symbol.name; + } + return stripQuotes(name); + } + function stripQuotes(name) { + var length = name.length; + if (length >= 2 && name.charCodeAt(0) === 34 /* doubleQuote */ && name.charCodeAt(length - 1) === 34 /* doubleQuote */) { + return name.substring(1, length - 1); + } + ; + return name; + } + function getSymbolScope(symbol) { + if (symbol.getFlags() && (4 /* Property */ | 8192 /* Method */)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 185 /* ClassDeclaration */); + } + } + if (symbol.parent) { + return undefined; + } + var scope = undefined; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var i = 0, n = declarations.length; i < n; i++) { + var container = getContainerNode(declarations[i]); + if (!container) { + return undefined; + } + if (scope && scope !== container) { + return undefined; + } + if (container.kind === 201 /* SourceFile */ && !ts.isExternalModule(container)) { + return undefined; + } + scope = container; + } + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + if (position > end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2 /* Latest */)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2 /* Latest */))) { + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel) { + var result = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; + } + if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function isValidReferencePosition(node, searchSymbolName) { + if (node) { + switch (node.kind) { + case 63 /* Identifier */: + return node.getWidth() === searchSymbolName.length; + case 7 /* StringLiteral */: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return node.getWidth() === searchSymbolName.length + 2; + } + break; + case 6 /* NumericLiteral */: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + return node.getWidth() === searchSymbolName.length; + } + break; + } + } + return false; + } + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result) { + var sourceFile = container.getSourceFile(); + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= 0) { + result.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); + } + } + }); + } + function isInString(position) { + var token = ts.getTokenAtPosition(sourceFile, position); + return token && token.kind === 7 /* StringLiteral */ && position > token.getStart(); + } + function isInComment(position) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (token && position < token.getStart()) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, function (c) { + if (c.pos < position && position < c.end) { + var commentText = sourceFile.text.substring(c.pos, c.end); + if (!tripleSlashDirectivePrefixRegex.test(commentText)) { + return true; + } + } + }); + } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts.getSuperContainer(superKeyword); + if (!searchSpaceNode) { + return undefined; + } + var staticFlag = 128 /* Static */; + switch (searchSpaceNode.kind) { + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + default: + return undefined; + } + var result = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 89 /* SuperKeyword */) { + return; + } + var container = ts.getSuperContainer(node); + if (container && (128 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 128 /* Static */; + switch (searchSpaceNode.kind) { + case 125 /* Method */: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { + break; + } + case 124 /* Property */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + case 201 /* SourceFile */: + if (ts.isExternalModule(searchSpaceNode)) { + return undefined; + } + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + break; + default: + return undefined; + } + var result = []; + if (searchSpaceNode.kind === 201 /* SourceFile */) { + ts.forEach(sourceFiles, function (sourceFile) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + }); + } + else { + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + } + return result; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 91 /* ThisKeyword */) { + return; + } + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 125 /* Method */: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 185 /* ClassDeclaration */: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 201 /* SourceFile */: + if (container.kind === 201 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; + } + }); + } + } + function populateSearchSymbolSet(symbol, location) { + var result = [symbol]; + if (isNameOfPropertyAssignment(location)) { + ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { + result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + }); + var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } + } + ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + } + }); + return result; + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { + if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (declaration.kind === 185 /* ClassDeclaration */) { + getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); + ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 186 /* InterfaceDeclaration */) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + }); + } + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeInfoResolver.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push(propertySymbol); + } + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + } + } + } + } + function isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation) { + if (searchSymbols.indexOf(referenceSymbol) >= 0) { + return true; + } + if (isNameOfPropertyAssignment(referenceLocation)) { + return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); + }); + } + return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (searchSymbols.indexOf(rootSymbol) >= 0) { + return true; + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + return ts.forEach(result, function (s) { return searchSymbols.indexOf(s) >= 0; }); + } + return false; + }); + } + function getPropertySymbolsFromContextualType(node) { + if (isNameOfPropertyAssignment(node)) { + var objectLiteral = node.parent.parent; + var contextualType = typeInfoResolver.getContextualType(objectLiteral); + var name = node.text; + if (contextualType) { + if (contextualType.flags & 16384 /* Union */) { + var unionProperty = contextualType.getProperty(name); + if (unionProperty) { + return [unionProperty]; + } + else { + var result = []; + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result.push(symbol); + } + }); + return result; + } + } + else { + var symbol = contextualType.getProperty(name); + if (symbol) { + return [symbol]; + } + } + } + } + return undefined; + } + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + do { + var lastIterationMeaning = meaning; + for (var i = 0, n = declarations.length; i < n; i++) { + var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; + } + } + function getReferenceEntryFromNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 7 /* StringLiteral */) { + start += 1; + end -= 1; + } + return { + fileName: node.getSourceFile().filename, + textSpan: TextSpan.fromBounds(start, end), + isWriteAccess: isWriteAccess(node) + }; + } + function isWriteAccess(node) { + if (node.kind === 63 /* Identifier */ && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 156 /* PostfixUnaryExpression */ || parent.kind === 155 /* PrefixUnaryExpression */) { + return true; + } + else if (parent.kind === 157 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operator; + return 51 /* FirstAssignment */ <= operator && operator <= 62 /* LastAssignment */; + } + } + return false; + } + function getNavigateToItems(searchValue) { + synchronizeHostData(); + var terms = searchValue.split(" "); + var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); + var items = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var filename = sourceFile.filename; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== 0 /* none */) { + var container = getContainerNode(declaration); + items.push({ + name: name, + kind: getNodeKind(declaration), + kindModifiers: ts.getNodeModifiers(declaration), + matchKind: MatchKind[matchKind], + fileName: filename, + textSpan: TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container && container.name ? container.name.text : "", + containerKind: container && container.name ? getNodeKind(container) : "" + }); + } + } + }); + return items; + function hasAnyUpperCaseCharacter(s) { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((65 /* A */ <= c && c <= 90 /* Z */) || (c >= 127 /* maxAsciiCharacter */ && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + return false; + } + function getMatchKind(searchTerms, name) { + var matchKind = 0 /* none */; + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + return 0 /* none */; + } + var termKind = 2 /* substring */; + if (index === 0) { + termKind = name.length === searchTerm.term.length ? 1 /* exact */ : 3 /* prefix */; + } + if (matchKind === 0 /* none */ || termKind < matchKind) { + matchKind = termKind; + } + } + } + return matchKind; + } + } + function containErrors(diagnostics) { + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); + } + function getEmitOutput(filename) { + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + var sourceFile = getSourceFile(filename); + var outputFiles = []; + function getEmitOutputWriter(filename, data, writeByteOrderMark) { + outputFiles.push({ + name: filename, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + writer = getEmitOutputWriter; + var emitOutput = getFullTypeCheckChecker().emitFiles(sourceFile); + writer = undefined; + return { + outputFiles: outputFiles, + emitOutputStatus: emitOutput.emitResultStatus + }; + } + function getMeaningFromDeclaration(node) { + switch (node.kind) { + case 123 /* Parameter */: + case 183 /* VariableDeclaration */: + case 124 /* Property */: + case 198 /* PropertyAssignment */: + case 199 /* ShorthandPropertyAssignment */: + case 200 /* EnumMember */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* FunctionDeclaration */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + case 197 /* CatchClause */: + return 1 /* Value */; + case 122 /* TypeParameter */: + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + case 136 /* TypeLiteral */: + return 2 /* Type */; + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + return 1 /* Value */ | 2 /* Type */; + case 189 /* ModuleDeclaration */: + if (node.name.kind === 7 /* StringLiteral */) { + return 4 /* Namespace */ | 1 /* Value */; + } + else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { + return 4 /* Namespace */ | 1 /* Value */; + } + else { + return 4 /* Namespace */; + } + case 191 /* ImportDeclaration */: + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + case 201 /* SourceFile */: + return 4 /* Namespace */ | 1 /* Value */; + } + ts.Debug.fail("Unknown declaration type"); + } + function isTypeReference(node) { + if (isRightSideOfQualifiedName(node)) { + node = node.parent; + } + return node.parent.kind === 132 /* TypeReference */; + } + function isNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 120 /* QualifiedName */) { + while (root.parent && root.parent.kind === 120 /* QualifiedName */) + root = root.parent; + isLastClause = root.right === node; + } + return root.parent.kind === 132 /* TypeReference */ && !isLastClause; + } + function isInRightSideOfImport(node) { + while (node.parent.kind === 120 /* QualifiedName */) { + node = node.parent; + } + return ts.isInternalModuleImportDeclaration(node.parent) && node.parent.moduleReference === node; + } + function getMeaningFromRightHandSideOfImport(node) { + ts.Debug.assert(node.kind === 63 /* Identifier */); + if (node.parent.kind === 120 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 191 /* ImportDeclaration */) { + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + } + return 4 /* Namespace */; + } + function getMeaningFromLocation(node) { + if (node.parent.kind === 192 /* ExportAssignment */) { + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImport(node); + } + else if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return 2 /* Type */; + } + else if (isNamespaceReference(node)) { + return 4 /* Namespace */; + } + else { + return 1 /* Value */; + } + } + function getSignatureHelpItems(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getSourceFile(fileName); + return ts.SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); + } + function getCurrentSourceFile(filename) { + filename = ts.normalizeSlashes(filename); + var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(filename); + return currentSourceFile; + } + function getNameOrDottedNameSpan(filename, startPos, endPos) { + filename = ts.normalizeSlashes(filename); + var node = ts.getTouchingPropertyName(getCurrentSourceFile(filename), startPos); + if (!node) { + return; + } + switch (node.kind) { + case 143 /* PropertyAccessExpression */: + case 120 /* QualifiedName */: + case 7 /* StringLiteral */: + case 78 /* FalseKeyword */: + case 93 /* TrueKeyword */: + case 87 /* NullKeyword */: + case 89 /* SuperKeyword */: + case 91 /* ThisKeyword */: + case 63 /* Identifier */: + break; + default: + return; + } + var nodeForStartPos = node; + while (true) { + if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { + nodeForStartPos = nodeForStartPos.parent; + } + else if (isNameOfModuleDeclaration(nodeForStartPos)) { + if (nodeForStartPos.parent.parent.kind === 189 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + nodeForStartPos = nodeForStartPos.parent.parent.name; + } + else { + break; + } + } + else { + break; + } + } + return TextSpan.fromBounds(nodeForStartPos.getStart(), node.getEnd()); + } + function getBreakpointStatementAtPosition(filename, position) { + filename = ts.normalizeSlashes(filename); + return ts.BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position); + } + function getNavigationBarItems(filename) { + filename = ts.normalizeSlashes(filename); + return ts.NavigationBar.getNavigationBarItems(getCurrentSourceFile(filename)); + } + function getSemanticClassifications(fileName, span) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getSourceFile(fileName); + var result = []; + processNode(sourceFile); + return result; + function classifySymbol(symbol, meaningAtPosition) { + var flags = symbol.getFlags(); + if (flags & 32 /* Class */) { + return ClassificationTypeNames.className; + } + else if (flags & 384 /* Enum */) { + return ClassificationTypeNames.enumName; + } + else if (flags & 2097152 /* TypeAlias */) { + return ClassificationTypeNames.typeAlias; + } + else if (meaningAtPosition & 2 /* Type */) { + if (flags & 64 /* Interface */) { + return ClassificationTypeNames.interfaceName; + } + else if (flags & 1048576 /* TypeParameter */) { + return ClassificationTypeNames.typeParameterName; + } + } + else if (flags & 1536 /* Module */) { + if (meaningAtPosition & 4 /* Namespace */ || (meaningAtPosition & 1 /* Value */ && hasValueSideModule(symbol))) { + return ClassificationTypeNames.moduleName; + } + } + return undefined; + function hasValueSideModule(symbol) { + return ts.forEach(symbol.declarations, function (declaration) { + return declaration.kind === 189 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; + }); + } + } + function processNode(node) { + if (node && span.intersectsWith(node.getStart(), node.getWidth())) { + if (node.kind === 63 /* Identifier */ && node.getWidth() > 0) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol) { + var type = classifySymbol(symbol, getMeaningFromLocation(node)); + if (type) { + result.push({ + textSpan: new TextSpan(node.getStart(), node.getWidth()), + classificationType: type + }); + } + } + } + ts.forEachChild(node, processNode); + } + } + } + function getSyntacticClassifications(fileName, span) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + var result = []; + processElement(sourceFile); + return result; + function classifyComment(comment) { + var width = comment.end - comment.pos; + if (span.intersectsWith(comment.pos, width)) { + result.push({ + textSpan: new TextSpan(comment.pos, width), + classificationType: ClassificationTypeNames.comment + }); + } + } + function classifyToken(token) { + ts.forEach(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()), classifyComment); + if (token.getWidth() > 0) { + var type = classifyTokenType(token); + if (type) { + result.push({ + textSpan: new TextSpan(token.getStart(), token.getWidth()), + classificationType: type + }); + } + } + ts.forEach(ts.getTrailingCommentRanges(sourceFile.text, token.getEnd()), classifyComment); + } + function classifyTokenType(token) { + var tokenKind = token.kind; + if (ts.isKeyword(tokenKind)) { + return ClassificationTypeNames.keyword; + } + if (tokenKind === 23 /* LessThanToken */ || tokenKind === 24 /* GreaterThanToken */) { + if (ts.getTypeArgumentOrTypeParameterList(token.parent)) { + return ClassificationTypeNames.punctuation; + } + } + if (ts.isPunctuation(token.kind)) { + if (token.parent.kind === 157 /* BinaryExpression */ || token.parent.kind === 183 /* VariableDeclaration */ || token.parent.kind === 155 /* PrefixUnaryExpression */ || token.parent.kind === 156 /* PostfixUnaryExpression */ || token.parent.kind === 158 /* ConditionalExpression */) { + return ClassificationTypeNames.operator; + } + else { + return ClassificationTypeNames.punctuation; + } + } + else if (tokenKind === 6 /* NumericLiteral */) { + return ClassificationTypeNames.numericLiteral; + } + else if (tokenKind === 7 /* StringLiteral */) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 8 /* RegularExpressionLiteral */) { + return ClassificationTypeNames.stringLiteral; + } + else if (ts.isTemplateLiteralKind(tokenKind)) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 63 /* Identifier */) { + switch (token.parent.kind) { + case 185 /* ClassDeclaration */: + if (token.parent.name === token) { + return ClassificationTypeNames.className; + } + return; + case 122 /* TypeParameter */: + if (token.parent.name === token) { + return ClassificationTypeNames.typeParameterName; + } + return; + case 186 /* InterfaceDeclaration */: + if (token.parent.name === token) { + return ClassificationTypeNames.interfaceName; + } + return; + case 188 /* EnumDeclaration */: + if (token.parent.name === token) { + return ClassificationTypeNames.enumName; + } + return; + case 189 /* ModuleDeclaration */: + if (token.parent.name === token) { + return ClassificationTypeNames.moduleName; + } + return; + default: + return ClassificationTypeNames.text; + } + } + } + function processElement(element) { + if (span.intersectsWith(element.getFullStart(), element.getFullWidth())) { + var children = element.getChildren(); + for (var i = 0, n = children.length; i < n; i++) { + var child = children[i]; + if (ts.isToken(child)) { + classifyToken(child); + } + else { + processElement(child); + } + } + } + } + } + function getOutliningSpans(filename) { + filename = ts.normalizeSlashes(filename); + var sourceFile = getCurrentSourceFile(filename); + return ts.OutliningElementsCollector.collectElements(sourceFile); + } + function getBraceMatchingAtPosition(filename, position) { + var sourceFile = getCurrentSourceFile(filename); + var result = []; + var token = ts.getTouchingToken(sourceFile, position); + if (token.getStart(sourceFile) === position) { + var matchKind = getMatchingTokenKind(token); + if (matchKind) { + var parentElement = token.parent; + var childNodes = parentElement.getChildren(sourceFile); + for (var i = 0, n = childNodes.length; i < n; i++) { + 33; + var current = childNodes[i]; + if (current.kind === matchKind) { + var range1 = new TextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = new TextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + if (range1.start() < range2.start()) { + result.push(range1, range2); + } + else { + result.push(range2, range1); + } + break; + } + } + } + } + return result; + function getMatchingTokenKind(token) { + switch (token.kind) { + case 13 /* OpenBraceToken */: return 14 /* CloseBraceToken */; + case 15 /* OpenParenToken */: return 16 /* CloseParenToken */; + case 17 /* OpenBracketToken */: return 18 /* CloseBracketToken */; + case 23 /* LessThanToken */: return 24 /* GreaterThanToken */; + case 14 /* CloseBraceToken */: return 13 /* OpenBraceToken */; + case 16 /* CloseParenToken */: return 15 /* OpenParenToken */; + case 18 /* CloseBracketToken */: return 17 /* OpenBracketToken */; + case 24 /* GreaterThanToken */: return 23 /* LessThanToken */; + } + return undefined; + } + } + function getIndentationAtPosition(filename, position, editorOptions) { + filename = ts.normalizeSlashes(filename); + var start = new Date().getTime(); + var sourceFile = getCurrentSourceFile(filename); + host.log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); + host.log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); + return result; + } + function getFormattingEditsForRange(fileName, start, end, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsForDocument(fileName, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsAfterKeystroke(fileName, position, key, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + if (key === "}") { + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); + } + else if (key === ";") { + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(options), options); + } + else if (key === "\n") { + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(options), options); + } + return []; + } + function getTodoComments(filename, descriptors) { + synchronizeHostData(); + filename = ts.normalizeSlashes(filename); + var sourceFile = getSourceFile(filename); + cancellationToken.throwIfCancellationRequested(); + var fileContents = sourceFile.text; + cancellationToken.throwIfCancellationRequested(); + var result = []; + if (descriptors.length > 0) { + var regExp = getTodoCommentsRegExp(); + var matchArray; + while (matchArray = regExp.exec(fileContents)) { + cancellationToken.throwIfCancellationRequested(); + var firstDescriptorCaptureIndex = 3; + ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); + var preamble = matchArray[1]; + var matchPosition = matchArray.index + preamble.length; + var token = ts.getTokenAtPosition(sourceFile, matchPosition); + if (!isInsideComment(sourceFile, token, matchPosition)) { + continue; + } + var descriptor = undefined; + for (var i = 0, n = descriptors.length; i < n; i++) { + if (matchArray[i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[i]; + } + } + ts.Debug.assert(descriptor !== undefined); + if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { + continue; + } + var message = matchArray[2]; + result.push({ + descriptor: descriptor, + message: message, + position: matchPosition + }); + } + } + return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function isLetterOrDigit(char) { + return (char >= 97 /* a */ && char <= 122 /* z */) || (char >= 65 /* A */ && char <= 90 /* Z */) || (char >= 48 /* _0 */ && char <= 57 /* _9 */); + } + } + function getRenameInfo(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getSourceFile(fileName); + var node = ts.getTouchingWord(sourceFile, position); + if (node && node.kind === 63 /* Identifier */) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { + var kind = getSymbolKind(symbol, typeInfoResolver); + if (kind) { + return getRenameInfo(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, getSymbolModifiers(symbol), new TextSpan(node.getStart(), node.getWidth())); + } + } + } + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); + function getRenameInfoError(localizedErrorMessage) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function getRenameInfo(displayName, fullDisplayName, kind, kindModifiers, triggerSpan) { + return { + canRename: true, + localizedErrorMessage: undefined, + displayName: displayName, + fullDisplayName: fullDisplayName, + kind: kind, + kindModifiers: kindModifiers, + triggerSpan: triggerSpan + }; + } + } + return { + dispose: dispose, + cleanupSemanticCache: cleanupSemanticCache, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, + getCompletionsAtPosition: getCompletionsAtPosition, + getCompletionEntryDetails: getCompletionEntryDetails, + getSignatureHelpItems: getSignatureHelpItems, + getQuickInfoAtPosition: getQuickInfoAtPosition, + getDefinitionAtPosition: getDefinitionAtPosition, + getReferencesAtPosition: getReferencesAtPosition, + getOccurrencesAtPosition: getOccurrencesAtPosition, + getNameOrDottedNameSpan: getNameOrDottedNameSpan, + getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, + findRenameLocations: findRenameLocations, + getNavigationBarItems: getNavigationBarItems, + getOutliningSpans: getOutliningSpans, + getTodoComments: getTodoComments, + getBraceMatchingAtPosition: getBraceMatchingAtPosition, + getIndentationAtPosition: getIndentationAtPosition, + getFormattingEditsForRange: getFormattingEditsForRange, + getFormattingEditsForDocument: getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getEmitOutput: getEmitOutput, + getSourceFile: getCurrentSourceFile + }; + } + ts.createLanguageService = createLanguageService; + function createClassifier(host) { + var scanner = ts.createScanner(2 /* Latest */, false); + var noRegexTable = []; + noRegexTable[63 /* Identifier */] = true; + noRegexTable[7 /* StringLiteral */] = true; + noRegexTable[6 /* NumericLiteral */] = true; + noRegexTable[8 /* RegularExpressionLiteral */] = true; + noRegexTable[91 /* ThisKeyword */] = true; + noRegexTable[37 /* PlusPlusToken */] = true; + noRegexTable[38 /* MinusMinusToken */] = true; + noRegexTable[16 /* CloseParenToken */] = true; + noRegexTable[18 /* CloseBracketToken */] = true; + noRegexTable[14 /* CloseBraceToken */] = true; + noRegexTable[93 /* TrueKeyword */] = true; + noRegexTable[78 /* FalseKeyword */] = true; + function isAccessibilityModifier(kind) { + switch (kind) { + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + return true; + } + return false; + } + function canFollow(keyword1, keyword2) { + if (isAccessibilityModifier(keyword1)) { + if (keyword2 === 113 /* GetKeyword */ || keyword2 === 117 /* SetKeyword */ || keyword2 === 111 /* ConstructorKeyword */ || keyword2 === 107 /* StaticKeyword */) { + return true; + } + return false; + } + return true; + } + function getClassificationsForLine(text, lexState, classifyKeywordsInGenerics) { + var offset = 0; + var token = 0 /* Unknown */; + var lastNonTriviaToken = 0 /* Unknown */; + switch (lexState) { + case 3 /* InDoubleQuoteStringLiteral */: + text = '"\\\n' + text; + offset = 3; + break; + case 2 /* InSingleQuoteStringLiteral */: + text = "'\\\n" + text; + offset = 3; + break; + case 1 /* InMultiLineCommentTrivia */: + text = "/*\n" + text; + offset = 3; + break; + } + scanner.setText(text); + var result = { + finalLexState: 0 /* Start */, + entries: [] + }; + var angleBracketStack = 0; + do { + token = scanner.scan(); + if (!ts.isTrivia(token)) { + if ((token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 8 /* RegularExpressionLiteral */) { + token = 8 /* RegularExpressionLiteral */; + } + } + else if (lastNonTriviaToken === 19 /* DotToken */ && isKeyword(token)) { + token = 63 /* Identifier */; + } + else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + token = 63 /* Identifier */; + } + else if (lastNonTriviaToken === 63 /* Identifier */ && token === 23 /* LessThanToken */) { + angleBracketStack++; + } + else if (token === 24 /* GreaterThanToken */ && angleBracketStack > 0) { + angleBracketStack--; + } + else if (token === 109 /* AnyKeyword */ || token === 118 /* StringKeyword */ || token === 116 /* NumberKeyword */ || token === 110 /* BooleanKeyword */) { + if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { + token = 63 /* Identifier */; + } + } + lastNonTriviaToken = token; + } + processToken(); + } while (token !== 1 /* EndOfFileToken */); + return result; + function processToken() { + var start = scanner.getTokenPos(); + var end = scanner.getTextPos(); + addResult(end - start, classFromKind(token)); + if (end >= text.length) { + if (token === 7 /* StringLiteral */) { + var tokenText = scanner.getTokenText(); + if (scanner.isUnterminated()) { + var lastCharIndex = tokenText.length - 1; + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92 /* backslash */) { + numBackslashes++; + } + if (numBackslashes & 1) { + var quoteChar = tokenText.charCodeAt(0); + result.finalLexState = quoteChar === 34 /* doubleQuote */ ? 3 /* InDoubleQuoteStringLiteral */ : 2 /* InSingleQuoteStringLiteral */; + } + } + } + else if (token === 3 /* MultiLineCommentTrivia */) { + if (scanner.isUnterminated()) { + result.finalLexState = 1 /* InMultiLineCommentTrivia */; + } + } + } + } + function addResult(length, classification) { + if (length > 0) { + if (result.entries.length === 0) { + length -= offset; + } + result.entries.push({ length: length, classification: classification }); + } + } + } + function isBinaryExpressionOperatorToken(token) { + switch (token) { + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 39 /* LessThanLessThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + case 85 /* InstanceOfKeyword */: + case 84 /* InKeyword */: + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 42 /* AmpersandToken */: + case 44 /* CaretToken */: + case 43 /* BarToken */: + case 47 /* AmpersandAmpersandToken */: + case 48 /* BarBarToken */: + case 61 /* BarEqualsToken */: + case 60 /* AmpersandEqualsToken */: + case 62 /* CaretEqualsToken */: + case 57 /* LessThanLessThanEqualsToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 52 /* PlusEqualsToken */: + case 53 /* MinusEqualsToken */: + case 54 /* AsteriskEqualsToken */: + case 55 /* SlashEqualsToken */: + case 56 /* PercentEqualsToken */: + case 51 /* EqualsToken */: + case 22 /* CommaToken */: + return true; + default: return false; + } + } + function isPrefixUnaryExpressionOperatorToken(token) { + switch (token) { + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + return true; + default: + return false; + } + } + function isKeyword(token) { + return token >= 64 /* FirstKeyword */ && token <= 119 /* LastKeyword */; + } + function classFromKind(token) { + if (isKeyword(token)) { + return 1 /* Keyword */; + } + else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { + return 2 /* Operator */; + } + else if (token >= 13 /* FirstPunctuation */ && token <= 62 /* LastPunctuation */) { + return 0 /* Punctuation */; + } + switch (token) { + case 6 /* NumericLiteral */: + return 6 /* NumberLiteral */; + case 7 /* StringLiteral */: + return 7 /* StringLiteral */; + case 8 /* RegularExpressionLiteral */: + return 8 /* RegExpLiteral */; + case 3 /* MultiLineCommentTrivia */: + case 2 /* SingleLineCommentTrivia */: + return 3 /* Comment */; + case 5 /* WhitespaceTrivia */: + return 4 /* Whitespace */; + case 63 /* Identifier */: + default: + return 5 /* Identifier */; + } + } + return { getClassificationsForLine: getClassificationsForLine }; + } + ts.createClassifier = createClassifier; + function initializeServices() { + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + var proto = kind === 201 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + proto.kind = kind; + proto.pos = 0; + proto.end = 0; + proto.flags = 0; + proto.parent = undefined; + Node.prototype = proto; + return Node; + }, + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } + }; + } + initializeServices(); +})(ts || (ts = {})); +var ts; +(function (ts) { + var BreakpointResolver; + (function (BreakpointResolver) { + function spanInSourceFileAtLocation(sourceFile, position) { + if (sourceFile.flags & 1024 /* DeclarationFile */) { + return undefined; + } + var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); + var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); + if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + return undefined; + } + } + if (ts.isInAmbientContext(tokenAtLocation)) { + return undefined; + } + return spanInNode(tokenAtLocation); + function textSpan(startNode, endNode) { + return ts.TextSpan.fromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + } + function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + return spanInNode(node); + } + return spanInNode(otherwiseOnNode); + } + function spanInPreviousNode(node) { + return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); + } + function spanInNextNode(node) { + return spanInNode(ts.findNextToken(node, node.parent)); + } + function spanInNode(node) { + if (node) { + if (ts.isExpression(node)) { + if (node.parent.kind === 168 /* DoStatement */) { + return spanInPreviousNode(node); + } + if (node.parent.kind === 170 /* ForStatement */) { + return textSpan(node); + } + if (node.parent.kind === 157 /* BinaryExpression */ && node.parent.operator === 22 /* CommaToken */) { + return textSpan(node); + } + if (node.parent.kind == 151 /* ArrowFunction */ && node.parent.body == node) { + return textSpan(node); + } + } + switch (node.kind) { + case 164 /* VariableStatement */: + return spanInVariableDeclaration(node.declarations[0]); + case 183 /* VariableDeclaration */: + case 124 /* Property */: + return spanInVariableDeclaration(node); + case 123 /* Parameter */: + return spanInParameterDeclaration(node); + case 184 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 150 /* FunctionExpression */: + case 151 /* ArrowFunction */: + return spanInFunctionDeclaration(node); + case 163 /* Block */: + if (ts.isFunctionBlock(node)) { + return spanInFunctionBlock(node); + } + case 180 /* TryBlock */: + case 181 /* FinallyBlock */: + case 190 /* ModuleBlock */: + return spanInBlock(node); + case 197 /* CatchClause */: + return spanInBlock(node.block); + case 166 /* ExpressionStatement */: + return textSpan(node.expression); + case 174 /* ReturnStatement */: + return textSpan(node.getChildAt(0), node.expression); + case 169 /* WhileStatement */: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 168 /* DoStatement */: + return spanInNode(node.statement); + case 182 /* DebuggerStatement */: + return textSpan(node.getChildAt(0)); + case 167 /* IfStatement */: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 177 /* LabeledStatement */: + return spanInNode(node.statement); + case 173 /* BreakStatement */: + case 172 /* ContinueStatement */: + return textSpan(node.getChildAt(0), node.label); + case 170 /* ForStatement */: + return spanInForStatement(node); + case 171 /* ForInStatement */: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 176 /* SwitchStatement */: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 194 /* CaseClause */: + case 195 /* DefaultClause */: + return spanInNode(node.statements[0]); + case 179 /* TryStatement */: + return spanInBlock(node.tryBlock); + case 178 /* ThrowStatement */: + return textSpan(node, node.expression); + case 192 /* ExportAssignment */: + return textSpan(node, node.exportName); + case 191 /* ImportDeclaration */: + return textSpan(node, node.moduleReference); + case 189 /* ModuleDeclaration */: + if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + return undefined; + } + case 185 /* ClassDeclaration */: + case 188 /* EnumDeclaration */: + case 200 /* EnumMember */: + case 145 /* CallExpression */: + case 146 /* NewExpression */: + return textSpan(node); + case 175 /* WithStatement */: + return spanInNode(node.statement); + case 186 /* InterfaceDeclaration */: + case 187 /* TypeAliasDeclaration */: + return undefined; + case 21 /* SemicolonToken */: + case 1 /* EndOfFileToken */: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); + case 22 /* CommaToken */: + return spanInPreviousNode(node); + case 13 /* OpenBraceToken */: + return spanInOpenBraceToken(node); + case 14 /* CloseBraceToken */: + return spanInCloseBraceToken(node); + case 15 /* OpenParenToken */: + return spanInOpenParenToken(node); + case 16 /* CloseParenToken */: + return spanInCloseParenToken(node); + case 50 /* ColonToken */: + return spanInColonToken(node); + case 24 /* GreaterThanToken */: + case 23 /* LessThanToken */: + return spanInGreaterThanOrLessThanToken(node); + case 98 /* WhileKeyword */: + return spanInWhileKeyword(node); + case 74 /* ElseKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + return spanInNextNode(node); + default: + if (node.parent.kind === 198 /* PropertyAssignment */ && node.parent.name === node) { + return spanInNode(node.parent.initializer); + } + if (node.parent.kind === 148 /* TypeAssertionExpression */ && node.parent.type === node) { + return spanInNode(node.parent.expression); + } + if (ts.isAnyFunction(node.parent) && node.parent.type === node) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + } + function spanInVariableDeclaration(variableDeclaration) { + if (variableDeclaration.parent.kind === 171 /* ForInStatement */) { + return spanInNode(variableDeclaration.parent); + } + var isParentVariableStatement = variableDeclaration.parent.kind === 164 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.kind === 170 /* ForStatement */ && ts.contains(variableDeclaration.parent.declarations, variableDeclaration); + var declarations = isParentVariableStatement ? variableDeclaration.parent.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.declarations : undefined; + if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */)) { + if (declarations && declarations[0] === variableDeclaration) { + if (isParentVariableStatement) { + return textSpan(variableDeclaration.parent, variableDeclaration); + } + else { + ts.Debug.assert(isDeclarationOfForStatement); + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + } + else { + return textSpan(variableDeclaration); + } + } + else if (declarations && declarations[0] !== variableDeclaration) { + var indexOfCurrentDeclaration = ts.indexOf(declarations, variableDeclaration); + return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + } + } + function canHaveSpanInParameterDeclaration(parameter) { + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16 /* Public */) || !!(parameter.flags & 32 /* Private */); + } + function spanInParameterDeclaration(parameter) { + if (canHaveSpanInParameterDeclaration(parameter)) { + return textSpan(parameter); + } + else { + var functionDeclaration = parameter.parent; + var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter); + if (indexOfParameter) { + return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); + } + else { + return spanInNode(functionDeclaration.body); + } + } + } + function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { + return !!(functionDeclaration.flags & 1 /* Export */) || (functionDeclaration.parent.kind === 185 /* ClassDeclaration */ && functionDeclaration.kind !== 126 /* Constructor */); + } + function spanInFunctionDeclaration(functionDeclaration) { + if (!functionDeclaration.body) { + return undefined; + } + if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) { + return textSpan(functionDeclaration); + } + return spanInNode(functionDeclaration.body); + } + function spanInFunctionBlock(block) { + var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { + return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + } + return spanInNode(nodeForSpanInBlock); + } + function spanInBlock(block) { + switch (block.parent.kind) { + case 189 /* ModuleDeclaration */: + if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { + return undefined; + } + case 169 /* WhileStatement */: + case 167 /* IfStatement */: + case 171 /* ForInStatement */: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 170 /* ForStatement */: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); + } + return spanInNode(block.statements[0]); + } + function spanInForStatement(forStatement) { + if (forStatement.declarations) { + return spanInNode(forStatement.declarations[0]); + } + if (forStatement.initializer) { + return spanInNode(forStatement.initializer); + } + if (forStatement.condition) { + return textSpan(forStatement.condition); + } + if (forStatement.iterator) { + return textSpan(forStatement.iterator); + } + } + function spanInOpenBraceToken(node) { + switch (node.parent.kind) { + case 188 /* EnumDeclaration */: + var enumDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); + case 185 /* ClassDeclaration */: + var classDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); + case 176 /* SwitchStatement */: + return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); + } + return spanInNode(node.parent); + } + function spanInCloseBraceToken(node) { + switch (node.parent.kind) { + case 190 /* ModuleBlock */: + if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { + return undefined; + } + case 188 /* EnumDeclaration */: + case 185 /* ClassDeclaration */: + return textSpan(node); + case 163 /* Block */: + if (ts.isFunctionBlock(node.parent)) { + return textSpan(node); + } + case 180 /* TryBlock */: + case 197 /* CatchClause */: + case 181 /* FinallyBlock */: + return spanInNode(node.parent.statements[node.parent.statements.length - 1]); + ; + case 176 /* SwitchStatement */: + var switchStatement = node.parent; + var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + if (lastClause) { + return spanInNode(lastClause.statements[lastClause.statements.length - 1]); + } + return undefined; + default: + return spanInNode(node.parent); + } + } + function spanInOpenParenToken(node) { + if (node.parent.kind === 168 /* DoStatement */) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInCloseParenToken(node) { + switch (node.parent.kind) { + case 150 /* FunctionExpression */: + case 184 /* FunctionDeclaration */: + case 151 /* ArrowFunction */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 169 /* WhileStatement */: + case 168 /* DoStatement */: + case 170 /* ForStatement */: + return spanInPreviousNode(node); + default: + return spanInNode(node.parent); + } + return spanInNode(node.parent); + } + function spanInColonToken(node) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 198 /* PropertyAssignment */) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInGreaterThanOrLessThanToken(node) { + if (node.parent.kind === 148 /* TypeAssertionExpression */) { + return spanInNode(node.parent.expression); + } + return spanInNode(node.parent); + } + function spanInWhileKeyword(node) { + if (node.parent.kind === 168 /* DoStatement */) { + return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); + } + return spanInNode(node.parent); + } + } + } + BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; + })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); +})(ts || (ts = {})); +var debugObjectHost = this; +var ts; +(function (ts) { + function logInternalError(logger, err) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } + var ScriptSnapshotShimAdapter = (function () { + function ScriptSnapshotShimAdapter(scriptSnapshotShim) { + this.scriptSnapshotShim = scriptSnapshotShim; + this.lineStartPositions = null; + } + ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { + return this.scriptSnapshotShim.getText(start, end); + }; + ScriptSnapshotShimAdapter.prototype.getLength = function () { + return this.scriptSnapshotShim.getLength(); + }; + ScriptSnapshotShimAdapter.prototype.getLineStartPositions = function () { + if (this.lineStartPositions == null) { + this.lineStartPositions = JSON.parse(this.scriptSnapshotShim.getLineStartPositions()); + } + return this.lineStartPositions; + }; + ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { + var oldSnapshotShim = oldSnapshot; + var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + if (encoded == null) { + return null; + } + var decoded = JSON.parse(encoded); + return new ts.TextChangeRange(new ts.TextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + }; + return ScriptSnapshotShimAdapter; + })(); + var LanguageServiceShimHostAdapter = (function () { + function LanguageServiceShimHostAdapter(shimHost) { + this.shimHost = shimHost; + } + LanguageServiceShimHostAdapter.prototype.log = function (s) { + this.shimHost.log(s); + }; + LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { + var settingsJson = this.shimHost.getCompilationSettings(); + if (settingsJson == null || settingsJson == "") { + throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); + return null; + } + return JSON.parse(settingsJson); + }; + LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { + var encoded = this.shimHost.getScriptFileNames(); + return JSON.parse(encoded); + }; + LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { + return new ScriptSnapshotShimAdapter(this.shimHost.getScriptSnapshot(fileName)); + }; + LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { + return this.shimHost.getScriptVersion(fileName); + }; + LanguageServiceShimHostAdapter.prototype.getScriptIsOpen = function (fileName) { + return this.shimHost.getScriptIsOpen(fileName); + }; + LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { + var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + return null; + } + try { + return JSON.parse(diagnosticMessagesJson); + } + catch (e) { + this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); + return null; + } + }; + LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { + return this.shimHost.getCancellationToken(); + }; + LanguageServiceShimHostAdapter.prototype.getDefaultLibFilename = function (options) { + return this.shimHost.getDefaultLibFilename(JSON.stringify(options)); + }; + LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { + return this.shimHost.getCurrentDirectory(); + }; + return LanguageServiceShimHostAdapter; + })(); + ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action) { + logger.log(actionDescription); + var start = Date.now(); + var result = action(); + var end = Date.now(); + logger.log(actionDescription + " completed in " + (end - start) + " msec"); + if (typeof (result) === "string") { + var str = result; + if (str.length > 128) { + str = str.substring(0, 128) + "..."; + } + logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); + } + return result; + } + function forwardJSONCall(logger, actionDescription, action) { + try { + var result = simpleForwardCall(logger, actionDescription, action); + return JSON.stringify({ result: result }); + } + catch (err) { + if (err instanceof ts.OperationCanceledException) { + return JSON.stringify({ canceled: true }); + } + logInternalError(logger, err); + err.description = actionDescription; + return JSON.stringify({ error: err }); + } + } + var ShimBase = (function () { + function ShimBase(factory) { + this.factory = factory; + factory.registerShim(this); + } + ShimBase.prototype.dispose = function (dummy) { + this.factory.unregisterShim(this); + }; + return ShimBase; + })(); + var LanguageServiceShimObject = (function (_super) { + __extends(LanguageServiceShimObject, _super); + function LanguageServiceShimObject(factory, host, languageService) { + _super.call(this, factory); + this.host = host; + this.languageService = languageService; + this.logger = this.host; + } + LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action); + }; + LanguageServiceShimObject.prototype.dispose = function (dummy) { + this.logger.log("dispose()"); + this.languageService.dispose(); + this.languageService = null; + if (debugObjectHost && debugObjectHost.CollectGarbage) { + debugObjectHost.CollectGarbage(); + this.logger.log("CollectGarbage()"); + } + this.logger = null; + _super.prototype.dispose.call(this, dummy); + }; + LanguageServiceShimObject.prototype.refresh = function (throwOnError) { + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { + return null; + }); + }; + LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { + var _this = this; + this.forwardJSONCall("cleanupSemanticCache()", function () { + _this.languageService.cleanupSemanticCache(); + return null; + }); + }; + LanguageServiceShimObject.realizeDiagnostic = function (diagnostic) { + return { + message: diagnostic.messageText, + start: diagnostic.start, + length: diagnostic.length, + category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code + }; + }; + LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSyntacticClassifications(fileName, new ts.TextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSemanticClassifications(fileName, new ts.TextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { + var errors = _this.languageService.getSyntacticDiagnostics(fileName); + return errors.map(LanguageServiceShimObject.realizeDiagnostic); + }); + }; + LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { + var errors = _this.languageService.getSemanticDiagnostics(fileName); + return errors.map(LanguageServiceShimObject.realizeDiagnostic); + }); + }; + LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { + var _this = this; + return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { + var errors = _this.languageService.getCompilerOptionsDiagnostics(); + return errors.map(LanguageServiceShimObject.realizeDiagnostic); + }); + }; + LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { + var quickInfo = _this.languageService.getQuickInfoAtPosition(fileName, position); + return quickInfo; + }); + }; + LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { + var _this = this; + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { + var spanInfo = _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); + return spanInfo; + }); + }; + LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { + var spanInfo = _this.languageService.getBreakpointStatementAtPosition(fileName, position); + return spanInfo; + }); + }; + LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { + var signatureInfo = _this.languageService.getSignatureHelpItems(fileName, position); + return signatureInfo; + }); + }; + LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getDefinitionAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { + return _this.languageService.getRenameInfo(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { + var _this = this; + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { + return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); + }); + }; + LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { + var textRanges = _this.languageService.getBraceMatchingAtPosition(fileName, position); + return textRanges; + }); + }; + LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getReferencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getOccurrencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { + var completion = _this.languageService.getCompletionsAtPosition(fileName, position); + return completion; + }); + }; + LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { + var _this = this; + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", function () { + var details = _this.languageService.getCompletionEntryDetails(fileName, position, entryName); + return details; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsForDocument(fileName, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue) { + var _this = this; + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "')", function () { + var items = _this.languageService.getNavigateToItems(searchValue); + return items; + }); + }; + LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { + var items = _this.languageService.getNavigationBarItems(fileName); + return items; + }); + }; + LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { + var _this = this; + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { + var items = _this.languageService.getOutliningSpans(fileName); + return items; + }); + }; + LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { + var _this = this; + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { + var items = _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); + return items; + }); + }; + LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { + var _this = this; + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { + var output = _this.languageService.getEmitOutput(fileName); + return output; + }); + }; + return LanguageServiceShimObject; + })(ShimBase); + var ClassifierShimObject = (function (_super) { + __extends(ClassifierShimObject, _super); + function ClassifierShimObject(factory, logger) { + _super.call(this, factory); + this.logger = logger; + this.classifier = ts.createClassifier(this.logger); + } + ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { + var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + var items = classification.entries; + var result = ""; + for (var i = 0; i < items.length; i++) { + result += items[i].length + "\n"; + result += items[i].classification + "\n"; + } + result += classification.finalLexState; + return result; + }; + return ClassifierShimObject; + })(ShimBase); + var CoreServicesShimObject = (function (_super) { + __extends(CoreServicesShimObject, _super); + function CoreServicesShimObject(factory, logger) { + _super.call(this, factory); + this.logger = logger; + } + CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action); + }; + CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + var convertResult = { + referencedFiles: [], + importedFiles: [], + isLibFile: result.isLibFile + }; + ts.forEach(result.referencedFiles, function (refFile) { + convertResult.referencedFiles.push({ + path: ts.normalizePath(refFile.filename), + position: refFile.pos, + length: refFile.end - refFile.pos + }); + }); + ts.forEach(result.importedFiles, function (importedFile) { + convertResult.importedFiles.push({ + path: ts.normalizeSlashes(importedFile.filename), + position: importedFile.pos, + length: importedFile.end - importedFile.pos + }); + }); + return convertResult; + }); + }; + CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { + return ts.getDefaultCompilerOptions(); + }); + }; + return CoreServicesShimObject; + })(ShimBase); + var TypeScriptServicesFactory = (function () { + function TypeScriptServicesFactory() { + this._shims = []; + this.documentRegistry = ts.createDocumentRegistry(); + } + TypeScriptServicesFactory.prototype.getServicesVersion = function () { + return ts.servicesVersion; + }; + TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { + try { + var hostAdapter = new LanguageServiceShimHostAdapter(host); + var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); + return new LanguageServiceShimObject(this, host, languageService); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { + try { + return new ClassifierShimObject(this, logger); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (logger) { + try { + return new CoreServicesShimObject(this, logger); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.close = function () { + this._shims = []; + this.documentRegistry = ts.createDocumentRegistry(); + }; + TypeScriptServicesFactory.prototype.registerShim = function (shim) { + this._shims.push(shim); + }; + TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { + for (var i = 0, n = this._shims.length; i < n; i++) { + if (this._shims[i] === shim) { + delete this._shims[i]; + return; + } + } + throw new Error("Invalid operation"); + }; + return TypeScriptServicesFactory; + })(); + ts.TypeScriptServicesFactory = TypeScriptServicesFactory; + if (typeof module !== "undefined" && module.exports) { + module.exports = ts; + } +})(ts || (ts = {})); +var TypeScript; +(function (TypeScript) { + var Services; + (function (Services) { + Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; + })(Services = TypeScript.Services || (TypeScript.Services = {})); +})(TypeScript || (TypeScript = {})); diff --git a/lib/typescript-src/support/typescript/bin/typescriptServices_internal.d.ts b/lib/typescript-src/support/typescript/bin/typescriptServices_internal.d.ts new file mode 100644 index 0000000..da6b924 --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/typescriptServices_internal.d.ts @@ -0,0 +1,258 @@ +/*! ***************************************************************************** +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 ts { + const enum Ternary { + False = 0, + Maybe = 1, + True = -1, + } + const enum Comparison { + LessThan = -1, + EqualTo = 0, + GreaterThan = 1, + } + interface StringSet extends Map { + } + function forEach(array: T[], callback: (element: T) => U): U; + function contains(array: T[], value: T): boolean; + function indexOf(array: T[], value: T): number; + function countWhere(array: T[], predicate: (x: T) => boolean): number; + function filter(array: T[], f: (x: T) => boolean): T[]; + function map(array: T[], f: (x: T) => U): U[]; + function concatenate(array1: T[], array2: T[]): T[]; + function deduplicate(array: T[]): T[]; + function sum(array: any[], prop: string): number; + /** + * Returns the last element of an array if non-empty, undefined otherwise. + */ + function lastOrUndefined(array: T[]): T; + function binarySearch(array: number[], value: number): number; + function hasProperty(map: Map, key: string): boolean; + function getProperty(map: Map, key: string): T; + function isEmpty(map: Map): boolean; + function clone(object: T): T; + 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; + function mapToArray(map: Map): T[]; + /** + * Creates a map from the elements of an array. + * + * @param array the array of input elements. + * @param makeKey a function that produces a key for a given element. + * + * This function makes no effort to avoid collisions; if any two elements produce + * the same key with the given 'makeKey' function, then the element with the higher + * index in the array will be the one associated with the produced key. + */ + function arrayToMap(array: T[], makeKey: (value: T) => string): Map; + var localizedDiagnosticMessages: Map; + function getLocaleSpecificMessage(message: string): string; + function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; + function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; + function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; + function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; + function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic; + function compareValues(a: T, b: T): Comparison; + function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number; + function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; + function normalizeSlashes(path: string): string; + function getRootLength(path: string): number; + var directorySeparator: string; + function normalizePath(path: string): string; + function getDirectoryPath(path: string): string; + function isUrl(path: string): boolean; + function isRootedDiskPath(path: string): boolean; + function getNormalizedPathComponents(path: string, currentDirectory: string): string[]; + function getNormalizedAbsolutePath(filename: string, currentDirectory: string): string; + function getNormalizedPathFromPathComponents(pathComponents: string[]): string; + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string; + function getBaseFilename(path: string): string; + function combinePaths(path1: string, path2: string): string; + function fileExtensionIs(path: string, extension: string): boolean; + function removeFileExtension(path: string): string; + /** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names + * or string literals. If the information encoded in the map changes, this needs to be revisited. */ + function escapeString(s: string): string; + interface ObjectAllocator { + getNodeConstructor(kind: SyntaxKind): new () => Node; + getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; + getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; + getSignatureConstructor(): new (checker: TypeChecker) => Signature; + } + var objectAllocator: ObjectAllocator; + const enum AssertionLevel { + None = 0, + Normal = 1, + Aggressive = 2, + VeryAggressive = 3, + } + module Debug { + function shouldAssert(level: AssertionLevel): boolean; + function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; + function fail(message?: string): void; + } +} +declare module ts { + interface System { + args: string[]; + newLine: string; + useCaseSensitiveFileNames: boolean; + write(s: string): void; + readFile(fileName: string, encoding?: string): string; + writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void; + watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher; + resolvePath(path: string): string; + fileExists(path: string): boolean; + directoryExists(path: string): boolean; + createDirectory(directoryName: string): void; + getExecutingFilePath(): string; + getCurrentDirectory(): string; + getMemoryUsage?(): number; + exit(exitCode?: number): void; + } + interface FileWatcher { + close(): void; + } + var sys: System; +} +declare module ts { + interface ReferencePathMatchResult { + fileReference?: FileReference; + diagnosticMessage?: DiagnosticMessage; + isNoDefaultLib?: boolean; + } + function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration; + interface StringSymbolWriter extends SymbolWriter { + string(): string; + } + function getSingleLineStringWriter(): StringSymbolWriter; + function releaseStringWriter(writer: StringSymbolWriter): void; + function getFullWidth(node: Node): number; + function hasFlag(val: number, flag: number): boolean; + function containsParseError(node: Node): boolean; + function getSourceFileOfNode(node: Node): SourceFile; + function nodePosToString(node: Node): string; + function getStartPosOfNode(node: Node): number; + function isMissingNode(node: Node): boolean; + function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; + function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string; + function getTextOfNodeFromSourceText(sourceText: string, node: Node): string; + function getTextOfNode(node: Node): string; + function escapeIdentifier(identifier: string): string; + function unescapeIdentifier(identifier: string): string; + function declarationNameToString(name: DeclarationName): string; + function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic; + function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic; + function getErrorSpanForNode(node: Node): Node; + function isExternalModule(file: SourceFile): boolean; + function isDeclarationFile(file: SourceFile): boolean; + function isConstEnumDeclaration(node: Node): boolean; + function isConst(node: Node): boolean; + function isLet(node: Node): boolean; + function isPrologueDirective(node: Node): boolean; + function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[]; + function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; + var fullTripleSlashReferencePathRegEx: RegExp; + function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; + function isAnyFunction(node: Node): boolean; + function isFunctionBlock(node: Node): boolean; + function isObjectLiteralMethod(node: Node): boolean; + function getContainingFunction(node: Node): FunctionLikeDeclaration; + function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; + function getSuperContainer(node: Node): Node; + function getInvokedExpression(node: CallLikeExpression): Expression; + function isExpression(node: Node): boolean; + function isExternalModuleImportDeclaration(node: Node): boolean; + function getExternalModuleImportDeclarationExpression(node: Node): Expression; + function isInternalModuleImportDeclaration(node: Node): boolean; + function hasDotDotDotToken(node: Node): boolean; + function hasQuestionToken(node: Node): boolean; + function hasRestParameters(s: SignatureDeclaration): boolean; + function isLiteralKind(kind: SyntaxKind): boolean; + function isTextualLiteralKind(kind: SyntaxKind): boolean; + function isTemplateLiteralKind(kind: SyntaxKind): boolean; + function isInAmbientContext(node: Node): boolean; + function isDeclaration(node: Node): boolean; + function isStatement(n: Node): boolean; + function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean; + function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode; + function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; + function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference): SourceFile; + function getAncestor(node: Node, kind: SyntaxKind): Node; + function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; + function isKeyword(token: SyntaxKind): boolean; + function isTrivia(token: SyntaxKind): boolean; + function isModifier(token: SyntaxKind): boolean; +} +declare module ts { + interface ListItemInfo { + listItemIndex: number; + list: Node; + } + function getEndLinePosition(line: number, sourceFile: SourceFile): number; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; + function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number; + function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; + function startEndContainsRange(start: number, end: number, range: TextRange): boolean; + function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; + function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean; + function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean; + function findListItemInfo(node: Node): ListItemInfo; + function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node; + function findContainingList(node: Node): Node; + function getTouchingWord(sourceFile: SourceFile, position: number): Node; + function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node; + /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ + function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node; + /** Returns a token if position is in [start-of-leading-trivia, end) */ + function getTokenAtPosition(sourceFile: SourceFile, position: number): Node; + /** + * The token on the left of the position is the token that strictly includes the position + * or sits to the left of the cursor if it is on a boundary. For example + * + * fo|o -> will return foo + * foo |bar -> will return foo + * + */ + function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node; + function findNextToken(previousToken: Node, parent: Node): Node; + function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node; + function getNodeModifiers(node: Node): string; + function getTypeArgumentOrTypeParameterList(node: Node): NodeArray; + function isToken(n: Node): boolean; + function isComment(kind: SyntaxKind): boolean; + function isPunctuation(kind: SyntaxKind): boolean; + function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean; + function compareDataObjects(dst: any, src: any): boolean; +} +declare module ts { + function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; + function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; + function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart; + function spacePart(): SymbolDisplayPart; + function keywordPart(kind: SyntaxKind): SymbolDisplayPart; + function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; + function operatorPart(kind: SyntaxKind): SymbolDisplayPart; + function textPart(text: string): SymbolDisplayPart; + function lineBreakPart(): SymbolDisplayPart; + function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[]; + function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; + function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[]; + function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; +} diff --git a/lib/typescript-src/support/typescript/bin/typescript_internal.d.ts b/lib/typescript-src/support/typescript/bin/typescript_internal.d.ts new file mode 100644 index 0000000..25422ad --- /dev/null +++ b/lib/typescript-src/support/typescript/bin/typescript_internal.d.ts @@ -0,0 +1,258 @@ +/*! ***************************************************************************** +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" { + const enum Ternary { + False = 0, + Maybe = 1, + True = -1, + } + const enum Comparison { + LessThan = -1, + EqualTo = 0, + GreaterThan = 1, + } + interface StringSet extends Map { + } + function forEach(array: T[], callback: (element: T) => U): U; + function contains(array: T[], value: T): boolean; + function indexOf(array: T[], value: T): number; + function countWhere(array: T[], predicate: (x: T) => boolean): number; + function filter(array: T[], f: (x: T) => boolean): T[]; + function map(array: T[], f: (x: T) => U): U[]; + function concatenate(array1: T[], array2: T[]): T[]; + function deduplicate(array: T[]): T[]; + function sum(array: any[], prop: string): number; + /** + * Returns the last element of an array if non-empty, undefined otherwise. + */ + function lastOrUndefined(array: T[]): T; + function binarySearch(array: number[], value: number): number; + function hasProperty(map: Map, key: string): boolean; + function getProperty(map: Map, key: string): T; + function isEmpty(map: Map): boolean; + function clone(object: T): T; + 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; + function mapToArray(map: Map): T[]; + /** + * Creates a map from the elements of an array. + * + * @param array the array of input elements. + * @param makeKey a function that produces a key for a given element. + * + * This function makes no effort to avoid collisions; if any two elements produce + * the same key with the given 'makeKey' function, then the element with the higher + * index in the array will be the one associated with the produced key. + */ + function arrayToMap(array: T[], makeKey: (value: T) => string): Map; + var localizedDiagnosticMessages: Map; + function getLocaleSpecificMessage(message: string): string; + function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; + function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; + function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; + function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; + function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic; + function compareValues(a: T, b: T): Comparison; + function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number; + function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; + function normalizeSlashes(path: string): string; + function getRootLength(path: string): number; + var directorySeparator: string; + function normalizePath(path: string): string; + function getDirectoryPath(path: string): string; + function isUrl(path: string): boolean; + function isRootedDiskPath(path: string): boolean; + function getNormalizedPathComponents(path: string, currentDirectory: string): string[]; + function getNormalizedAbsolutePath(filename: string, currentDirectory: string): string; + function getNormalizedPathFromPathComponents(pathComponents: string[]): string; + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string; + function getBaseFilename(path: string): string; + function combinePaths(path1: string, path2: string): string; + function fileExtensionIs(path: string, extension: string): boolean; + function removeFileExtension(path: string): string; + /** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names + * or string literals. If the information encoded in the map changes, this needs to be revisited. */ + function escapeString(s: string): string; + interface ObjectAllocator { + getNodeConstructor(kind: SyntaxKind): new () => Node; + getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; + getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; + getSignatureConstructor(): new (checker: TypeChecker) => Signature; + } + var objectAllocator: ObjectAllocator; + const enum AssertionLevel { + None = 0, + Normal = 1, + Aggressive = 2, + VeryAggressive = 3, + } + module Debug { + function shouldAssert(level: AssertionLevel): boolean; + function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; + function fail(message?: string): void; + } +} +declare module "typescript" { + interface System { + args: string[]; + newLine: string; + useCaseSensitiveFileNames: boolean; + write(s: string): void; + readFile(fileName: string, encoding?: string): string; + writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void; + watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher; + resolvePath(path: string): string; + fileExists(path: string): boolean; + directoryExists(path: string): boolean; + createDirectory(directoryName: string): void; + getExecutingFilePath(): string; + getCurrentDirectory(): string; + getMemoryUsage?(): number; + exit(exitCode?: number): void; + } + interface FileWatcher { + close(): void; + } + var sys: System; +} +declare module "typescript" { + interface ReferencePathMatchResult { + fileReference?: FileReference; + diagnosticMessage?: DiagnosticMessage; + isNoDefaultLib?: boolean; + } + function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration; + interface StringSymbolWriter extends SymbolWriter { + string(): string; + } + function getSingleLineStringWriter(): StringSymbolWriter; + function releaseStringWriter(writer: StringSymbolWriter): void; + function getFullWidth(node: Node): number; + function hasFlag(val: number, flag: number): boolean; + function containsParseError(node: Node): boolean; + function getSourceFileOfNode(node: Node): SourceFile; + function nodePosToString(node: Node): string; + function getStartPosOfNode(node: Node): number; + function isMissingNode(node: Node): boolean; + function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; + function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string; + function getTextOfNodeFromSourceText(sourceText: string, node: Node): string; + function getTextOfNode(node: Node): string; + function escapeIdentifier(identifier: string): string; + function unescapeIdentifier(identifier: string): string; + function declarationNameToString(name: DeclarationName): string; + function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic; + function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic; + function getErrorSpanForNode(node: Node): Node; + function isExternalModule(file: SourceFile): boolean; + function isDeclarationFile(file: SourceFile): boolean; + function isConstEnumDeclaration(node: Node): boolean; + function isConst(node: Node): boolean; + function isLet(node: Node): boolean; + function isPrologueDirective(node: Node): boolean; + function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[]; + function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; + var fullTripleSlashReferencePathRegEx: RegExp; + function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; + function isAnyFunction(node: Node): boolean; + function isFunctionBlock(node: Node): boolean; + function isObjectLiteralMethod(node: Node): boolean; + function getContainingFunction(node: Node): FunctionLikeDeclaration; + function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; + function getSuperContainer(node: Node): Node; + function getInvokedExpression(node: CallLikeExpression): Expression; + function isExpression(node: Node): boolean; + function isExternalModuleImportDeclaration(node: Node): boolean; + function getExternalModuleImportDeclarationExpression(node: Node): Expression; + function isInternalModuleImportDeclaration(node: Node): boolean; + function hasDotDotDotToken(node: Node): boolean; + function hasQuestionToken(node: Node): boolean; + function hasRestParameters(s: SignatureDeclaration): boolean; + function isLiteralKind(kind: SyntaxKind): boolean; + function isTextualLiteralKind(kind: SyntaxKind): boolean; + function isTemplateLiteralKind(kind: SyntaxKind): boolean; + function isInAmbientContext(node: Node): boolean; + function isDeclaration(node: Node): boolean; + function isStatement(n: Node): boolean; + function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean; + function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode; + function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray; + function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; + function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; + function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference): SourceFile; + function getAncestor(node: Node, kind: SyntaxKind): Node; + function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; + function isKeyword(token: SyntaxKind): boolean; + function isTrivia(token: SyntaxKind): boolean; + function isModifier(token: SyntaxKind): boolean; +} +declare module "typescript" { + interface ListItemInfo { + listItemIndex: number; + list: Node; + } + function getEndLinePosition(line: number, sourceFile: SourceFile): number; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; + function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number; + function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; + function startEndContainsRange(start: number, end: number, range: TextRange): boolean; + function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; + function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean; + function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean; + function findListItemInfo(node: Node): ListItemInfo; + function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node; + function findContainingList(node: Node): Node; + function getTouchingWord(sourceFile: SourceFile, position: number): Node; + function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node; + /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ + function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node; + /** Returns a token if position is in [start-of-leading-trivia, end) */ + function getTokenAtPosition(sourceFile: SourceFile, position: number): Node; + /** + * The token on the left of the position is the token that strictly includes the position + * or sits to the left of the cursor if it is on a boundary. For example + * + * fo|o -> will return foo + * foo |bar -> will return foo + * + */ + function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node; + function findNextToken(previousToken: Node, parent: Node): Node; + function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node; + function getNodeModifiers(node: Node): string; + function getTypeArgumentOrTypeParameterList(node: Node): NodeArray; + function isToken(n: Node): boolean; + function isComment(kind: SyntaxKind): boolean; + function isPunctuation(kind: SyntaxKind): boolean; + function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean; + function compareDataObjects(dst: any, src: any): boolean; +} +declare module "typescript" { + function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; + function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; + function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart; + function spacePart(): SymbolDisplayPart; + function keywordPart(kind: SyntaxKind): SymbolDisplayPart; + function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; + function operatorPart(kind: SyntaxKind): SymbolDisplayPart; + function textPart(text: string): SymbolDisplayPart; + function lineBreakPart(): SymbolDisplayPart; + function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[]; + function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; + function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[]; + function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; +} diff --git a/lib/typescript-src/support/typescript/package.json b/lib/typescript-src/support/typescript/package.json index a604f08..82523f0 100644 --- a/lib/typescript-src/support/typescript/package.json +++ b/lib/typescript-src/support/typescript/package.json @@ -4,11 +4,11 @@ "name": "Microsoft Corp." }, "homepage": "http://typescriptlang.org/", - "version": "1.0.1", + "version": "1.4.1", "licenses": [ { "type": "Apache License 2.0", - "url": "http://typescript.codeplex.com/license" + "url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt" } ], "description": "TypeScript is a language for application scale JavaScript development", @@ -20,14 +20,14 @@ "javascript" ], "bugs": { - "url": "http://typescript.codeplex.com/workitem/list/basic" + "url": "https://github.com/Microsoft/TypeScript/issues" }, "repository": { "type": "git", - "url": "https://git01.codeplex.com/typescript" + "url": "https://github.com/Microsoft/TypeScript.git" }, "preferGlobal": true, - "main": "./bin/typescript.js", + "main": "./bin/typescriptServices.js", "bin": { "tsc": "./bin/tsc" }, @@ -35,15 +35,21 @@ "node": ">=0.8.0" }, "devDependencies": { - "jake": "latest" + "jake": "latest", + "mocha": "latest", + "chai": "latest", + "browserify": "latest", + "istanbul": "latest", + "codeclimate-test-reporter": "latest" }, - "_id": "typescript@1.0.1", - "dist": { - "shasum": "e8eacde3084a091d3fe29b60ac5862252662a25a", - "tarball": "http://registry.npmjs.org/typescript/-/typescript-1.0.1.tgz" + "scripts": { + "test": "jake generate-code-coverage" }, - "_from": "typescript@*", - "_npmVersion": "1.4.3", + "gitHead": "3ab3f916c00755a1d9937f7116d1e9a80ddf2ef3", + "_id": "typescript@1.4.1", + "_shasum": "eb4da986d1b7f01452eafb57559e0cc8f516cd48", + "_from": "typescript@1.4.1", + "_npmVersion": "1.4.28", "_npmUser": { "name": "typescript", "email": "typescript@microsoft.com" @@ -54,8 +60,10 @@ "email": "typescript@microsoft.com" } ], + "dist": { + "shasum": "eb4da986d1b7f01452eafb57559e0cc8f516cd48", + "tarball": "http://registry.npmjs.org/typescript/-/typescript-1.4.1.tgz" + }, "directories": {}, - "_shasum": "e8eacde3084a091d3fe29b60ac5862252662a25a", - "_resolved": "https://registry.npmjs.org/typescript/-/typescript-1.0.1.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/typescript/-/typescript-1.4.1.tgz" } diff --git a/lib/typescript-src/version.rb b/lib/typescript-src/version.rb index 53b3cb5..86830fe 100644 --- a/lib/typescript-src/version.rb +++ b/lib/typescript-src/version.rb @@ -1,5 +1,5 @@ module TypeScript module Src - VERSION = '1.0.1.3' # TypeScript compiler version + gem's revision + VERSION = '1.4.1.3' # TypeScript compiler version + gem's revision end end \ No newline at end of file